resources/Editors/Editor.Roo.LayoutDialog.bjs
[app.Builder.js] / resources / Editors / Editor.Roo.LayoutDialog.bjs
1 {
2  "name" : "Editor.Roo.LayoutDialog",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/app.Builder.js/resources/Editors/Editor.Roo.LayoutDialog.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "b021df6aac4654c454f46c77646e745f" : "Label",
10   "4ce58cbe362a5d7b156992a496d55bf3" : "Database Column",
11   "2f616612593df62aeed112de4f03110e" : "Edit a Grid",
12   "0ccc2bf3fb98387c23b6ca5500244d6e" : "Use ",
13   "c671c787b49f50a3ace9fdc5bd597825" : "core_enum",
14   "32954654ac8fe66a1d09be19001de2d4" : "Width",
15   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
16   "6e7376dca68a2386a8737944196ab491" : "Create / Edit Grid",
17   "7fc56270e7a70fa81a5935b72eacbe29" : "A"
18  },
19  "items" : [
20   {
21    "listeners" : {
22     "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
23    },
24    "| function loadData" : "function(data) { \n\n     alert(\"IPC:TEST:\" + JSON.stringify(data,null,4));\n    var ar = [];\n    for (var k in data) { \n        var r = data[k];\n        var has_s = typeof(r.relates_to_schema) != 'undefined'\n        ar.push([ !has_s , r.Field, r.Type,  r.Field, 100] );\n        if (!has_s) {\n            continue;\n        }\n        for (var kk in r.relates_to_schema) {         \n            var rr = r.relates_to_schema[kk];\n            if (rr.Field == r.relates_to_col) {\n                continue;\n            }\n            ar.push([ false, r.Field + '_'+ rr.Field, rr.Type,  rr.Field, 100] );\n        }\n    }\n    \n    alert(\"IPC:TEST:\" + JSON.stringify(ar));\n    this.grid.dataSource.loadData(ar);\n}",
25    "| function toBJS" : "function() { \n\n// convert the selected cells into a BJS data ready to send back to the UI..\n   \n    this.table = \"XXX\";\n    this.firstTxtCol = \"XXX\";\n   \n    \n    var jreader = {};\n    var     colmodel = [];\n    this.grid.dataSource.each(function(rec) {\n        if (!rec.data.active) {\n            return;\n        }\n        \n        \n        \n        colmodel.push({\n            \"xtype\": \"ColumnModel\",\n            \"header\": rec.data.title,\n            \"width\":  rec.data.width * 1,\n            \"dataIndex\": rec.data.dataIndex,\n            \"|renderer\": !rec.data.type.match(/date/i) ? \n                    \"function(v) { return String.format('{0}', v); }\" :\n                    \"function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }\" , // special for date\n            \"|xns\": \"Roo.grid\",\n            \"*prop\": \"cm[]\"\n        });\n    });\n    \n    \n    \n\n    alert(\"IPC:OUT:\" + JSON.stringify({\n        '|xns' : 'Roo',\n        xtype : \"GridPanel\",\n        \"title\": this.table,\n        \"fitToframe\": true,\n        \"fitContainer\": true,\n        \"tableName\": this.table,\n        \"background\": true,\n        \"region\" : 'center',\n        \"listeners\": {\n            \"|activate\": \"function() {\\n    _this.panel = this;\\n    if (_this.grid) {\\n        _this.grid.footer.onClick('first');\\n    }\\n}\"\n        },\n        \"items\": [\n            {\n                \"*prop\": \"grid\",\n                \"xtype\": \"Grid\",\n                \"autoExpandColumn\": this.firstTxtCol,\n                \"loadMask\": true,\n                \"listeners\": {\n                    \"|render\": \"function() \\n\" +\n                        \"{\\n\" +\n                        \"    _this.grid = this; \\n\" +\n                        \"    //_this.dialog = Pman.Dialog.FILL_IN\\n\" +\n                        \"    if (_this.panel.active) {\\n\" +\n                        \"       this.footer.onClick('first');\\n\" +\n                        \"    }\\n\" +\n                        \"}\",\n                    \"|rowdblclick\": \"function (_self, rowIndex, e)\\n\" + \n                        \"{\\n\" + \n                        \"    if (!_this.dialog) return;\\n\" + \n                        \"    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\\n\" + \n                        \"        _this.grid.footer.onClick('first');\\n\" + \n                        \"    }); \\n\" + \n                        \"}\\n\"\n                },\n                \"|xns\": \"Roo.grid\",\n\n                \"items\": [\n                    {\n                        \"*prop\": \"dataSource\",\n                        \"xtype\": \"Store\",\n                         remoteSort : true,\n                        '|sortInfo' : \"{ field : '\" + this.firstTxtCol  +  \"', direction: 'ASC' }\", \n                        \"|xns\": \"Roo.data\",\n                        \"items\": [\n                            \n                            {\n                                \"*prop\": \"proxy\",\n                                \"xtype\": \"HttpProxy\",\n                                \"method\": \"GET\",\n                                \"|url\": \"baseURL + '/Roo/\" + this.table + \".php'\",\n                                \"|xns\": \"Roo.data\"\n                            },\n                            {\n                                '*prop' : 'reader',\n                                'xtype' : 'JsonReader',\n                                '|xns' : 'Roo.data',\n                                'id' : 'id',\n                                'root' : 'data',\n                                'totalProperty' : 'total'\n                            }\n                        ]\n                    },\n                    {\n                        \"*prop\": \"footer\",\n                        \"xtype\": \"PagingToolbar\",\n                        \"pageSize\": 25,\n                        \"displayInfo\": true,\n                        \"displayMsg\": \"Displaying \" + this.table + \"{0} - {1} of {2}\",\n                        \"emptyMsg\": \"No \" + this.table + \" found\",\n                        \"|xns\": \"Roo\"\n                    },\n                    {\n                        \"*prop\": \"toolbar\",\n                        \"xtype\": \"Toolbar\",\n                        \"|xns\": \"Roo\",\n                        \"items\": [\n                            {\n                                \"text\": \"Add\",\n                                \"xtype\": \"Button\",\n                                \"cls\": \"x-btn-text-icon\",\n                                \"|icon\": \"Roo.rootURL + 'images/default/dd/drop-add.gif'\",\n                                \"listeners\": {\n                                    \"|click\": \"function()\\n\"+\n                                        \"{\\n\"+\n                                        \"    if (!_this.dialog) return;\\n\" +\n                                        \"    _this.dialog.show( { id : 0 } , function() {\\n\"+\n                                        \"        _this.grid.footer.onClick('first');\\n\"+\n                                        \"   }); \\n\"+\n                                        \"}\\n\"\n                                },\n                                \"|xns\": \"Roo.Toolbar\"\n                            },\n                             // fill ????\n                            {\n                                \"text\": \"Delete\",\n                                \"cls\": \"x-btn-text-icon\",\n                                \"|icon\": \"rootURL + '/Pman/templates/images/trash.gif'\",\n                                \"xtype\": \"Button\",\n                                \"listeners\": {\n                                    \"|click\": \"function()\\n\"+\n                                        \"{\\n\"+\n                                        \"     Pman.genericDelete(_this, '\" + this.table + \"'); \\n\"+\n                                        \"}\\n\"+\n                                        \"        \"\n                                },\n                                \"|xns\": \"Roo.Toolbar\"\n                            }\n                        ]\n                    }, // end toolbar\n                ].concat( colmodel)\n            }\n        ]\n        \n        \n    }, null, 4));\n\n}",
26    "fitToframe" : true,
27    "background" : false,
28    "region" : "center",
29    "title" : "core_enum",
30    "xtype" : "GridPanel",
31    "$ xns" : "Roo",
32    "fitContainer" : true,
33    "String title" : "Create / Edit Grid",
34    "tableName" : "core_enum",
35    "items" : [
36     {
37      "listeners" : {
38       "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n  \n}\n",
39       "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n\n}",
40       "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        if (di != 'active') {\n            return;\n        }\n         \n        var rec = _this.grid.ds.getAt(rowIndex);\n        \n        rec.set('active', rec.data.active * 1 ? 0 : 1);\n        rec.commit();\n         \n        \n}"
41      },
42      "Number clicksToEdit" : 1,
43      "autoExpandColumn" : "title",
44      "xtype" : "EditorGrid",
45      "loadMask" : true,
46      "$ xns" : "Roo.grid",
47      "* prop" : "grid",
48      "items" : [
49       {
50        "$ Array fields" : "[ 'active', 'dataIndex', 'type','title', 'width' ]",
51        "$ Array data" : "[\n  [ 1, 'test', 'test', 110 ]\n  \n\n]",
52        "Number id" : "'dataIndex'",
53        "xtype" : "SimpleStore",
54        "$ xns" : "Roo.data",
55        "* prop" : "ds"
56       },
57       {
58        "xtype" : "Toolbar",
59        "$ xns" : "Roo",
60        "* prop" : "toolbar",
61        "items" : [
62         {
63          "string text" : "Edit a Grid",
64          "xtype" : "TextItem",
65          "$ xns" : "Roo.Toolbar"
66         }
67        ]
68       },
69       {
70        "xtype" : "ColumnModel",
71        "width" : 75,
72        "header" : "Use ",
73        "$ renderer" : "function(v) {  \n    var state = v *1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
74        "$ xns" : "Roo.grid",
75        "* prop" : "cm[]",
76        "dataIndex" : "active"
77       },
78       {
79        "xtype" : "ColumnModel",
80        "header" : "Database Column",
81        "width" : 150,
82        "$ renderer" : "function(v) { return String.format('{0}', v); }",
83        "$ xns" : "Roo.grid",
84        "* prop" : "cm[]",
85        "dataIndex" : "dataIndex"
86       },
87       {
88        "xtype" : "ColumnModel",
89        "width" : 100,
90        "header" : "Type",
91        "$ renderer" : "function(v) { return String.format('{0}', v); }",
92        "$ xns" : "Roo.grid",
93        "* prop" : "cm[]",
94        "dataIndex" : "type"
95       },
96       {
97        "xtype" : "ColumnModel",
98        "header" : "Label",
99        "width" : 75,
100        "$ renderer" : "function(v) { return String.format('{0}', v); }",
101        "$ xns" : "Roo.grid",
102        "* prop" : "cm[]",
103        "dataIndex" : "title",
104        "items" : [
105         {
106          "xtype" : "GridEditor",
107          "$ xns" : "Roo.grid",
108          "* prop" : "editor",
109          "items" : [
110           {
111            "xtype" : "TextField",
112            "$ xns" : "Roo.form",
113            "* prop" : "field"
114           }
115          ]
116         }
117        ]
118       },
119       {
120        "xtype" : "ColumnModel",
121        "width" : 75,
122        "header" : "Label",
123        "$ renderer" : "function(v) { return String.format('{0}', v); }",
124        "$ xns" : "Roo.grid",
125        "* prop" : "cm[]",
126        "dataIndex" : "title",
127        "items" : [
128         {
129          "xtype" : "GridEditor",
130          "$ xns" : "Roo.grid",
131          "* prop" : "editor",
132          "items" : [
133           {
134            "listWidth" : 200,
135            "triggerAction" : "all",
136            "displayField" : "fname",
137            "hiddenName" : "status",
138            "value" : "A",
139            "valueField" : "ftype",
140            "xtype" : "ComboBox",
141            "allowBlank" : false,
142            "editable" : false,
143            "width" : 150,
144            "$ xns" : "Roo.form",
145            "mode" : "local",
146            "name" : "status",
147            "* prop" : "field",
148            "items" : [
149             {
150              "xtype" : "SimpleStore",
151              "$ data" : "[ \n    [ 'O', \"Open\"],\n    [ 'C' , \"Closed\"],\n    [ 'A', \"All\"] \n]\n",
152              "$ fields" : "[  'ftype', 'fname']",
153              "$ xns" : "Roo.data",
154              "* prop" : "store"
155             }
156            ]
157           }
158          ]
159         }
160        ]
161       },
162       {
163        "xtype" : "ColumnModel",
164        "width" : 75,
165        "header" : "Width",
166        "$ renderer" : "function(v) { return String.format('{0}', v); }",
167        "$ xns" : "Roo.grid",
168        "* prop" : "cm[]",
169        "dataIndex" : "width",
170        "items" : [
171         {
172          "xtype" : "GridEditor",
173          "$ xns" : "Roo.grid",
174          "* prop" : "editor",
175          "items" : [
176           {
177            "xtype" : "NumberField",
178            "Number decimalPrecision" : 0,
179            "$ xns" : "Roo.form",
180            "* prop" : "field"
181           }
182          ]
183         }
184        ]
185       }
186      ]
187     }
188    ]
189   }
190  ]
191 }