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