column widths on notify
[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               } else  {
368                   options.params['!event_id'] = 0;
369               }
370               
371               if (!_this.personCombo) {
372                   return false;
373               }
374               var p = _this.personCombo.getValue();
375               if (p*1) { 
376                   options.params.person_id = p;
377               }
378               
379               var from = _this.fromDateSel.getValue();
380               
381               if(from){
382                   options.params.from = from.format('Y-m-d');
383               }
384               
385               var to = _this.toDateSel.getValue();
386               
387               if(to){
388                   options.params.to = to.format('Y-m-d');
389               }
390               
391               var type = _this.typeCombo.getValue();
392               
393               if(type.length){
394                   options.params.evtype = type;
395               }
396           }
397         },
398         xns : Roo.data,
399         '|xns' : 'Roo.data',
400         proxy : {
401          xtype : 'HttpProxy',
402          method : 'GET',
403          url : baseURL + '/Roo/core_notify.php',
404          xns : Roo.data,
405          '|xns' : 'Roo.data'
406         },
407         reader : {
408          xtype : 'JsonReader',
409          fields : [
410              {
411                  'name': 'id',
412                  'type': 'int'
413              },
414              {
415                  'name': 'act_when',
416                  'type': 'date',
417                  'dateFormat': 'Y-m-d'
418              },
419              {
420                  'name': 'onid',
421                  'type': 'int'
422              },
423              {
424                  'name': 'ontable',
425                  'type': 'string'
426              },
427              {
428                  'name': 'person_id',
429                  'type': 'int'
430              },
431              {
432                  'name': 'msgid',
433                  'type': 'string'
434              },
435              {
436                  'name': 'sent',
437                  'type': 'date',
438                  'dateFormat': 'Y-m-d'
439              },
440              {
441                  'name': 'event_id',
442                  'type': 'int'
443              },
444              {
445                  'name': 'person_id_id',
446                  'type': 'int'
447              },
448              {
449                  'name': 'person_id_office_id',
450                  'type': 'int'
451              },
452              {
453                  'name': 'person_id_name',
454                  'type': 'string'
455              },
456              {
457                  'name': 'person_id_phone',
458                  'type': 'string'
459              },
460              {
461                  'name': 'person_id_fax',
462                  'type': 'string'
463              },
464              {
465                  'name': 'person_id_email',
466                  'type': 'string'
467              },
468              {
469                  'name': 'person_id_company_id',
470                  'type': 'int'
471              },
472              {
473                  'name': 'person_id_role',
474                  'type': 'string'
475              },
476              {
477                  'name': 'person_id_active',
478                  'type': 'int'
479              },
480              {
481                  'name': 'person_id_remarks',
482                  'type': 'string'
483              },
484              {
485                  'name': 'person_id_passwd',
486                  'type': 'string'
487              },
488              {
489                  'name': 'person_id_owner_id',
490                  'type': 'int'
491              },
492              {
493                  'name': 'person_id_lang',
494                  'type': 'string'
495              },
496              {
497                  'name': 'person_id_no_reset_sent',
498                  'type': 'int'
499              },
500              {
501                  'name': 'person_id_action_type',
502                  'type': 'string'
503              },
504              {
505                  'name': 'person_id_project_id',
506                  'type': 'int'
507              },
508              {
509                  'name': 'person_id_deleted_by',
510                  'type': 'int'
511              },
512              {
513                  'name': 'person_id_deleted_dt',
514                  'type': 'date'
515              },
516              {
517                  'name': 'event_id_id',
518                  'type': 'int'
519              },
520              {
521                  'name': 'event_id_person_name',
522                  'type': 'string'
523              },
524              {
525                  'name': 'event_id_event_when',
526                  'type': 'date'
527              },
528              {
529                  'name': 'event_id_action',
530                  'type': 'string'
531              },
532              {
533                  'name': 'event_id_ipaddr',
534                  'type': 'string'
535              },
536              {
537                  'name': 'event_id_on_id',
538                  'type': 'int'
539              },
540              {
541                  'name': 'event_id_on_table',
542                  'type': 'string'
543              },
544              {
545                  'name': 'event_id_person_id',
546                  'type': 'int'
547              },
548              {
549                  'name': 'event_id_remarks',
550                  'type': 'string'
551              }
552          ],
553          id : 'id',
554          root : 'data',
555          totalProperty : 'total',
556          xns : Roo.data,
557          '|xns' : 'Roo.data'
558         }
559        },
560        sm : {
561         xtype : 'RowSelectionModel',
562         singleSelect : true,
563         listeners : {
564          afterselectionchange : function (_self)
565           {
566               // load detail log in _this.viewPanel;
567               if (!this.getSelected()) {
568                   this.viewPanel.setContent("Nothing Selected");
569                   return;
570               }
571               var id = this.getSelected().data.event_id;
572               if (id *1 < 1) {
573               
574                  _this.viewPanel.setContent("No Event for this line");    
575                   return;
576               }
577               _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
578               
579           }
580         },
581         xns : Roo.grid,
582         '|xns' : 'Roo.grid'
583        },
584        colModel : [
585         {
586          xtype : 'ColumnModel',
587          dataIndex : 'id',
588          header : _this._strings['dc873ea4b71ca217b0d8d1fdd45854ac'] /* id# */,
589          renderer : function(v) { return String.format('{0}', v ); },
590          sortable : true,
591          width : 50,
592          xns : Roo.grid,
593          '|xns' : 'Roo.grid'
594         },
595         {
596          xtype : 'ColumnModel',
597          dataIndex : 'evtype',
598          header : _this._strings['4c3880bb027f159e801041b1021e88e8'] /* Method */,
599          renderer : function(v,x,r) 
600          { 
601              var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;
602              return String.format('<span qtip="{0}">{1}</span>', v, vv ); 
603          },
604          sortable : true,
605          width : 70,
606          xns : Roo.grid,
607          '|xns' : 'Roo.grid'
608         },
609         {
610          xtype : 'ColumnModel',
611          dataIndex : 'act_when',
612          header : _this._strings['0f6d01b16d57911731aa44b94dbfefcc'] /* Act when */,
613          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
614          sortable : true,
615          width : 130,
616          xns : Roo.grid,
617          '|xns' : 'Roo.grid'
618         },
619         {
620          xtype : 'ColumnModel',
621          dataIndex : 'sent',
622          header : _this._strings['7f8c0283f16925caed8e632086b81b9c'] /* Sent */,
623          renderer : function(v,x,r) {
624              if (r.data.event_id *1 == 0) {
625                  return '';
626              }
627               return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');
628            },
629          sortable : true,
630          width : 130,
631          xns : Roo.grid,
632          '|xns' : 'Roo.grid'
633         },
634         {
635          xtype : 'ColumnModel',
636          dataIndex : 'ontable',
637          header : _this._strings['478192f02d448c49bc6b7d76818d8483'] /* Ontable */,
638          renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); },
639          width : 150,
640          xns : Roo.grid,
641          '|xns' : 'Roo.grid'
642         },
643         {
644          xtype : 'ColumnModel',
645          dataIndex : 'person_id_name',
646          header : _this._strings['24463f10155b8af973300f86302c4fde'] /* Who to notify */,
647          renderer : function(v,x,r) {
648          
649              var pt = r.data.person_table.toLowerCase() ;
650              var pt = pt.length ? pt : 'person';
651               var ecol = pt + '_id_email' ;
652               var ncol = pt + '_id_name' ;
653               return String.format('{0} <u>&lt;{1}&gt;</u>', r.data[ncol], r.data[ecol]); 
654           },
655          width : 100,
656          xns : Roo.grid,
657          '|xns' : 'Roo.grid'
658         },
659         {
660          xtype : 'ColumnModel',
661          dataIndex : 'trigger_event_id',
662          header : _this._strings['b22e7ea679daf5146f08f477419dd8bd'] /* Triggered by */,
663          renderer : function(v,x,r) {
664               return String.format(
665                      '{0} : {1} {2}', 
666                      r.data.trigger_event_id_on_table, 
667                      r.data.trigger_event_id_on_id, 
668                      r.data.trigger_event_id_remarks
669                  ); 
670           },
671          width : 100,
672          xns : Roo.grid,
673          '|xns' : 'Roo.grid'
674         },
675         {
676          xtype : 'ColumnModel',
677          dataIndex : 'msgid',
678          header : _this._strings['12832b4def6eb0b6105b3d11e16066ea'] /* Msgid */,
679          renderer : function(v) { return String.format('{0}', v); },
680          width : 50,
681          xns : Roo.grid,
682          '|xns' : 'Roo.grid'
683         },
684         {
685          xtype : 'ColumnModel',
686          dataIndex : 'event_id_remarks',
687          header : _this._strings['a4ecfc70574394990cf17bd83df499f7'] /* Event */,
688          renderer : function(v) { return String.format('<span qtip="{0}">{0}</span>', v); },
689          width : 300,
690          xns : Roo.grid,
691          '|xns' : 'Roo.grid'
692         }
693        ]
694       }
695      },
696      {
697       xtype : 'ContentPanel',
698       fitToFrame : true,
699       region : 'south',
700       listeners : {
701        render : function (_self)
702         {
703           _this.viewPanel = _self;
704         }
705       },
706       xns : Roo,
707       '|xns' : 'Roo'
708      }
709     ]
710    }
711   };  }
712 });