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