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