Pman.Dialog.CmsCategory.bjs
[Pman.Cms] / Pman.Dialog.CmsCategory.bjs
1 {
2     "id": "roo-file-80",
3     "name": "Pman.Dialog.CmsCategory",
4     "parent": "",
5     "title": "Cms - Category Edit",
6     "path": "/home/alan/gitlive/Pman.Cms/Pman.Dialog.CmsCategory.bjs",
7     "items": [
8         {
9             "xtype": "LayoutDialog",
10             "|xns": "Roo",
11             "background": true,
12             "width": 800,
13             "height": 500,
14             "title": "Edit Category",
15             "modal": true,
16             "resizable": false,
17             "collapsible": false,
18             "closable": false,
19             "listeners": {},
20             "items": [
21                 {
22                     "xtype": "LayoutRegion",
23                     "*prop": "center",
24                     "titlebar": false,
25                     "listeners": {},
26                     "|xns": "Roo"
27                 },
28                 {
29                     "xtype": "LayoutRegion",
30                     "*prop": "east",
31                     "titlebar": false,
32                     "split": "true",
33                     "fitToFrame": "true",
34                     "width": 200,
35                     "listeners": {},
36                     "|xns": "Roo"
37                 },
38                 {
39                     "xtype": "ContentPanel",
40                     "background": true,
41                     "fitToFrame": true,
42                     "region": "center",
43                     "listeners": {},
44                     "|xns": "Roo",
45                     "items": [
46                         {
47                             "listeners": {
48                                 "|actionfailed": "function (_self, action)\n{\n    _this.dialog.el.unmask();\n    Pman.standardActionFailed(_self, action);\n}\n",
49                                 "|actioncomplete": "function (_self, action)\n{\n   \n   if (action.type =='submit') {\n       \n       _this.dialog.el.unmask();\n       _this.dialog.hide();\n       \n        if (_this.callback) {\n           _this.callback.call(_this, _this.form.getValues());\n        }\n        _this.form.reset();\n        return;\n    }\n     if (action.type == 'setdata') {\n         if (_this.data.id) {\n           _this.dialog.el.mask(\"Loading\");\n           this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n            return;\n       }\n      _this.grid.getDataSource().load();\n       return;\n    }\n    if (action.type == 'load') {\n       _this.grid.getDataSource().load();\n        _this.dialog.el.unmask();\n        return;\n    }\n    \n  \n    \n}\n",
50                                 "|rendered": "function (_self)\n{\n    _this.form = _self;\n}\n"
51                             },
52                             "method": "POST",
53                             "style": "margin: 5px",
54                             "xtype": "Form",
55                             "|url": "baseURL + '/Roo/Category.php'",
56                             "|xns": "Roo.form",
57                             "items": [
58                                 {
59                                     "fieldLabel": "Parent",
60                                     "name": "parent_id_title",
61                                     "readOnly": true,
62                                     "width": 450,
63                                     "xtype": "TextField",
64                                     "|xns": "Roo.form"
65                                 },
66                                 {
67                                     "decimalPrecision": 2,
68                                     "fieldLabel": "Order (1 first)",
69                                     "name": "display_order",
70                                     "xtype": "NumberField",
71                                     "|xns": "Roo.form"
72                                 },
73                                 {
74                                     "name": "title",
75                                     "fieldLabel": "Title",
76                                     "width": 450,
77                                     "xtype": "TextField",
78                                     "listeners": {},
79                                     "|xns": "Roo.form"
80                                 },
81                                 {
82                                     "allowBlank": true,
83                                     "displayField": "name",
84                                     "editable": "false",
85                                     "emptyText": "Select Type",
86                                     "fieldLabel": "Type",
87                                     "forceSelection": true,
88                                     "hiddenName": "category_type_id",
89                                     "listWidth": 200,
90                                     "loadingText": "Searching...",
91                                     "minChars": 2,
92                                     "name": "category_type_id_name",
93                                     "pageSize": 20,
94                                     "qtip": "Select cms_category_type",
95                                     "selectOnFocus": true,
96                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
97                                     "triggerAction": "all",
98                                     "typeAhead": true,
99                                     "valueField": "id",
100                                     "width": 200,
101                                     "xtype": "ComboBox",
102                                     "|xns": "Roo.form",
103                                     "items": [
104                                         {
105                                             "*prop": "store",
106                                             "xtype": "Store",
107                                             "|xns": "Roo.data",
108                                             "remoteSort": true,
109                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
110                                             "listeners": {
111                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
112                                             },
113                                             "items": [
114                                                 {
115                                                     "*prop": "proxy",
116                                                     "xtype": "HttpProxy",
117                                                     "method": "GET",
118                                                     "|xns": "Roo.data",
119                                                     "|url": "baseURL + '/Roo/cms_category_type.php'"
120                                                 },
121                                                 {
122                                                     "*prop": "reader",
123                                                     "xtype": "JsonReader",
124                                                     "|xns": "Roo.data",
125                                                     "id": "id",
126                                                     "root": "data",
127                                                     "totalProperty": "total",
128                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]"
129                                                 }
130                                             ]
131                                         }
132                                     ]
133                                 },
134                                 {
135                                     "fieldLabel": "Visible",
136                                     "name": "visible",
137                                     "xtype": "Checkbox",
138                                     "|xns": "Roo.form"
139                                 },
140                                 {
141                                     "name": "parent_id",
142                                     "xtype": "Hidden",
143                                     "|xns": "Roo.form"
144                                 },
145                                 {
146                                     "name": "id",
147                                     "xtype": "Hidden",
148                                     "listeners": {},
149                                     "|xns": "Roo.form"
150                                 }
151                             ]
152                         }
153                     ]
154                 },
155                 {
156                     "xtype": "GridPanel",
157                     "title": "Images",
158                     "fitToframe": true,
159                     "fitContainer": true,
160                     "tableName": "Images",
161                     "background": false,
162                     "listeners": {
163                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        //_this.grid.footer.onClick('first');\n    }\n}"
164                     },
165                     "region": "east",
166                     "|xns": "Roo",
167                     "items": [
168                         {
169                             "*prop": "grid",
170                             "xtype": "Grid",
171                             "autoExpandColumn": "filename",
172                             "loadMask": true,
173                             "listeners": {
174                                 "|render": "function() { \n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       //this.footer.onClick('first');\n    }\n}"
175                             },
176                             "|xns": "Roo.grid",
177                             "items": [
178                                 {
179                                     "*prop": "dataSource",
180                                     "xtype": "Store",
181                                     "|reader": "Pman.Readers.Images",
182                                     "listeners": {
183                                         "|beforeload": "function (_self, o)\n{\n  if (!_this.data.id) {\n       return false;\n    }               \n    o.params = o.params || {};\n    o.params.onid = _this.data.id;\n    o.params.ontable = 'Category';\n}"
184                                     },
185                                     "|xns": "Roo.data",
186                                     "items": [
187                                         {
188                                             "*prop": "proxy",
189                                             "xtype": "HttpProxy",
190                                             "method": "GET",
191                                             "|url": "baseURL + '/Roo/Images.php'",
192                                             "listeners": {},
193                                             "|xns": "Roo.data"
194                                         }
195                                     ]
196                                 },
197                                 {
198                                     "*prop": "toolbar",
199                                     "xtype": "Toolbar",
200                                     "listeners": {},
201                                     "|xns": "Roo",
202                                     "items": [
203                                         {
204                                             "text": "Add",
205                                             "xtype": "Button",
206                                             "cls": "x-btn-text-icon",
207                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
208                                             "listeners": {
209                                                 "|click": "function()\n        {\n            Pman.Dialog.Image.show( { id : 0, onid: _this.data.id, ontable: 'Category' }, function(data) {\n                _this.grid.getDataSource().load();\n                 Pman.Dialog.CmsImage.show(data, function() {\n                   _this.grid.getDataSource().load();\n               }); \n    \n                \n            }); \n\n        }\n        "
210                                             },
211                                             "|xns": "Roo"
212                                         },
213                                         {
214                                             "text": "Edit",
215                                             "xtype": "Button",
216                                             "cls": "x-btn-text-icon",
217                                             "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
218                                             "listeners": {
219                                                 "|click": "function()\n        {\n            var s = _this.grid.getSelectionModel().getSelections();\n            if (!s.length || (s.length > 1))  {\n                Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n                return;\n            }\n            var data = _this.grid.getDataSource().getById(s[0].data.id).data;\n            Pman.Dialog.CmsImage.show(data, function() {\n                _this.grid.getDataSource().load();\n               }); \n            \n        }\n        "
220                                             },
221                                             "|xns": "Roo"
222                                         },
223                                         {
224                                             "text": "Delete",
225                                             "cls": "x-btn-text-icon",
226                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
227                                             "xtype": "Button",
228                                             "listeners": {
229                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, _this.panel.tableName); \n        }\n        "
230                                             },
231                                             "|xns": "Roo"
232                                         }
233                                     ]
234                                 },
235                                 {
236                                     "xtype": "ColumnModel",
237                                     "header": "",
238                                     "width": 110,
239                                     "dataIndex": "id",
240                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\">', baseURL, v, r.data.filename); }",
241                                     "listeners": {},
242                                     "|xns": "Roo.grid",
243                                     "*prop": "colModel[]"
244                                 },
245                                 {
246                                     "xtype": "ColumnModel",
247                                     "header": "Filename",
248                                     "width": 100,
249                                     "dataIndex": "filename",
250                                     "|renderer": "function(v,x,r) { return String.format('{0}<br/><i qtip=\"{1}\">{1}</i>', v, r.data.linkurl); }",
251                                     "listeners": {},
252                                     "|xns": "Roo.grid",
253                                     "*prop": "colModel[]"
254                                 }
255                             ]
256                         }
257                     ]
258                 },
259                 {
260                     "text": "Cancel",
261                     "xtype": "Button",
262                     "|xns": "Roo",
263                     "listeners": {
264                         "|click": " function() {\n\n                                    _this.form.reset();\n\n                                    _this.dialog.hide();\n\n                                }\n"
265                     },
266                     "*prop": "buttons[]"
267                 },
268                 {
269                     "text": "OK",
270                     "xtype": "Button",
271                     "|xns": "Roo",
272                     "listeners": {
273                         "|click": " function() {\n\n                                    _this.dialog.el.mask(\"Saving\");\n\n                                    _this.form.doAction(\"submit\");\n\n                                }\n"
274                     },
275                     "*prop": "buttons[]"
276                 }
277             ]
278         }
279     ],
280     "permname": ""
281 }