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