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: 'Fill',
133                             xns: Roo.Toolbar
134                         },
135                         {
136                             xtype: 'Button',
137                             xns: Roo.Toolbar,
138                             text : "Add",
139                             cls : 'x-btn-text-icon',
140                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
141                             listeners : {
142                                 click : function()
143                                 {
144                                     if (!_this.dialog) return;
145                                     _this.dialog.show( { id : 0 } , function() {
146                                         _this.grid.footer.onClick('first');
147                                    }); 
148                                 }
149                             }
150                         },
151                         {
152                             xtype: 'Button',
153                             xns: Roo.Toolbar,
154                             text : "Edit",
155                             cls : 'x-btn-text-icon',
156                             icon : Roo.rootURL + 'images/default/tree/leaf.gif',
157                             listeners : {
158                                 click : function()
159                                 {
160                                     var s = _this.grid.getSelectionModel().getSelections();
161                                     if (!s.length || (s.length > 1))  {
162                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
163                                         return;
164                                     }
165                                     if (!_this.dialog) return;
166                                     _this.dialog.show(s[0].data, function() {
167                                         _this.grid.footer.onClick('first');
168                                     }); 
169                                     
170                                 }
171                             }
172                         },
173                         {
174                             xtype: 'Button',
175                             xns: Roo.Toolbar,
176                             text : "Delete",
177                             cls : 'x-btn-text-icon',
178                             icon : rootURL + '/Pman/templates/images/trash.gif',
179                             listeners : {
180                                 click : function()
181                                 {
182                                      Pman.genericDelete(_this, 'cms_rssaggr'); 
183                                 }
184                             }
185                         }
186                     ]
187                 },
188                 colModel : [
189                     {
190                         xtype: 'ColumnModel',
191                         xns: Roo.grid,
192                         header : 'Id',
193                         width : 75,
194                         dataIndex : 'id',
195                         renderer : function(v) { return String.format('{0}', v); }
196                     },
197                     {
198                         xtype: 'ColumnModel',
199                         xns: Roo.grid,
200                         header : 'Extid',
201                         width : 200,
202                         dataIndex : 'extid',
203                         renderer : function(v) { return String.format('{0}', v); }
204                     },
205                     {
206                         xtype: 'ColumnModel',
207                         xns: Roo.grid,
208                         header : 'Published dt',
209                         width : 75,
210                         dataIndex : 'published_dt',
211                         renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
212                     },
213                     {
214                         xtype: 'ColumnModel',
215                         xns: Roo.grid,
216                         header : 'Headline',
217                         width : 200,
218                         dataIndex : 'headline',
219                         renderer : function(v) { return String.format('{0}', v); }
220                     },
221                     {
222                         xtype: 'ColumnModel',
223                         xns: Roo.grid,
224                         header : 'Body',
225                         width : 200,
226                         dataIndex : 'body',
227                         renderer : function(v) { return String.format('{0}', v); }
228                     },
229                     {
230                         xtype: 'ColumnModel',
231                         xns: Roo.grid,
232                         header : 'Src',
233                         width : 75,
234                         dataIndex : 'src_id',
235                         renderer : function(v) { return String.format('{0}', v); }
236                     }
237                 ]
238             }
239         });
240         this.layout = this.panel.layout;
241
242     }
243 });