Pman.Tab.CmsProduct.js
[Pman.Cms] / Pman.Dialog.CmsPage.bjs
1 {
2     "id": "roo-file-85",
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": 850,
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": "Page link",
57                                     "name": "page_link",
58                                     "width": 200,
59                                     "|xns": "Roo.form",
60                                     "xtype": "TextField"
61                                 },
62                                 {
63                                     "allowBlank": true,
64                                     "displayField": "page_link",
65                                     "editable": false,
66                                     "emptyText": "Select Parent",
67                                     "fieldLabel": "Parent page",
68                                     "forceSelection": true,
69                                     "hiddenName": "parent_id",
70                                     "listWidth": 400,
71                                     "loadingText": "Searching...",
72                                     "minChars": 2,
73                                     "name": "parent_id_page_link",
74                                     "pageSize": 20,
75                                     "qtip": "Select Category ",
76                                     "selectOnFocus": true,
77                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b><br/><i>{page_link}</i> </div>",
78                                     "triggerAction": "all",
79                                     "typeAhead": true,
80                                     "valueField": "id",
81                                     "width": 400,
82                                     "xtype": "ComboBox",
83                                     "|xns": "Roo.form",
84                                     "items": [
85                                         {
86                                             "*prop": "store",
87                                             "remoteSort": true,
88                                             "xtype": "Store",
89                                             "|sortInfo": "{ field: 'page_link', direction: 'ASC' }",
90                                             "|xns": "Roo.data",
91                                             "items": [
92                                                 {
93                                                     "*prop": "proxy",
94                                                     "method": "GET",
95                                                     "xtype": "HttpProxy",
96                                                     "|url": "baseURL + '/Roo/Page.php'",
97                                                     "|xns": "Roo.data"
98                                                 },
99                                                 {
100                                                     "*prop": "reader",
101                                                     "id": "id",
102                                                     "root": "data",
103                                                     "totalProperty": "total",
104                                                     "xtype": "JsonReader",
105                                                     "|fields": "[\n { name: 'id', type: 'int' },\n 'title',\n 'page_link' \n]",
106                                                     "|xns": "Roo.data"
107                                                 }
108                                             ]
109                                         }
110                                     ]
111                                 },
112                                 {
113                                     "|xns": "Roo.form",
114                                     "xtype": "Row",
115                                     "items": [
116                                         {
117                                             "fieldLabel": "Date to Publish",
118                                             "format": "Y-m-d",
119                                             "name": "published",
120                                             "width": 200,
121                                             "xtype": "DateField",
122                                             "|xns": "Roo.form"
123                                         },
124                                         {
125                                             "fieldLabel": "Replaces",
126                                             "name": "replaces_id",
127                                             "width": 75,
128                                             "|xns": "Roo.form",
129                                             "xtype": "TextField"
130                                         }
131                                     ]
132                                 },
133                                 {
134                                     "hideLabels": true,
135                                     "labelWidth": 0,
136                                     "width": 520,
137                                     "xtype": "Row",
138                                     "|xns": "Roo.form",
139                                     "items": [
140                                         {
141                                             "boxLabel": "Visible",
142                                             "name": "visible",
143                                             "width": 100,
144                                             "xtype": "Checkbox",
145                                             "|xns": "Roo.form"
146                                         },
147                                         {
148                                             "boxLabel": "Display in RSS",
149                                             "name": "in_rss",
150                                             "width": 150,
151                                             "xtype": "Checkbox",
152                                             "|xns": "Roo.form"
153                                         },
154                                         {
155                                             "boxLabel": "Extended Vis.?",
156                                             "inputValue": 1,
157                                             "name": "has_extended",
158                                             "width": 140,
159                                             "xtype": "Checkbox",
160                                             "|xns": "Roo.form"
161                                         }
162                                     ]
163                                 },
164                                 {
165                                     "fieldLabel": "Title",
166                                     "name": "title",
167                                     "width": 390,
168                                     "xtype": "TextField",
169                                     "|xns": "Roo.form"
170                                 },
171                                 {
172                                     "xtype": "Column",
173                                     "width": "570",
174                                     "listeners": {},
175                                     "labelAlign": "top",
176                                     "|xns": "Roo.form",
177                                     "items": [
178                                         {
179                                             "fieldLabel": "Contents",
180                                             "height": 240,
181                                             "name": "contents",
182                                             "width": 550,
183                                             "xtype": "HtmlEditor",
184                                             "|xns": "Roo.form"
185                                         }
186                                     ]
187                                 },
188                                 {
189                                     "xtype": "Column",
190                                     "width": "570",
191                                     "listeners": {},
192                                     "labelAlign": "top",
193                                     "|xns": "Roo.form",
194                                     "items": [
195                                         {
196                                             "fieldLabel": "Extended Contents",
197                                             "height": 340,
198                                             "name": "extended",
199                                             "width": 550,
200                                             "xtype": "HtmlEditor",
201                                             "|xns": "Roo.form"
202                                         }
203                                     ]
204                                 },
205                                 {
206                                     "name": "id",
207                                     "xtype": "Hidden",
208                                     "listeners": {},
209                                     "|xns": "Roo.form"
210                                 }
211                             ]
212                         }
213                     ]
214                 },
215                 {
216                     "xtype": "GridPanel",
217                     "title": "Images",
218                     "fitToframe": true,
219                     "fitContainer": true,
220                     "tableName": "Images",
221                     "background": false,
222                     "listeners": {
223                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
224                     },
225                     "region": "east",
226                     "|xns": "Roo",
227                     "items": [
228                         {
229                             "*prop": "grid",
230                             "xtype": "Grid",
231                             "autoExpandColumn": "filename",
232                             "loadMask": true,
233                             "listeners": {
234                                 "|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}",
235                                 "|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}"
236                             },
237                             "|xns": "Roo.grid",
238                             "items": [
239                                 {
240                                     "listeners": {
241                                         "|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}"
242                                     },
243                                     "*prop": "dataSource",
244                                     "xtype": "Store",
245                                     "|reader": "Pman.Readers.Images",
246                                     "|xns": "Roo.data",
247                                     "items": [
248                                         {
249                                             "*prop": "proxy",
250                                             "xtype": "HttpProxy",
251                                             "method": "GET",
252                                             "|url": "baseURL + '/Roo/Images.php'",
253                                             "|xns": "Roo.data"
254                                         }
255                                     ]
256                                 },
257                                 {
258                                     "*prop": "toolbar",
259                                     "xtype": "Toolbar",
260                                     "listeners": {},
261                                     "|xns": "Roo",
262                                     "items": [
263                                         {
264                                             "listeners": {
265                                                 "|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        "
266                                             },
267                                             "cls": "x-btn-text-icon",
268                                             "text": "Add",
269                                             "xtype": "Button",
270                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
271                                             "|xns": "Roo"
272                                         },
273                                         {
274                                             "text": "Delete",
275                                             "cls": "x-btn-text-icon",
276                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
277                                             "xtype": "Button",
278                                             "listeners": {
279                                                 "|click": "function()\n        {\n        Pman.genericDelete(_this, _this.panel.tableName); \n        }\n        "
280                                             },
281                                             "|xns": "Roo"
282                                         }
283                                     ]
284                                 },
285                                 {
286                                     "xtype": "ColumnModel",
287                                     "header": "",
288                                     "width": 50,
289                                     "dataIndex": "id",
290                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\">', baseURL, v, r.data.filename); }",
291                                     "listeners": {},
292                                     "sortable": false,
293                                     "|xns": "Roo.grid",
294                                     "*prop": "colModel[]"
295                                 },
296                                 {
297                                     "xtype": "ColumnModel",
298                                     "header": "Filename",
299                                     "width": 100,
300                                     "dataIndex": "filename",
301                                     "|renderer": "function(v) { return String.format('{0}', v); }",
302                                     "listeners": {},
303                                     "|xns": "Roo.grid",
304                                     "*prop": "colModel[]"
305                                 }
306                             ]
307                         }
308                     ]
309                 },
310                 {
311                     "text": "Cancel",
312                     "xtype": "Button",
313                     "|xns": "Roo",
314                     "listeners": {
315                         "|click": " function() {\n\n                                    _this.form.reset();\n\n                                    _this.dialog.hide();\n\n                                }\n"
316                     },
317                     "*prop": "buttons[]"
318                 },
319                 {
320                     "text": "OK",
321                     "xtype": "Button",
322                     "|xns": "Roo",
323                     "listeners": {
324                         "|click": " function() {\n\n                                    _this.dialog.el.mask(\"Saving\");\n _this.form.findField('contents').syncValue();\n                                    _this.form.doAction(\"submit\");\n\n                                }\n"
325                     },
326                     "*prop": "buttons[]"
327                 }
328             ]
329         }
330     ]
331 }