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