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