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/michael/gitlive/Pman.Admin/Pman.Tab.AdminEnum.bjs",
6     "permname" : "",
7     "modOrder" : "500",
8     "items" : [
9         {
10             "xtype" : "NestedLayoutPanel",
11             "String region" : "center",
12             "$ xns" : "Roo",
13             "String title" : "Pulldown Options",
14             "items" : [
15                 {
16                     "xtype" : "BorderLayout",
17                     "$ xns" : "Roo",
18                     "* prop" : "layout",
19                     "items" : [
20                         {
21                             "Number width" : 200,
22                             "xtype" : "LayoutRegion",
23                             "$ xns" : "Roo",
24                             "* prop" : "west",
25                             "Boolean split" : true
26                         },
27                         {
28                             "xtype" : "LayoutRegion",
29                             "$ xns" : "Roo",
30                             "* prop" : "center"
31                         },
32                         {
33                             "listeners" : {
34                                 "|activate" : "function() {\n    _this.epanel = this;\n    if (_this.egrid) {\n        _this.egrid.footer.onClick('first');\n    }\n}"
35                             },
36                             "background" : false,
37                             "region" : "west",
38                             "title" : "Pulldown Options",
39                             "xtype" : "GridPanel",
40                             "$ xns" : "Roo",
41                             "tableName" : "core_enum",
42                             "items" : [
43                                 {
44                                     "listeners" : {
45                                         "beforeedit" : "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}",
46                                         "|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}",
47                                         "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}",
48                                         "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}",
49                                         "afteredit" : "function (e)\n{\n   e.record.commit();     \n}"
50                                     },
51                                     "autoExpandColumn" : "display_name",
52                                     "xtype" : "EditorGrid",
53                                     "loadMask" : true,
54                                     "clicksToEdit" : 1,
55                                     "$ xns" : "Roo.grid",
56                                     "* prop" : "grid",
57                                     "items" : [
58                                         {
59                                             "listeners" : {
60                                                 "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}",
61                                                 "beforeload" : "function (_self, o)\n{\n    o.params['query[empty_etype]'] = 1; \n  \n}"
62                                             },
63                                             "xtype" : "Store",
64                                             "remoteSort" : true,
65                                             "$ sortInfo" : "{ field : 'etype', direction: 'ASC' }",
66                                             "$ xns" : "Roo.data",
67                                             "* prop" : "dataSource",
68                                             "items" : [
69                                                 {
70                                                     "$ url" : "baseURL + '/Roo/core_enum.php'",
71                                                     "method" : "GET",
72                                                     "xtype" : "HttpProxy",
73                                                     "$ xns" : "Roo.data",
74                                                     "* prop" : "proxy"
75                                                 },
76                                                 {
77                                                     "id" : "id",
78                                                     "root" : "data",
79                                                     "xtype" : "JsonReader",
80                                                     "$ xns" : "Roo.data",
81                                                     "$ 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]",
82                                                     "* prop" : "reader",
83                                                     "totalProperty" : "total"
84                                                 }
85                                             ]
86                                         },
87                                         {
88                                             "listeners" : {
89                                                 "selectionchange" : "function (_self, selection)\n{\n    _this.grid.footer.onClick('first');\n}"
90                                             },
91                                             "xtype" : "CellSelectionModel",
92                                             "$ xns" : "Roo.grid",
93                                             "* prop" : "sm"
94                                         },
95                                         {
96                                             "pageSize" : 100,
97                                             "xtype" : "PagingToolbar",
98                                             "emptyMsg" : "No core_enum found",
99                                             "$ xns" : "Roo",
100                                             "displayInfo" : false,
101                                             "displayMsg" : " ",
102                                             "* prop" : "footer"
103                                         },
104                                         {
105                                             "xtype" : "Toolbar",
106                                             "$ xns" : "Roo",
107                                             "* prop" : "toolbar",
108                                             "items" : [
109                                                 {
110                                                     "listeners" : {
111                                                         "|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"
112                                                     },
113                                                     "text" : "Add new pulldown list",
114                                                     "xtype" : "Button",
115                                                     "cls" : "x-btn-text-icon",
116                                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
117                                                     "$ xns" : "Roo.Toolbar"
118                                                 }
119                                             ]
120                                         },
121                                         {
122                                             "xtype" : "ColumnModel",
123                                             "width" : 200,
124                                             "header" : "Pulldown",
125                                             "$ 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}",
126                                             "$ xns" : "Roo.grid",
127                                             "* prop" : "colModel[]",
128                                             "dataIndex" : "display_name"
129                                         },
130                                         {
131                                             "xtype" : "ColumnModel",
132                                             "width" : 50,
133                                             "header" : "Active",
134                                             "$ 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 }",
135                                             "$ xns" : "Roo.grid",
136                                             "* prop" : "colModel[]",
137                                             "dataIndex" : "active"
138                                         }
139                                     ]
140                                 }
141                             ]
142                         },
143                         {
144                             "listeners" : {
145                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
146                             },
147                             "fitToframe" : true,
148                             "background" : false,
149                             "region" : "center",
150                             "title" : "Pulldown Options",
151                             "xtype" : "GridPanel",
152                             "$ xns" : "Roo",
153                             "tableName" : "core_enum",
154                             "items" : [
155                                 {
156                                     "listeners" : {
157                                         "beforeedit" : "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}",
158                                         "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}",
159                                         "|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}",
160                                         "afteredit" : "function (e)\n{\n   e.record.commit();     \n}"
161                                     },
162                                     "autoExpandColumn" : "display_name",
163                                     "xtype" : "EditorGrid",
164                                     "loadMask" : true,
165                                     "clicksToEdit" : 1,
166                                     "$ xns" : "Roo.grid",
167                                     "* prop" : "grid",
168                                     "items" : [
169                                         {
170                                             "listeners" : {
171                                                 "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}",
172                                                 "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}"
173                                             },
174                                             "xtype" : "Store",
175                                             "remoteSort" : true,
176                                             "$ sortInfo" : "{ field : 'etype', direction: 'ASC' }",
177                                             "$ xns" : "Roo.data",
178                                             "* prop" : "dataSource",
179                                             "items" : [
180                                                 {
181                                                     "$ url" : "baseURL + '/Roo/core_enum.php'",
182                                                     "xtype" : "HttpProxy",
183                                                     "method" : "GET",
184                                                     "$ xns" : "Roo.data",
185                                                     "* prop" : "proxy"
186                                                 },
187                                                 {
188                                                     "id" : "id",
189                                                     "root" : "data",
190                                                     "xtype" : "JsonReader",
191                                                     "$ xns" : "Roo.data",
192                                                     "$ 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]",
193                                                     "* prop" : "reader",
194                                                     "totalProperty" : "total"
195                                                 }
196                                             ]
197                                         },
198                                         {
199                                             "pageSize" : 25,
200                                             "xtype" : "PagingToolbar",
201                                             "emptyMsg" : "No core_enum found",
202                                             "$ xns" : "Roo",
203                                             "displayInfo" : true,
204                                             "displayMsg" : "Displaying core_enum{0} - {1} of {2}",
205                                             "* prop" : "footer",
206                                             "items" : [
207                                                 {
208                                                     "listeners" : {
209                                                         "click" : "function (_self, e)\n{\n    new Pman.Download({\n        grid : _this.grid\n    });\n    Roo.MessageBox.alert(\"Downloading\", \"File is downloading\");\n}"
210                                                     },
211                                                     "text" : "Download",
212                                                     "xtype" : "Button",
213                                                     "$ xns" : "Roo.Toolbar"
214                                                 },
215                                                 {
216                                                     "listeners" : {
217                                                         "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}"
218                                                     },
219                                                     "text" : "Upload Values",
220                                                     "xtype" : "Button",
221                                                     "$ xns" : "Roo.Toolbar"
222                                                 }
223                                             ]
224                                         },
225                                         {
226                                             "xtype" : "Toolbar",
227                                             "$ xns" : "Roo",
228                                             "* prop" : "toolbar",
229                                             "items" : [
230                                                 {
231                                                     "listeners" : {
232                                                         "|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"
233                                                     },
234                                                     "text" : "Add Value",
235                                                     "xtype" : "Button",
236                                                     "cls" : "x-btn-text-icon",
237                                                     "$ icon" : "baseURL + '/Pman/templates/images/search.gif'",
238                                                     "$ xns" : "Roo.Toolbar"
239                                                 },
240                                                 {
241                                                     "listeners" : {
242                                                         "|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"
243                                                     },
244                                                     "text" : "Add Image",
245                                                     "xtype" : "Button",
246                                                     "cls" : "x-btn-text-icon",
247                                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
248                                                     "$ xns" : "Roo.Toolbar"
249                                                 },
250                                                 {
251                                                     "listeners" : {
252                                                         "render" : "function (_self)\n{\n    _this.searchBox = this;\n}"
253                                                     },
254                                                     "String name" : "search",
255                                                     "xtype" : "TextField",
256                                                     "String fieldLabel" : "Search",
257                                                     "$ xns" : "Roo.form"
258                                                 },
259                                                 {
260                                                     "listeners" : {
261                                                         "click" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
262                                                     },
263                                                     "String cls" : "x-btn-icon",
264                                                     "xtype" : "Button",
265                                                     "$ xns" : "Roo.Toolbar",
266                                                     "$ icon" : "rootURL + '/Pman/templates/images/search.gif'"
267                                                 },
268                                                 {
269                                                     "listeners" : {
270                                                         "click" : "function (_self, e)\n{\n     _this.searchBox.setValue('');\n     _this.grid.footer.onClick('first');\n}"
271                                                     },
272                                                     "String cls" : "x-btn-icon",
273                                                     "xtype" : "Button",
274                                                     "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
275                                                     "$ xns" : "Roo.Toolbar"
276                                                 }
277                                             ]
278                                         },
279                                         {
280                                             "xtype" : "ColumnModel",
281                                             "header" : "Internal #",
282                                             "width" : 75,
283                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
284                                             "$ xns" : "Roo.grid",
285                                             "Boolean sortable" : true,
286                                             "* prop" : "colModel[]",
287                                             "dataIndex" : "id"
288                                         },
289                                         {
290                                             "xtype" : "ColumnModel",
291                                             "header" : "Image",
292                                             "width" : 75,
293                                             "$ 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); }",
294                                             "$ xns" : "Roo.grid",
295                                             "* prop" : "colModel[]",
296                                             "dataIndex" : "images_id_id"
297                                         },
298                                         {
299                                             "xtype" : "ColumnModel",
300                                             "width" : 200,
301                                             "header" : "Name",
302                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
303                                             "$ xns" : "Roo.grid",
304                                             "Boolean sortable" : true,
305                                             "* prop" : "colModel[]",
306                                             "dataIndex" : "name",
307                                             "items" : [
308                                                 {
309                                                     "xtype" : "GridEditor",
310                                                     "$ xns" : "Roo.grid",
311                                                     "* prop" : "editor",
312                                                     "items" : [
313                                                         {
314                                                             "xtype" : "TextField",
315                                                             "$ xns" : "Roo.form",
316                                                             "* prop" : "field"
317                                                         }
318                                                     ]
319                                                 }
320                                             ]
321                                         },
322                                         {
323                                             "xtype" : "ColumnModel",
324                                             "header" : "Display Name",
325                                             "width" : 200,
326                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
327                                             "$ xns" : "Roo.grid",
328                                             "Boolean sortable" : true,
329                                             "* prop" : "colModel[]",
330                                             "dataIndex" : "display_name",
331                                             "items" : [
332                                                 {
333                                                     "xtype" : "GridEditor",
334                                                     "$ xns" : "Roo.grid",
335                                                     "* prop" : "editor",
336                                                     "items" : [
337                                                         {
338                                                             "xtype" : "TextField",
339                                                             "$ xns" : "Roo.form",
340                                                             "* prop" : "field"
341                                                         }
342                                                     ]
343                                                 }
344                                             ]
345                                         },
346                                         {
347                                             "xtype" : "ColumnModel",
348                                             "header" : "Active",
349                                             "width" : 75,
350                                             "$ 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 }",
351                                             "$ xns" : "Roo.grid",
352                                             "Boolean sortable" : true,
353                                             "* prop" : "colModel[]",
354                                             "dataIndex" : "active"
355                                         },
356                                         {
357                                             "xtype" : "ColumnModel",
358                                             "sortable" : true,
359                                             "header" : "Order #",
360                                             "width" : 75,
361                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
362                                             "$ xns" : "Roo.grid",
363                                             "Boolean sortable" : true,
364                                             "* prop" : "colModel[]",
365                                             "dataIndex" : "seqid",
366                                             "items" : [
367                                                 {
368                                                     "xtype" : "GridEditor",
369                                                     "$ xns" : "Roo.grid",
370                                                     "* prop" : "editor",
371                                                     "items" : [
372                                                         {
373                                                             "allowNegative" : true,
374                                                             "xtype" : "NumberField",
375                                                             "allowDecimals" : false,
376                                                             "decimalPrecision" : 0,
377                                                             "$ xns" : "Roo.form",
378                                                             "* prop" : "field"
379                                                         }
380                                                     ]
381                                                 }
382                                             ]
383                                         }
384                                     ]
385                                 }
386                             ]
387                         }
388                     ]
389                 }
390             ]
391         }
392     ]
393 }