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