1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Editor.Roo');
7 Editor.Roo.LayoutDialog = new Roo.XComponent({
10 'b021df6aac4654c454f46c77646e745f' :"Label",
11 '793548e77e782c209a78ed67f255b5e2' :"Display Field",
12 '040076bde7f6b3387448e32b66c2eee0' :"To BJS",
13 '4ce58cbe362a5d7b156992a496d55bf3' :"Database Column",
14 '189efd19c4153526994a6d7ea5f6f068' :"Field Type",
15 '2f616612593df62aeed112de4f03110e' :"Edit a Grid",
16 '0ccc2bf3fb98387c23b6ca5500244d6e' :"Use ",
17 'c671c787b49f50a3ace9fdc5bd597825' :"core_enum",
18 '32954654ac8fe66a1d09be19001de2d4' :"Width",
19 'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
20 '6e7376dca68a2386a8737944196ab491' :"Create / Edit Grid",
21 'f541774a08fc687f6e2016c77a6ebca5' :"Load Data"
24 part : ["Editors", "LayoutDialog" ],
25 order : '001-Editor.Roo.LayoutDialog',
28 name : "unnamed module",
40 [ 1, 'test', 'test', 110 ]
66 '|xns' : 'Roo.Toolbar',
67 text : _this._strings['2f616612593df62aeed112de4f03110e'],
72 '|xns' : 'Roo.Toolbar',
77 '|xns' : 'Roo.Toolbar',
78 text : _this._strings['f541774a08fc687f6e2016c77a6ebca5'],
82 click : function (_self, e)
86 "Field": "manage_scale_id",
92 "relates_to_table": "core_enum",
93 "relates_to_col": "id",
94 "relates_to_schema": {
101 "Extra": "auto_increment"
105 "Type": "varchar(32)",
113 "Type": "varchar(255)",
144 "Field": "display_name",
152 "Field": "is_system_enum",
162 "Field": "person_type",
170 "Field": "employer_name",
178 "Field": "birth_date",
182 "Default": "0000-00-00",
185 "employ_start_date": {
186 "Field": "employ_start_date",
190 "Default": "0000-00-00",
194 "Field": "employ_end_date",
198 "Default": "0000-00-00",
201 "hide_same_employer": {
202 "Field": "hide_same_employer",
210 "Field": "salary_currency",
211 "Type": "varchar(256)",
218 "Field": "quota_currency",
219 "Type": "varchar(256)",
226 "Field": "created_dt",
230 "Default": "0000-00-00 00:00:00",
234 "Field": "updated_dt",
238 "Default": "0000-00-00 00:00:00",
243 Roo.log('Loading Data...');
244 _this.panel.loadData(data);
250 '|xns' : 'Roo.Toolbar',
255 '|xns' : 'Roo.Toolbar',
256 text : _this._strings['040076bde7f6b3387448e32b66c2eee0'],
260 click : function (_self, e)
263 Roo.log('Converting to BJS...');
273 autoExpandColumn : 'title',
277 xtype : 'EditorGrid',
281 dataIndex : 'active',
282 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
283 renderer : function(v) {
284 var state = v *1 > 0 ? '-checked' : '';
286 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
291 xtype : 'ColumnModel'
295 dataIndex : 'dataIndex',
296 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
297 renderer : function(v) { return String.format('{0}', v); },
300 xtype : 'ColumnModel'
305 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
306 renderer : function(v) { return String.format('{0}', v); },
309 xtype : 'ColumnModel'
320 xtype : 'GridEditor',
328 header : _this._strings['b021df6aac4654c454f46c77646e745f'],
329 renderer : function(v) { return String.format('{0}', v); },
332 xtype : 'ColumnModel',
344 [ 'ComboBox', "ComboBox"],
345 [ 'ComboBoxArray', "ComboBoxArray"]
346 [ 'TextField' , "TextField"],
347 [ 'NumberField', "NumberField"],
348 [ 'TextArea', "TextArea"],
349 [ 'HtmlEditor', "HtmlEditor"],
350 [ 'Hidden', "Hidden"],
351 [ 'DateField', "DateField"],
352 [ 'Checkbox', "Checkbox"]
355 fields : [ 'ftype', 'fname'],
357 xtype : 'SimpleStore'
361 displayField : 'fname',
363 hiddenName : 'status',
367 triggerAction : 'all',
368 valueField : 'ftype',
379 xtype : 'GridEditor',
387 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
388 renderer : function(v) { return String.format('{0}', v); },
391 xtype : 'ColumnModel',
405 fields : [ 'dfield'],
407 xtype : 'SimpleStore'
411 displayField : 'dfield',
413 hiddenName : 'status',
416 name : 'display_field',
417 triggerAction : 'all',
418 valueField : 'dfield',
429 xtype : 'GridEditor',
436 dataIndex : 'display_field',
437 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
438 renderer : function(v) { return String.format('{0}', v); },
441 xtype : 'ColumnModel',
451 decimalPrecision : 0,
453 xtype : 'NumberField'
457 xtype : 'GridEditor',
465 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
466 renderer : function(v) { return String.format('{0}', v); },
469 xtype : 'ColumnModel',
477 beforeedit : function (e)
479 Roo.log('before edit!!!');
482 if(e.field != 'display_field'){
486 _this.grid.colModel.getCellEditor(e.column, e.row).field.store.loadData(e.record.data.relates_to_schema);
488 cellclick : function (_self, rowIndex, columnIndex, e)
491 var di = this.colModel.getDataIndex(columnIndex);
492 if (di != 'active') {
496 var rec = _this.grid.ds.getAt(rowIndex);
498 rec.set('active', rec.data.active * 1 ? 0 : 1);
506 //_this.dialog = Pman.Dialog.FILL_IN
509 rowdblclick : function (_self, rowIndex, e)
511 if (!_this.dialog) return;
524 loadData : function(data) {
526 //alert("IPC:TEST:" + JSON.stringify(data,null,4));
528 var fields = _this.grid.dataSource.reader.recordType.prototype.fields;
533 for (var k in data) {
535 var has_s = typeof(r.relates_to_schema) != 'undefined';
538 var field_type = 'TextField';
540 if (r.Type == 'text'){
541 field_type = 'TextArea';
544 if(r.Type == 'date' || r.Type == 'datetime'){
545 field_type = 'DateField';
548 var regex = /(.*?)\((.*?)\)/;
550 if(regex.test(r.Type)){
551 var type_match = regex.exec(r.Type);
553 if(type_match[1] == 'int'){
554 field_type = 'NumberField';
556 if(type_match[2] * 1 < 11){
557 field_type = 'CheckBox';
562 var rt = '', rc = '', rs = [];
565 for (var kk in r.relates_to_schema) {
566 var rr = r.relates_to_schema[kk];
568 rt = r.relates_to_table;
569 rc = r.relates_to_col;
575 field_type = 'ComboBox';
578 if(r.Field == 'id'){ // usually 'id' is hidden on the form
579 field_type = 'Hidden';
591 display_field : rc, //r.Field + '_display_name',
592 relates_to_table : rt,
594 relates_to_schema : rs
603 Roo.each(d, function(dd){
607 for(var j = 0; j < fields.length; j++){
608 var f = fields.items[j];
610 if(dd.hasOwnProperty(f.name)){
620 //alert("IPC:TEST:" + JSON.stringify(ar));
621 this.grid.dataSource.loadData(ar);
624 tableName : 'core_enum',
625 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
626 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
629 // convert the selected cells into a BJS data ready to send back to the UI..
632 this.firstTxtCol = "XXX";
637 var formElements = [];
638 this.grid.dataSource.each(function(rec) {
639 if (!rec.data.active) {
644 fieldLabel : rec.data.title,
645 name : rec.data.dataIndex,
646 width : rec.data.width,
648 xtype : rec.data.ftype
650 if (el.xtype == 'DateField') {
656 if (el.xtype == 'TextArea') {
660 if (el.xtype == 'Hidden') {
661 delete el.fieldLabel;
665 if (el.xtype == 'ComboBox') {
667 el.alwaysQuery = true;
668 el.triggerAction = 'all';
669 el.forceSelection = true;
674 el.queryParam = 'query[' + rec.data.display_field + ']';// SET WHEN USED
676 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
677 el.name = rec.data.dataIndex + '_' + rec.data.display_field; // SET WHEN USED eg. project_id_name
679 el.displayField = rec.data.display_field // SET WHEN USED eg. project_id
680 el.valueField = rec.data.relates_to_col
682 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + rec.data.display_field +'}</b> </div>'; // SET WHEN USED
692 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
694 '|beforeload' : 'function (_self, o)' +
696 " o.params = o.params || {};\n" +
697 " // set more here\n" +
703 'xtype' : 'HttpProxy',
706 '|url' : "baseURL + '/Roo/" + rec.data.relates_to_table + ".php'",
711 'xtype' : 'JsonReader',
715 'totalProperty' : 'total'
725 if (el.xtype == 'ComboBoxArray') {
727 el.hiddenName = rec.data.dataIndex;
728 el.name = rec.data.dataIndex + '_' + rec.data.display_field;
736 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
738 '|beforeload' : 'function (_self, o)' +
740 " o.params = o.params || {};\n" +
741 " // set more here\n" +
747 'xtype' : 'HttpProxy',
750 '|url' : "baseURL + '/Roo/" + rec.data.relates_to_table + ".php'",
755 'xtype' : 'JsonReader',
759 'totalProperty' : 'total'
767 el.queryParam = 'query[' + rec.data.display_field + ']';// SET WHEN USED
769 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
770 el.name = rec.data.dataIndex + '_' + rec.data.display_field; // SET WHEN USED eg. project_id_name
772 el.displayField = rec.data.display_field // SET WHEN USED eg. project_id
773 el.valueField = rec.data.relates_to_col
775 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + rec.data.display_field +'}</b> </div>'; // SET WHEN USED
782 if (el.xtype == 'HtmlEditor') {
787 '* prop' : 'toolbars[]',
788 '|xns' : 'Roo.form.HtmlEditor',
789 'xtype' : 'ToolbarContext'
792 '* prop' : 'toolbars[]',
793 '|xns' : 'Roo.form.HtmlEditor',
794 'xtype' : 'ToolbarStandard'
800 formElements.push(el);
802 formHeight += rec.data.ftype == 'TextArea' ? 100 : ((rec.data.ftype == 'HtmlEditor') ? 250 : 30);
817 "|actioncomplete" : "function(_self,action)\n"+
819 " if (action.type == 'setdata') {\n"+
820 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
823 " if (action.type == 'load') {\n"+
826 " if (action.type =='submit') {\n"+
828 " _this.dialog.hide();\n"+
830 " if (_this.callback) {\n"+
831 " _this.callback.call(_this, action.result.data);\n"+
833 " _this.form.reset();\n"+
838 "|rendered" : "function (form)\n"+
840 " _this.form= form;\n"+
844 style : "margin:10px;",
845 "|url" : "baseURL + '/Roo/" + this.table + "'",
850 alert("IPC:OUT:" + JSON.stringify({
852 "collapsible": false,
853 "height": formHeight,
855 "title": "Edit / Create " + this.table,
858 "xtype": "LayoutDialog",
863 "xtype": "LayoutRegion",
868 "xtype": "ContentPanel",
877 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
879 "*prop": "buttons[]",
886 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
888 "*prop": "buttons[]",
903 activate : function() {
906 _this.grid.footer.onClick('first');