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