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