Uncommited changes synced
[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 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.CmsAggregate = new Roo.XComponent({
8
9  _strings : {
10   '3b82002c77bd3f33f81e7be33deceb80' :"RSS Feed Aggregator",
11   '116af9a686a753275179db02cbb68f62' :"Displaying cms_rssaggr{0} - {1} of {2}",
12   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
13   '7dce122004969d56ae2e0245cb754d35' :"Edit",
14   '9b9d8a976b42e0bd66381797644943d5' :"Published",
15   '4c57e321aef3fb4261f9930dc39d9fb1' :"Update from Feed",
16   '86754577897acfb25deb69039d49d9a7' :"Displayed",
17   'b6f4933fc36f3dd21c402b0ab1e4e0c7' :"No cms_rssaggr found",
18   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
19   'c6568e77f61109390e82d035aaacaef0' :"Headline"
20  },
21
22   part     :  ["Cms", "Aggregate" ],
23   order    : '850-Pman.Tab.CmsAggregate',
24   region   : 'center',
25   parent   : 'Pman.Tab.Cms',
26   name     : "Pman.Tab.CmsAggregate",
27   disabled : false, 
28   permname : '', 
29   _tree : function()
30   {
31    var _this = this;
32    var MODULE = this;
33    return {
34    region : 'center',
35    title : _this._strings['3b82002c77bd3f33f81e7be33deceb80'] /* RSS Feed Aggregator */,
36    xns : Roo,
37    '|xns' : 'Roo',
38    xtype : 'NestedLayoutPanel',
39    layout : {
40     xns : Roo,
41     '|xns' : 'Roo',
42     xtype : 'BorderLayout',
43     center : {
44      xns : Roo,
45      '|xns' : 'Roo',
46      xtype : 'LayoutRegion'
47     },
48     south : {
49      height : 150,
50      xns : Roo,
51      '|xns' : 'Roo',
52      xtype : 'LayoutRegion'
53     },
54     items  : [
55      {
56       background : true,
57       fitContainer : true,
58       fitToframe : true,
59       region : 'center',
60       tableName : 'cms_rssaggr',
61       title : _this._strings['3b82002c77bd3f33f81e7be33deceb80'] /* RSS Feed Aggregator */,
62       xns : Roo,
63       '|xns' : 'Roo',
64       xtype : 'GridPanel',
65       listeners : {
66        activate : function() {
67             _this.panel = this;
68             if (_this.grid) {
69                 _this.grid.footer.onClick('first');
70             }
71         }
72       },
73       grid : {
74        autoExpandColumn : 'headline',
75        loadMask : true,
76        xns : Roo.grid,
77        '|xns' : 'Roo.grid',
78        xtype : 'Grid',
79        listeners : {
80         cellclick : function (_self, rowIndex, colIndex, e)
81          {
82          
83              if (colIndex != 0) {
84                  return;
85              }
86              var d = this.ds.getAt(rowIndex);
87              var s =    d.data.is_displayed ? 0 : 1;
88              d.set('is_displayed', s);
89              new Pman.Request({
90                  url : baseURL + '/Roo/cms_rssaggr',
91                  method : 'POST',
92                  params : {
93                      id : d.data.id,
94                      is_displayed : s
95                  },
96                  success : function( ) {
97                  
98                  } 
99                  // should error on failure.
100              });
101               
102          
103          },
104         render : function() 
105          {
106              _this.grid = this; 
107              //_this.dialog = Pman.Dialog.FILL_IN
108              if (_this.panel.active) {
109                 this.footer.onClick('first');
110              }
111          },
112         rowclick : function (_self, rowIndex, e)
113          {
114              _this.cpanel.setContent(
115              
116                  String.format('<div style="margin:10px">{0}</div>',
117                  _this.grid.ds.getAt(rowIndex).data.body)
118              );
119          }
120        },
121        footer : {
122         displayInfo : true,
123         displayMsg : _this._strings['116af9a686a753275179db02cbb68f62'] /* Displaying cms_rssaggr{0} - {1} of {2} */,
124         emptyMsg : _this._strings['b6f4933fc36f3dd21c402b0ab1e4e0c7'] /* No cms_rssaggr found */,
125         pageSize : 25,
126         xns : Roo,
127         '|xns' : 'Roo',
128         xtype : 'PagingToolbar'
129        },
130        toolbar : {
131         xns : Roo,
132         '|xns' : 'Roo',
133         xtype : 'Toolbar',
134         items  : [
135          {
136           text : _this._strings['4c57e321aef3fb4261f9930dc39d9fb1'] /* Update from Feed */,
137           xns : Roo.Toolbar,
138           '|xns' : 'Roo.Toolbar',
139           xtype : 'Button',
140           listeners : {
141            click : function (_self, e)
142             {
143                 Roo.MessageBox.alert("Downloading", 
144                     "Updating feed, wait till this message disapears, or press OK to let it carry on in the background"
145                 );
146                 
147                 
148                 new Pman.Request({
149                     url : baseURL + '/Roo/cms_rssaggr',
150                     method : 'GET',
151                     params : {
152                         _pullfeed : 1
153                     },
154                     success : function() {
155                         Roo.MessageBox.hide();
156                         _this.grid.footer.onClick('first');
157                     }
158                 });
159             }
160           }
161          },
162          {
163           xns : Roo.Toolbar,
164           '|xns' : 'Roo.Toolbar',
165           xtype : 'Fill'
166          },
167          {
168           cls : 'x-btn-text-icon',
169           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
170           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
171           xns : Roo.Toolbar,
172           '|xns' : 'Roo.Toolbar',
173           xtype : 'Button',
174           listeners : {
175            click : function()
176             {
177                 if (!_this.dialog) {
178                     return;
179                 }
180                 _this.dialog.show( { id : 0 } , function() {
181                     _this.grid.footer.onClick('first');
182                }); 
183             }
184           }
185          },
186          {
187           cls : 'x-btn-text-icon',
188           icon : Roo.rootURL + 'images/default/tree/leaf.gif',
189           text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
190           xns : Roo.Toolbar,
191           '|xns' : 'Roo.Toolbar',
192           xtype : 'Button',
193           listeners : {
194            click : function()
195             {
196                 var s = _this.grid.getSelectionModel().getSelections();
197                 if (!s.length || (s.length > 1))  {
198                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
199                     return;
200                 }
201                 if (!_this.dialog) {
202                     return;
203                 }
204                 
205                 _this.dialog.show(s[0].data, function() {
206                     _this.grid.footer.onClick('first');
207                 }); 
208                 
209             }
210           }
211          },
212          {
213           cls : 'x-btn-text-icon',
214           icon : rootURL + '/Pman/templates/images/trash.gif',
215           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
216           xns : Roo.Toolbar,
217           '|xns' : 'Roo.Toolbar',
218           xtype : 'Button',
219           listeners : {
220            click : function()
221             {
222                  Pman.genericDelete(_this, 'cms_rssaggr'); 
223             }
224           }
225          }
226         ]
227        },
228        dataSource : {
229         remoteSort : true,
230         sortInfo : { field : 'published_dt', direction: 'DESC' },
231         xns : Roo.data,
232         '|xns' : 'Roo.data',
233         xtype : 'Store',
234         proxy : {
235          method : 'GET',
236          url : baseURL + '/Roo/cms_rssaggr.php',
237          xns : Roo.data,
238          '|xns' : 'Roo.data',
239          xtype : 'HttpProxy'
240         },
241         reader : {
242          fields : [
243              {
244                  'name': 'id',
245                  'type': 'int'
246              },
247              {
248                  'name': 'extid',
249                  'type': 'string'
250              },
251              {
252                  'name': 'published_dt',
253                  'type': 'date',
254                  'dateFormat': 'Y-m-d'
255              },
256              {
257                  'name': 'headline',
258                  'type': 'string'
259              },
260              {
261                  'name': 'body',
262                  'type': 'string'
263              },
264              {
265                  'name': 'src_id',
266                  'type': 'int'
267              }
268          ],
269          id : 'id',
270          root : 'data',
271          totalProperty : 'total',
272          xns : Roo.data,
273          '|xns' : 'Roo.data',
274          xtype : 'JsonReader'
275         }
276        },
277        colModel : [
278         {
279          dataIndex : 'is_displayed',
280          header : _this._strings['86754577897acfb25deb69039d49d9a7'] /* Displayed */,
281          renderer : function(v) {  
282              var state = v> 0 ?  '-checked' : '';
283          
284              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
285                          
286           },
287          width : 75,
288          xns : Roo.grid,
289          '|xns' : 'Roo.grid',
290          xtype : 'ColumnModel'
291         },
292         {
293          dataIndex : 'published_dt',
294          header : _this._strings['9b9d8a976b42e0bd66381797644943d5'] /* Published */,
295          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
296          width : 75,
297          xns : Roo.grid,
298          '|xns' : 'Roo.grid',
299          xtype : 'ColumnModel'
300         },
301         {
302          dataIndex : 'headline',
303          header : _this._strings['c6568e77f61109390e82d035aaacaef0'] /* Headline */,
304          renderer : function(v) { return String.format('{0}', v); },
305          width : 200,
306          xns : Roo.grid,
307          '|xns' : 'Roo.grid',
308          xtype : 'ColumnModel'
309         }
310        ]
311       }
312      },
313      {
314       region : 'south',
315       xns : Roo,
316       '|xns' : 'Roo',
317       xtype : 'ContentPanel',
318       listeners : {
319        render : function (_self)
320         {
321             _this.cpanel = _self;
322         }
323       }
324      }
325     ]
326    }
327   };  }
328 });