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