Pman.Dialog.AdminCoreEnum.bjs
[Pman.Admin] / Pman.Tab.AdminEnums.bjs
1 {
2     "id": "roo-file-162",
3     "name": "Pman.Tab.AdminEnums",
4     "parent": "Pman.Tab.Admin",
5     "title": "Pman.Tab.AdminEnums",
6     "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminEnums.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
11             },
12             "background": true,
13             "fitContainer": true,
14             "fitToframe": true,
15             "region": "center",
16             "tableName": "core_enum",
17             "title": "Pulldown Options",
18             "xtype": "GridPanel",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "listeners": {
23                         "|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}",
24                         "afteredit": "function (e)\n{\n   e.record.commit();     \n}",
25                         "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}",
26                         "beforeedit": "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}"
27                     },
28                     "*prop": "grid",
29                     "autoExpandColumn": "display_name",
30                     "clicksToEdit": 1,
31                     "loadMask": true,
32                     "xtype": "EditorGrid",
33                     "|xns": "Roo.grid",
34                     "items": [
35                         {
36                             "listeners": {
37                                 "beforeload": "function (_self, options)\n{\n    if (!_this.etypeCombo) {\n        return false;\n    }\n    options.params.etype = _this.etypeCombo.getValue();\n    if (!options.params.etype.length) {\n        return false;\n    }\n}",
38                                 "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.etypeCombo.getValue(),\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}"
39                             },
40                             "*prop": "dataSource",
41                             "remoteSort": true,
42                             "xtype": "Store",
43                             "|sortInfo": "{ field : 'etype', direction: 'ASC' }",
44                             "|xns": "Roo.data",
45                             "items": [
46                                 {
47                                     "*prop": "proxy",
48                                     "method": "GET",
49                                     "xtype": "HttpProxy",
50                                     "|url": "baseURL + '/Roo/core_enum.php'",
51                                     "|xns": "Roo.data"
52                                 },
53                                 {
54                                     "|xns": "Roo.data",
55                                     "xtype": "JsonReader",
56                                     "totalProperty": "total",
57                                     "root": "data",
58                                     "*prop": "reader",
59                                     "id": "id",
60                                     "|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]"
61                                 }
62                             ]
63                         },
64                         {
65                             "*prop": "footer",
66                             "xtype": "PagingToolbar",
67                             "pageSize": 25,
68                             "displayInfo": true,
69                             "displayMsg": "Displaying core_enum{0} - {1} of {2}",
70                             "emptyMsg": "No core_enum found",
71                             "|xns": "Roo",
72                             "items": [
73                                 {
74                                     "listeners": {
75                                         "click": "function (_self, e)\n{\n    new Pman.Download({\n        grid : _this.grid\n    });\n    Roo.MessageBox.alert(\"Downloading\", \"File is downloading\");\n}"
76                                     },
77                                     "text": "Download",
78                                     "xtype": "Button",
79                                     "|xns": "Roo.Toolbar"
80                                 }
81                             ]
82                         },
83                         {
84                             "*prop": "toolbar",
85                             "xtype": "Toolbar",
86                             "|xns": "Roo",
87                             "items": [
88                                 {
89                                     "text": "Pulldown Name:",
90                                     "xtype": "TextItem",
91                                     "|xns": "Roo.Toolbar"
92                                 },
93                                 {
94                                     "listeners": {
95                                         "render": "function (_self)\n{\n    _this.etypeCombo = _self;\n}",
96                                         "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
97                                     },
98                                     "alwaysQuery": true,
99                                     "displayField": "name",
100                                     "editable": "false",
101                                     "emptyText": "Select pulldown",
102                                     "fieldLabel": "core_enum",
103                                     "forceSelection": true,
104                                     "listWidth": 400,
105                                     "loadingText": "Searching...",
106                                     "minChars": 2,
107                                     "pageSize": 50,
108                                     "qtip": "Select type",
109                                     "queryParam": "query[name]",
110                                     "selectOnFocus": true,
111                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> - {name} </div>",
112                                     "triggerAction": "all",
113                                     "typeAhead": false,
114                                     "valueField": "name",
115                                     "width": 300,
116                                     "xtype": "ComboBox",
117                                     "|xns": "Roo.form",
118                                     "items": [
119                                         {
120                                             "listeners": {
121                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params['query[empty_etype]'] = 1; \n}\n"
122                                             },
123                                             "*prop": "store",
124                                             "remoteSort": true,
125                                             "xtype": "Store",
126                                             "|sortInfo": "{ direction : 'ASC', field: 'display_name' }",
127                                             "|xns": "Roo.data",
128                                             "items": [
129                                                 {
130                                                     "*prop": "proxy",
131                                                     "xtype": "HttpProxy",
132                                                     "method": "GET",
133                                                     "|xns": "Roo.data",
134                                                     "|url": "baseURL + '/Roo/core_enum.php'"
135                                                 },
136                                                 {
137                                                     "*prop": "reader",
138                                                     "xtype": "JsonReader",
139                                                     "|xns": "Roo.data",
140                                                     "id": "id",
141                                                     "root": "data",
142                                                     "totalProperty": "total",
143                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]"
144                                                 }
145                                             ]
146                                         }
147                                     ]
148                                 },
149                                 {
150                                     "listeners": {
151                                         "|click": "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    var et = _this.etypeCombo.getValue();\n    var ds = _this.grid.getDataSource();\n    if (!et) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n        return;\n    }\n\n    var add = ds.reader.newRow({    \n             id: 0, \n             display_name : '', \n             name : '', \n             etype: et, \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"
152                                     },
153                                     "cls": "x-btn-text-icon",
154                                     "text": "Add Value",
155                                     "xtype": "Button",
156                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
157                                     "|xns": "Roo.Toolbar"
158                                 },
159                                 {
160                                     "listeners": {
161                                         "|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"
162                                     },
163                                     "cls": "x-btn-text-icon",
164                                     "text": "Add Images",
165                                     "xtype": "Button",
166                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
167                                     "|xns": "Roo.Toolbar"
168                                 },
169                                 {
170                                     "|xns": "Roo.Toolbar",
171                                     "xtype": "Fill"
172                                 },
173                                 {
174                                     "listeners": {
175                                         "|click": "function()\n{\n    \n    Roo.MessageBox.prompt (\"Create a new Enum type\",\n        \"Enter the name for a new enum type, \" + \n        \"this is only relivant if you  know how it is going to be used\",\n        function(btn,txt) {\n            if (btn != 'ok') {\n                return; \n            }\n            new Pman.Request({\n                url : baseURL + '/Roo/Core_enum.php',\n                method : 'POST',\n                params : {\n                    etype : '',\n                    name : txt,\n                    active : 1\n                }, \n                success : function() {\n                    Roo.MessageBox.alert(\"Created\", \"You can now select it from the type list on the left\");\n                }\n            });\n                    \n            \n             \n             \n        }\n    ); \n         \n         \n\n}\n"
176                                     },
177                                     "cls": "x-btn-text-icon",
178                                     "text": "Add new pulldown list",
179                                     "xtype": "Button",
180                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
181                                     "|xns": "Roo.Toolbar"
182                                 }
183                             ]
184                         },
185                         {
186                             "*prop": "colModel[]",
187                             "dataIndex": "id",
188                             "header": "Internal #",
189                             "width": 75,
190                             "xtype": "ColumnModel",
191                             "|renderer": "function(v) { return String.format('{0}', v); }",
192                             "|xns": "Roo.grid"
193                         },
194                         {
195                             "*prop": "colModel[]",
196                             "dataIndex": "images_id_id",
197                             "header": "Image",
198                             "width": 75,
199                             "xtype": "ColumnModel",
200                             "|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); }",
201                             "|xns": "Roo.grid"
202                         },
203                         {
204                             "xtype": "ColumnModel",
205                             "header": "Name",
206                             "width": 200,
207                             "dataIndex": "name",
208                             "|renderer": "function(v) { return String.format('{0}', v); }",
209                             "|xns": "Roo.grid",
210                             "*prop": "colModel[]",
211                             "items": [
212                                 {
213                                     "|xns": "Roo.grid",
214                                     "xtype": "GridEditor",
215                                     "*prop": "editor",
216                                     "items": [
217                                         {
218                                             "|xns": "Roo.form",
219                                             "xtype": "TextField",
220                                             "*prop": "field"
221                                         }
222                                     ]
223                                 }
224                             ]
225                         },
226                         {
227                             "*prop": "colModel[]",
228                             "dataIndex": "display_name",
229                             "header": "Display Name",
230                             "width": 200,
231                             "xtype": "ColumnModel",
232                             "|renderer": "function(v) { return String.format('{0}', v); }",
233                             "|xns": "Roo.grid",
234                             "items": [
235                                 {
236                                     "|xns": "Roo.grid",
237                                     "xtype": "GridEditor",
238                                     "*prop": "editor",
239                                     "items": [
240                                         {
241                                             "|xns": "Roo.form",
242                                             "xtype": "TextField",
243                                             "*prop": "field"
244                                         }
245                                     ]
246                                 }
247                             ]
248                         },
249                         {
250                             "*prop": "colModel[]",
251                             "dataIndex": "active",
252                             "header": "Active",
253                             "width": 75,
254                             "xtype": "ColumnModel",
255                             "|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 }",
256                             "|xns": "Roo.grid"
257                         },
258                         {
259                             "*prop": "colModel[]",
260                             "dataIndex": "seqid",
261                             "header": "Order #",
262                             "sortable": true,
263                             "width": 75,
264                             "xtype": "ColumnModel",
265                             "|renderer": "function(v) { return String.format('{0}', v); }",
266                             "|xns": "Roo.grid",
267                             "items": [
268                                 {
269                                     "|xns": "Roo.grid",
270                                     "xtype": "GridEditor",
271                                     "*prop": "editor",
272                                     "items": [
273                                         {
274                                             "*prop": "field",
275                                             "allowDecimals": false,
276                                             "allowNegative": true,
277                                             "decimalPrecision": 0,
278                                             "xtype": "NumberField",
279                                             "|xns": "Roo.form"
280                                         }
281                                     ]
282                                 }
283                             ]
284                         }
285                     ]
286                 }
287             ]
288         }
289     ],
290     "permname": "Admin.Enums",
291     "modOrder": "500"
292 }