Pman.Dialog.CmsPage.bjs
[Pman.Cms] / Pman.Dialog.CmsPage.bjs
1 {
2     "id": "roo-file-6",
3     "name": "Pman.Dialog.CmsPage",
4     "parent": "",
5     "title": "Cms -Edit Page",
6     "path": "/home/alan/gitlive/Pman.Cms/Pman.Dialog.CmsPage.bjs",
7     "items": [
8         {
9             "background": true,
10             "closable": false,
11             "collapsible": false,
12             "height": 600,
13             "modal": true,
14             "resizable": false,
15             "title": "Edit Page",
16             "width": 800,
17             "xtype": "LayoutDialog",
18             "|xns": "Roo",
19             "items": [
20                 {
21                     "xtype": "LayoutRegion",
22                     "*prop": "center",
23                     "titlebar": false,
24                     "|xns": "Roo"
25                 },
26                 {
27                     "xtype": "LayoutRegion",
28                     "*prop": "east",
29                     "titlebar": false,
30                     "fitToFrame": "true",
31                     "width": 200,
32                     "listeners": {},
33                     "|xns": "Roo"
34                 },
35                 {
36                     "autoScroll": true,
37                     "fitToFrame": true,
38                     "region": "center",
39                     "xtype": "ContentPanel",
40                     "|xns": "Roo",
41                     "listeners": {},
42                     "items": [
43                         {
44                             "listeners": {
45                                 "|actionfailed": "function (_self, action)\n{\n    _this.dialog.el.unmask();\n    Pman.standardActionFailed(_self, action);\n}\n",
46                                 "|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.loaded = false;\n          \n  //      _this.dialog.getLayout().showPanel(0);\n    //   _this.form.addForm(_this.form1);\n          if ( _this.data.id) {\n                _this.dialog.el.mask(\"Loading\");\n                this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n           } else {\n                _this.loaded = true;\n                //disable image upload!\n              _this.form.findField('publish_status').setValue(-1);\n          }\n\n       return;\n      \n    }\n    \n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n       _this.grid.getDataSource().load();\n        return;\n    }\n}\n",
47                                 "|rendered": "function (_self)\n{\n    _this.form = _self;\n}\n"
48                             },
49                             "method": "POST",
50                             "style": "margin: 5px",
51                             "xtype": "Form",
52                             "|url": "baseURL + '/Roo/Page.php'",
53                             "|xns": "Roo.form",
54                             "items": [
55                                 {
56                                     "fieldLabel": "Replaces",
57                                     "name": "replaces_id",
58                                     "width": 75,
59                                     "|xns": "Roo.form",
60                                     "xtype": "TextField"
61                                 },
62                                 {
63                                     "fieldLabel": "Parent",
64                                     "name": "parent_id",
65                                     "width": 75,
66                                     "|xns": "Roo.form",
67                                     "xtype": "TextField"
68                                 },
69                                 {
70                                     "fieldLabel": "Page link",
71                                     "name": "page_link",
72                                     "width": 200,
73                                     "|xns": "Roo.form",
74                                     "xtype": "TextField"
75                                 },
76                                 {
77                                     "fieldLabel": "Date to Publish",
78                                     "name": "published",
79                                     "width": 200,
80                                     "xtype": "DateField",
81                                     "|xns": "Roo.form"
82                                 },
83                                 {
84                                     "labelAlign": "right",
85                                     "width": 420,
86                                     "xtype": "Row",
87                                     "|xns": "Roo.form",
88                                     "listeners": {},
89                                     "items": [
90                                         {
91                                             "boxLabel": "Visible",
92                                             "name": "visible",
93                                             "width": 100,
94                                             "xtype": "Checkbox",
95                                             "|xns": "Roo.form"
96                                         },
97                                         {
98                                             "boxLabel": "Display in RSS",
99                                             "name": "in_rss",
100                                             "width": 100,
101                                             "xtype": "Checkbox",
102                                             "|xns": "Roo.form"
103                                         },
104                                         {
105                                             "boxLabel": "Extended Vis.?",
106                                             "inputValue": 1,
107                                             "name": "has_extended",
108                                             "width": 100,
109                                             "xtype": "Checkbox",
110                                             "|xns": "Roo.form"
111                                         }
112                                     ]
113                                 },
114                                 {
115                                     "allowBlank": true,
116                                     "displayField": "title",
117                                     "editable": false,
118                                     "emptyText": "Select Category ",
119                                     "fieldLabel": "Category ",
120                                     "forceSelection": true,
121                                     "hiddenName": "category_id",
122                                     "listWidth": 390,
123                                     "loadingText": "Searching...",
124                                     "minChars": 2,
125                                     "name": "category_id_title",
126                                     "pageSize": 20,
127                                     "qtip": "Select Category ",
128                                     "queryParam": "query[title]",
129                                     "selectOnFocus": true,
130                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
131                                     "triggerAction": "all",
132                                     "typeAhead": true,
133                                     "valueField": "id",
134                                     "width": 450,
135                                     "xtype": "ComboBox",
136                                     "|xns": "Roo.form",
137                                     "items": [
138                                         {
139                                             "*prop": "store",
140                                             "xtype": "Store",
141                                             "|reader": "Pman.Readers.Category",
142                                             "|xns": "Roo.data",
143                                             "items": [
144                                                 {
145                                                     "*prop": "proxy",
146                                                     "xtype": "HttpProxy",
147                                                     "|url": "baseURL + '/Roo/Category.php'",
148                                                     "method": "GET",
149                                                     "|xns": "Roo.data"
150                                                 }
151                                             ]
152                                         }
153                                     ]
154                                 },
155                                 {
156                                     "fieldLabel": "Title",
157                                     "name": "title",
158                                     "width": 390,
159                                     "xtype": "TextField",
160                                     "|xns": "Roo.form"
161                                 },
162                                 {
163                                     "xtype": "Column",
164                                     "width": "570",
165                                     "listeners": {},
166                                     "labelAlign": "top",
167                                     "|xns": "Roo.form",
168                                     "items": [
169                                         {
170                                             "fieldLabel": "Contents",
171                                             "height": 240,
172                                             "name": "contents",
173                                             "width": 550,
174                                             "xtype": "HtmlEditor",
175                                             "|xns": "Roo.form"
176                                         }
177                                     ]
178                                 },
179                                 {
180                                     "xtype": "Column",
181                                     "width": "570",
182                                     "listeners": {},
183                                     "labelAlign": "top",
184                                     "|xns": "Roo.form",
185                                     "items": [
186                                         {
187                                             "fieldLabel": "Extended Contents",
188                                             "height": 340,
189                                             "name": "extended",
190                                             "width": 550,
191                                             "xtype": "HtmlEditor",
192                                             "|xns": "Roo.form"
193                                         }
194                                     ]
195                                 },
196                                 {
197                                     "name": "id",
198                                     "xtype": "Hidden",
199                                     "listeners": {},
200                                     "|xns": "Roo.form"
201                                 }
202                             ]
203                         }
204                     ]
205                 },
206                 {
207                     "xtype": "GridPanel",
208                     "title": "Images",
209                     "fitToframe": true,
210                     "fitContainer": true,
211                     "tableName": "Images",
212                     "background": false,
213                     "listeners": {
214                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
215                     },
216                     "region": "east",
217                     "|xns": "Roo",
218                     "items": [
219                         {
220                             "*prop": "grid",
221                             "xtype": "Grid",
222                             "autoExpandColumn": "filename",
223                             "loadMask": true,
224                             "listeners": {
225                                 "|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}",
226                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n    var rd = _this.grid.getDataSource().getAt(rowIndex);\n    var id = rd.data.id;\n    var url = String.format('{0}/Images/{1}/{2}', baseURL, rd.data.id, rd.data.filename);\n    _this.form.findField('contents').execCmd('insertimage', url);\n\n}"
227                             },
228                             "|xns": "Roo.grid",
229                             "items": [
230                                 {
231                                     "*prop": "dataSource",
232                                     "xtype": "Store",
233                                     "|reader": "Pman.Readers.Images",
234                                     "listeners": {
235                                         "|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 = 'Page';\n}"
236                                     },
237                                     "|xns": "Roo.data",
238                                     "items": [
239                                         {
240                                             "*prop": "proxy",
241                                             "xtype": "HttpProxy",
242                                             "method": "GET",
243                                             "|url": "baseURL + '/Roo/Images.php'",
244                                             "|xns": "Roo.data"
245                                         }
246                                     ]
247                                 },
248                                 {
249                                     "*prop": "toolbar",
250                                     "xtype": "Toolbar",
251                                     "listeners": {},
252                                     "|xns": "Roo",
253                                     "items": [
254                                         {
255                                             "text": "Add",
256                                             "xtype": "Button",
257                                             "cls": "x-btn-text-icon",
258                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
259                                             "listeners": {
260                                                 "|click": "function()\n        {\n            Pman.Dialog.Image.show( { id : 0, onid: _this.data.id, ontable: 'Page' }, function() {\n                _this.grid.getDataSource().load();\n            }); \n\n        }\n        "
261                                             },
262                                             "|xns": "Roo"
263                                         },
264                                         {
265                                             "text": "Delete",
266                                             "cls": "x-btn-text-icon",
267                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
268                                             "xtype": "Button",
269                                             "listeners": {
270                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, _this.panel.tableName); \n        }\n        "
271                                             },
272                                             "|xns": "Roo"
273                                         }
274                                     ]
275                                 },
276                                 {
277                                     "xtype": "ColumnModel",
278                                     "header": "",
279                                     "width": 50,
280                                     "dataIndex": "id",
281                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\">', baseURL, v, r.data.filename); }",
282                                     "listeners": {},
283                                     "sortable": false,
284                                     "|xns": "Roo.grid",
285                                     "*prop": "colModel[]"
286                                 },
287                                 {
288                                     "xtype": "ColumnModel",
289                                     "header": "Filename",
290                                     "width": 100,
291                                     "dataIndex": "filename",
292                                     "|renderer": "function(v) { return String.format('{0}', v); }",
293                                     "listeners": {},
294                                     "|xns": "Roo.grid",
295                                     "*prop": "colModel[]"
296                                 }
297                             ]
298                         }
299                     ]
300                 },
301                 {
302                     "text": "Cancel",
303                     "xtype": "Button",
304                     "|xns": "Roo",
305                     "listeners": {
306                         "|click": " function() {\n\n                                    _this.form.reset();\n\n                                    _this.dialog.hide();\n\n                                }\n"
307                     },
308                     "*prop": "buttons[]"
309                 },
310                 {
311                     "text": "OK",
312                     "xtype": "Button",
313                     "|xns": "Roo",
314                     "listeners": {
315                         "|click": " function() {\n\n                                    _this.dialog.el.mask(\"Saving\");\n _this.form.findField('contents').syncValue();\n                                    _this.form.doAction(\"submit\");\n\n                                }\n"
316                     },
317                     "*prop": "buttons[]"
318                 }
319             ]
320         }
321     ]
322 }