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