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