sync
[Pman.Admin] / Pman.Tab.AdminEmailTemplates.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.AdminEmailTemplates = new Roo.XComponent({
8
9  _strings : {
10   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
11   'c7d299bf3f9e37c77ab646f7e5366696' :"core_email",
12   '00d6e06d2f3c092b4f5e1e708a360b0f' :"Displaying Message{0} - {1} of {2}",
13   '9076cbba1d9ef79280b4f39e2aa0d115' :"Nothing found",
14   'b78a3223503896721cca1303f776159b' :"Title",
15   '68b00d723d37122f64da8d9939f836f0' :"BCC Group",
16   '9e11143e29a031212f2cdefcf61f39e9' :"View Message",
17   'f49559cda3fb906fbd7736f8b8a0e37d' :"Email Template",
18   '01bd6a16732dfa2b760dc8566c58afae' :"Download to Excel",
19   '4a4a8fe0c6dfb6bd2a41755d15eb6f0b' :"From Name",
20   '4ca679a383343ab3d4ca1cd7c91b43f7' :"From Email",
21   '5fb63579fc981698f97d55bfecb213ea' :"Copy",
22   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
23   '49ee3087348e8d44e1feda1917443987' :"Name"
24  },
25
26   part     :  ["Admin", "EmailTemplates" ],
27   order    : '999-Pman.Tab.AdminEmailTemplates',
28   region   : 'center',
29   parent   : 'Pman.Tab.Admin',
30   name     : "Manage Email Templates",
31   disabled : false, 
32   permname : '', 
33   _tree : function(_data)
34   {
35    var _this = this;
36    var MODULE = this;
37    return {
38    xtype : 'NestedLayoutPanel',
39    region : 'center',
40    title : _this._strings['f49559cda3fb906fbd7736f8b8a0e37d'] /* Email Template */,
41    listeners : {
42     render : function (_self)
43      {
44          _this.nest = this;
45      }
46    },
47    xns : Roo,
48    '|xns' : 'Roo',
49    layout : {
50     xtype : 'BorderLayout',
51     xns : Roo,
52     '|xns' : 'Roo',
53     center : {
54      xtype : 'LayoutRegion',
55      autoScroll : false,
56      split : true,
57      xns : Roo,
58      '|xns' : 'Roo'
59     },
60     south : {
61      xtype : 'LayoutRegion',
62      height : 300,
63      split : true,
64      titlebar : true,
65      xns : Roo,
66      '|xns' : 'Roo'
67     },
68     items  : [
69      {
70       xtype : 'GridPanel',
71       background : true,
72       fitContainer : true,
73       fitToframe : true,
74       region : 'center',
75       tableName : 'core_email',
76       title : _this._strings['c7d299bf3f9e37c77ab646f7e5366696'] /* core_email */,
77       listeners : {
78        activate : function() {
79             _this.panel = this;
80             if (_this.grid) {
81                 _this.grid.footer.onClick('first');
82             }
83         }
84       },
85       xns : Roo,
86       '|xns' : 'Roo',
87       grid : {
88        xtype : 'Grid',
89        autoExpandColumn : 'subject',
90        loadMask : true,
91        listeners : {
92         render : function() 
93          {
94              _this.grid = this; 
95              _this.dialog = Pman.Dialog.CoreEmail;
96              if (_this.panel.active) {
97                 _this.grid.footer.onClick('first');
98              }
99          },
100         rowclick : function (_self, rowIndex, e)
101          {
102             // _this.grid.ds.load({});
103              _this.viewPanel.view.store.load({});
104          },
105         rowdblclick : function (_self, rowIndex, e)
106          {
107              if (!_this.dialog) { 
108                  return;
109                  }
110              var data = this.getDataSource().getAt(rowIndex).data;
111              _this.dialog.show( {id : data.id, module : 'core_email'} , function() {
112                  _this.grid.footer.onClick('first');
113              }); 
114          }
115        },
116        xns : Roo.grid,
117        '|xns' : 'Roo.grid',
118        footer : {
119         xtype : 'PagingToolbar',
120         displayInfo : true,
121         displayMsg : _this._strings['00d6e06d2f3c092b4f5e1e708a360b0f'] /* Displaying Message{0} - {1} of {2} */,
122         emptyMsg : _this._strings['9076cbba1d9ef79280b4f39e2aa0d115'] /* Nothing found */,
123         pageSize : 25,
124         xns : Roo,
125         '|xns' : 'Roo',
126         items  : [
127          {
128           xtype : 'Button',
129           text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
130           listeners : {
131            click : function()
132             {
133                
134             new Pman.Download({
135                 url : baseURL + '/Roo/Core_email',
136                 method : 'GET',
137                 params : {
138                     csvCols : '*',
139                     csvTitles : '*'
140                 }
141             });
142             Roo.MessageBox.alert("Notice", "Should be downloading now");
143               
144             }
145           },
146           xns : Roo.Toolbar,
147           '|xns' : 'Roo.Toolbar'
148          }
149         ]
150        },
151        toolbar : {
152         xtype : 'Toolbar',
153         xns : Roo,
154         '|xns' : 'Roo',
155         items  : [
156          {
157           xtype : 'TextField',
158           listeners : {
159            render : function (_self)
160             {
161                 _this.searchBox = _self;
162             },
163            specialkey : function (_self, e)
164             {
165               _this.grid.footer.onClick('first');
166             }
167           },
168           xns : Roo.form,
169           '|xns' : 'Roo.form'
170          },
171          {
172           xtype : 'Button',
173           cls : 'x-btn-icon',
174           icon : rootURL + '/Pman/templates/images/search.gif',
175           listeners : {
176            click : function (_self, e)
177             {
178                 _this.grid.footer.onClick('first');
179             }
180           },
181           xns : Roo.Toolbar,
182           '|xns' : 'Roo.Toolbar'
183          },
184          {
185           xtype : 'Button',
186           cls : 'x-btn-icon',
187           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
188           listeners : {
189            click : function (_self, e)
190             {
191                 _this.searchBox.setValue('');\r
192                 _this.grid.footer.onClick('first');\r
193             }
194           },
195           xns : Roo.Toolbar,
196           '|xns' : 'Roo.Toolbar'
197          },
198          {
199           xtype : 'Fill',
200           xns : Roo.Toolbar,
201           '|xns' : 'Roo.Toolbar'
202          },
203          {
204           xtype : 'Button',
205           cls : 'x-btn-text-icon',
206           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
207           text : _this._strings['5fb63579fc981698f97d55bfecb213ea'] /* Copy */,
208           listeners : {
209            click : function()
210             {
211               var sel = _this.grid.selModel.getSelected();
212               if (!sel) {
213                     Roo.MessageBox.alert("Error", "Select a message to copy");
214                     return;
215                 }
216             new Pman.Request({
217                 url : baseURL + '/Roo/Core_email',
218                 method : 'POST',
219                 params : {
220                     id : sel.data.id,
221                     _make_copy : 1
222                 },
223                 success : function() {
224                     _this.grid.footer.onClick('refresh');
225                 }
226             });
227               
228             }
229           },
230           xns : Roo.Toolbar,
231           '|xns' : 'Roo.Toolbar'
232          },
233          {
234           xtype : 'Button',
235           cls : 'x-btn-text-icon',
236           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
237           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
238           listeners : {
239            click : function()
240             {
241                 if (!_this.dialog) {
242                      return;
243                      }
244                 _this.dialog.show( { id : 0, module : 'core_email' } , function() {
245                     _this.grid.footer.onClick('first');
246                }); 
247             }
248           },
249           xns : Roo.Toolbar,
250           '|xns' : 'Roo.Toolbar'
251          },
252          {
253           xtype : 'Separator',
254           xns : Roo.Toolbar,
255           '|xns' : 'Roo.Toolbar'
256          },
257          {
258           xtype : 'Button',
259           cls : 'x-btn-text-icon',
260           icon : rootURL + '/Pman/templates/images/trash.gif',
261           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
262           listeners : {
263            click : function()
264             {
265                 Pman.genericDelete(_this, 'core_email');
266                 
267             }
268           },
269           xns : Roo.Toolbar,
270           '|xns' : 'Roo.Toolbar'
271          }
272         ]
273        },
274        dataSource : {
275         xtype : 'Store',
276         remoteSort : true,
277         sortInfo : { field : 'description', direction: 'ASC' },
278         listeners : {
279          beforeload : function (_self, options)
280           {
281               options.params = options.params || {};
282               
283               var s = _this.searchBox.getValue();
284               
285               if(s.length){
286                   options.params['search[nameortitle]'] = s;
287               }
288           
289           }
290         },
291         xns : Roo.data,
292         '|xns' : 'Roo.data',
293         proxy : {
294          xtype : 'HttpProxy',
295          method : 'GET',
296          url : baseURL + '/Roo/Core_email.php',
297          xns : Roo.data,
298          '|xns' : 'Roo.data'
299         },
300         reader : {
301          xtype : 'JsonReader',
302          fields : [
303              {
304                  "name":"name",
305                  "type":"string"
306              },
307              {
308                  "name":"subject",
309                  "type":"string"
310              }
311          ],
312          id : 'id',
313          root : 'data',
314          totalProperty : 'total',
315          xns : Roo.data,
316          '|xns' : 'Roo.data'
317         }
318        },
319        sm : {
320         xtype : 'RowSelectionModel',
321         singleSelect : true,
322         xns : Roo.grid,
323         '|xns' : 'Roo.grid'
324        },
325        cm : [
326         {
327          xtype : 'ColumnModel',
328          dataIndex : 'name',
329          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
330          renderer : function(v,x,r) 
331          { 
332              if (r.data.description.length > 0) {
333                  v = r.data.description;
334              }
335              
336              
337              if(r.data.active * 1 < 1){
338                  return String.format('<s>{0}</s>', v ? v : ''); 
339              }
340              
341              return String.format('{0}', v ? v : ''); 
342          },
343          sortable : true,
344          width : 250,
345          xns : Roo.grid,
346          '|xns' : 'Roo.grid'
347         },
348         {
349          xtype : 'ColumnModel',
350          dataIndex : 'subject',
351          header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
352          renderer : function(v,x,r) 
353          { 
354              if(r.data.active * 1 < 1){
355                  return String.format('<s>{0}</s>', v ? v : ''); 
356              }
357              
358              return String.format('{0}', v ? v : ''); 
359          },
360          sortable : true,
361          width : 300,
362          xns : Roo.grid,
363          '|xns' : 'Roo.grid'
364         },
365         {
366          xtype : 'ColumnModel',
367          dataIndex : 'from_name',
368          header : _this._strings['4a4a8fe0c6dfb6bd2a41755d15eb6f0b'] /* From Name */,
369          renderer : function(v) { return String.format('{0}', v ? v : ''); },
370          sortable : true,
371          width : 150,
372          xns : Roo.grid,
373          '|xns' : 'Roo.grid'
374         },
375         {
376          xtype : 'ColumnModel',
377          dataIndex : 'from_email',
378          header : _this._strings['4ca679a383343ab3d4ca1cd7c91b43f7'] /* From Email */,
379          renderer : function(v) { return String.format('{0}', v ? v : ''); },
380          sortable : true,
381          width : 150,
382          xns : Roo.grid,
383          '|xns' : 'Roo.grid'
384         },
385         {
386          xtype : 'ColumnModel',
387          dataIndex : 'bcc_group_name',
388          header : _this._strings['68b00d723d37122f64da8d9939f836f0'] /* BCC Group */,
389          renderer : function(v) { return String.format('{0}', v ? v : ''); },
390          sortable : true,
391          width : 150,
392          xns : Roo.grid,
393          '|xns' : 'Roo.grid'
394         }
395        ]
396       }
397      },
398      {
399       xtype : 'ContentPanel',
400       autoScroll : true,
401       background : false,
402       fitContainer : true,
403       fitToFrame : true,
404       region : 'south',
405       title : _this._strings['9e11143e29a031212f2cdefcf61f39e9'] /* View Message */,
406       listeners : {
407        render : function (_self)
408         {
409             _this.viewPanel = _self;
410         }
411       },
412       xns : Roo,
413       '|xns' : 'Roo',
414       view : {
415        xtype : 'View',
416        tpl : new Roo.DomTemplate({url : rootURL+'/Pman/Crm/domtemplates/crm_mail.html'}),
417        listeners : {
418         preparedata : function (_self, data, i, rec)
419          {
420             // Roo.log(data);
421              //Roo.apply(data, rec.json);
422          }
423        },
424        xns : Roo,
425        '|xns' : 'Roo',
426        store : {
427         xtype : 'Store',
428         listeners : {
429          beforeload : function (_self, options)
430           {
431               options.params = options.params || {};
432               var p = _this.grid.selModel.getSelected();
433               if (!p || !p.data.id) {
434                   this.removeAll();
435                   return false;
436               }
437              
438               options.params['id'] = p.data.id;
439            
440           },
441          load : function (_self, records, options)
442           {
443               var p = _this.grid.selModel.getSelected();
444             //  Roo.log(p);
445               if (!p || !p.data.id) {
446                   this.removeAll();
447                   return false;
448               }
449            
450           }
451         },
452         xns : Roo.data,
453         '|xns' : 'Roo.data',
454         proxy : {
455          xtype : 'HttpProxy',
456          method : 'GET',
457          url : baseURL+'/Roo/Core_email.php',
458          xns : Roo.data,
459          '|xns' : 'Roo.data'
460         },
461         reader : {
462          xtype : 'JsonReader',
463          id : 'id',
464          root : 'data',
465          totalProperty : 'total',
466          xns : Roo.data,
467          '|xns' : 'Roo.data'
468         }
469        }
470       }
471      }
472     ]
473    }
474   };  }
475 });