Pman.Tab.AdminEnum.bjs
[Pman.Admin] / Pman.Tab.AdminEnum.bjs
1 {
2  "name" : "Pman.Tab.AdminEnum",
3  "parent" : "Pman.Tab.Admin",
4  "title" : "Pman.Tab.AdminEnum",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminEnum.bjs",
6  "permname" : "",
7  "modOrder" : "500",
8  "strings" : {
9   "2df80d5febcde0c10a66818488622b7c" : "Pulldown Options",
10   "d1228f5476d15142b1358ae4b5fa2454" : "Order #",
11   "fdff10eac021dfbb69e9c38204237fdc" : "Add new pulldown list",
12   "1206eb8aea05be4625371c9c12818785" : "Pulldown",
13   "801ab24683a4a8c433c6eb40c48bcd9d" : "Download",
14   "7af54708cf5a4286cf0cfa58ff5148a8" : "Internal #",
15   "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
16   "b48968e1c912da07df5e8d6d246291ec" : "Display Name",
17   "510bc6e58593b2b8002c9fe0c21f3fde" : "Displaying core_enum{0} - {1} of {2}",
18   "1ba4d808fc7b27a7f60ce2ff75a8af3a" : "No core_enum found",
19   "c550aeed26e71a81a88360c1889245ab" : "Upload Values",
20   "d9ec74f5aa29ceef6bf7b45f7fec5d0f" : "Add Value",
21   "b9c49611cfda3259a2b837b39489e650" : "Add Image",
22   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
23   "49ee3087348e8d44e1feda1917443987" : "Name",
24   "7215ee9c7d9dc229d2921a40e899ec5f" : " "
25  },
26  "items" : [
27   {
28    "xtype" : "NestedLayoutPanel",
29    "$ xns" : "Roo",
30    "String region" : "center",
31    "String title" : "Pulldown Options",
32    "items" : [
33     {
34      "xtype" : "BorderLayout",
35      "$ xns" : "Roo",
36      "* prop" : "layout",
37      "items" : [
38       {
39        "Number width" : 200,
40        "xtype" : "LayoutRegion",
41        "$ xns" : "Roo",
42        "* prop" : "west",
43        "Boolean split" : true
44       },
45       {
46        "xtype" : "LayoutRegion",
47        "$ xns" : "Roo",
48        "* prop" : "center"
49       },
50       {
51        "listeners" : {
52         "|activate" : "function() {\n    _this.epanel = this;\n    //if (_this.egrid) {\n    //    _this.egrid.footer.onClick('first');\n    //}\n}"
53        },
54        "background" : false,
55        "region" : "west",
56        "title" : "Pulldown Options",
57        "xtype" : "GridPanel",
58        "$ xns" : "Roo",
59        "tableName" : "core_enum",
60        "items" : [
61         {
62          "listeners" : {
63           "beforeedit" : "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}",
64           "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 ? 0 : 1);\n        rec.commit();\n         \n        \n}",
65           "|render" : "function() \n{\n    _this.egrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.epanel.active) {\n       this.footer.onClick('first');\n    }\n}",
66           "celldblclick" : "function (_self, rowIndex, columnIndex, e)\n{\n    var rec = _this.egrid.ds.getAt(rowIndex);\n    Pman.Dialog.AdminEnumType.show(rec.data,function(){\n        \n        _this.egrid.footer.onClick('first');\n    });\n}",
67           "afteredit" : "function (e)\n{\n   e.record.commit();     \n}"
68          },
69          "autoExpandColumn" : "display_name",
70          "xtype" : "EditorGrid",
71          "loadMask" : true,
72          "clicksToEdit" : 1,
73          "$ xns" : "Roo.grid",
74          "* prop" : "grid",
75          "items" : [
76           {
77            "listeners" : {
78             "update" : "function (_self, record, operation)\n{\n    if (operation != Roo.data.Record.COMMIT) {\n        return;\n    }\n    // got commit..\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_enum.php',\n        method : 'POST',\n        params : {\n            id : record.data.id,\n            etype : _this.grid.ds.getById(record.id).data.etype,\n            name : record.data.name,\n            active : record.data.active,\n            seqid : record.data.seqid,\n            display_name : record.data.display_name\n        }, \n        success : function(res) {\n            //Roo.log(data);\n            // update the ID if it's not set..\n            if (record.data.id * 1 < 1) {\n                record.set('id', res.data.id);\n            }\n        }\n    });\n    \n}",
79             "beforeload" : "function (_self, o)\n{\n    o.params['query[empty_etype]'] = 1; \n  \n}"
80            },
81            "xtype" : "Store",
82            "remoteSort" : true,
83            "$ sortInfo" : "{ field : 'etype', direction: 'ASC' }",
84            "$ xns" : "Roo.data",
85            "* prop" : "dataSource",
86            "items" : [
87             {
88              "$ url" : "baseURL + '/Roo/core_enum.php'",
89              "xtype" : "HttpProxy",
90              "method" : "GET",
91              "$ xns" : "Roo.data",
92              "* prop" : "proxy"
93             },
94             {
95              "id" : "id",
96              "root" : "data",
97              "xtype" : "JsonReader",
98              "$ xns" : "Roo.data",
99              "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'etype',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'seqid',\n        'type': 'int'\n    }\n]",
100              "* prop" : "reader",
101              "totalProperty" : "total"
102             }
103            ]
104           },
105           {
106            "listeners" : {
107             "selectionchange" : "function (_self, selection)\n{\n    _this.grid.footer.onClick('first');\n}"
108            },
109            "xtype" : "CellSelectionModel",
110            "$ xns" : "Roo.grid",
111            "* prop" : "sm"
112           },
113           {
114            "pageSize" : 100,
115            "xtype" : "PagingToolbar",
116            "emptyMsg" : "No core_enum found",
117            "$ xns" : "Roo",
118            "displayInfo" : false,
119            "displayMsg" : " ",
120            "* prop" : "footer"
121           },
122           {
123            "xtype" : "Toolbar",
124            "$ xns" : "Roo",
125            "* prop" : "toolbar",
126            "items" : [
127             {
128              "listeners" : {
129               "|click" : "function()\n{\n    \n    var data = {\n        active:1,\n        display_name:'',\n        etype:'',\n        name:''\n    };\n    Pman.Dialog.AdminEnumType.show(data,function(){\n        \n        _this.egrid.footer.onClick('first');\n    });\n         \n         \n\n}\n"
130              },
131              "text" : "Add new pulldown list",
132              "xtype" : "Button",
133              "cls" : "x-btn-text-icon",
134              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
135              "$ xns" : "Roo.Toolbar"
136             }
137            ]
138           },
139           {
140            "xtype" : "ColumnModel",
141            "header" : "Pulldown",
142            "width" : 200,
143            "$ renderer" : "function(v,x,r) { \n\n\n    return String.format('<span qtip=\"{1}\">{0}</span>', (''+v).length ? v : r.data.name, r.data.name); \n}",
144            "$ xns" : "Roo.grid",
145            "* prop" : "colModel[]",
146            "dataIndex" : "display_name"
147           },
148           {
149            "xtype" : "ColumnModel",
150            "header" : "Active",
151            "width" : 50,
152            "$ renderer" : "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
153            "$ xns" : "Roo.grid",
154            "* prop" : "colModel[]",
155            "dataIndex" : "active"
156           }
157          ]
158         }
159        ]
160       },
161       {
162        "listeners" : {
163         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
164        },
165        "region" : "center",
166        "fitToframe" : true,
167        "background" : false,
168        "title" : "Pulldown Options",
169        "xtype" : "GridPanel",
170        "$ xns" : "Roo",
171        "tableName" : "core_enum",
172        "items" : [
173         {
174          "listeners" : {
175           "keypress" : "function (e)\n{\n    if(e.keyCode == 13){\n        _this.grid.footer.onClick('first');\n    }\n}",
176           "beforeedit" : "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}",
177           "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
178           "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        var rec = _this.grid.ds.getAt(rowIndex);\n            \n        if (di == 'active') {\n            \n            rec.set('active', rec.data.active ? 0 : 1);\n            rec.commit();\n            return;\n        }\n        if (di == 'id' ) {\n        \n            if (this.last_selected && e.shiftKey) {\n                // the highlight all the lines between the one last selected, and this one.\n                var s = this.dataSource.indexOf(this.last_selected);\n                var e = this.dataSource.indexOf(rec);\n                var ss = Math.min(s,e);\n                var ee = Math.max(s,e) +1;\n                for(var i = ss; i < ee; i++) {\n                    var rr = this.dataSource.getAt(i);\n                    rr.selected = 1;\n                    rr.set('sel', 1);\n                }\n                this.last_selected = rec;\n                return;\n\n            }\n        \n            rec.selected = rec.selected ? 0 : 1;\n            this.last_selected = rec.selected ? rec : false;\n            rec.set('sel', rec.data.sel ? 0 : 1);\n        }\n         \n\n         \n        \n}",
179           "afteredit" : "function (e)\n{\n   e.record.commit();     \n}"
180          },
181          "autoExpandColumn" : "display_name",
182          "xtype" : "EditorGrid",
183          "loadMask" : true,
184          "clicksToEdit" : 1,
185          "$ xns" : "Roo.grid",
186          "* prop" : "grid",
187          "items" : [
188           {
189            "listeners" : {
190             "update" : "function (_self, record, operation)\n{\n    if (operation != Roo.data.Record.COMMIT) {\n        return;\n    }\n    // got commit..\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_enum.php',\n        method : 'POST',\n        params : {\n            id : record.data.id,\n            etype : _this.grid.ds.getById(record.id).data.etype,\n            name : record.data.name,\n            active : record.data.active,\n            seqid : record.data.seqid,\n            display_name : record.data.display_name\n        }, \n        success : function(res) {\n            //Roo.log(data);\n            // update the ID if it's not set..\n            if (record.data.id * 1 < 1) {\n                record.set('id', res.data.id);\n            }\n        }\n    });\n    \n}",
191             "beforeload" : "function (_self, options)\n{\n\n    var s =     _this.egrid.getSelectionModel().getSelectedCell();\n    \n\n    if (!s) {\n        return false;\n    }\n    var d = _this.egrid.dataSource.getAt(s[0]);\n    \n    options.params.etype = d.data.name;\n    options.params['query[search]'] = _this.searchBox.getValue();\n    if (!options.params.etype.length) {\n        return false;\n    }\n}"
192            },
193            "xtype" : "Store",
194            "remoteSort" : true,
195            "$ sortInfo" : "{ field : 'etype', direction: 'ASC' }",
196            "$ xns" : "Roo.data",
197            "* prop" : "dataSource",
198            "items" : [
199             {
200              "$ url" : "baseURL + '/Roo/core_enum.php'",
201              "method" : "GET",
202              "xtype" : "HttpProxy",
203              "$ xns" : "Roo.data",
204              "* prop" : "proxy"
205             },
206             {
207              "id" : "id",
208              "root" : "data",
209              "xtype" : "JsonReader",
210              "$ xns" : "Roo.data",
211              "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'etype',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'seqid',\n        'type': 'int'\n    }\n]",
212              "* prop" : "reader",
213              "totalProperty" : "total"
214             }
215            ]
216           },
217           {
218            "pageSize" : 25,
219            "xtype" : "PagingToolbar",
220            "emptyMsg" : "No core_enum found",
221            "$ xns" : "Roo",
222            "displayInfo" : true,
223            "displayMsg" : "Displaying core_enum{0} - {1} of {2}",
224            "* prop" : "footer",
225            "items" : [
226             {
227              "listeners" : {
228               "click" : "function (_self, e)\n{\n    new Pman.Download({\n        grid : _this.grid\n    });\n    Roo.MessageBox.alert(\"Downloading\", \"File is downloading\");\n}"
229              },
230              "text" : "Download",
231              "xtype" : "Button",
232              "$ xns" : "Roo.Toolbar"
233             },
234             {
235              "listeners" : {
236               "click" : "function (_self, e)\n{\n\n  var s =     _this.egrid.getSelectionModel().getSelectedCell();\n    \n\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n    }\n    \n    var d = _this.egrid.dataSource.getAt(s[0]);\n \n\n    var etype = d.data.name;\n    \n    if(!etype.length){\n        Roo.MessageBox.alert('Error', 'Please select a pulldown');\n        return;\n    }\n    \n    Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Admin/Import/Enum?' + Roo.urlEncode({'etype' : etype})\n        \n       },\n       function () {\n            _this.grid.footer.onClick('first');\n       }\n   );\n}"
237              },
238              "text" : "Upload Values",
239              "xtype" : "Button",
240              "$ xns" : "Roo.Toolbar"
241             }
242            ]
243           },
244           {
245            "xtype" : "Toolbar",
246            "$ xns" : "Roo",
247            "* prop" : "toolbar",
248            "items" : [
249             {
250              "listeners" : {
251               "|click" : "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    \n    \n    var s =     _this.egrid.getSelectionModel().getSelectedCell();\n    \n\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n    }\n    \n    var d = _this.egrid.dataSource.getAt(s[0]);\n \n\n    var ds = _this.grid.getDataSource();\n\n    var add = ds.reader.newRow({    \n             id: 0, \n             display_name : '', \n             name : '', \n             etype: d.data.name, \n             active: 1, \n             seqid: 0\n      });\n     var r = ds.data.length;\n    ds.insert(r  , add);  \n    _this.grid.startEditing(r, 1); // name... \n}\n"
252              },
253              "text" : "Add Value",
254              "xtype" : "Button",
255              "cls" : "x-btn-text-icon",
256              "$ icon" : "baseURL + '/Pman/templates/images/search.gif'",
257              "$ xns" : "Roo.Toolbar"
258             },
259             {
260              "listeners" : {
261               "|click" : "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    var et = _this.etypeCombo.getValue();\n    \n    if (!et) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n        return;\n    }\n    var sc = _this.grid.getSelectionModel().getSelectedCell();\n    Roo.log(sc);\n    var ds = _this.grid.ds.getAt(sc[0]);\n    if (!ds) {\n        Roo.MessageBox.alert(\"Error\", \"Select enum\");\n        return;\n    }\n    \n    Roo.log(ds);\n    Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){\n        _this.grid.footer.onClick('first');\n    });\n    \n}\n"
262              },
263              "text" : "Add Image",
264              "xtype" : "Button",
265              "cls" : "x-btn-text-icon",
266              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
267              "$ xns" : "Roo.Toolbar"
268             },
269             {
270              "listeners" : {
271               "render" : "function (_self)\n{\n    _this.searchBox = this;\n}"
272              },
273              "String name" : "search",
274              "xtype" : "TextField",
275              "String fieldLabel" : "Search",
276              "$ xns" : "Roo.form"
277             },
278             {
279              "listeners" : {
280               "click" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
281              },
282              "String cls" : "x-btn-icon",
283              "xtype" : "Button",
284              "$ xns" : "Roo.Toolbar",
285              "$ icon" : "rootURL + '/Pman/templates/images/search.gif'"
286             },
287             {
288              "listeners" : {
289               "click" : "function (_self, e)\n{\n     _this.searchBox.setValue('');\n     _this.grid.footer.onClick('first');\n}"
290              },
291              "String cls" : "x-btn-icon",
292              "xtype" : "Button",
293              "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
294              "$ xns" : "Roo.Toolbar"
295             }
296            ]
297           },
298           {
299            "xtype" : "ColumnModel",
300            "width" : 75,
301            "header" : "Internal #",
302            "$ renderer" : "function(v,x,r) { \n    var fmt = '{0}';\n    if (r.selected) {\n        fmt = '<span style=\"color:orange;font-weight:bold;\">{0}</span>';\n    }\n    return String.format(fmt, v); }",
303            "$ xns" : "Roo.grid",
304            "Boolean sortable" : true,
305            "* prop" : "colModel[]",
306            "dataIndex" : "id"
307           },
308           {
309            "xtype" : "ColumnModel",
310            "width" : 75,
311            "header" : "Image",
312            "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/25/{1}/{2}\" width=\"25\" height=\"25\">', baseURL, v, r.data.images_id_filename); }",
313            "$ xns" : "Roo.grid",
314            "* prop" : "colModel[]",
315            "dataIndex" : "images_id_id"
316           },
317           {
318            "xtype" : "ColumnModel",
319            "header" : "Name",
320            "width" : 200,
321            "$ renderer" : "function(v) { return String.format('{0}', v); }",
322            "$ xns" : "Roo.grid",
323            "Boolean sortable" : true,
324            "* prop" : "colModel[]",
325            "dataIndex" : "name",
326            "items" : [
327             {
328              "xtype" : "GridEditor",
329              "$ xns" : "Roo.grid",
330              "* prop" : "editor",
331              "items" : [
332               {
333                "xtype" : "TextField",
334                "$ xns" : "Roo.form",
335                "* prop" : "field"
336               }
337              ]
338             }
339            ]
340           },
341           {
342            "xtype" : "ColumnModel",
343            "width" : 200,
344            "header" : "Display Name",
345            "$ renderer" : "function(v) { return String.format('{0}', v); }",
346            "$ xns" : "Roo.grid",
347            "Boolean sortable" : true,
348            "* prop" : "colModel[]",
349            "dataIndex" : "display_name",
350            "items" : [
351             {
352              "xtype" : "GridEditor",
353              "$ xns" : "Roo.grid",
354              "* prop" : "editor",
355              "items" : [
356               {
357                "xtype" : "TextField",
358                "$ xns" : "Roo.form",
359                "* prop" : "field"
360               }
361              ]
362             }
363            ]
364           },
365           {
366            "xtype" : "ColumnModel",
367            "width" : 75,
368            "header" : "Active",
369            "$ renderer" : "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
370            "$ xns" : "Roo.grid",
371            "Boolean sortable" : true,
372            "* prop" : "colModel[]",
373            "dataIndex" : "active"
374           },
375           {
376            "xtype" : "ColumnModel",
377            "sortable" : true,
378            "header" : "Order #",
379            "width" : 75,
380            "$ renderer" : "function(v) { return String.format('{0}', v); }",
381            "$ xns" : "Roo.grid",
382            "Boolean sortable" : true,
383            "* prop" : "colModel[]",
384            "dataIndex" : "seqid",
385            "items" : [
386             {
387              "xtype" : "GridEditor",
388              "$ xns" : "Roo.grid",
389              "* prop" : "editor",
390              "items" : [
391               {
392                "allowNegative" : true,
393                "xtype" : "NumberField",
394                "allowDecimals" : false,
395                "decimalPrecision" : 0,
396                "$ xns" : "Roo.form",
397                "* prop" : "field"
398               }
399              ]
400             }
401            ]
402           }
403          ]
404         }
405        ]
406       }
407      ]
408     }
409    ]
410   }
411  ]
412 }