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