1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.AdminLogEvents = new Roo.XComponent({
10 'e4ef97f584a9c8d2d686f84569307575' :"Download to Excel (with extra descriptions)",
11 '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
12 '2ea72778ebaacc973260c88837dd7a2f' :"Displaying Events {0} - {1} of {2}",
13 '87f9f735a1d36793ceaecd4e47124b63' :"Events",
14 '1b7f7d24575cdbfadb83b9587fa1bf97' :"#id",
15 'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
16 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
17 '01bd6a16732dfa2b760dc8566c58afae' :"Download to Excel",
18 '498f79c4c5bbde77f1bceb6c86fd0f6d' :"Show",
19 '037fd50b0e85bb65995ca7125d06c7cd' :"Select Person Table",
20 '40bed7cf9b3d4bb3a3d7a7e3eb18c5eb' :"Person ",
21 '340c2ee497b85d5954b01c64de7f44f6' :"Select Person ",
22 '679308a758de538c5f39c4c6cdba6593' :"Select Affects",
23 'a8929eb5c1553d3f70497f862d25d0ce' :"Select Action",
24 '39b9e051f9fe75e65c7a330bb00499d4' :"Date Range",
25 '4e97aeeaa8b15ca1180fcd1f3ac478d1' :"When",
26 '40bed7cf9b3d4bb3a3d7a7e3eb18c5eb' :"Person",
27 '004bf6c9a40003140292e97330236c53' :"Action",
28 '2bd339d85ee3b33e513359ce781b60cc' :"Restore",
29 '90e4ac2e5a22e53df63b6b186d8727ba' :"No Events found",
30 '2c92a9a6a5dbf570825e62eabcdecd8d' :"Affected"
33 part : ["Admin", "LogEvents" ],
34 order : '001-Pman.Tab.AdminLogEvents',
36 parent : 'Pman.Tab.AdminLogs',
37 name : "Admin - Logs - Events",
39 permname : 'Admin.Logs',
45 xtype : 'NestedLayoutPanel',
47 title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'] /* Events */,
51 xtype : 'BorderLayout',
55 xtype : 'LayoutRegion',
60 xtype : 'LayoutRegion',
69 xtype : 'ContentPanel',
73 render : function (_self)
75 _this.viewPanel = _self;
88 title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'] /* Events */,
90 activate : function() {
91 Roo.log('get activate??????????');
94 _this.grid.footer.onClick('first');
102 autoExpandColumn : 'remarks',
108 //_this.dialog = Pman.Dialog.FILL_IN
109 if (_this.panel.active) {
110 this.footer.onClick('first');
117 xtype : 'PagingToolbar',
119 displayMsg : _this._strings['2ea72778ebaacc973260c88837dd7a2f'] /* Displaying Events {0} - {1} of {2} */,
120 emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'] /* No Events found */,
127 text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
129 click : function (_self, e)
133 'sort' : 'event_when',
137 person_id : _this.personSel.getValue(),
138 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when',
139 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name',
140 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action',
141 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' ,
142 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table',
143 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks'
146 params.person_id = _this.personSel.getValue();
147 var act = _this.actionSel.getValue();
151 var tbl = _this.affectSel.getValue();
153 params.on_table = tbl;
155 act = _this.dateFrom.getValue();
157 params['query[from]'] = act.format('Y-m-d');
159 act = _this.dateTo.getValue();
161 params['query[to]'] = act.format('Y-m-d');
167 url : baseURL + '/Roo/Events.php',
175 '|xns' : 'Roo.Toolbar'
179 text : _this._strings['e4ef97f584a9c8d2d686f84569307575'] /* Download to Excel (with extra descriptions) */,
181 click : function (_self, e)
185 'sort' : 'event_when',
189 person_id : _this.personSel.getValue(),
190 'csvTitles[0]' : 'ID#', 'csvCols[0]' : 'id',
191 'csvTitles[1]' : 'When', 'csvCols[1]' : 'event_when',
192 'csvTitles[2]' : 'Staff', 'csvCols[2]' : 'person_id_name',
193 'csvTitles[3]' : 'Action', 'csvCols[3]' : 'action',
194 'csvTitles[4]' : 'Record ID', 'csvCols[4]' : 'on_id' ,
195 'csvTitles[5]' : 'Record Type', 'csvCols[5]' : 'on_table',
196 'csvTitles[6]' : 'Remarks', 'csvCols[6]' : 'remarks'
198 params._with_obj_summary = 1;
199 params.person_id = _this.personSel.getValue();
200 var act = _this.actionSel.getValue();
204 var tbl = _this.affectSel.getValue();
206 params.on_table = tbl;
208 act = _this.dateFrom.getValue();
210 params['query[from]'] = act.format('Y-m-d');
212 act = _this.dateTo.getValue();
214 params['query[to]'] = act.format('Y-m-d');
220 url : baseURL + '/Roo/Events.php',
228 '|xns' : 'Roo.Toolbar'
233 '|xns' : 'Roo.Toolbar'
237 cls : 'x-btn-text-icon',
238 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
239 text : _this._strings['2bd339d85ee3b33e513359ce781b60cc'] /* Restore */,
243 var s = _this.grid.getSelectionModel().getSelected();
245 if(!s || s.data.id * 1 < 1 || s.data.action != 'DELETE'){
246 Roo.MessageBox.alert('Error', 'Please select a deleted person');
251 url: baseURL + '/Roo/Events',
258 success : function(ret) {
259 _this.grid.footer.onClick('refresh');
260 Roo.MessageBox.alert('Notice', 'Restored person successfully');
266 '|xns' : 'Roo.Toolbar'
277 text : _this._strings['498f79c4c5bbde77f1bceb6c86fd0f6d'] /* Show */,
279 '|xns' : 'Roo.Toolbar'
285 displayField : 'value',
287 emptyText : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'] /* Select Person Table */,
288 forceSelection : true,
290 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
292 name : 'person_table',
294 qtip : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'] /* Select Person Table */,
295 selectOnFocus : true,
296 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>',
297 triggerAction : 'all',
299 valueField : 'value',
302 render : function (_self)
304 _this.tableSel = _self;
307 typeof(uiConfig) == 'undefined' ||
308 typeof(uiConfig.events_person_table) == 'undefined' ||
309 !uiConfig.events_person_table.length
315 select : function (combo, record, index)
317 _this.grid.footer.onClick('first');
323 xtype : 'SimpleStore',
326 if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){
331 return uiConfig.events_person_table;
334 fields : [ 'value' ],
343 displayField : 'name',
345 emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
346 fieldLabel : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person */,
347 forceSelection : true,
349 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
351 name : 'person_id_name',
353 qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
354 queryParam : 'query[name]',
355 selectOnFocus : true,
356 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
357 triggerAction : 'all',
362 render : function (_self)
364 _this.personSel = _self;
366 select : function (combo, record, index)
368 _this.grid.footer.onClick('first');
377 sortInfo : { field : 'name' , direction : 'ASC' },
379 beforeload : function (_self, o)
381 o.params = o.params || {};
382 // this will show everyone... - for MO - that means they can see users.
383 //o.params.company_id = Pman.Login.authUser.company_id;
391 url : baseURL + '/Roo/Person.php',
396 xtype : 'JsonReader',
423 'name': 'company_id',
451 'name': 'no_reset_sent',
455 'name': 'action_type',
459 'name': 'project_id',
463 'name': 'deleted_by',
467 'name': 'deleted_dt',
469 'dateFormat': 'Y-m-d'
472 'name': 'office_id_id',
476 'name': 'office_id_company_id',
480 'name': 'office_id_name',
484 'name': 'office_id_address',
488 'name': 'office_id_phone',
492 'name': 'office_id_fax',
496 'name': 'office_id_email',
500 'name': 'office_id_role',
504 'name': 'company_id_code',
508 'name': 'company_id_name',
512 'name': 'company_id_remarks',
516 'name': 'company_id_owner_id',
520 'name': 'company_id_address',
524 'name': 'company_id_tel',
528 'name': 'company_id_fax',
532 'name': 'company_id_email',
536 'name': 'company_id_id',
540 'name': 'company_id_isOwner',
544 'name': 'company_id_logo_id',
548 'name': 'company_id_background_color',
552 'name': 'company_id_comptype',
556 'name': 'company_id_url',
560 'name': 'company_id_main_office_id',
564 'name': 'company_id_created_by',
568 'name': 'company_id_created_dt',
572 'name': 'company_id_updated_by',
576 'name': 'company_id_updated_dt',
580 'name': 'company_id_passwd',
584 'name': 'company_id_dispatch_port',
588 'name': 'company_id_province',
592 'name': 'company_id_country',
596 'name': 'project_id_id',
600 'name': 'project_id_name',
604 'name': 'project_id_remarks',
608 'name': 'project_id_owner_id',
612 'name': 'project_id_code',
616 'name': 'project_id_active',
620 'name': 'project_id_type',
624 'name': 'project_id_client_id',
628 'name': 'project_id_team_id',
632 'name': 'project_id_file_location',
636 'name': 'project_id_open_date',
640 'name': 'project_id_open_by',
644 'name': 'project_id_close_date',
648 'name': 'project_id_countries',
652 'name': 'project_id_languages',
656 'name': 'project_id_agency_id',
660 'name': 'owner_id_id',
664 'name': 'owner_id_office_id',
668 'name': 'owner_id_name',
672 'name': 'owner_id_phone',
676 'name': 'owner_id_fax',
680 'name': 'owner_id_email',
684 'name': 'owner_id_company_id',
688 'name': 'owner_id_role',
692 'name': 'owner_id_active',
696 'name': 'owner_id_remarks',
700 'name': 'owner_id_passwd',
704 'name': 'owner_id_owner_id',
708 'name': 'owner_id_lang',
712 'name': 'owner_id_no_reset_sent',
716 'name': 'owner_id_action_type',
720 'name': 'owner_id_project_id',
724 'name': 'owner_id_deleted_by',
728 'name': 'owner_id_deleted_dt',
734 totalProperty : 'total',
743 displayField : 'action',
745 emptyText : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
746 forceSelection : true,
748 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
752 qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
753 queryParam : 'query[action]',
754 selectOnFocus : true,
755 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
756 triggerAction : 'all',
758 valueField : 'action',
761 render : function (_self)
763 _this.actionSel = _self;
765 select : function (combo, record, index)
767 _this.grid.footer.onClick('first');
775 sortInfo : { field : 'action' , direction : 'ASC' },
777 beforeload : function (_self, o)
779 o.params = o.params || {};
780 // staff can see all logs, other companies can only see their own.
781 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
782 o.params.company_id = Pman.Login.authUser.company_id;
784 o.params._distinct = 'action';
785 o.params._columns ='action';
793 url : baseURL + '/Roo/Events.php',
798 xtype : 'JsonReader',
805 'name': 'person_name',
809 'name': 'event_when',
811 'dateFormat': 'Y-m-d'
838 'name': 'person_id_id',
842 'name': 'person_id_office_id',
846 'name': 'person_id_name',
850 'name': 'person_id_phone',
854 'name': 'person_id_fax',
858 'name': 'person_id_email',
862 'name': 'person_id_company_id',
866 'name': 'person_id_role',
870 'name': 'person_id_active',
874 'name': 'person_id_remarks',
878 'name': 'person_id_passwd',
882 'name': 'person_id_owner_id',
886 'name': 'person_id_lang',
890 'name': 'person_id_no_reset_sent',
894 'name': 'person_id_action_type',
898 'name': 'person_id_project_id',
902 'name': 'person_id_deleted_by',
906 'name': 'person_id_deleted_dt',
912 totalProperty : 'total',
921 displayField : 'on_table',
923 emptyText : _this._strings['679308a758de538c5f39c4c6cdba6593'] /* Select Affects */,
924 forceSelection : true,
926 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
930 qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
931 queryParam : 'query[on_table]',
932 selectOnFocus : true,
933 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
934 triggerAction : 'all',
936 valueField : 'action',
939 render : function (_self)
941 _this.affectSel = _self;
943 if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){
947 select : function (combo, record, index)
949 _this.grid.footer.onClick('first');
957 sortInfo : { field : 'on_table' , direction : 'ASC' },
959 beforeload : function (_self, o)
961 o.params = o.params || {};
962 // staff can see all logs, other companies can only see their own.
963 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
964 o.params.company_id = Pman.Login.authUser.company_id;
966 o.params._distinct = 'on_table';
967 o.params._columns ='on_table';
975 url : baseURL + '/Roo/Events.php',
980 xtype : 'JsonReader',
987 'name': 'person_name',
991 'name': 'event_when',
993 'dateFormat': 'Y-m-d'
1012 'name': 'person_id',
1020 'name': 'person_id_id',
1024 'name': 'person_id_office_id',
1028 'name': 'person_id_name',
1032 'name': 'person_id_phone',
1036 'name': 'person_id_fax',
1040 'name': 'person_id_email',
1044 'name': 'person_id_company_id',
1048 'name': 'person_id_role',
1052 'name': 'person_id_active',
1056 'name': 'person_id_remarks',
1060 'name': 'person_id_passwd',
1064 'name': 'person_id_owner_id',
1068 'name': 'person_id_lang',
1072 'name': 'person_id_no_reset_sent',
1076 'name': 'person_id_action_type',
1080 'name': 'person_id_project_id',
1084 'name': 'person_id_deleted_by',
1088 'name': 'person_id_deleted_dt',
1094 totalProperty : 'total',
1102 text : _this._strings['39b9e051f9fe75e65c7a330bb00499d4'] /* Date Range */,
1104 '|xns' : 'Roo.Toolbar'
1107 xtype : 'DateField',
1110 change : function (_self, newValue, oldValue)
1112 _this.grid.footer.onClick('first');
1114 render : function (_self)
1116 _this.dateFrom = _self;
1123 xtype : 'DateField',
1126 change : function (_self, newValue, oldValue)
1128 _this.grid.footer.onClick('first');
1130 render : function (_self)
1132 _this.dateTo = _self;
1143 sortInfo : { field: 'event_when', direction: 'DESC'},
1145 beforeload : function (_self, o)
1147 if (!Pman.buildCompleted) {
1152 if (! _this.personSel) {
1155 o.params = o.params || {};
1156 o.params.person_id = _this.personSel.getValue();
1157 o.params.person_table = _this.tableSel.getValue();
1158 var act = _this.actionSel.getValue();
1160 o.params.action = act;
1162 var tbl = _this.affectSel.getValue();
1164 o.params.on_table = tbl;
1166 act = _this.dateFrom.getValue();
1168 o.params['query[from]'] = act.format('Y-m-d');
1170 act = _this.dateTo.getValue();
1172 o.params['query[to]'] = act.format('Y-m-d');
1177 act = _this.groupedCombo.getValue();
1178 o.params['query[grouped]'] = act;
1179 if (o.params['query[grouped]'] == 'gr') {
1182 Roo.MessageBox.alert("Error", "Select a table to group results on");
1185 // o.params['_columns'] =
1186 o.params['_distinct'] = 'on_id';
1197 '|xns' : 'Roo.data',
1199 xtype : 'HttpProxy',
1201 url : baseURL + '/Roo/Events.php',
1206 xtype : 'JsonReader',
1213 'name': 'person_name',
1217 'name': 'event_when',
1219 'dateFormat': 'Y-m-d'
1238 'name': 'person_id',
1246 'name': 'person_id_id',
1250 'name': 'person_id_office_id',
1254 'name': 'person_id_name',
1258 'name': 'person_id_phone',
1262 'name': 'person_id_fax',
1266 'name': 'person_id_email',
1270 'name': 'person_id_company_id',
1274 'name': 'person_id_role',
1278 'name': 'person_id_active',
1282 'name': 'person_id_remarks',
1286 'name': 'person_id_passwd',
1290 'name': 'person_id_owner_id',
1294 'name': 'person_id_lang',
1298 'name': 'person_id_no_reset_sent',
1302 'name': 'person_id_action_type',
1306 'name': 'person_id_project_id',
1310 'name': 'person_id_deleted_by',
1314 'name': 'person_id_deleted_dt',
1320 totalProperty : 'total',
1326 xtype : 'RowSelectionModel',
1327 singleSelect : true,
1329 afterselectionchange : function (_self)
1331 // load detail log in _this.viewPanel;
1332 if (!this.getSelected()) {
1333 this.viewPanel.setContent("Nothing Selected");
1336 var id = this.getSelected().data.id;
1337 _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
1346 xtype : 'ColumnModel',
1347 dataIndex : 'event_when',
1348 header : _this._strings['4e97aeeaa8b15ca1180fcd1f3ac478d1'] /* When */,
1349 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1355 xtype : 'ColumnModel',
1357 header : _this._strings['1b7f7d24575cdbfadb83b9587fa1bf97'] /* #id */,
1358 hidden : (function() {
1359 return typeof(Pman.Tab.AdminLogEvents.hide_cols) == 'undefined' ?
1361 ((Pman.Tab.AdminLogEvents.hide_cols.indexOf('id') > -1) ? true : false);
1368 xtype : 'ColumnModel',
1369 dataIndex : 'person_id_name',
1370 header : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person */,
1371 renderer : function(v,x,r) {
1373 var ptable = _this.tableSel.getValue();
1375 var efield = 'person_id_email';
1376 var nfield = 'person_id_name';
1380 ptable != 'Person' &&
1381 typeof(r.data[ptable + '_id_email']) != 'undefined' &&
1382 typeof(r.data[ptable + '_id_name']) != 'undefined'
1384 efield = ptable + '_id_email';
1385 nfield = ptable + '_id_name';
1388 var email = r.data[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1389 var name = r.data[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1390 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1400 xtype : 'ColumnModel',
1401 dataIndex : 'action',
1402 header : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
1403 renderer : function(v) { return String.format('{0}', v); },
1409 xtype : 'ColumnModel',
1410 dataIndex : 'ipaddr',
1411 header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
1412 renderer : function(v) { return String.format('{0}', v); },
1418 xtype : 'ColumnModel',
1419 dataIndex : 'on_table',
1420 header : _this._strings['2c92a9a6a5dbf570825e62eabcdecd8d'] /* Affected */,
1421 hidden : (function() {
1422 return typeof(Pman.Tab.AdminLogEvents.hide_cols) == 'undefined' ?
1424 ((Pman.Tab.AdminLogEvents.hide_cols.indexOf('on_table') > -1) ? true : false);
1426 renderer : function(v, x, r) {
1427 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1434 xtype : 'ColumnModel',
1435 dataIndex : 'remarks',
1436 header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
1437 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },