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