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