DataObjects/Cms_page.php
[Pman.Cms] / Pman.Dialog.CmsCategory.bjs
1 {
2     "id": "roo-file-271",
3     "name": "Pman.Dialog.CmsCategory",
4     "parent": "",
5     "title": "Cms - Category Edit",
6     "path": "/home/edward/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": 0,
68                                     "fieldLabel": "Order (1 first)",
69                                     "name": "display_order",
70                                     "width": 50,
71                                     "xtype": "NumberField",
72                                     "|xns": "Roo.form"
73                                 },
74                                 {
75                                     "name": "title",
76                                     "fieldLabel": "Title",
77                                     "width": 450,
78                                     "xtype": "TextField",
79                                     "listeners": {},
80                                     "|xns": "Roo.form"
81                                 },
82                                 {
83                                     "allowBlank": true,
84                                     "displayField": "name",
85                                     "editable": "false",
86                                     "emptyText": "Select Type",
87                                     "fieldLabel": "Type",
88                                     "forceSelection": true,
89                                     "hiddenName": "category_type_id",
90                                     "listWidth": 200,
91                                     "loadingText": "Searching...",
92                                     "minChars": 2,
93                                     "name": "category_type_id_name",
94                                     "pageSize": 20,
95                                     "qtip": "Select cms_category_type",
96                                     "selectOnFocus": true,
97                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
98                                     "triggerAction": "all",
99                                     "typeAhead": true,
100                                     "valueField": "id",
101                                     "width": 200,
102                                     "xtype": "ComboBox",
103                                     "|xns": "Roo.form",
104                                     "items": [
105                                         {
106                                             "*prop": "store",
107                                             "xtype": "Store",
108                                             "|xns": "Roo.data",
109                                             "remoteSort": true,
110                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
111                                             "listeners": {
112                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
113                                             },
114                                             "items": [
115                                                 {
116                                                     "*prop": "proxy",
117                                                     "xtype": "HttpProxy",
118                                                     "method": "GET",
119                                                     "|xns": "Roo.data",
120                                                     "|url": "baseURL + '/Roo/cms_category_type.php'"
121                                                 },
122                                                 {
123                                                     "*prop": "reader",
124                                                     "xtype": "JsonReader",
125                                                     "|xns": "Roo.data",
126                                                     "id": "id",
127                                                     "root": "data",
128                                                     "totalProperty": "total",
129                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]"
130                                                 }
131                                             ]
132                                         }
133                                     ]
134                                 },
135                                 {
136                                     "fieldLabel": "Visible",
137                                     "name": "visible",
138                                     "xtype": "Checkbox",
139                                     "|xns": "Roo.form"
140                                 },
141                                 {
142                                     "name": "parent_id",
143                                     "xtype": "Hidden",
144                                     "|xns": "Roo.form"
145                                 },
146                                 {
147                                     "name": "id",
148                                     "xtype": "Hidden",
149                                     "listeners": {},
150                                     "|xns": "Roo.form"
151                                 }
152                             ]
153                         }
154                     ]
155                 },
156                 {
157                     "xtype": "GridPanel",
158                     "title": "Images",
159                     "fitToframe": true,
160                     "fitContainer": true,
161                     "tableName": "Images",
162                     "background": false,
163                     "listeners": {
164                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        //_this.grid.footer.onClick('first');\n    }\n}"
165                     },
166                     "region": "east",
167                     "|xns": "Roo",
168                     "items": [
169                         {
170                             "*prop": "grid",
171                             "xtype": "Grid",
172                             "autoExpandColumn": "filename",
173                             "loadMask": true,
174                             "listeners": {
175                                 "|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}"
176                             },
177                             "|xns": "Roo.grid",
178                             "items": [
179                                 {
180                                     "*prop": "dataSource",
181                                     "xtype": "Store",
182                                     "|reader": "Pman.Readers.Images",
183                                     "listeners": {
184                                         "|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}"
185                                     },
186                                     "|xns": "Roo.data",
187                                     "items": [
188                                         {
189                                             "*prop": "proxy",
190                                             "xtype": "HttpProxy",
191                                             "method": "GET",
192                                             "|url": "baseURL + '/Roo/Images.php'",
193                                             "listeners": {},
194                                             "|xns": "Roo.data"
195                                         }
196                                     ]
197                                 },
198                                 {
199                                     "*prop": "toolbar",
200                                     "xtype": "Toolbar",
201                                     "listeners": {},
202                                     "|xns": "Roo",
203                                     "items": [
204                                         {
205                                             "text": "Add",
206                                             "xtype": "Button",
207                                             "cls": "x-btn-text-icon",
208                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
209                                             "listeners": {
210                                                 "|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        "
211                                             },
212                                             "|xns": "Roo"
213                                         },
214                                         {
215                                             "text": "Edit",
216                                             "xtype": "Button",
217                                             "cls": "x-btn-text-icon",
218                                             "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
219                                             "listeners": {
220                                                 "|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        "
221                                             },
222                                             "|xns": "Roo"
223                                         },
224                                         {
225                                             "text": "Delete",
226                                             "cls": "x-btn-text-icon",
227                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
228                                             "xtype": "Button",
229                                             "listeners": {
230                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, _this.panel.tableName); \n        }\n        "
231                                             },
232                                             "|xns": "Roo"
233                                         }
234                                     ]
235                                 },
236                                 {
237                                     "*prop": "colModel[]",
238                                     "dataIndex": "id",
239                                     "header": "",
240                                     "width": 110,
241                                     "xtype": "ColumnModel",
242                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\">', baseURL, v, r.data.filename); }",
243                                     "|xns": "Roo.grid"
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     "modOrder": "001"
282 }