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