Pman.Dialog.AdminCoreEnum.bjs
[Pman.Admin] / Pman.Tab.AdminEnums.bjs
1 {
2     "id": "roo-file-270",
3     "name": "Pman.Tab.AdminEnums",
4     "parent": "Pman.Tab.Admin",
5     "title": "Pman.Tab.AdminEnums",
6     "path": "/home/edward/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                                     "listeners": {
83                                         "click": "function (_self, e)\n{\n    var etype = _this.etypeCombo.getValue();\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+'/Xtuple/Import/Enum?' + Roo.urlEncode({'etype' : etype})\n        \n       },\n       function () {\n            _this.grid.footer.onClick('first');\n       }\n   );\n}"
84                                     },
85                                     "text": "Upload Value",
86                                     "xtype": "Button",
87                                     "|xns": "Roo.Toolbar"
88                                 }
89                             ]
90                         },
91                         {
92                             "*prop": "toolbar",
93                             "xtype": "Toolbar",
94                             "|xns": "Roo",
95                             "items": [
96                                 {
97                                     "text": "Pulldown Name:",
98                                     "xtype": "TextItem",
99                                     "|xns": "Roo.Toolbar"
100                                 },
101                                 {
102                                     "listeners": {
103                                         "render": "function (_self)\n{\n    _this.etypeCombo = _self;\n}",
104                                         "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
105                                     },
106                                     "alwaysQuery": true,
107                                     "displayField": "name",
108                                     "editable": "false",
109                                     "emptyText": "Select pulldown",
110                                     "fieldLabel": "core_enum",
111                                     "forceSelection": true,
112                                     "listWidth": 400,
113                                     "loadingText": "Searching...",
114                                     "minChars": 2,
115                                     "pageSize": 50,
116                                     "qtip": "Select type",
117                                     "queryParam": "query[name]",
118                                     "selectOnFocus": true,
119                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> - {name} </div>",
120                                     "triggerAction": "all",
121                                     "typeAhead": false,
122                                     "valueField": "name",
123                                     "width": 300,
124                                     "xtype": "ComboBox",
125                                     "|xns": "Roo.form",
126                                     "items": [
127                                         {
128                                             "listeners": {
129                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params['query[empty_etype]'] = 1; \n}\n"
130                                             },
131                                             "*prop": "store",
132                                             "remoteSort": true,
133                                             "xtype": "Store",
134                                             "|sortInfo": "{ direction : 'ASC', field: 'display_name' }",
135                                             "|xns": "Roo.data",
136                                             "items": [
137                                                 {
138                                                     "*prop": "proxy",
139                                                     "xtype": "HttpProxy",
140                                                     "method": "GET",
141                                                     "|xns": "Roo.data",
142                                                     "|url": "baseURL + '/Roo/core_enum.php'"
143                                                 },
144                                                 {
145                                                     "*prop": "reader",
146                                                     "xtype": "JsonReader",
147                                                     "|xns": "Roo.data",
148                                                     "id": "id",
149                                                     "root": "data",
150                                                     "totalProperty": "total",
151                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]"
152                                                 }
153                                             ]
154                                         }
155                                     ]
156                                 },
157                                 {
158                                     "listeners": {
159                                         "|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"
160                                     },
161                                     "cls": "x-btn-text-icon",
162                                     "text": "Add Value",
163                                     "xtype": "Button",
164                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
165                                     "|xns": "Roo.Toolbar"
166                                 },
167                                 {
168                                     "listeners": {
169                                         "|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"
170                                     },
171                                     "cls": "x-btn-text-icon",
172                                     "text": "Add Images",
173                                     "xtype": "Button",
174                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
175                                     "|xns": "Roo.Toolbar"
176                                 },
177                                 {
178                                     "|xns": "Roo.Toolbar",
179                                     "xtype": "Fill"
180                                 },
181                                 {
182                                     "listeners": {
183                                         "|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"
184                                     },
185                                     "cls": "x-btn-text-icon",
186                                     "text": "Add new pulldown list",
187                                     "xtype": "Button",
188                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
189                                     "|xns": "Roo.Toolbar"
190                                 }
191                             ]
192                         },
193                         {
194                             "*prop": "colModel[]",
195                             "dataIndex": "id",
196                             "header": "Internal #",
197                             "width": 75,
198                             "xtype": "ColumnModel",
199                             "|renderer": "function(v) { return String.format('{0}', v); }",
200                             "|xns": "Roo.grid"
201                         },
202                         {
203                             "*prop": "colModel[]",
204                             "dataIndex": "images_id_id",
205                             "header": "Image",
206                             "width": 75,
207                             "xtype": "ColumnModel",
208                             "|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); }",
209                             "|xns": "Roo.grid"
210                         },
211                         {
212                             "xtype": "ColumnModel",
213                             "header": "Name",
214                             "width": 200,
215                             "dataIndex": "name",
216                             "|renderer": "function(v) { return String.format('{0}', v); }",
217                             "|xns": "Roo.grid",
218                             "*prop": "colModel[]",
219                             "items": [
220                                 {
221                                     "|xns": "Roo.grid",
222                                     "xtype": "GridEditor",
223                                     "*prop": "editor",
224                                     "items": [
225                                         {
226                                             "|xns": "Roo.form",
227                                             "xtype": "TextField",
228                                             "*prop": "field"
229                                         }
230                                     ]
231                                 }
232                             ]
233                         },
234                         {
235                             "*prop": "colModel[]",
236                             "dataIndex": "display_name",
237                             "header": "Display Name",
238                             "width": 200,
239                             "xtype": "ColumnModel",
240                             "|renderer": "function(v) { return String.format('{0}', v); }",
241                             "|xns": "Roo.grid",
242                             "items": [
243                                 {
244                                     "|xns": "Roo.grid",
245                                     "xtype": "GridEditor",
246                                     "*prop": "editor",
247                                     "items": [
248                                         {
249                                             "|xns": "Roo.form",
250                                             "xtype": "TextField",
251                                             "*prop": "field"
252                                         }
253                                     ]
254                                 }
255                             ]
256                         },
257                         {
258                             "*prop": "colModel[]",
259                             "dataIndex": "active",
260                             "header": "Active",
261                             "width": 75,
262                             "xtype": "ColumnModel",
263                             "|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 }",
264                             "|xns": "Roo.grid"
265                         },
266                         {
267                             "*prop": "colModel[]",
268                             "dataIndex": "seqid",
269                             "header": "Order #",
270                             "sortable": true,
271                             "width": 75,
272                             "xtype": "ColumnModel",
273                             "|renderer": "function(v) { return String.format('{0}', v); }",
274                             "|xns": "Roo.grid",
275                             "items": [
276                                 {
277                                     "|xns": "Roo.grid",
278                                     "xtype": "GridEditor",
279                                     "*prop": "editor",
280                                     "items": [
281                                         {
282                                             "*prop": "field",
283                                             "allowDecimals": false,
284                                             "allowNegative": true,
285                                             "decimalPrecision": 0,
286                                             "xtype": "NumberField",
287                                             "|xns": "Roo.form"
288                                         }
289                                     ]
290                                 }
291                             ]
292                         }
293                     ]
294                 }
295             ]
296         }
297     ],
298     "permname": "Admin.Enums",
299     "modOrder": "500"
300 }