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