dbgenerate.js
[app.Builder.js] / dbgenerate.js
1 //<script type="text/javascript">
2
3 /**
4  * This is a hacky generator to generate element definitions for the Roo version from the database
5  * 
6  * Let's see if libgda can be used to generate our Readers for roo...
7  * 
8  * Concept - conect to database..
9  * 
10  * list tables
11  * 
12  * extra schemas..
13  * 
14  * write readers..
15  * 
16  * usage: seed generate.js
17  *
18  *
19  *
20  *
21  *Hack needed to latest GLib-2.0.gir 
22  *
23  * <record name="KeyFile" c:type="GKeyFile" disguised="1">
24         <constructor name="new" c:identifier="g_key_file_new">
25         <return-value transfer-ownership="full">
26           <type name="KeyFile" c:type="GKeyFile*"/>
27         </return-value>
28       </constructor>
29  *
30  *
31  * remove introspectable =0 from g_key_file_get_groups
32  *   and add transfer-owneership = none to return value
33  * remove introspectable =0 from g_key_file_get_keys
34  *   and add transfer-owneership = none to return value* 
35  * 
36  */
37 Gda  = imports.gi.Gda;
38 GObject = imports.gi.GObject;
39
40 GLib = imports.gi.GLib;
41
42 console = imports.console;
43 File = imports.File.File;
44 Options = imports.Options.Options;
45
46 //Gda.init();
47
48 var prov = Gda.Config.list_providers ();
49 //print(prov.dump_as_string());
50
51 var o = new Options({
52     help_description : 'Element builder for App Builder based on database schema',
53     
54     options:  [
55         { arg_long : 'DBTYPE' , arg_short : 't', description : 'Database Type (eg. MySQL or PostgreSQL ' },
56         { arg_long : 'DBNAME' , arg_short : 'd', description : 'Database Name' },
57         { arg_long : 'USERNAME' , arg_short : 'u', description : 'Username'},
58         { arg_long : 'PASSWORD' , arg_short : 'p', description : '' , arg_default :'' },
59         { arg_long : 'INI' , arg_short : 'I', description :
60                     'Either base directory which has Pman/***/DataObjects/***.links.ini or location of ini file.' },
61     ]
62            
63 })
64
65
66
67 var cfg = o.parse(Seed.argv);
68 print(JSON.stringify(cfg, null,4));
69
70 var   cnc = Gda.Connection.open_from_string (cfg.DBTYPE,
71          "DB_NAME=" + cfg.DBNAME, 
72         "USERNAME=" + cfg.USERNAME + ';PASSWORD=' + cfg.PASSWORD,
73         Gda.ConnectionOptions.NONE, null);
74
75
76
77                                               
78
79  
80 Gda.DataSelect.prototype.fetchAll = function()
81 {
82     var cols = [];
83     
84     for (var i =0;i < this.get_n_columns(); i++) {
85         cols.push(this.get_column_name(i));
86     }
87     //print(JSON.stringify(cols, null,4));
88     var iter = this.create_iter();
89     var res = [];
90     //print(this.get_n_rows());
91     var _this = this;
92     for (var r = 0; r < this.get_n_rows(); r++) {
93         
94         // single clo..
95         //print("GOT ROW");
96         if (cols.length == 1) {
97             res.push(this.get_value_at(0,r).get_string());
98             continue;
99         }
100         var add = { };
101         
102         cols.forEach(function(n,i) {
103             var val = _this.get_value_at(i,r);
104             var type = GObject.type_name(val.g_type) ;
105             var vs = ['GdaBinary', 'GdaBlob' ].indexOf(type) > -1 ? val.value.to_string(1024) : val.value;
106             //print(n + " : TYPE: " + GObject.type_name(val.g_type) + " : " + vs);
107             //print (n + '=' + iter.get_value_at(i).value);
108             add[n] = vs;
109         });
110         
111         res.push(add);
112         
113     }
114     return res;
115
116 }
117
118 var map = {
119     'date' : 'date',
120     'datetime' : 'date',
121     'time' : 'string', //bogus
122     'int' : 'int',
123     'bigint' : 'int',
124     'double' : 'float',
125     'tinyint' : 'int',
126     'smallint' : 'int',
127     'decimal' : 'float',
128     'float' : 'float',
129     'char' : 'string',
130     'varchar' : 'string',
131     'text' : 'string',
132     'longtext' : 'string',
133     'tinytext' : 'string',
134     'mediumtext' : 'string',
135     'enum' : 'string',
136     'timestamp' : 'number',
137     'blob' : 'text'
138     
139 }
140
141 var ini = { }
142
143 function readIni(fn)
144 {
145     print('Read INI : ' + fn);
146     var key_file = new GLib.KeyFile.c_new();
147     if (!key_file.load_from_file (fn , GLib.KeyFileFlags.NONE )) {
148         return;
149     }
150    
151     var groups = key_file.get_groups();
152     groups.forEach(function(g) {
153         ini[g] = {}
154            print("KEY:"+g);
155         var keys = key_file.get_keys(g);
156         if (!keys) { return; }
157          keys.forEach(function(k) {
158             ini[g][k] = key_file.get_value(g,k);
159         })
160     })
161     
162 }
163 if (File.isFile(cfg.INI)) {
164     if (cfg.INI.match(/links\.ini$/)) {
165         readIni(cfg.INI);
166     } else {
167         readIni(cfg.INI.replace(/\.ini$/, ".links.ini"));
168     }
169 }
170
171
172 if (File.isDirectory(cfg.INI)) {
173         
174
175     //--- load ini files..
176     // this is very specific.
177     
178     var dirs = File.list( cfg.INI + '/Pman').filter( 
179         function(e) { 
180             if (!File.isDirectory(cfg.INI + '/Pman/' + e + '/DataObjects')) {
181                 return false;
182             }
183             return true;
184         }
185     );
186     
187      
188     dirs.forEach(function(d) {
189         // this currently misses the web.*/Pman/XXXX/DataObjects..
190         var path = cfg.INI + '/Pman/' + d + '/DataObjects';
191          
192         if (!File.isDirectory(path)) {
193             return; //skip
194         }
195         var inis = File.list(path).filter(
196             function(e) { return e.match(/\.links\.ini$/); }
197         );
198         if (!inis.length) {
199             return;
200         }
201         
202         inis.forEach(function(i) {
203             readIni(path + '/' + i); 
204             
205         })
206  
207     });
208     // look at web.XXXX/Pman/XXX/DataObjects/*.ini
209     var inis = File.list(cfg.INI).filter(
210         function(e) { return e.match(/\.links\.ini$/); }
211     )
212     
213      inis.forEach(function(i) {
214         readIni(path + '/' + i); 
215         
216     })
217     
218     
219 }
220 //print(JSON.stringify(ini, null,4));
221  //console.dump(ini);
222
223
224  //Seed.quit();
225
226 //GLib.key_file_load_from_file (key_file, String file, KeyFileFlags flags) : Boolean
227
228
229
230  
231
232 var tables = Gda.execute_select_command(cnc, "SHOW TABLES").fetchAll();
233 var readers = [];
234 tables.forEach(function(table) {
235     //print(table);
236     var schema = Gda.execute_select_command(cnc, "DESCRIBE `" + table+'`').fetchAll();
237     var reader = []; 
238     var colmodel = []; 
239     var combofields= [ { name : 'id', type: 'int' } ]; // technically the primary key..
240          
241     var form = {}
242        
243     var firstTxtCol = '';
244     
245     //print(JSON.stringify(schema, null,4));
246     
247     schema.forEach(function(e)  {
248         var type = e.Type.match(/([^(]+)\(([^\)]+)\)/);
249         var row  = { }; 
250         if (type) {
251             e.Type = type[1];
252             e.Size = type[2];
253         }
254         
255         
256         
257         row.name = e.Field;
258         
259         
260         if (typeof(map[e.Type]) == 'undefined') {
261            console.dump(e);
262            throw {
263                 name: "ArgumentError", 
264                 message: "Unknown mapping for type : " + e.Type
265             };
266         }
267         row.type = map[e.Type];
268         
269         if (row.type == 'string' && !firstTxtCol.length) {
270             firstTxtCol = row.name;
271         }
272         
273         if (row.type == 'date') {
274             row.dateFormat = 'Y-m-d';
275         }
276         reader.push(row);
277         
278         if (combofields.length == 1 && row.type == 'string') {
279             combofields.push(row);
280         }
281         
282         
283         var title = row.name.replace(/_id/, '').replace(/_/g, ' ');
284         title  = title[0].toUpperCase() + title.substring(1);
285         
286         colmodel.push({
287             "xtype": "ColumnModel",
288             "header": title,
289             "width":  row.type == 'string' ? 200 : 75,
290             "dataIndex": row.name,
291             "|renderer": row.type != 'date' ? 
292                     "function(v) { return String.format('{0}', v); }" :
293                     "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }" , // special for date
294             "|xns": "Roo.grid",
295             "*prop": "colModel[]"
296         });
297         var xtype = 'TextField';
298         if (row.type == 'number') {
299             xtype = 'NumberField';
300         }
301         if (row.type == 'date') {
302             xtype = 'DateField';
303         }
304         if (e.Type == 'text') {
305             xtype = 'TextArea';
306         }
307         if (row.name == 'id') {
308             xtype = 'Hidden';
309         } 
310         // what about booleans.. -> checkboxes..
311         
312         
313         
314         form[row.name] = {
315             fieldLabel : title,
316             name : row.name,
317             width : row.type == 'string' ? 200 : 75,
318             '|xns' : 'Roo.form',
319             xtype : xtype
320         }
321         if (xtype == 'TextArea') {
322             form[row.name].height = 100;
323         }
324         if (xtype == 'Hidden') {
325             delete form[row.name].fieldLabel;
326             delete form[row.name].width;
327         }
328         
329     });
330     
331     var combo = {
332         '|xns' : 'Roo.form',
333         xtype: 'ComboBox',
334         allowBlank : 'false',
335         editable : 'false',
336         emptyText : 'Select ' + table,
337         forceSelection : true,
338         listWidth : 400,
339         loadingText: 'Searching...',
340         minChars : 2,
341         pageSize : 20,
342         qtip: 'Select ' + table,
343         selectOnFocus: true,
344         triggerAction : 'all',
345         typeAhead: true,
346         
347         width: 300,
348         
349         
350         
351         tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>', // SET WHEN USED
352         queryParam : '',// SET WHEN USED
353         fieldLabel : table,  // SET WHEN USED
354         valueField : 'id',
355         displayField : '', // SET WHEN USED eg. project_id_name
356         hiddenName : '', // SET WHEN USED eg. project_id
357         name : '', // SET WHEN USED eg. project_id_name
358         items : [
359             {
360                     
361                 '*prop' : 'store',
362                 'xtype' : 'Store',
363                 '|xns' : 'Roo.data',
364                 'remoteSort' : true,
365                 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
366                 listeners : {
367                     '|beforeload' : 'function (_self, o)' +
368                     "{\n" +
369                     "    o.params = o.params || {};\n" +
370                     "    // set more here\n" +
371                     "}\n"
372                 },
373                 items : [
374                     {
375                         '*prop' : 'proxy',
376                         'xtype' : 'HttpProxy',
377                         'method' : 'GET',
378                         '|xns' : 'Roo.data',
379                         '|url' : "baseURL + '/Roo/" + table + ".php'",
380                     },
381                     
382                     {
383                         '*prop' : 'reader',
384                         'xtype' : 'JsonReader',
385                         '|xns' : 'Roo.data',
386                         'id' : 'id',
387                         'root' : 'data',
388                         'totalProperty' : 'total',
389                         '|fields' : JSON.stringify(combofields)
390                         
391                     }
392                 ]
393             }
394         ]
395     }
396     
397     
398     
399     
400     //print(JSON.stringify(reader,null,4));
401     readers.push({
402         table : table ,
403         combo : combo,
404         combofields : combofields,
405         reader :  reader,
406         oreader : JSON.parse(JSON.stringify(reader)), // dupe it..
407         colmodel : colmodel,
408         firstTxtCol : firstTxtCol,
409         form : form
410     });
411     
412     //console.dump(schema );
413     
414      
415 });
416
417
418
419 // merge in the linked tables..
420 readers.forEach(function(reader) {
421     if (typeof(ini[reader.table]) == 'undefined') {
422      
423         return;
424     }
425     print("OVERLAY - " + reader.table);
426     // we have a map..
427     for (var col in ini[reader.table]) {
428         var kv = ini[reader.table][col].split(':');
429         
430         
431         var add = readers.filter(function(r) { return r.table == kv[0] })[0];
432         if (!add) {
433             continue;
434         }
435         // merge in data (eg. project_id => project_id_*****
436      
437         add.oreader.forEach(function(or) {
438             reader.reader.push({
439                 name : col + '_' + or.name,
440                 type : or.type
441             });
442         });
443         
444         // col is mapped to something..
445         var combofields = add.combofields;
446         if (add.combofields.length < 2) {
447             continue;
448         }
449         if (typeof(reader.form[col]) == 'undefined') {
450             print (JSON.stringify(reader.form, null,4));
451             print("missing linked column " + col);
452             continue;
453         }
454         
455         var combofields_name = add.combofields[1].name;
456         var old =   reader.form[col];
457         reader.form[col] = JSON.parse(JSON.stringify(add.combo)); // clone
458         reader.form[col].queryParam  = 'query[' + combofields_name + ']';// SET WHEN USED
459         reader.form[col].fieldLabel = old.fieldLabel;  // SET WHEN USED
460         reader.form[col].hiddenName = old.name; // SET WHEN USED eg. project_id
461         reader.form[col].displayField = combofields_name; // SET WHEN USED eg. project_id
462         reader.form[col].name  = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
463         reader.form[col].tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
464         
465              
466     };
467     
468     
469 });
470
471 //readers.forEach(function(reader) {
472 //    delete reader.oreader;
473 //});
474
475  
476
477
478
479 //print(JSON.stringify(readers, null, 4));
480
481 readers.forEach(function(reader) {
482     
483
484     var dir = GLib.get_home_dir() + '/.Builder/Roo.data.JsonReader'; 
485     if (!File.isDirectory(dir)) {
486         print("mkdir " + dir);
487         File.mkdir(dir);
488     }
489     
490     // READERS
491     print("WRITE: " +  dir + '/' + cfg.DBNAME + '_' + reader.table + '.json');
492     
493                 
494     var jreader = {
495         '|xns' : 'Roo.data',
496         xtype : "JsonReader",
497         totalProperty : "total",
498         root : "data",
499         '*prop' : "reader",
500         id : 'id', // maybe no..
501        
502         '|fields' :  JSON.stringify(reader.reader, null,4).replace(/"/g,"'")
503     };
504     
505     File.write(
506         dir + '/' + cfg.DBNAME + '_' + reader.table + '.json',
507         JSON.stringify(jreader, null, 4)
508     )
509     
510     
511     // GRIDS
512     dir = GLib.get_home_dir() + '/.Builder/Roo.GridPanel'; 
513     if (!File.isDirectory(dir)) {
514         print("mkdir " + dir);
515         File.mkdir(dir);
516     }
517     
518
519     print("WRITE: " +  dir + '/' + cfg.DBNAME + '_' + reader.table + '.json');
520     
521     File.write(
522         dir + '/' + cfg.DBNAME + '_' + reader.table + '.json',
523             
524        
525         JSON.stringify({
526             '|xns' : 'Roo',
527             xtype : "GridPanel",
528             "title": reader.table,
529             "fitToframe": true,
530             "fitContainer": true,
531             "tableName": reader.table,
532             "background": true,
533             "region" : 'center',
534             "listeners": {
535                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
536             },
537             "items": [
538                 {
539                     "*prop": "grid",
540                     "xtype": "Grid",
541                     "autoExpandColumn": reader.firstTxtCol,
542                     "loadMask": true,
543                     "listeners": {
544                         "|render": "function() \n" +
545                             "{\n" +
546                             "    _this.grid = this; \n" +
547                             "    //_this.dialog = Pman.Dialog.FILL_IN\n" +
548                             "    if (_this.panel.active) {\n" +
549                             "       this.footer.onClick('first');\n" +
550                             "    }\n" +
551                             "}",
552                         "|rowdblclick": "function (_self, rowIndex, e)\n" + 
553                             "{\n" + 
554                             "    if (!_this.dialog) return;\n" + 
555                             "    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n" + 
556                             "        _this.grid.footer.onClick('first');\n" + 
557                             "    }); \n" + 
558                             "}\n"
559                     },
560                     "|xns": "Roo.grid",
561
562                     "items": [
563                         {
564                             "*prop": "dataSource",
565                             "xtype": "Store",
566                              remoteSort : true,
567                             '|sortInfo' : "{ field : '" + reader.firstTxtCol  +  "', direction: 'ASC' }", 
568                             "|xns": "Roo.data",
569                             "items": [
570                                 
571                                 {
572                                     "*prop": "proxy",
573                                     "xtype": "HttpProxy",
574                                     "method": "GET",
575                                     "|url": "baseURL + '/Roo/" + reader.table + ".php'",
576                                     "|xns": "Roo.data"
577                                 },
578                                 jreader
579                             ]
580                         },
581                         {
582                             "*prop": "footer",
583                             "xtype": "PagingToolbar",
584                             "pageSize": 25,
585                             "displayInfo": true,
586                             "displayMsg": "Displaying " + reader.table + "{0} - {1} of {2}",
587                             "emptyMsg": "No " + reader.table + " found",
588                             "|xns": "Roo"
589                         },
590                         {
591                             "*prop": "toolbar",
592                             "xtype": "Toolbar",
593                             "|xns": "Roo",
594                             "items": [
595                                 {
596                                     "text": "Add",
597                                     "xtype": "Button",
598                                     "cls": "x-btn-text-icon",
599                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
600                                     "listeners": {
601                                         "|click": "function()\n"+
602                                             "{\n"+
603                                             "    if (!_this.dialog) return;\n" +
604                                             "    _this.dialog.show( { id : 0 } , function() {\n"+
605                                             "        _this.grid.footer.onClick('first');\n"+
606                                             "   }); \n"+
607                                             "}\n"
608                                     },
609                                     "|xns": "Roo.Toolbar"
610                                 },
611                                 {
612                                     "text": "Edit",
613                                     "xtype": "Button",
614                                     "cls": "x-btn-text-icon",
615                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
616                                     "listeners": {
617                                         "|click": "function()\n"+
618                                             "{\n"+
619                                             "    var s = _this.grid.getSelectionModel().getSelections();\n"+
620                                             "    if (!s.length || (s.length > 1))  {\n"+
621                                             "        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n"+
622                                             "        return;\n"+
623                                             "    }\n"+
624                                             "    if (!_this.dialog) return;\n" +
625                                             "    _this.dialog.show(s[0].data, function() {\n"+
626                                             "        _this.grid.footer.onClick('first');\n"+
627                                             "    }); \n"+
628                                             "    \n"+
629                                             "}\n" 
630                                         
631                                     },
632                                     "|xns": "Roo.Toolbar"
633                                 },
634                                 {
635                                     "text": "Delete",
636                                     "cls": "x-btn-text-icon",
637                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
638                                     "xtype": "Button",
639                                     "listeners": {
640                                         "|click": "function()\n"+
641                                             "{\n"+
642                                             "     Pman.genericDelete(_this, '" + reader.table + "'); \n"+
643                                             "}\n"+
644                                             "        "
645                                     },
646                                     "|xns": "Roo.Toolbar"
647                                 }
648                             ]
649                         }, // end toolbar
650                     ].concat( reader.colmodel)
651                 }
652             ]
653             
654             
655         }, null, 4)
656     )
657     
658     /// FORMS..
659     
660     dir = GLib.get_home_dir() + '/.Builder/Roo.form.Form'; 
661     if (!File.isDirectory(dir)) {
662         print("mkdir " + dir);
663         File.mkdir(dir);
664     }
665     var formElements = [];
666     var formHeight = 50;
667     for (var k in reader.form) {
668         if (k == 'id') { // should really do primary key testing..
669             continue;
670         }
671         formHeight += reader.form[k].xtype == 'TextArea' ? 100 : 30;
672         
673         formElements.push(reader.form[k]);
674     }
675     if (reader.form['id']) {
676         formElements.push(reader.form['id']);
677     }
678     
679
680     print("WRITE: " +  dir + '/' + cfg.DBNAME + '_' + reader.table + '.json');
681     var frmCfg = 
682     {
683         '|xns' : 'Roo.form',
684         xtype : "Form",
685         listeners : {
686             "|actioncomplete" : "function(_self,action)\n"+
687                 "{\n"+
688                 "    if (action.type == 'setdata') {\n"+
689                 "       //_this.dialog.el.mask(\"Loading\");\n"+
690                 "       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
691                 "       return;\n"+
692                 "    }\n"+
693                 "    if (action.type == 'load') {\n"+
694                 "        _this.dialog.el.unmask();\n"+
695                 "        return;\n"+
696                 "    }\n"+
697                 "    if (action.type =='submit') {\n"+
698                 "    \n"+
699                 "        _this.dialog.el.unmask();\n"+
700                 "        _this.dialog.hide();\n"+
701                 "    \n"+
702                 "         if (_this.callback) {\n"+
703                 "            _this.callback.call(_this, _this.form.getValues());\n"+
704                 "         }\n"+
705                 "         _this.form.reset();\n"+
706                 "         return;\n"+
707                 "    }\n"+
708                 "}\n",
709             
710             "|rendered" : "function (form)\n"+
711                 "{\n"+
712                 "    _this.form= form;\n"+
713                 "}\n"
714         },
715         method : "POST",
716         style : "margin:10px;",
717         "|url" : "baseURL + '/Roo/" + reader.table + ".php'",
718         items : formElements
719     };
720     
721     
722     File.write(
723         dir + '/' + cfg.DBNAME + '_' + reader.table + '.json',
724             
725        
726         JSON.stringify( frmCfg, null, 4)
727     );
728             
729             
730    
731    
732    
733      /// COMBO..
734     
735     dir = GLib.get_home_dir() + '/.Builder/Roo.form.ComboBox'; 
736     if (!File.isDirectory(dir)) {
737         print("mkdir " + dir);
738         File.mkdir(dir);
739     }
740    
741     print("WRITE: " +  dir + '/' + cfg.DBNAME + '_' + reader.table + '.json');
742     
743     File.write(
744         dir + '/' + cfg.DBNAME + '_' + reader.table + '.json',
745             
746        
747         JSON.stringify(reader.combo, null, 4)
748     );
749             
750    
751    
752    
753    
754    
755     // DIALOG.
756    
757    
758     dir = GLib.get_home_dir() + '/.Builder/Roo.LayoutDialog'; 
759     if (!File.isDirectory(dir)) {
760         print("mkdir " + dir);
761         File.mkdir(dir);
762     }
763     var formElements = [];
764     for (var k in reader.form) {
765         if (k == 'id') { // should really do primary key testing..
766             continue;
767         }
768         formElements.push(reader.form[k]);
769     }
770     formElements.push(reader.form['id']);
771
772     print("WRITE: " +  dir + '/' + cfg.DBNAME + '_' + reader.table + '.json');
773     
774     File.write(
775         dir + '/' + cfg.DBNAME + '_' + reader.table + '.json',
776             
777        
778         JSON.stringify({
779        
780             "closable": false,
781             "collapsible": false,
782             "height": formHeight,
783             "resizable": false,
784             "title": "Edit / Create " + reader.table,
785             "width": 400,
786             "xtype": "LayoutDialog",
787             "|xns": "Roo",
788             "items": [
789                 {
790                     "|xns": "Roo",
791                     "xtype": "LayoutRegion",
792                     "*prop": "center"
793                 },
794                 {
795                     "region": "center",
796                     "xtype": "ContentPanel",
797                     "|xns": "Roo",
798                     "items": [
799                         frmCfg
800                     ]
801                 },
802                 
803                 {
804                     "listeners": {
805                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
806                     },
807                     "*prop": "buttons[]",
808                     "text": "Cancel",
809                     "xtype": "Button",
810                     "|xns": "Roo"
811                 },
812                 {
813                     "listeners": {
814                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
815                     },
816                     "*prop": "buttons[]",
817                     "text": "Save",
818                     "xtype": "Button",
819                     "|xns": "Roo"
820                 }
821             ]
822         }, null,4)
823     );
824    
825    
826    
827 });
828
829