Pman.Tab.CmsAggregate.bjs
[Pman.Cms] / Pman.Tab.CmsAggregate.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         part :  ["Cms","Aggregate"],
12         modKey : '001-Pman.Tab.CmsAggregate',
13         module : Pman.Tab.CmsAggregate,
14         region : 'center',
15         parent : false,
16         name : "unnamed module",
17         disabled : false, 
18         permname: '' 
19     });
20 });
21
22 Pman.Tab.CmsAggregate = new Roo.util.Observable({
23
24     panel : false,
25     disabled : false,
26     parentLayout:  false,
27
28     add : function(parentLayout, region)
29     {
30
31         var _this = this;
32         this.parentLayout = parentLayout;
33
34         this.panel = parentLayout.addxtype({
35             xtype: 'GridPanel',
36             xns: Roo,
37             title : "cms_rssaggr",
38             fitToframe : true,
39             fitContainer : true,
40             tableName : 'cms_rssaggr',
41             background : true,
42             region : 'center',
43             listeners : {
44                 activate : function() {
45                     _this.panel = this;
46                     if (_this.grid) {
47                         _this.grid.footer.onClick('first');
48                     }
49                 }
50             },
51             grid : {
52                 xtype: 'Grid',
53                 xns: Roo.grid,
54                 autoExpandColumn : 'extid',
55                 loadMask : true,
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                     rowdblclick : function (_self, rowIndex, e)
66                     {
67                         if (!_this.dialog) return;
68                         _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
69                             _this.grid.footer.onClick('first');
70                         }); 
71                     }
72                 },
73                 dataSource : {
74                     xtype: 'Store',
75                     xns: Roo.data,
76                     remoteSort : true,
77                     sortInfo : { field : 'extid', direction: 'ASC' },
78                     proxy : {
79                         xtype: 'HttpProxy',
80                         xns: Roo.data,
81                         method : 'GET',
82                         url : baseURL + '/Roo/cms_rssaggr.php'
83                     },
84                     reader : {
85                         xtype: 'JsonReader',
86                         xns: Roo.data,
87                         totalProperty : 'total',
88                         root : 'data',
89                         id : 'id',
90                         fields : [
91                             {
92                                 'name': 'id',
93                                 'type': 'int'
94                             },
95                             {
96                                 'name': 'extid',
97                                 'type': 'string'
98                             },
99                             {
100                                 'name': 'published_dt',
101                                 'type': 'date',
102                                 'dateFormat': 'Y-m-d'
103                             },
104                             {
105                                 'name': 'headline',
106                                 'type': 'string'
107                             },
108                             {
109                                 'name': 'body',
110                                 'type': 'string'
111                             },
112                             {
113                                 'name': 'src_id',
114                                 'type': 'int'
115                             }
116                         ]
117                     }
118                 },
119                 footer : {
120                     xtype: 'PagingToolbar',
121                     xns: Roo,
122                     pageSize : 25,
123                     displayInfo : true,
124                     displayMsg : "Displaying cms_rssaggr{0} - {1} of {2}",
125                     emptyMsg : "No cms_rssaggr found"
126                 },
127                 toolbar : {
128                     xtype: 'Toolbar',
129                     xns: Roo,
130                     items : [
131                         {
132                             xtype: 'Button',
133                             xns: Roo.Toolbar,
134                             listeners : {
135                                 click : function (_self, e)
136                                 {
137                                     new Pman.Request({
138                                         url : baseURL + '/Roo/cms_rssaggr',
139                                         method : 'GET',
140                                         params : {
141                                             _pullfeed : 1
142                                         },
143                                         success : function() {
144                                             _this.grid.onClick('first');
145                                         }
146                                     });
147                                 }
148                             },
149                             text : "Reload"
150                         },
151                         {
152                             xtype: 'Fill',
153                             xns: Roo.Toolbar
154                         },
155                         {
156                             xtype: 'Button',
157                             xns: Roo.Toolbar,
158                             text : "Add",
159                             cls : 'x-btn-text-icon',
160                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
161                             listeners : {
162                                 click : function()
163                                 {
164                                     if (!_this.dialog) return;
165                                     _this.dialog.show( { id : 0 } , function() {
166                                         _this.grid.footer.onClick('first');
167                                    }); 
168                                 }
169                             }
170                         },
171                         {
172                             xtype: 'Button',
173                             xns: Roo.Toolbar,
174                             text : "Edit",
175                             cls : 'x-btn-text-icon',
176                             icon : Roo.rootURL + 'images/default/tree/leaf.gif',
177                             listeners : {
178                                 click : function()
179                                 {
180                                     var s = _this.grid.getSelectionModel().getSelections();
181                                     if (!s.length || (s.length > 1))  {
182                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
183                                         return;
184                                     }
185                                     if (!_this.dialog) return;
186                                     _this.dialog.show(s[0].data, function() {
187                                         _this.grid.footer.onClick('first');
188                                     }); 
189                                     
190                                 }
191                             }
192                         },
193                         {
194                             xtype: 'Button',
195                             xns: Roo.Toolbar,
196                             text : "Delete",
197                             cls : 'x-btn-text-icon',
198                             icon : rootURL + '/Pman/templates/images/trash.gif',
199                             listeners : {
200                                 click : function()
201                                 {
202                                      Pman.genericDelete(_this, 'cms_rssaggr'); 
203                                 }
204                             }
205                         }
206                     ]
207                 },
208                 colModel : [
209                     {
210                         xtype: 'ColumnModel',
211                         xns: Roo.grid,
212                         dataIndex : 'id',
213                         header : 'Displayed',
214                         width : 75,
215                         renderer : function(v) { return String.format('{0}', v); }
216                     },
217                     {
218                         xtype: 'ColumnModel',
219                         xns: Roo.grid,
220                         header : 'Extid',
221                         width : 200,
222                         dataIndex : 'extid',
223                         renderer : function(v) { return String.format('{0}', v); }
224                     },
225                     {
226                         xtype: 'ColumnModel',
227                         xns: Roo.grid,
228                         header : 'Published dt',
229                         width : 75,
230                         dataIndex : 'published_dt',
231                         renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
232                     },
233                     {
234                         xtype: 'ColumnModel',
235                         xns: Roo.grid,
236                         header : 'Headline',
237                         width : 200,
238                         dataIndex : 'headline',
239                         renderer : function(v) { return String.format('{0}', v); }
240                     },
241                     {
242                         xtype: 'ColumnModel',
243                         xns: Roo.grid,
244                         header : 'Body',
245                         width : 200,
246                         dataIndex : 'body',
247                         renderer : function(v) { return String.format('{0}', v); }
248                     }
249                 ]
250             }
251         });
252         this.layout = this.panel.layout;
253
254     }
255 });