Pman.Dialog.CmsCategory.bjs
[Pman.Cms] / Pman.Dialog.CmsCategory.bjs
1 {
2     "id": "roo-file-84",
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                             "xtype": "Form",
48                             "style": "margin: 5px",
49                             "|url": "baseURL + '/Roo/Category.php'",
50                             "method": "POST",
51                             "listeners": {
52                                 "|actionfailed": "function (_self, action)\n{\n    _this.dialog.el.unmask();\n    Pman.standardActionFailed(_self, action);\n}\n",
53                                 "|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       _this.grid.getDataSource().load();\n    \n    }\n}\n",
54                                 "|rendered": "function (_self)\n{\n    _this.form = _self;\n}\n"
55                             },
56                             "|xns": "Roo.form",
57                             "items": [
58                                 {
59                                     "fieldLabel": "Parent ",
60                                     "name": "parent_id_title",
61                                     "hiddenName": "parent_id",
62                                     "qtip": "Select Parent ",
63                                     "emptyText": "Select Parent ",
64                                     "xtype": "ComboBox",
65                                     "selectOnFocus": true,
66                                     "allowBlank": true,
67                                     "width": 300,
68                                     "listWidth": 400,
69                                     "editable": false,
70                                     "displayField": "title",
71                                     "valueField": "id",
72                                     "typeAhead": true,
73                                     "forceSelection": true,
74                                     "triggerAction": "all",
75                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
76                                     "queryParam": "query[title]",
77                                     "loadingText": "Searching...",
78                                     "minChars": 2,
79                                     "pageSize": 20,
80                                     "listeners": {},
81                                     "|xns": "Roo.form",
82                                     "items": [
83                                         {
84                                             "*prop": "store",
85                                             "xtype": "Store",
86                                             "|reader": "Pman.Readers.Category",
87                                             "|xns": "Roo.data",
88                                             "items": [
89                                                 {
90                                                     "*prop": "proxy",
91                                                     "xtype": "HttpProxy",
92                                                     "|url": "baseURL + '/Roo/Category.php'",
93                                                     "method": "GET",
94                                                     "|xns": "Roo.data"
95                                                 }
96                                             ]
97                                         }
98                                     ]
99                                 },
100                                 {
101                                     "name": "title",
102                                     "fieldLabel": "Title",
103                                     "width": 450,
104                                     "xtype": "TextField",
105                                     "listeners": {},
106                                     "|xns": "Roo.form"
107                                 },
108                                 {
109                                     "fieldLabel": "Colour",
110                                     "name": "short_name",
111                                     "width": 100,
112                                     "xtype": "TextField",
113                                     "|xns": "Roo.form"
114                                 },
115                                 {
116                                     "fieldLabel": "Visible",
117                                     "name": "visible",
118                                     "xtype": "Checkbox",
119                                     "|xns": "Roo.form"
120                                 },
121                                 {
122                                     "xtype": "Column",
123                                     "width": "550",
124                                     "listeners": {},
125                                     "labelAlign": "top",
126                                     "|xns": "Roo.form",
127                                     "items": [
128                                         {
129                                             "fieldLabel": "Page text",
130                                             "height": 250,
131                                             "name": "page_text",
132                                             "width": 550,
133                                             "xtype": "HtmlEditor",
134                                             "|xns": "Roo.form"
135                                         }
136                                     ]
137                                 },
138                                 {
139                                     "name": "id",
140                                     "xtype": "Hidden",
141                                     "listeners": {},
142                                     "|xns": "Roo.form"
143                                 }
144                             ]
145                         }
146                     ]
147                 },
148                 {
149                     "xtype": "GridPanel",
150                     "title": "Images",
151                     "fitToframe": true,
152                     "fitContainer": true,
153                     "tableName": "Images",
154                     "background": false,
155                     "listeners": {
156                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        //_this.grid.footer.onClick('first');\n    }\n}"
157                     },
158                     "region": "east",
159                     "|xns": "Roo",
160                     "items": [
161                         {
162                             "*prop": "grid",
163                             "xtype": "Grid",
164                             "autoExpandColumn": "filename",
165                             "loadMask": true,
166                             "listeners": {
167                                 "|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}"
168                             },
169                             "|xns": "Roo.grid",
170                             "items": [
171                                 {
172                                     "*prop": "dataSource",
173                                     "xtype": "Store",
174                                     "|reader": "Pman.Readers.Images",
175                                     "listeners": {
176                                         "|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}"
177                                     },
178                                     "|xns": "Roo.data",
179                                     "items": [
180                                         {
181                                             "*prop": "proxy",
182                                             "xtype": "HttpProxy",
183                                             "method": "GET",
184                                             "|url": "baseURL + '/Roo/Images.php'",
185                                             "listeners": {},
186                                             "|xns": "Roo.data"
187                                         }
188                                     ]
189                                 },
190                                 {
191                                     "*prop": "toolbar",
192                                     "xtype": "Toolbar",
193                                     "listeners": {},
194                                     "|xns": "Roo",
195                                     "items": [
196                                         {
197                                             "text": "Add",
198                                             "xtype": "Button",
199                                             "cls": "x-btn-text-icon",
200                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
201                                             "listeners": {
202                                                 "|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        "
203                                             },
204                                             "|xns": "Roo"
205                                         },
206                                         {
207                                             "text": "Edit",
208                                             "xtype": "Button",
209                                             "cls": "x-btn-text-icon",
210                                             "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
211                                             "listeners": {
212                                                 "|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        "
213                                             },
214                                             "|xns": "Roo"
215                                         },
216                                         {
217                                             "text": "Delete",
218                                             "cls": "x-btn-text-icon",
219                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
220                                             "xtype": "Button",
221                                             "listeners": {
222                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, _this.panel.tableName); \n        }\n        "
223                                             },
224                                             "|xns": "Roo"
225                                         }
226                                     ]
227                                 },
228                                 {
229                                     "xtype": "ColumnModel",
230                                     "header": "",
231                                     "width": 110,
232                                     "dataIndex": "id",
233                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\">', baseURL, v, r.data.filename); }",
234                                     "listeners": {},
235                                     "|xns": "Roo.grid",
236                                     "*prop": "colModel[]"
237                                 },
238                                 {
239                                     "xtype": "ColumnModel",
240                                     "header": "Filename",
241                                     "width": 100,
242                                     "dataIndex": "filename",
243                                     "|renderer": "function(v,x,r) { return String.format('{0}<br/><i qtip=\"{1}\">{1}</i>', v, r.data.linkurl); }",
244                                     "listeners": {},
245                                     "|xns": "Roo.grid",
246                                     "*prop": "colModel[]"
247                                 }
248                             ]
249                         }
250                     ]
251                 },
252                 {
253                     "text": "Cancel",
254                     "xtype": "Button",
255                     "|xns": "Roo",
256                     "listeners": {
257                         "|click": " function() {\n\n                                    _this.form.reset();\n\n                                    _this.dialog.hide();\n\n                                }\n"
258                     },
259                     "*prop": "buttons[]"
260                 },
261                 {
262                     "text": "OK",
263                     "xtype": "Button",
264                     "|xns": "Roo",
265                     "listeners": {
266                         "|click": " function() {\n\n                                    _this.dialog.el.mask(\"Saving\");\n\n                                    _this.form.doAction(\"submit\");\n\n                                }\n"
267                     },
268                     "*prop": "buttons[]"
269                 }
270             ]
271         }
272     ]
273 }