Pman.Dialog.AdminCoreEnum.bjs
[Pman.Admin] / Pman.Dialog.AdminCoreEnum.bjs
1 {
2     "id": "roo-file-180",
3     "name": "Pman.Dialog.AdminCoreEnum",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Admin/Pman.Dialog.AdminCoreEnum.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    var name_hidden = false;\n\n    if (typeof(_this.data._hide_name) != 'undefined') {\n        name_hidden = true;\n    \n    }\n    \n  _this.grid.colModel.setHidden(1,name_hidden);\n    _this.grid.footer.onClick('first');\n}"
11             },
12             "closable": false,
13             "height": 400,
14             "modal": true,
15             "resizable": false,
16             "title": "Pulldown Options",
17             "width": 950,
18             "xtype": "LayoutDialog",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "|xns": "Roo",
23                     "xtype": "LayoutRegion",
24                     "*prop": "center"
25                 },
26                 {
27                     "listeners": {
28                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n     //   _this.grid.footer.onClick('first');\n    }\n}"
29                     },
30                     "background": false,
31                     "fitContainer": true,
32                     "fitToframe": true,
33                     "region": "center",
34                     "tableName": "core_enum",
35                     "title": "Pulldown Options",
36                     "xtype": "GridPanel",
37                     "|xns": "Roo",
38                     "items": [
39                         {
40                             "listeners": {
41                                 "|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}",
42                                 "afteredit": "function (e)\n{\n   (function() {  e.record.commit(); }).defer(100);\n}",
43                                 "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}",
44                                 "beforeedit": "function (e)\n{\n    Roo.log('before edit?');\n    // force fill in of name first.. (Except when it's hidden)\n    if (typeof(_this.data._hide_name) != 'undefined') { \n        if(e.field == 'display_name' && e.record.data.is_system_enum*1 == 1){\n            return ;\n        }\n    }\n    \n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        Roo.log(\"block name?\");\n        return false;\n    }\n}"
45                             },
46                             "*prop": "grid",
47                             "autoExpandColumn": "display_name",
48                             "clicksToEdit": 1,
49                             "loadMask": true,
50                             "xtype": "EditorGrid",
51                             "|xns": "Roo.grid",
52                             "items": [
53                                 {
54                                     "listeners": {
55                                         "beforeload": "function (_self, options)\n{\n\n    options.params.etype = _this.data.etype;\n    if (!options.params.etype.length) {\n        return false;\n    }\n}",
56                                         "update": "function (_self, record, operation)\n{\n    if (operation != Roo.data.Record.COMMIT) {\n        return;\n    }\n    Roo.log(record);\n\n    if (typeof(_this.data._hide_name) != 'undefined') {\n        record.set('name', record.data.display_name);\n    }\n    if (!record.data.name.length) {\n        return;\n    }\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.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}"
57                                     },
58                                     "*prop": "dataSource",
59                                     "remoteSort": true,
60                                     "xtype": "Store",
61                                     "|sortInfo": "{ field : 'etype', direction: 'ASC' }",
62                                     "|xns": "Roo.data",
63                                     "items": [
64                                         {
65                                             "*prop": "proxy",
66                                             "method": "GET",
67                                             "xtype": "HttpProxy",
68                                             "|url": "baseURL + '/Roo/core_enum.php'",
69                                             "|xns": "Roo.data"
70                                         },
71                                         {
72                                             "|xns": "Roo.data",
73                                             "xtype": "JsonReader",
74                                             "totalProperty": "total",
75                                             "root": "data",
76                                             "*prop": "reader",
77                                             "id": "id",
78                                             "|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]"
79                                         }
80                                     ]
81                                 },
82                                 {
83                                     "*prop": "footer",
84                                     "xtype": "PagingToolbar",
85                                     "pageSize": 25,
86                                     "displayInfo": true,
87                                     "displayMsg": "Displaying core_enum{0} - {1} of {2}",
88                                     "emptyMsg": "No core_enum found",
89                                     "|xns": "Roo"
90                                 },
91                                 {
92                                     "*prop": "toolbar",
93                                     "xtype": "Toolbar",
94                                     "|xns": "Roo",
95                                     "items": [
96                                         {
97                                             "listeners": {
98                                                 "|click": "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    var et = _this.data.etype;\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"
99                                             },
100                                             "cls": "x-btn-text-icon",
101                                             "text": "Add Value",
102                                             "xtype": "Button",
103                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
104                                             "|xns": "Roo.Toolbar"
105                                         },
106                                         {
107                                             "|xns": "Roo.Toolbar",
108                                             "xtype": "Fill"
109                                         }
110                                     ]
111                                 },
112                                 {
113                                     "*prop": "colModel[]",
114                                     "dataIndex": "id",
115                                     "header": "Internal #",
116                                     "width": 75,
117                                     "xtype": "ColumnModel",
118                                     "|renderer": "function(v) { return String.format('{0}', v); }",
119                                     "|xns": "Roo.grid"
120                                 },
121                                 {
122                                     "xtype": "ColumnModel",
123                                     "header": "Name",
124                                     "width": 200,
125                                     "dataIndex": "name",
126                                     "|renderer": "function(v) { return String.format('{0}', v); }",
127                                     "|xns": "Roo.grid",
128                                     "*prop": "colModel[]",
129                                     "items": [
130                                         {
131                                             "|xns": "Roo.grid",
132                                             "xtype": "GridEditor",
133                                             "*prop": "editor",
134                                             "items": [
135                                                 {
136                                                     "|xns": "Roo.form",
137                                                     "xtype": "TextField",
138                                                     "*prop": "field"
139                                                 }
140                                             ]
141                                         }
142                                     ]
143                                 },
144                                 {
145                                     "*prop": "colModel[]",
146                                     "dataIndex": "display_name",
147                                     "header": "Display Name",
148                                     "width": 200,
149                                     "xtype": "ColumnModel",
150                                     "|renderer": "function(v) { return String.format('{0}', v); }",
151                                     "|xns": "Roo.grid",
152                                     "items": [
153                                         {
154                                             "|xns": "Roo.grid",
155                                             "xtype": "GridEditor",
156                                             "*prop": "editor",
157                                             "items": [
158                                                 {
159                                                     "|xns": "Roo.form",
160                                                     "xtype": "TextField",
161                                                     "*prop": "field"
162                                                 }
163                                             ]
164                                         }
165                                     ]
166                                 },
167                                 {
168                                     "*prop": "colModel[]",
169                                     "dataIndex": "active",
170                                     "header": "Active",
171                                     "width": 75,
172                                     "xtype": "ColumnModel",
173                                     "|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 }",
174                                     "|xns": "Roo.grid"
175                                 },
176                                 {
177                                     "*prop": "colModel[]",
178                                     "dataIndex": "seqid",
179                                     "header": "Order #",
180                                     "sortable": true,
181                                     "width": 75,
182                                     "xtype": "ColumnModel",
183                                     "|renderer": "function(v) { return String.format('{0}', v); }",
184                                     "|xns": "Roo.grid",
185                                     "items": [
186                                         {
187                                             "|xns": "Roo.grid",
188                                             "xtype": "GridEditor",
189                                             "*prop": "editor",
190                                             "items": [
191                                                 {
192                                                     "*prop": "field",
193                                                     "allowDecimals": false,
194                                                     "allowNegative": true,
195                                                     "decimalPrecision": 0,
196                                                     "xtype": "NumberField",
197                                                     "|xns": "Roo.form"
198                                                 }
199                                             ]
200                                         }
201                                     ]
202                                 }
203                             ]
204                         }
205                     ]
206                 },
207                 {
208                     "listeners": {
209                         "click": "function (_self, e)\n{\n  _this.dialog.hide();\n}"
210                     },
211                     "*prop": "buttons[]",
212                     "text": "Cancel",
213                     "xtype": "Button",
214                     "|xns": "Roo"
215                 },
216                 {
217                     "listeners": {
218                         "click": "function (_self, e)\n{\n    var sel = _this.grid.selModel.getSelectedCell();\n    if (!sel && _this.callback) {\n        Roo.MessageBox.alert(\"Error\", \"Select an item\");\n        return;\n    }\n    \n\n    if (_this.callback) {\n        var rec = _this.grid.ds.getAt(sel[0]);\n       _this.callback(rec.data);\n   }\n   _this.dialog.hide();\n}"
219                     },
220                     "*prop": "buttons[]",
221                     "text": "OK",
222                     "xtype": "Button",
223                     "|xns": "Roo"
224                 }
225             ]
226         }
227     ],
228     "permname": "",
229     "modOrder": "001"
230 }