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