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