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