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