Pman.Tab.AdminLogEvents.bjs
[Pman.Admin] / Pman.Tab.AdminLogEvents.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.AdminLogEvents = new Roo.XComponent({
8
9  _strings : {
10   '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
11   '2ea72778ebaacc973260c88837dd7a2f' :"Displaying Events  {0} - {1} of {2}",
12   '87f9f735a1d36793ceaecd4e47124b63' :"Events",
13   '1b7f7d24575cdbfadb83b9587fa1bf97' :"#id",
14   'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
15   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
16   '01bd6a16732dfa2b760dc8566c58afae' :"Download to Excel",
17   '498f79c4c5bbde77f1bceb6c86fd0f6d' :"Show",
18   '037fd50b0e85bb65995ca7125d06c7cd' :"Select Person Table",
19   'fd7535ce3979bb8547e2c01689db0767' :"Select Person ",
20   '679308a758de538c5f39c4c6cdba6593' :"Select Affects",
21   '8f7f93630c366dc55aec88eb8e9640d0' :"Staff",
22   'a8929eb5c1553d3f70497f862d25d0ce' :"Select Action",
23   '39b9e051f9fe75e65c7a330bb00499d4' :"Date Range",
24   '4e97aeeaa8b15ca1180fcd1f3ac478d1' :"When",
25   '004bf6c9a40003140292e97330236c53' :"Action",
26   '90e4ac2e5a22e53df63b6b186d8727ba' :"No Events found",
27   '2c92a9a6a5dbf570825e62eabcdecd8d' :"Affected"
28  },
29
30   part     :  ["Admin", "LogEvents" ],
31   order    : '001-Pman.Tab.AdminLogEvents',
32   region   : 'center',
33   parent   : 'Pman.Tab.AdminLogs',
34   name     : "Admin - Logs - Events",
35   disabled : false, 
36   permname : 'Admin.Logs', 
37   _tree : function()
38   {
39    var _this = this;
40    var MODULE = this;
41    return {
42    layout : {
43     center : {
44      '|xns' : 'Roo',
45      xns : Roo,
46      xtype : 'LayoutRegion'
47     },
48     south : {
49      '|xns' : 'Roo',
50      autoScroll : true,
51      height : 150,
52      split : true,
53      xns : Roo,
54      xtype : 'LayoutRegion'
55     },
56     '|xns' : 'Roo',
57     xns : Roo,
58     xtype : 'BorderLayout',
59     items : [
60      {
61       '|xns' : 'Roo',
62       fitToFrame : true,
63       region : 'south',
64       xns : Roo,
65       xtype : 'ContentPanel',
66       listeners : {
67        render : function (_self)
68         {
69           _this.viewPanel = _self;
70         }
71       }
72      },
73      {
74       grid : {
75        sm : {
76         '|xns' : 'Roo.grid',
77         singleSelect : true,
78         xns : Roo.grid,
79         xtype : 'RowSelectionModel',
80         listeners : {
81          afterselectionchange : function (_self)
82           {
83               // load detail log in _this.viewPanel;
84               if (!this.getSelected()) {
85                   this.viewPanel.setContent("Nothing Selected");
86                   return;
87               }
88               var id = this.getSelected().data.id;
89               _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
90               
91           }
92         }
93        },
94        dataSource : {
95         reader : {
96          '|xns' : 'Roo.data',
97          fields : [
98              {
99                  'name': 'id',
100                  'type': 'int'
101              },
102              {
103                  'name': 'person_name',
104                  'type': 'string'
105              },
106              {
107                  'name': 'event_when',
108                  'type': 'date',
109                  'dateFormat': 'Y-m-d'
110              },
111              {
112                  'name': 'action',
113                  'type': 'string'
114              },
115              {
116                  'name': 'ipaddr',
117                  'type': 'string'
118              },
119              {
120                  'name': 'on_id',
121                  'type': 'int'
122              },
123              {
124                  'name': 'on_table',
125                  'type': 'string'
126              },
127              {
128                  'name': 'person_id',
129                  'type': 'int'
130              },
131              {
132                  'name': 'remarks',
133                  'type': 'string'
134              },
135              {
136                  'name': 'person_id_id',
137                  'type': 'int'
138              },
139              {
140                  'name': 'person_id_office_id',
141                  'type': 'int'
142              },
143              {
144                  'name': 'person_id_name',
145                  'type': 'string'
146              },
147              {
148                  'name': 'person_id_phone',
149                  'type': 'string'
150              },
151              {
152                  'name': 'person_id_fax',
153                  'type': 'string'
154              },
155              {
156                  'name': 'person_id_email',
157                  'type': 'string'
158              },
159              {
160                  'name': 'person_id_company_id',
161                  'type': 'int'
162              },
163              {
164                  'name': 'person_id_role',
165                  'type': 'string'
166              },
167              {
168                  'name': 'person_id_active',
169                  'type': 'int'
170              },
171              {
172                  'name': 'person_id_remarks',
173                  'type': 'string'
174              },
175              {
176                  'name': 'person_id_passwd',
177                  'type': 'string'
178              },
179              {
180                  'name': 'person_id_owner_id',
181                  'type': 'int'
182              },
183              {
184                  'name': 'person_id_lang',
185                  'type': 'string'
186              },
187              {
188                  'name': 'person_id_no_reset_sent',
189                  'type': 'int'
190              },
191              {
192                  'name': 'person_id_action_type',
193                  'type': 'string'
194              },
195              {
196                  'name': 'person_id_project_id',
197                  'type': 'int'
198              },
199              {
200                  'name': 'person_id_deleted_by',
201                  'type': 'int'
202              },
203              {
204                  'name': 'person_id_deleted_dt',
205                  'type': 'date'
206              }
207          ],
208          id : 'id',
209          root : 'data',
210          totalProperty : 'total',
211          xns : Roo.data,
212          xtype : 'JsonReader'
213         },
214         proxy : {
215          '|xns' : 'Roo.data',
216          method : 'GET',
217          url : baseURL + '/Roo/Events.php',
218          xns : Roo.data,
219          xtype : 'HttpProxy'
220         },
221         '|xns' : 'Roo.data',
222         remoteSort : true,
223         sortInfo : { field: 'event_when', direction: 'DESC'},
224         xns : Roo.data,
225         xtype : 'Store',
226         listeners : {
227          beforeload : function (_self, o)
228           {
229               if (!Pman.buildCompleted) {
230                   return false;
231               }
232              
233              
234              if (! _this.personSel) {
235               return false;
236               }
237               o.params = o.params || {};
238               o.params.person_id = _this.personSel.getValue();
239               o.params.person_table = _this.tableSel.getValue();
240               var act = _this.actionSel.getValue();
241               if (act.length) {
242                   o.params.action = act;
243               }
244               var tbl = _this.affectSel.getValue();
245               if (tbl.length) {
246                   o.params.on_table = tbl;
247               }
248               act = _this.dateFrom.getValue();
249               if (act.format) {
250                   o.params['query[from]'] = act.format('Y-m-d');
251               }
252               act = _this.dateTo.getValue();
253               if (act.format) {
254                   o.params['query[to]'] = act.format('Y-m-d');
255               }
256            
257               
258               /*
259               act = _this.groupedCombo.getValue();
260               o.params['query[grouped]'] = act;
261               if (o.params['query[grouped]'] == 'gr') {
262               
263                   if (!tbl.length) {
264                       Roo.MessageBox.alert("Error", "Select a table to group results on");
265                       return false;
266                   }
267           //        o.params['_columns']  = 
268                   o.params['_distinct'] = 'on_id';
269                   
270                   
271               }
272               
273               */
274           
275               
276           }
277         },
278         items : [
279
280         ]
281
282        },
283        footer : {
284         '|xns' : 'Roo',
285         displayInfo : true,
286         displayMsg : _this._strings['2ea72778ebaacc973260c88837dd7a2f'],
287         emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'],
288         pageSize : 25,
289         xns : Roo,
290         xtype : 'PagingToolbar',
291         items : [
292          {
293           '|xns' : 'Roo.Toolbar',
294           text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'],
295           xns : Roo.Toolbar,
296           xtype : 'Button',
297           listeners : {
298            click : function (_self, e)
299             {
300                 
301                 var params = {
302                     'sort' : 'event_when',
303                     'dir' : 'DESC',
304                     'start' : 0,
305                     'limit' : 900,
306                     person_id : _this.personSel.getValue(), 
307                     'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', 
308                     'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_id_name', 
309                     'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', 
310                     'csvTitles[3]' : 'Record ID',   'csvCols[3]' : 'on_id'       ,
311                     'csvTitles[4]' : 'Record Type',   'csvCols[4]' : 'on_table',
312                     'csvTitles[5]' : 'Remarks',   'csvCols[5]' : 'remarks'        
313                 }
314                     
315                 params.person_id = _this.personSel.getValue();
316                 var act = _this.actionSel.getValue();
317                 if (act.length) {
318                     params.action = act;
319                 }
320                 var tbl = _this.affectSel.getValue();
321                 if (tbl.length) {
322                     params.on_table = tbl;
323                 }
324                 act = _this.dateFrom.getValue();
325                 if (act.format) {
326                     params['query[from]'] = act.format('Y-m-d');
327                 }
328                 act = _this.dateTo.getValue();
329                 if (act.format) {
330                     params['query[to]'] = act.format('Y-m-d');
331                 }
332                 params.limit = 9999;
333                 
334             
335                 new Pman.download({
336                     url : baseURL + '/Roo/Events.php',
337                     params : params ,
338                     newWindow: true
339                     
340                 });
341             }
342           }
343          }
344         ]
345
346        },
347        toolbar : {
348         '|xns' : 'Roo',
349         xns : Roo,
350         xtype : 'Toolbar',
351         items : [
352          {
353           '|xns' : 'Roo.Toolbar',
354           text : _this._strings['498f79c4c5bbde77f1bceb6c86fd0f6d'],
355           xns : Roo.Toolbar,
356           xtype : 'TextItem'
357          },
358          {
359           store : {
360            '|xns' : 'Roo.data',
361            data : (function() { 
362            
363                if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){
364            
365                    return [];        
366                }
367            
368                return uiConfig.events_person_table;
369                
370            })(),
371            fields : [ 'value' ],
372            isLocal : true,
373            xns : Roo.data,
374            xtype : 'SimpleStore'
375           },
376           '|xns' : 'Roo.form',
377           allowBlank : true,
378           alwaysQuery : true,
379           displayField : 'value',
380           editable : false,
381           emptyText : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'],
382           forceSelection : true,
383           listWidth : 300,
384           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
385           minChars : 2,
386           name : 'person_table',
387           pageSize : 20,
388           qtip : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'],
389           selectOnFocus : true,
390           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>',
391           triggerAction : 'all',
392           typeAhead : true,
393           valueField : 'value',
394           width : 150,
395           xns : Roo.form,
396           xtype : 'ComboBox',
397           listeners : {
398            render : function (_self)
399             {
400                 _this.tableSel = _self;
401               
402                 if(
403                     typeof(uiConfig) == 'undefined' || 
404                     typeof(uiConfig.events_person_table) == 'undefined' || 
405                     !uiConfig.events_person_table.length
406                 ){
407                     this.hide();
408                 }
409               
410             },
411            select : function (combo, record, index)
412             {
413               _this.grid.footer.onClick('first');
414             }
415           },
416           items : [
417
418           ]
419
420          },
421          {
422           store : {
423            proxy : {
424             '|xns' : 'Roo.data',
425             method : 'GET',
426             url : baseURL + '/Roo/Person.php',
427             xns : Roo.data,
428             xtype : 'HttpProxy'
429            },
430            reader : {
431             '|xns' : 'Roo.data',
432             fields : [
433                 {
434                     'name': 'id',
435                     'type': 'int'
436                 },
437                 {
438                     'name': 'office_id',
439                     'type': 'int'
440                 },
441                 {
442                     'name': 'name',
443                     'type': 'string'
444                 },
445                 {
446                     'name': 'phone',
447                     'type': 'string'
448                 },
449                 {
450                     'name': 'fax',
451                     'type': 'string'
452                 },
453                 {
454                     'name': 'email',
455                     'type': 'string'
456                 },
457                 {
458                     'name': 'company_id',
459                     'type': 'int'
460                 },
461                 {
462                     'name': 'role',
463                     'type': 'string'
464                 },
465                 {
466                     'name': 'active',
467                     'type': 'int'
468                 },
469                 {
470                     'name': 'remarks',
471                     'type': 'string'
472                 },
473                 {
474                     'name': 'passwd',
475                     'type': 'string'
476                 },
477                 {
478                     'name': 'owner_id',
479                     'type': 'int'
480                 },
481                 {
482                     'name': 'lang',
483                     'type': 'string'
484                 },
485                 {
486                     'name': 'no_reset_sent',
487                     'type': 'int'
488                 },
489                 {
490                     'name': 'action_type',
491                     'type': 'string'
492                 },
493                 {
494                     'name': 'project_id',
495                     'type': 'int'
496                 },
497                 {
498                     'name': 'deleted_by',
499                     'type': 'int'
500                 },
501                 {
502                     'name': 'deleted_dt',
503                     'type': 'date',
504                     'dateFormat': 'Y-m-d'
505                 },
506                 {
507                     'name': 'office_id_id',
508                     'type': 'int'
509                 },
510                 {
511                     'name': 'office_id_company_id',
512                     'type': 'int'
513                 },
514                 {
515                     'name': 'office_id_name',
516                     'type': 'string'
517                 },
518                 {
519                     'name': 'office_id_address',
520                     'type': 'string'
521                 },
522                 {
523                     'name': 'office_id_phone',
524                     'type': 'string'
525                 },
526                 {
527                     'name': 'office_id_fax',
528                     'type': 'string'
529                 },
530                 {
531                     'name': 'office_id_email',
532                     'type': 'string'
533                 },
534                 {
535                     'name': 'office_id_role',
536                     'type': 'string'
537                 },
538                 {
539                     'name': 'company_id_code',
540                     'type': 'string'
541                 },
542                 {
543                     'name': 'company_id_name',
544                     'type': 'string'
545                 },
546                 {
547                     'name': 'company_id_remarks',
548                     'type': 'string'
549                 },
550                 {
551                     'name': 'company_id_owner_id',
552                     'type': 'int'
553                 },
554                 {
555                     'name': 'company_id_address',
556                     'type': 'string'
557                 },
558                 {
559                     'name': 'company_id_tel',
560                     'type': 'string'
561                 },
562                 {
563                     'name': 'company_id_fax',
564                     'type': 'string'
565                 },
566                 {
567                     'name': 'company_id_email',
568                     'type': 'string'
569                 },
570                 {
571                     'name': 'company_id_id',
572                     'type': 'int'
573                 },
574                 {
575                     'name': 'company_id_isOwner',
576                     'type': 'int'
577                 },
578                 {
579                     'name': 'company_id_logo_id',
580                     'type': 'int'
581                 },
582                 {
583                     'name': 'company_id_background_color',
584                     'type': 'string'
585                 },
586                 {
587                     'name': 'company_id_comptype',
588                     'type': 'string'
589                 },
590                 {
591                     'name': 'company_id_url',
592                     'type': 'string'
593                 },
594                 {
595                     'name': 'company_id_main_office_id',
596                     'type': 'int'
597                 },
598                 {
599                     'name': 'company_id_created_by',
600                     'type': 'int'
601                 },
602                 {
603                     'name': 'company_id_created_dt',
604                     'type': 'date'
605                 },
606                 {
607                     'name': 'company_id_updated_by',
608                     'type': 'int'
609                 },
610                 {
611                     'name': 'company_id_updated_dt',
612                     'type': 'date'
613                 },
614                 {
615                     'name': 'company_id_passwd',
616                     'type': 'string'
617                 },
618                 {
619                     'name': 'company_id_dispatch_port',
620                     'type': 'string'
621                 },
622                 {
623                     'name': 'company_id_province',
624                     'type': 'string'
625                 },
626                 {
627                     'name': 'company_id_country',
628                     'type': 'string'
629                 },
630                 {
631                     'name': 'project_id_id',
632                     'type': 'int'
633                 },
634                 {
635                     'name': 'project_id_name',
636                     'type': 'string'
637                 },
638                 {
639                     'name': 'project_id_remarks',
640                     'type': 'string'
641                 },
642                 {
643                     'name': 'project_id_owner_id',
644                     'type': 'int'
645                 },
646                 {
647                     'name': 'project_id_code',
648                     'type': 'string'
649                 },
650                 {
651                     'name': 'project_id_active',
652                     'type': 'int'
653                 },
654                 {
655                     'name': 'project_id_type',
656                     'type': 'string'
657                 },
658                 {
659                     'name': 'project_id_client_id',
660                     'type': 'int'
661                 },
662                 {
663                     'name': 'project_id_team_id',
664                     'type': 'int'
665                 },
666                 {
667                     'name': 'project_id_file_location',
668                     'type': 'string'
669                 },
670                 {
671                     'name': 'project_id_open_date',
672                     'type': 'date'
673                 },
674                 {
675                     'name': 'project_id_open_by',
676                     'type': 'int'
677                 },
678                 {
679                     'name': 'project_id_close_date',
680                     'type': 'date'
681                 },
682                 {
683                     'name': 'project_id_countries',
684                     'type': 'string'
685                 },
686                 {
687                     'name': 'project_id_languages',
688                     'type': 'string'
689                 },
690                 {
691                     'name': 'project_id_agency_id',
692                     'type': 'int'
693                 },
694                 {
695                     'name': 'owner_id_id',
696                     'type': 'int'
697                 },
698                 {
699                     'name': 'owner_id_office_id',
700                     'type': 'int'
701                 },
702                 {
703                     'name': 'owner_id_name',
704                     'type': 'string'
705                 },
706                 {
707                     'name': 'owner_id_phone',
708                     'type': 'string'
709                 },
710                 {
711                     'name': 'owner_id_fax',
712                     'type': 'string'
713                 },
714                 {
715                     'name': 'owner_id_email',
716                     'type': 'string'
717                 },
718                 {
719                     'name': 'owner_id_company_id',
720                     'type': 'int'
721                 },
722                 {
723                     'name': 'owner_id_role',
724                     'type': 'string'
725                 },
726                 {
727                     'name': 'owner_id_active',
728                     'type': 'int'
729                 },
730                 {
731                     'name': 'owner_id_remarks',
732                     'type': 'string'
733                 },
734                 {
735                     'name': 'owner_id_passwd',
736                     'type': 'string'
737                 },
738                 {
739                     'name': 'owner_id_owner_id',
740                     'type': 'int'
741                 },
742                 {
743                     'name': 'owner_id_lang',
744                     'type': 'string'
745                 },
746                 {
747                     'name': 'owner_id_no_reset_sent',
748                     'type': 'int'
749                 },
750                 {
751                     'name': 'owner_id_action_type',
752                     'type': 'string'
753                 },
754                 {
755                     'name': 'owner_id_project_id',
756                     'type': 'int'
757                 },
758                 {
759                     'name': 'owner_id_deleted_by',
760                     'type': 'int'
761                 },
762                 {
763                     'name': 'owner_id_deleted_dt',
764                     'type': 'date'
765                 }
766             ],
767             id : 'id',
768             root : 'data',
769             totalProperty : 'total',
770             xns : Roo.data,
771             xtype : 'JsonReader'
772            },
773            '|xns' : 'Roo.data',
774            remoteSort : true,
775            sortInfo : { field : 'name' , direction : 'ASC' },
776            xns : Roo.data,
777            xtype : 'Store',
778            listeners : {
779             beforeload : function (_self, o)
780              {
781                  o.params = o.params || {};
782                  o.params.company_id = Pman.Login.authUser.company_id;
783              }
784            },
785            items : [
786
787            ]
788
789           },
790           '|xns' : 'Roo.form',
791           allowBlank : true,
792           displayField : 'name',
793           editable : true,
794           emptyText : _this._strings['fd7535ce3979bb8547e2c01689db0767'],
795           fieldLabel : 'Person ',
796           forceSelection : true,
797           listWidth : 600,
798           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
799           minChars : 2,
800           name : 'person_id_name',
801           pageSize : 20,
802           qtip : _this._strings['fd7535ce3979bb8547e2c01689db0767'],
803           queryParam : 'query[name]',
804           selectOnFocus : true,
805           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) &lt;{email}&gt; </div>',
806           triggerAction : 'all',
807           typeAhead : true,
808           valueField : 'id',
809           width : 150,
810           xns : Roo.form,
811           xtype : 'ComboBox',
812           listeners : {
813            render : function (_self)
814             {
815               _this.personSel = _self;
816             },
817            select : function (combo, record, index)
818             {
819               _this.grid.footer.onClick('first');
820               
821             }
822           },
823           items : [
824
825           ]
826
827          },
828          {
829           store : {
830            proxy : {
831             '|xns' : 'Roo.data',
832             method : 'GET',
833             url : baseURL + '/Roo/Events.php',
834             xns : Roo.data,
835             xtype : 'HttpProxy'
836            },
837            reader : {
838             '|xns' : 'Roo.data',
839             fields : [
840                 {
841                     'name': 'id',
842                     'type': 'int'
843                 },
844                 {
845                     'name': 'person_name',
846                     'type': 'string'
847                 },
848                 {
849                     'name': 'event_when',
850                     'type': 'date',
851                     'dateFormat': 'Y-m-d'
852                 },
853                 {
854                     'name': 'action',
855                     'type': 'string'
856                 },
857                 {
858                     'name': 'ipaddr',
859                     'type': 'string'
860                 },
861                 {
862                     'name': 'on_id',
863                     'type': 'int'
864                 },
865                 {
866                     'name': 'on_table',
867                     'type': 'string'
868                 },
869                 {
870                     'name': 'person_id',
871                     'type': 'int'
872                 },
873                 {
874                     'name': 'remarks',
875                     'type': 'string'
876                 },
877                 {
878                     'name': 'person_id_id',
879                     'type': 'int'
880                 },
881                 {
882                     'name': 'person_id_office_id',
883                     'type': 'int'
884                 },
885                 {
886                     'name': 'person_id_name',
887                     'type': 'string'
888                 },
889                 {
890                     'name': 'person_id_phone',
891                     'type': 'string'
892                 },
893                 {
894                     'name': 'person_id_fax',
895                     'type': 'string'
896                 },
897                 {
898                     'name': 'person_id_email',
899                     'type': 'string'
900                 },
901                 {
902                     'name': 'person_id_company_id',
903                     'type': 'int'
904                 },
905                 {
906                     'name': 'person_id_role',
907                     'type': 'string'
908                 },
909                 {
910                     'name': 'person_id_active',
911                     'type': 'int'
912                 },
913                 {
914                     'name': 'person_id_remarks',
915                     'type': 'string'
916                 },
917                 {
918                     'name': 'person_id_passwd',
919                     'type': 'string'
920                 },
921                 {
922                     'name': 'person_id_owner_id',
923                     'type': 'int'
924                 },
925                 {
926                     'name': 'person_id_lang',
927                     'type': 'string'
928                 },
929                 {
930                     'name': 'person_id_no_reset_sent',
931                     'type': 'int'
932                 },
933                 {
934                     'name': 'person_id_action_type',
935                     'type': 'string'
936                 },
937                 {
938                     'name': 'person_id_project_id',
939                     'type': 'int'
940                 },
941                 {
942                     'name': 'person_id_deleted_by',
943                     'type': 'int'
944                 },
945                 {
946                     'name': 'person_id_deleted_dt',
947                     'type': 'date'
948                 }
949             ],
950             id : 'id',
951             root : 'data',
952             totalProperty : 'total',
953             xns : Roo.data,
954             xtype : 'JsonReader'
955            },
956            '|xns' : 'Roo.data',
957            remoteSort : true,
958            sortInfo : { field : 'action' , direction : 'ASC' },
959            xns : Roo.data,
960            xtype : 'Store',
961            listeners : {
962             beforeload : function (_self, o)
963              {
964                  o.params = o.params || {};
965                  // staff can see all logs, other companies can only see their own.
966                  if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
967                      o.params.company_id = Pman.Login.authUser.company_id;
968                  }
969                  o.params._distinct = 'action';
970                  o.params._columns ='action';
971              }
972            },
973            items : [
974
975            ]
976
977           },
978           '|xns' : 'Roo.form',
979           allowBlank : true,
980           displayField : 'action',
981           editable : true,
982           emptyText : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'],
983           forceSelection : true,
984           listWidth : 300,
985           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
986           minChars : 2,
987           name : 'action',
988           pageSize : 20,
989           qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'],
990           queryParam : 'query[action]',
991           selectOnFocus : true,
992           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
993           triggerAction : 'all',
994           typeAhead : true,
995           valueField : 'action',
996           width : 150,
997           xns : Roo.form,
998           xtype : 'ComboBox',
999           listeners : {
1000            render : function (_self)
1001             {
1002               _this.actionSel = _self;
1003             },
1004            select : function (combo, record, index)
1005             {
1006               _this.grid.footer.onClick('first');
1007             }
1008           },
1009           items : [
1010
1011           ]
1012
1013          },
1014          {
1015           store : {
1016            proxy : {
1017             '|xns' : 'Roo.data',
1018             method : 'GET',
1019             url : baseURL + '/Roo/Events.php',
1020             xns : Roo.data,
1021             xtype : 'HttpProxy'
1022            },
1023            reader : {
1024             '|xns' : 'Roo.data',
1025             fields : [
1026                 {
1027                     'name': 'id',
1028                     'type': 'int'
1029                 },
1030                 {
1031                     'name': 'person_name',
1032                     'type': 'string'
1033                 },
1034                 {
1035                     'name': 'event_when',
1036                     'type': 'date',
1037                     'dateFormat': 'Y-m-d'
1038                 },
1039                 {
1040                     'name': 'action',
1041                     'type': 'string'
1042                 },
1043                 {
1044                     'name': 'ipaddr',
1045                     'type': 'string'
1046                 },
1047                 {
1048                     'name': 'on_id',
1049                     'type': 'int'
1050                 },
1051                 {
1052                     'name': 'on_table',
1053                     'type': 'string'
1054                 },
1055                 {
1056                     'name': 'person_id',
1057                     'type': 'int'
1058                 },
1059                 {
1060                     'name': 'remarks',
1061                     'type': 'string'
1062                 },
1063                 {
1064                     'name': 'person_id_id',
1065                     'type': 'int'
1066                 },
1067                 {
1068                     'name': 'person_id_office_id',
1069                     'type': 'int'
1070                 },
1071                 {
1072                     'name': 'person_id_name',
1073                     'type': 'string'
1074                 },
1075                 {
1076                     'name': 'person_id_phone',
1077                     'type': 'string'
1078                 },
1079                 {
1080                     'name': 'person_id_fax',
1081                     'type': 'string'
1082                 },
1083                 {
1084                     'name': 'person_id_email',
1085                     'type': 'string'
1086                 },
1087                 {
1088                     'name': 'person_id_company_id',
1089                     'type': 'int'
1090                 },
1091                 {
1092                     'name': 'person_id_role',
1093                     'type': 'string'
1094                 },
1095                 {
1096                     'name': 'person_id_active',
1097                     'type': 'int'
1098                 },
1099                 {
1100                     'name': 'person_id_remarks',
1101                     'type': 'string'
1102                 },
1103                 {
1104                     'name': 'person_id_passwd',
1105                     'type': 'string'
1106                 },
1107                 {
1108                     'name': 'person_id_owner_id',
1109                     'type': 'int'
1110                 },
1111                 {
1112                     'name': 'person_id_lang',
1113                     'type': 'string'
1114                 },
1115                 {
1116                     'name': 'person_id_no_reset_sent',
1117                     'type': 'int'
1118                 },
1119                 {
1120                     'name': 'person_id_action_type',
1121                     'type': 'string'
1122                 },
1123                 {
1124                     'name': 'person_id_project_id',
1125                     'type': 'int'
1126                 },
1127                 {
1128                     'name': 'person_id_deleted_by',
1129                     'type': 'int'
1130                 },
1131                 {
1132                     'name': 'person_id_deleted_dt',
1133                     'type': 'date'
1134                 }
1135             ],
1136             id : 'id',
1137             root : 'data',
1138             totalProperty : 'total',
1139             xns : Roo.data,
1140             xtype : 'JsonReader'
1141            },
1142            '|xns' : 'Roo.data',
1143            remoteSort : true,
1144            sortInfo : { field : 'on_table' , direction : 'ASC' },
1145            xns : Roo.data,
1146            xtype : 'Store',
1147            listeners : {
1148             beforeload : function (_self, o)
1149              {
1150                  o.params = o.params || {};
1151                  // staff can see all logs, other companies can only see their own.
1152                  if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
1153                      o.params.company_id = Pman.Login.authUser.company_id;
1154                  }
1155                  o.params._distinct = 'on_table';
1156                  o.params._columns ='on_table';
1157              }
1158            },
1159            items : [
1160
1161            ]
1162
1163           },
1164           '|xns' : 'Roo.form',
1165           allowBlank : true,
1166           displayField : 'on_table',
1167           editable : true,
1168           emptyText : _this._strings['679308a758de538c5f39c4c6cdba6593'],
1169           forceSelection : true,
1170           listWidth : 300,
1171           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
1172           minChars : 2,
1173           name : 'on_table',
1174           pageSize : 20,
1175           qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'],
1176           queryParam : 'query[on_table]',
1177           selectOnFocus : true,
1178           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
1179           triggerAction : 'all',
1180           typeAhead : true,
1181           valueField : 'action',
1182           width : 150,
1183           xns : Roo.form,
1184           xtype : 'ComboBox',
1185           listeners : {
1186            render : function (_self)
1187             {
1188                 _this.affectSel = _self;
1189               
1190                 if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){
1191                     this.hide();
1192                 }
1193             },
1194            select : function (combo, record, index)
1195             {
1196               _this.grid.footer.onClick('first');
1197             }
1198           },
1199           items : [
1200
1201           ]
1202
1203          },
1204          {
1205           '|xns' : 'Roo.Toolbar',
1206           text : _this._strings['39b9e051f9fe75e65c7a330bb00499d4'],
1207           xns : Roo.Toolbar,
1208           xtype : 'TextItem'
1209          },
1210          {
1211           '|xns' : 'Roo.form',
1212           format : 'Y-m-d',
1213           xns : Roo.form,
1214           xtype : 'DateField',
1215           listeners : {
1216            change : function (_self, newValue, oldValue)
1217             {
1218               _this.grid.footer.onClick('first');
1219             },
1220            render : function (_self)
1221             {
1222               _this.dateFrom = _self;
1223             }
1224           }
1225          },
1226          {
1227           '|xns' : 'Roo.form',
1228           format : 'Y-m-d',
1229           xns : Roo.form,
1230           xtype : 'DateField',
1231           listeners : {
1232            change : function (_self, newValue, oldValue)
1233             {
1234               _this.grid.footer.onClick('first');
1235             },
1236            render : function (_self)
1237             {
1238               _this.dateTo = _self;
1239             }
1240           }
1241          }
1242         ]
1243
1244        },
1245        '|xns' : 'Roo.grid',
1246        autoExpandColumn : 'remarks',
1247        loadMask : true,
1248        xns : Roo.grid,
1249        xtype : 'Grid',
1250        colModel : [
1251          {
1252           '|xns' : 'Roo.grid',
1253           dataIndex : 'event_when',
1254           header : _this._strings['4e97aeeaa8b15ca1180fcd1f3ac478d1'],
1255           renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1256           width : 100,
1257           xns : Roo.grid,
1258           xtype : 'ColumnModel'
1259          },
1260 {
1261           '|xns' : 'Roo.grid',
1262           dataIndex : 'id',
1263           header : _this._strings['1b7f7d24575cdbfadb83b9587fa1bf97'],
1264           width : 100,
1265           xns : Roo.grid,
1266           xtype : 'ColumnModel'
1267          },
1268 {
1269           '|xns' : 'Roo.grid',
1270           dataIndex : 'person_id_name',
1271           header : _this._strings['8f7f93630c366dc55aec88eb8e9640d0'],
1272           renderer : function(v,x,r) { 
1273               
1274               var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;
1275               var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;    
1276               
1277               //Roo.log([r, efield, nfield]);
1278               
1279               var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1280               var name  = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;    
1281               return String.format('{0} &lt;<a href="mailto:{1}">{1}</a>&gt;', 
1282                   name, email); 
1283           
1284           
1285           },
1286           width : 150,
1287           xns : Roo.grid,
1288           xtype : 'ColumnModel'
1289          },
1290 {
1291           '|xns' : 'Roo.grid',
1292           dataIndex : 'action',
1293           header : _this._strings['004bf6c9a40003140292e97330236c53'],
1294           renderer : function(v) { return String.format('{0}', v); },
1295           width : 100,
1296           xns : Roo.grid,
1297           xtype : 'ColumnModel'
1298          },
1299 {
1300           '|xns' : 'Roo.grid',
1301           dataIndex : 'ipaddr',
1302           header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'],
1303           renderer : function(v) { return String.format('{0}', v); },
1304           width : 100,
1305           xns : Roo.grid,
1306           xtype : 'ColumnModel'
1307          },
1308 {
1309           '|xns' : 'Roo.grid',
1310           dataIndex : 'on_table',
1311           header : _this._strings['2c92a9a6a5dbf570825e62eabcdecd8d'],
1312           renderer : function(v, x, r) {                     
1313                       return v ? String.format('{0}({1})', v,  r.data.on_id)  : '';  
1314              },
1315           width : 100,
1316           xns : Roo.grid,
1317           xtype : 'ColumnModel'
1318          },
1319 {
1320           '|xns' : 'Roo.grid',
1321           dataIndex : 'remarks',
1322           header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'],
1323           renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },
1324           width : 300,
1325           xns : Roo.grid,
1326           xtype : 'ColumnModel'
1327          }
1328        ],
1329        listeners : {
1330         render : function() { 
1331              _this.grid = this; 
1332              //_this.dialog = Pman.Dialog.FILL_IN
1333              if (_this.panel.active) {
1334                 this.footer.onClick('first');
1335              }
1336          }
1337        },
1338        items : [
1339
1340        ]
1341
1342       },
1343       '|xns' : 'Roo',
1344       background : false,
1345       fitContainer : true,
1346       fitToframe : true,
1347       region : 'center',
1348       tableName : 'Events',
1349       title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'],
1350       xns : Roo,
1351       xtype : 'GridPanel',
1352       listeners : {
1353        activate : function() {
1354             _this.panel = this;
1355             if (_this.grid) {
1356                 _this.grid.footer.onClick('first');
1357             }
1358         }
1359       },
1360       items : [
1361
1362       ]
1363
1364      }
1365     ]
1366
1367    },
1368    '|xns' : 'Roo',
1369    region : 'center',
1370    title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'],
1371    xns : Roo,
1372    xtype : 'NestedLayoutPanel',
1373    items : [
1374
1375    ]
1376
1377   };  }
1378 });