Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.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.AdminNotify = new Roo.XComponent({
8
9  _strings : {
10   '136fac3c5c5881e0a7d0039e57decd68' :"Select notify type",
11   'bf1cb7e2a337a5e2ebf614009cbce9cc' :"Current Notifications",
12   '8535bcc0f05358a583bb432bbadf7e0d' :"Select type",
13   'e12167aa0a7698e6ebc92b4ce3909b53' :"To",
14   '478192f02d448c49bc6b7d76818d8483' :"Ontable",
15   'dca4dd744d00b6fe1362ef7825ffdee5' :"No core_notify found",
16   'dc873ea4b71ca217b0d8d1fdd45854ac' :"id#",
17   '0f6d01b16d57911731aa44b94dbfefcc' :"Act when",
18   '7f8c0283f16925caed8e632086b81b9c' :"Sent",
19   'c956c97343a45cca5d492e70c56daa8e' :"Select person",
20   '12832b4def6eb0b6105b3d11e16066ea' :"Msgid",
21   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
22   '24463f10155b8af973300f86302c4fde' :"Who to notify",
23   'b22e7ea679daf5146f08f477419dd8bd' :"Triggered by",
24   '5da618e8e4b89c66fe86e32cdafde142' :"From",
25   'e4b478c05a833569833f9cc63b6c4354' :"Displaying core_notify{0} - {1} of {2}",
26   '4c3880bb027f159e801041b1021e88e8' :"Method",
27   'a4ecfc70574394990cf17bd83df499f7' :"Event",
28   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
29   'f821027bade4aa6b7a4191cd1676cf41' :"Show Completed"
30  },
31
32   part     :  ["Admin", "Notify" ],
33   order    : '001-Pman.Tab.AdminNotify',
34   region   : 'center',
35   parent   : 'Pman.Tab.AdminWatchNotify',
36   name     : "Pman.Tab.AdminNotify",
37   disabled : false, 
38   permname : '', 
39   _tree : function()
40   {
41    var _this = this;
42    var MODULE = this;
43    return {
44    title : _this._strings['bf1cb7e2a337a5e2ebf614009cbce9cc'] /* Current Notifications */,
45    xns : Roo,
46    '|xns' : 'Roo',
47    xtype : 'NestedLayoutPanel',
48    layout : {
49     xns : Roo,
50     '|xns' : 'Roo',
51     xtype : 'BorderLayout',
52     center : {
53      xns : Roo,
54      '|xns' : 'Roo',
55      xtype : 'LayoutRegion'
56     },
57     south : {
58      autoScroll : true,
59      height : 150,
60      split : true,
61      xns : Roo,
62      '|xns' : 'Roo',
63      xtype : 'LayoutRegion'
64     },
65     items  : [
66      {
67       background : true,
68       fitContainer : true,
69       fitToframe : true,
70       region : 'center',
71       tableName : 'core_notify',
72       title : _this._strings['bf1cb7e2a337a5e2ebf614009cbce9cc'] /* Current Notifications */,
73       xns : Roo,
74       '|xns' : 'Roo',
75       xtype : 'GridPanel',
76       listeners : {
77        activate : function() {
78             _this.panel = this;
79             if (_this.grid) {
80                 _this.grid.footer.onClick('first');
81             }
82             
83         }
84       },
85       grid : {
86        autoExpandColumn : 'person_id_name',
87        loadMask : true,
88        xns : Roo.grid,
89        '|xns' : 'Roo.grid',
90        xtype : 'Grid',
91        listeners : {
92         render : function() 
93          {
94              _this.grid = this; 
95              //_this.dialog = Pman.Dialog.FILL_IN
96              if (_this.panel.active) {
97                 this.footer.onClick('first');
98              }
99          }
100        },
101        footer : {
102         displayInfo : true,
103         displayMsg : _this._strings['e4b478c05a833569833f9cc63b6c4354'] /* Displaying core_notify{0} - {1} of {2} */,
104         emptyMsg : _this._strings['dca4dd744d00b6fe1362ef7825ffdee5'] /* No core_notify found */,
105         pageSize : 25,
106         xns : Roo,
107         '|xns' : 'Roo',
108         xtype : 'PagingToolbar'
109        },
110        toolbar : {
111         xns : Roo,
112         '|xns' : 'Roo',
113         xtype : 'Toolbar',
114         items  : [
115          {
116           allowBlank : true,
117           displayField : 'person_id_name',
118           editable : true,
119           emptyText : _this._strings['c956c97343a45cca5d492e70c56daa8e'] /* Select person */,
120           forceSelection : true,
121           listWidth : 400,
122           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
123           minChars : 2,
124           pageSize : 20,
125           qtip : _this._strings['c956c97343a45cca5d492e70c56daa8e'] /* Select person */,
126           queryParam : 'query[person_id_name]',
127           selectOnFocus : true,
128           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>',
129           triggerAction : 'all',
130           valueField : 'person_id',
131           width : 200,
132           xns : Roo.form,
133           '|xns' : 'Roo.form',
134           xtype : 'ComboBox',
135           listeners : {
136            render : function (_self)
137             {
138                _this.personCombo = _self;
139             },
140            select : function (combo, record, index)
141             {
142                _this.grid.footer.onClick('first');
143             }
144           },
145           store : {
146            remoteSort : true,
147            sortInfo : { direction : 'ASC', field: 'person_id_name' },
148            xns : Roo.data,
149            '|xns' : 'Roo.data',
150            xtype : 'Store',
151            listeners : {
152             beforeload : function (_self, o){
153                  o.params = o.params || {};
154                  o.params._distinct='person_id';
155                  o.params._columns='person_id,person_id_name,person_id_email';
156                  o.params['!person_id_name'] = '';
157                  
158                  // set more here
159              }
160            },
161            proxy : {
162             method : 'GET',
163             url : baseURL + '/Roo/core_notify.php',
164             xns : Roo.data,
165             '|xns' : 'Roo.data',
166             xtype : 'HttpProxy'
167            },
168            reader : {
169             fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}],
170             id : 'id',
171             root : 'data',
172             totalProperty : 'total',
173             xns : Roo.data,
174             '|xns' : 'Roo.data',
175             xtype : 'JsonReader'
176            }
177           }
178          },
179          {
180           xns : Roo.Toolbar,
181           '|xns' : 'Roo.Toolbar',
182           xtype : 'Separator'
183          },
184          {
185           allowBlank : true,
186           displayField : 'display_name',
187           editable : true,
188           emptyText : _this._strings['136fac3c5c5881e0a7d0039e57decd68'] /* Select notify type */,
189           forceSelection : true,
190           listWidth : 400,
191           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
192           minChars : 2,
193           pageSize : 20,
194           qtip : _this._strings['8535bcc0f05358a583bb432bbadf7e0d'] /* Select type */,
195           queryParam : 'query[name]',
196           selectOnFocus : true,
197           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b></div>',
198           triggerAction : 'all',
199           valueField : 'name',
200           width : 200,
201           xns : Roo.form,
202           '|xns' : 'Roo.form',
203           xtype : 'ComboBox',
204           listeners : {
205            render : function (_self)
206             {
207                _this.typeCombo = _self;
208             },
209            select : function (combo, record, index)
210             {
211                _this.grid.footer.onClick('first');
212             }
213           },
214           store : {
215            remoteSort : true,
216            sortInfo : { direction : 'ASC', field: 'id' },
217            xns : Roo.data,
218            '|xns' : 'Roo.data',
219            xtype : 'Store',
220            listeners : {
221             beforeload : function (_self, o){
222                  o.params = o.params || {};
223                  o.params.etype = 'Core.NotifyType';
224                  o.params.active = 1;
225              }
226            },
227            proxy : {
228             method : 'GET',
229             url : baseURL + '/Roo/core_enum.php',
230             xns : Roo.data,
231             '|xns' : 'Roo.data',
232             xtype : 'HttpProxy'
233            },
234            reader : {
235             fields : [{"name":"name","type":"string"},{"name":"display_name","type":"string"}],
236             id : 'id',
237             root : 'data',
238             totalProperty : 'total',
239             xns : Roo.data,
240             '|xns' : 'Roo.data',
241             xtype : 'JsonReader'
242            }
243           }
244          },
245          {
246           xns : Roo.Toolbar,
247           '|xns' : 'Roo.Toolbar',
248           xtype : 'Separator'
249          },
250          {
251           text : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
252           xns : Roo.Toolbar,
253           '|xns' : 'Roo.Toolbar',
254           xtype : 'TextItem'
255          },
256          {
257           format : 'd/M/Y',
258           width : 100,
259           xns : Roo.form,
260           '|xns' : 'Roo.form',
261           xtype : 'DateField',
262           listeners : {
263            render : function (_self)
264             {
265                 _this.fromDateSel = _self;
266                //_self.setValue(  new Date() );
267             },
268            select : function (combo, date)
269             {
270                 _this.grid.footer.onClick('first');
271             }
272           }
273          },
274          {
275           xns : Roo.Toolbar,
276           '|xns' : 'Roo.Toolbar',
277           xtype : 'Separator'
278          },
279          {
280           text : _this._strings['e12167aa0a7698e6ebc92b4ce3909b53'] /* To */,
281           xns : Roo.Toolbar,
282           '|xns' : 'Roo.Toolbar',
283           xtype : 'TextItem'
284          },
285          {
286           format : 'd/M/Y',
287           width : 100,
288           xns : Roo.form,
289           '|xns' : 'Roo.form',
290           xtype : 'DateField',
291           listeners : {
292            render : function (_self)
293             {
294                 _this.toDateSel = _self;
295                //_self.setValue(  new Date() );
296             },
297            select : function (combo, date)
298             {
299                 _this.grid.footer.onClick('first');
300             }
301           }
302          },
303          {
304           xns : Roo.Toolbar,
305           '|xns' : 'Roo.Toolbar',
306           xtype : 'Fill'
307          },
308          {
309           cls : 'x-btn-text-icon',
310           icon : rootURL + '/Pman/templates/images/trash.gif',
311           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
312           xns : Roo.Toolbar,
313           '|xns' : 'Roo.Toolbar',
314           xtype : 'Button',
315           listeners : {
316            click : function()
317             {
318                 Pman.genericDelete(_this, 'core_notify'); 
319             }
320           }
321          },
322          {
323           enableToggle : true,
324           text : _this._strings['f821027bade4aa6b7a4191cd1676cf41'] /* Show Completed */,
325           xns : Roo.Toolbar,
326           '|xns' : 'Roo.Toolbar',
327           xtype : 'Button',
328           listeners : {
329            render : function (_self)
330             {
331                 _this.toggleBtn = _self;
332             },
333            toggle : function (_self, pressed)
334             {
335                 this.setText(pressed ? "Hide Completed" : "Show Completed");
336                 _this.grid.footer.onClick('first');
337             }
338           }
339          }
340         ]
341        },
342        dataSource : {
343         remoteSort : true,
344         sortInfo : { field : 'act_when', direction: 'DESC' },
345         xns : Roo.data,
346         '|xns' : 'Roo.data',
347         xtype : 'Store',
348         listeners : {
349          beforeload : function (_self, options)
350           {
351               options.params = options.params || {};
352               
353               options.params._evtype_align = 1;
354               
355               if (!_this.toggleBtn.pressed) {
356                   options.params['event_id'] = 0;
357               }
358               if (!_this.personCombo) {
359                   return false;
360               }
361               var p = _this.personCombo.getValue();
362               if (p*1) { 
363                   options.params.person_id = p;
364               }
365               
366               var from = _this.fromDateSel.getValue();
367               
368               if(from){
369                   options.params.from = from.format('Y-m-d');
370               }
371               
372               var to = _this.toDateSel.getValue();
373               
374               if(to){
375                   options.params.to = to.format('Y-m-d');
376               }
377               
378               var type = _this.typeCombo.getValue();
379               
380               if(type.length){
381                   options.params.evtype = type;
382               }
383           }
384         },
385         proxy : {
386          method : 'GET',
387          url : baseURL + '/Roo/core_notify.php',
388          xns : Roo.data,
389          '|xns' : 'Roo.data',
390          xtype : 'HttpProxy'
391         },
392         reader : {
393          fields : [
394              {
395                  'name': 'id',
396                  'type': 'int'
397              },
398              {
399                  'name': 'act_when',
400                  'type': 'date',
401                  'dateFormat': 'Y-m-d'
402              },
403              {
404                  'name': 'onid',
405                  'type': 'int'
406              },
407              {
408                  'name': 'ontable',
409                  'type': 'string'
410              },
411              {
412                  'name': 'person_id',
413                  'type': 'int'
414              },
415              {
416                  'name': 'msgid',
417                  'type': 'string'
418              },
419              {
420                  'name': 'sent',
421                  'type': 'date',
422                  'dateFormat': 'Y-m-d'
423              },
424              {
425                  'name': 'event_id',
426                  'type': 'int'
427              },
428              {
429                  'name': 'person_id_id',
430                  'type': 'int'
431              },
432              {
433                  'name': 'person_id_office_id',
434                  'type': 'int'
435              },
436              {
437                  'name': 'person_id_name',
438                  'type': 'string'
439              },
440              {
441                  'name': 'person_id_phone',
442                  'type': 'string'
443              },
444              {
445                  'name': 'person_id_fax',
446                  'type': 'string'
447              },
448              {
449                  'name': 'person_id_email',
450                  'type': 'string'
451              },
452              {
453                  'name': 'person_id_company_id',
454                  'type': 'int'
455              },
456              {
457                  'name': 'person_id_role',
458                  'type': 'string'
459              },
460              {
461                  'name': 'person_id_active',
462                  'type': 'int'
463              },
464              {
465                  'name': 'person_id_remarks',
466                  'type': 'string'
467              },
468              {
469                  'name': 'person_id_passwd',
470                  'type': 'string'
471              },
472              {
473                  'name': 'person_id_owner_id',
474                  'type': 'int'
475              },
476              {
477                  'name': 'person_id_lang',
478                  'type': 'string'
479              },
480              {
481                  'name': 'person_id_no_reset_sent',
482                  'type': 'int'
483              },
484              {
485                  'name': 'person_id_action_type',
486                  'type': 'string'
487              },
488              {
489                  'name': 'person_id_project_id',
490                  'type': 'int'
491              },
492              {
493                  'name': 'person_id_deleted_by',
494                  'type': 'int'
495              },
496              {
497                  'name': 'person_id_deleted_dt',
498                  'type': 'date'
499              },
500              {
501                  'name': 'event_id_id',
502                  'type': 'int'
503              },
504              {
505                  'name': 'event_id_person_name',
506                  'type': 'string'
507              },
508              {
509                  'name': 'event_id_event_when',
510                  'type': 'date'
511              },
512              {
513                  'name': 'event_id_action',
514                  'type': 'string'
515              },
516              {
517                  'name': 'event_id_ipaddr',
518                  'type': 'string'
519              },
520              {
521                  'name': 'event_id_on_id',
522                  'type': 'int'
523              },
524              {
525                  'name': 'event_id_on_table',
526                  'type': 'string'
527              },
528              {
529                  'name': 'event_id_person_id',
530                  'type': 'int'
531              },
532              {
533                  'name': 'event_id_remarks',
534                  'type': 'string'
535              }
536          ],
537          id : 'id',
538          root : 'data',
539          totalProperty : 'total',
540          xns : Roo.data,
541          '|xns' : 'Roo.data',
542          xtype : 'JsonReader'
543         }
544        },
545        colModel : [
546         {
547          dataIndex : 'id',
548          header : _this._strings['dc873ea4b71ca217b0d8d1fdd45854ac'] /* id# */,
549          renderer : function(v) { return String.format('{0}', v ); },
550          sortable : true,
551          width : 50,
552          xns : Roo.grid,
553          '|xns' : 'Roo.grid',
554          xtype : 'ColumnModel'
555         },
556         {
557          dataIndex : 'evtype',
558          header : _this._strings['4c3880bb027f159e801041b1021e88e8'] /* Method */,
559          renderer : function(v,x,r) 
560          { 
561              var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;
562              return String.format('<span qtip="{0}">{1}</span>', v, vv ); 
563          },
564          sortable : true,
565          width : 100,
566          xns : Roo.grid,
567          '|xns' : 'Roo.grid',
568          xtype : 'ColumnModel'
569         },
570         {
571          dataIndex : 'act_when',
572          header : _this._strings['0f6d01b16d57911731aa44b94dbfefcc'] /* Act when */,
573          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
574          sortable : true,
575          width : 150,
576          xns : Roo.grid,
577          '|xns' : 'Roo.grid',
578          xtype : 'ColumnModel'
579         },
580         {
581          dataIndex : 'sent',
582          header : _this._strings['7f8c0283f16925caed8e632086b81b9c'] /* Sent */,
583          renderer : function(v,x,r) {
584              if (r.data.event_id *1 == 0) {
585                  return '';
586              }
587               return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');
588            },
589          sortable : true,
590          width : 150,
591          xns : Roo.grid,
592          '|xns' : 'Roo.grid',
593          xtype : 'ColumnModel'
594         },
595         {
596          dataIndex : 'ontable',
597          header : _this._strings['478192f02d448c49bc6b7d76818d8483'] /* Ontable */,
598          renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); },
599          width : 150,
600          xns : Roo.grid,
601          '|xns' : 'Roo.grid',
602          xtype : 'ColumnModel'
603         },
604         {
605          dataIndex : 'person_id_name',
606          header : _this._strings['24463f10155b8af973300f86302c4fde'] /* Who to notify */,
607          renderer : function(v,x,r) {
608          
609              var pt = r.data.person_table.toLowerCase() ;
610              var pt = pt.length ? pt : 'person';
611               var ecol = pt + '_id_email' ;
612               var ncol = pt + '_id_name' ;
613               return String.format('{0} <u>&lt;{1}&gt;</u>', r.data[ncol], r.data[ecol]); 
614           },
615          width : 100,
616          xns : Roo.grid,
617          '|xns' : 'Roo.grid',
618          xtype : 'ColumnModel'
619         },
620         {
621          dataIndex : 'trigger_event_id',
622          header : _this._strings['b22e7ea679daf5146f08f477419dd8bd'] /* Triggered by */,
623          renderer : function(v,x,r) {
624               return String.format(
625                      '{0} : {1} {2}', 
626                      r.data.trigger_event_id_on_table, 
627                      r.data.trigger_event_id_on_id, 
628                      r.data.trigger_event_id_remarks
629                  ); 
630           },
631          width : 100,
632          xns : Roo.grid,
633          '|xns' : 'Roo.grid',
634          xtype : 'ColumnModel'
635         },
636         {
637          dataIndex : 'msgid',
638          header : _this._strings['12832b4def6eb0b6105b3d11e16066ea'] /* Msgid */,
639          renderer : function(v) { return String.format('{0}', v); },
640          width : 200,
641          xns : Roo.grid,
642          '|xns' : 'Roo.grid',
643          xtype : 'ColumnModel'
644         },
645         {
646          dataIndex : 'event_id_remarks',
647          header : _this._strings['a4ecfc70574394990cf17bd83df499f7'] /* Event */,
648          renderer : function(v) { return String.format('<span qtip="{0}">{0}</span>', v); },
649          width : 300,
650          xns : Roo.grid,
651          '|xns' : 'Roo.grid',
652          xtype : 'ColumnModel'
653         }
654        ]
655       }
656      },
657      {
658       fitToFrame : true,
659       region : 'south',
660       xns : Roo,
661       '|xns' : 'Roo',
662       xtype : 'ContentPanel',
663       listeners : {
664        render : function (_self)
665         {
666           _this.viewPanel = _self;
667         }
668       }
669      }
670     ]
671    }
672   };  }
673 });