Pman.Tab.CmsProduct.js
[Pman.Cms] / Pman.Tab.CmsPage.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5
6
7 // register the module first
8 Pman.on('beforeload', function()
9 {
10     Pman.register({
11         modKey : '800-Pman.Tab.CmsPage',
12         module : Pman.Tab.CmsPage,
13         region : 'center',
14         parent : Pman.Tab.Cms,
15         name : "Cms - Page",
16         disabled : false, 
17         permname: 'Cms.Page' 
18     });
19 });
20
21 Pman.Tab.CmsPage = new Roo.util.Observable({
22
23     panel : false,
24     disabled : false,
25     parentLayout:  false,
26
27     add : function(parentLayout, region)
28     {
29
30         var _this = this;
31         this.parentLayout = parentLayout;
32
33         this.panel = parentLayout.addxtype({
34             xtype: 'GridPanel',
35             xns: Roo,
36             listeners : {
37                 activate : function() {
38                     _this.panel = this;
39                     if (_this.grid) {
40                         _this.grid.footer.onClick('first');
41                     }
42                     try {
43                       _this.dialog = Pman.Dialog.CmsPage;
44                     } catch(e) {}
45                 }
46             },
47             background : true,
48             fitContainer : true,
49             fitToframe : true,
50             region : 'center',
51             tableName : 'Page',
52             title : "Page",
53             grid : {
54                 xtype: 'Grid',
55                 xns: Roo.grid,
56                 listeners : {
57                     render : function() 
58                     {
59                        _this.grid = this; 
60                         //_this.dialog = Pman.Dialog.FILL_IN
61                         if (_this.panel.active) {
62                            this.footer.onClick('first');
63                         }
64                     },
65                     celldblclick : function (_self, rowIndex, columnIndex, e)
66                     {
67                     
68                        var s = this.getDataSource().getAt(rowIndex);
69                        _this.dialog.show(s.data, function() {
70                             _this.grid.footer.onClick('first');
71                         }); 
72                         
73                     }
74                 },
75                 autoExpandColumn : 'title',
76                 clicksToEdit : 1,
77                 loadMask : true,
78                 dataSource : {
79                     xtype: 'Store',
80                     xns: Roo.data,
81                     listeners : {
82                         beforeload : function (_self, options)
83                         {
84                             options.params =   options.params || {};
85                             options.params._columns = 'id,category_id_title,title,published,page_link,parent_id_page_link,visible,in_rss';
86                             options.params['query[search]'] = _this.searchField.getValue();
87                         }
88                     },
89                     remoteSort : true,
90                     sortInfo : {field : 'updated', direction : 'DESC' },
91                     proxy : {
92                         xtype: 'HttpProxy',
93                         xns: Roo.data,
94                         method : 'GET',
95                         url : baseURL + '/Roo/Page.php'
96                     },
97                     reader : {
98                         xtype: 'JsonReader',
99                         xns: Roo.data,
100                         id : 'id',
101                         root : 'data',
102                         totalProperty : 'total',
103                         fields : [
104                             {
105                                 'name': 'id',
106                                 'type': 'int'
107                             },
108                             {
109                                 'name': 'shortname',
110                                 'type': 'string'
111                             },
112                             {
113                                 'name': 'category_id',
114                                 'type': 'int'
115                             },
116                             {
117                                 'name': 'category_id_title',
118                                 'type': 'int'
119                             },
120                             {
121                                 'name': 'title',
122                                 'type': 'string'
123                             },
124                             {
125                                 'name': 'contents',
126                                 'type': 'string'
127                             },
128                             {
129                                 'name': 'visible',
130                                 'type': 'int'
131                             },
132                             {
133                                 'name': 'extended',
134                                 'type': 'string'
135                             },
136                             {
137                                 'name': 'trackbacks_no',
138                                 'type': 'int'
139                             },
140                             {
141                                 'name': 'comments_no',
142                                 'type': 'int'
143                             },
144                             {
145                                 'name': 'has_extended',
146                                 'type': 'int'
147                             },
148                             {
149                                 'name': 'author_id',
150                                 'type': 'int'
151                             },
152                             {
153                                 'name': 'author_name',
154                                 'type': 'string'
155                             },
156                             {
157                                 'name': 'updated',
158                                 'type': 'string'
159                             },
160                             {
161                                 'name': 'created',
162                                 'type': 'string'
163                             },
164                             {
165                                 'name': 'published',
166                                 'type': 'string'
167                             },
168                             {
169                                 'name': 'page_link',
170                                 'type': 'string'
171                             },
172                             {
173                                 'name': 'parent_id',
174                                 'type': 'int'
175                             },
176                             {
177                                 'name': 'in_rss',
178                                 'type': 'int'
179                             },
180                             {
181                                 'name': 'replaces_id',
182                                 'type': 'int'
183                             },
184                             {
185                                 'name': 'category_id_id',
186                                 'type': 'int'
187                             },
188                             {
189                                 'name': 'category_id_parent_id',
190                                 'type': 'int'
191                             },
192                             {
193                                 'name': 'category_id_short_name',
194                                 'type': 'string'
195                             },
196                             {
197                                 'name': 'category_id_title',
198                                 'type': 'string'
199                             },
200                             {
201                                 'name': 'category_id_page_text',
202                                 'type': 'string'
203                             },
204                             {
205                                 'name': 'category_id_type',
206                                 'type': 'string'
207                             },
208                             {
209                                 'name': 'category_id_search_on',
210                                 'type': 'string'
211                             },
212                             {
213                                 'name': 'category_id_image_menu_id',
214                                 'type': 'int'
215                             },
216                             {
217                                 'name': 'category_id_image_menuover_id',
218                                 'type': 'int'
219                             },
220                             {
221                                 'name': 'category_id_image_leftactive_id',
222                                 'type': 'int'
223                             },
224                             {
225                                 'name': 'category_id_image_page_id',
226                                 'type': 'int'
227                             },
228                             {
229                                 'name': 'category_id_display_order',
230                                 'type': 'int'
231                             },
232                             {
233                                 'name': 'category_id_more_info_title',
234                                 'type': 'string'
235                             },
236                             {
237                                 'name': 'category_id_more_info_text',
238                                 'type': 'string'
239                             },
240                             {
241                                 'name': 'category_id_visible',
242                                 'type': 'int'
243                             }
244                         ]
245                     }
246                 },
247                 footer : {
248                     xtype: 'PagingToolbar',
249                     xns: Roo,
250                     pageSize : 25,
251                     displayInfo : true,
252                     displayMsg : 'Displaying Page{0} - {1} of {2}',
253                     emptyMsg : 'No Page found'
254                 },
255                 toolbar : {
256                     xtype: 'Toolbar',
257                     xns: Roo,
258                     items : [
259                         {
260                             xtype: 'TextField',
261                             xns: Roo.form,
262                             listeners : {
263                                 render : function (_self)
264                                 {
265                                     _this.searchField = _self;
266                                 }
267                             }
268                         },
269                         {
270                             xtype: 'Button',
271                             xns: Roo.Toolbar,
272                             listeners : {
273                                 click : function (_self, e)
274                                 {
275                                 _this.grid.footer.onClick('first');
276                                 }
277                             },
278                             cls : 'x-btn-icon',
279                             icon : rootURL + '/Pman/templates/images/search.gif'
280                         },
281                         {
282                             xtype: 'Fill',
283                             xns: Roo.Toolbar
284                         },
285                         {
286                             xtype: 'Button',
287                             xns: Roo,
288                             listeners : {
289                                 click : function()
290                                 {
291                                    _this.dialog.show( { id : 0 } , function() {
292                                      _this.grid.footer.onClick('first');
293                                    }); 
294                                 }
295                             },
296                             cls : 'x-btn-text-icon',
297                             text : "Add",
298                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
299                         },
300                         {
301                             xtype: 'Button',
302                             xns: Roo,
303                             listeners : {
304                                 click : function()
305                                 {
306                                     var sc = _this.grid.getSelectionModel().getSelected();
307                                     if (!sc)  {
308                                         Roo.MessageBox.alert("Error", "Select a Row");
309                                         return;
310                                     }
311                                     var s =_this.grid.getDataSource().getById(sc.id);
312                                     
313                                     _this.dialog.show(s.data, function() {
314                                         _this.grid.footer.onClick('first');
315                                     }); 
316                                     
317                                 }
318                             },
319                             cls : 'x-btn-text-icon',
320                             text : "Edit",
321                             icon : Roo.rootURL + 'images/default/tree/leaf.gif'
322                         },
323                         {
324                             xtype: 'Button',
325                             xns: Roo,
326                             listeners : {
327                                 click : function()
328                                 {
329                                   // Pman.genericDelete(_this, _this.panel.tableName); 
330                                 }
331                             },
332                             cls : 'x-btn-text-icon',
333                             text : "Delete",
334                             icon : rootURL + '/Pman/templates/images/trash.gif'
335                         }
336                     ]
337                 },
338                 colModel : [
339                     {
340                         xtype: 'ColumnModel',
341                         xns: Roo.grid,
342                         header : 'Id',
343                         width : 75,
344                         dataIndex : 'id',
345                         renderer : function(v) { return String.format('{0}', v); }
346                     },
347                     {
348                         xtype: 'ColumnModel',
349                         xns: Roo.grid,
350                         dataIndex : 'category_id_title',
351                         header : 'Category',
352                         width : 75,
353                         renderer : function(v) { return String.format('{0}', v); }
354                     },
355                     {
356                         xtype: 'ColumnModel',
357                         xns: Roo.grid,
358                         header : 'Title',
359                         width : 200,
360                         dataIndex : 'title',
361                         renderer : function(v) { return String.format('{0}', v); }
362                     },
363                     {
364                         xtype: 'ColumnModel',
365                         xns: Roo.grid,
366                         header : 'Published',
367                         width : 200,
368                         dataIndex : 'published',
369                         renderer : function(v) { return String.format('{0}', v); }
370                     },
371                     {
372                         xtype: 'ColumnModel',
373                         xns: Roo.grid,
374                         header : 'Page link',
375                         width : 200,
376                         dataIndex : 'page_link',
377                         renderer : function(v) { return String.format('{0}', v); }
378                     },
379                     {
380                         xtype: 'ColumnModel',
381                         xns: Roo.grid,
382                         header : 'Parent',
383                         width : 75,
384                         dataIndex : 'parent_id',
385                         renderer : function(v) { return String.format('{0}', v); }
386                     },
387                     {
388                         xtype: 'ColumnModel',
389                         xns: Roo.grid,
390                         dataIndex : 'visible',
391                         header : 'Vis',
392                         width : 30,
393                         renderer : function(v) { return String.format('{0}', v); }
394                     },
395                     {
396                         xtype: 'ColumnModel',
397                         xns: Roo.grid,
398                         dataIndex : 'in_rss',
399                         header : 'RSS',
400                         width : 30,
401                         renderer : function(v) { return String.format('{0}', v); }
402                     }
403                 ]
404             }
405         });
406         this.layout = this.panel.layout;
407
408     }
409 });