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',
40 _tree : function(_data)
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() {
93 _this.grid.footer.onClick('first');
101 autoExpandColumn : 'remarks',
107 //_this.dialog = Pman.Dialog.FILL_IN
108 if (_this.panel.active) {
109 this.footer.onClick('first');
116 xtype : 'PagingToolbar',
118 displayMsg : _this._strings['2ea72778ebaacc973260c88837dd7a2f'] /* Displaying Events {0} - {1} of {2} */,
119 emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'] /* No Events found */,
126 text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
128 click : function (_self, e)
132 'sort' : 'event_when',
136 person_id : _this.personSel.getValue(),
137 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when',
138 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name',
139 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action',
140 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' ,
141 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table',
142 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks'
145 params.person_id = _this.personSel.getValue();
146 var act = _this.actionSel.getValue();
150 var tbl = _this.affectSel.getValue();
152 params.on_table = tbl;
154 act = _this.dateFrom.getValue();
156 params['query[from]'] = act.format('Y-m-d');
158 act = _this.dateTo.getValue();
160 params['query[to]'] = act.format('Y-m-d');
166 url : baseURL + '/Roo/Events.php',
174 '|xns' : 'Roo.Toolbar'
178 text : _this._strings['e4ef97f584a9c8d2d686f84569307575'] /* Download to Excel (with extra descriptions) */,
180 click : function (_self, e)
184 'sort' : 'event_when',
188 person_id : _this.personSel.getValue(),
189 'csvTitles[0]' : 'ID#', 'csvCols[0]' : 'id',
190 'csvTitles[1]' : 'When', 'csvCols[1]' : 'event_when',
191 'csvTitles[2]' : 'Staff', 'csvCols[2]' : 'person_id_name',
192 'csvTitles[3]' : 'Action', 'csvCols[3]' : 'action',
193 'csvTitles[4]' : 'Record ID', 'csvCols[4]' : 'on_id' ,
194 'csvTitles[5]' : 'Record Type', 'csvCols[5]' : 'on_table',
195 'csvTitles[6]' : 'Remarks', 'csvCols[6]' : 'remarks'
197 params._with_obj_summary = 1;
198 params.person_id = _this.personSel.getValue();
199 var act = _this.actionSel.getValue();
203 var tbl = _this.affectSel.getValue();
205 params.on_table = tbl;
207 act = _this.dateFrom.getValue();
209 params['query[from]'] = act.format('Y-m-d');
211 act = _this.dateTo.getValue();
213 params['query[to]'] = act.format('Y-m-d');
219 url : baseURL + '/Roo/Events.php',
227 '|xns' : 'Roo.Toolbar'
232 '|xns' : 'Roo.Toolbar'
236 cls : 'x-btn-text-icon',
237 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
238 text : _this._strings['2bd339d85ee3b33e513359ce781b60cc'] /* Restore */,
242 var s = _this.grid.getSelectionModel().getSelected();
244 if(!s || s.data.id * 1 < 1 || s.data.action != 'DELETE'){
245 Roo.MessageBox.alert('Error', 'Please select a deleted person');
250 url: baseURL + '/Roo/Events',
257 success : function(ret) {
258 _this.grid.footer.onClick('refresh');
259 Roo.MessageBox.alert('Notice', 'Restored person successfully');
265 '|xns' : 'Roo.Toolbar'
276 text : _this._strings['498f79c4c5bbde77f1bceb6c86fd0f6d'] /* Show */,
278 '|xns' : 'Roo.Toolbar'
284 displayField : 'value',
286 emptyText : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'] /* Select Person Table */,
287 forceSelection : true,
289 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
291 name : 'person_table',
293 qtip : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'] /* Select Person Table */,
294 selectOnFocus : true,
295 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>',
296 triggerAction : 'all',
298 valueField : 'value',
301 render : function (_self)
303 _this.tableSel = _self;
306 typeof(uiConfig) == 'undefined' ||
307 typeof(uiConfig.events_person_table) == 'undefined' ||
308 !uiConfig.events_person_table.length
314 select : function (combo, record, index)
316 _this.grid.footer.onClick('first');
322 xtype : 'SimpleStore',
325 if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){
330 return uiConfig.events_person_table;
333 fields : [ 'value' ],
342 displayField : 'name',
344 emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
345 fieldLabel : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person */,
346 forceSelection : true,
348 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
350 name : 'person_id_name',
352 qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
353 queryParam : 'query[name]',
354 selectOnFocus : true,
355 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
356 triggerAction : 'all',
361 render : function (_self)
363 _this.personSel = _self;
365 select : function (combo, record, index)
367 _this.grid.footer.onClick('first');
376 sortInfo : { field : 'name' , direction : 'ASC' },
378 beforeload : function (_self, o)
380 o.params = o.params || {};
381 // this will show everyone... - for MO - that means they can see users.
382 //o.params.company_id = Pman.Login.authUser.company_id;
390 url : baseURL + '/Roo/core_person',
395 xtype : 'JsonReader',
422 'name': 'company_id',
450 'name': 'no_reset_sent',
454 'name': 'action_type',
458 'name': 'project_id',
462 'name': 'deleted_by',
466 'name': 'deleted_dt',
468 'dateFormat': 'Y-m-d'
471 'name': 'office_id_id',
475 'name': 'office_id_company_id',
479 'name': 'office_id_name',
483 'name': 'office_id_address',
487 'name': 'office_id_phone',
491 'name': 'office_id_fax',
495 'name': 'office_id_email',
499 'name': 'office_id_role',
503 'name': 'company_id_code',
507 'name': 'company_id_name',
511 'name': 'company_id_remarks',
515 'name': 'company_id_owner_id',
519 'name': 'company_id_address',
523 'name': 'company_id_tel',
527 'name': 'company_id_fax',
531 'name': 'company_id_email',
535 'name': 'company_id_id',
539 'name': 'company_id_isOwner',
543 'name': 'company_id_logo_id',
547 'name': 'company_id_background_color',
551 'name': 'company_id_comptype',
555 'name': 'company_id_url',
559 'name': 'company_id_main_office_id',
563 'name': 'company_id_created_by',
567 'name': 'company_id_created_dt',
571 'name': 'company_id_updated_by',
575 'name': 'company_id_updated_dt',
579 'name': 'company_id_passwd',
583 'name': 'company_id_dispatch_port',
587 'name': 'company_id_province',
591 'name': 'company_id_country',
595 'name': 'project_id_id',
599 'name': 'project_id_name',
603 'name': 'project_id_remarks',
607 'name': 'project_id_owner_id',
611 'name': 'project_id_code',
615 'name': 'project_id_active',
619 'name': 'project_id_type',
623 'name': 'project_id_client_id',
627 'name': 'project_id_team_id',
631 'name': 'project_id_file_location',
635 'name': 'project_id_open_date',
639 'name': 'project_id_open_by',
643 'name': 'project_id_close_date',
647 'name': 'project_id_countries',
651 'name': 'project_id_languages',
655 'name': 'project_id_agency_id',
659 'name': 'owner_id_id',
663 'name': 'owner_id_office_id',
667 'name': 'owner_id_name',
671 'name': 'owner_id_phone',
675 'name': 'owner_id_fax',
679 'name': 'owner_id_email',
683 'name': 'owner_id_company_id',
687 'name': 'owner_id_role',
691 'name': 'owner_id_active',
695 'name': 'owner_id_remarks',
699 'name': 'owner_id_passwd',
703 'name': 'owner_id_owner_id',
707 'name': 'owner_id_lang',
711 'name': 'owner_id_no_reset_sent',
715 'name': 'owner_id_action_type',
719 'name': 'owner_id_project_id',
723 'name': 'owner_id_deleted_by',
727 'name': 'owner_id_deleted_dt',
733 totalProperty : 'total',
742 displayField : 'action',
744 emptyText : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
745 forceSelection : true,
747 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
751 qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
752 queryParam : 'query[action]',
753 selectOnFocus : true,
754 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
755 triggerAction : 'all',
757 valueField : 'action',
760 render : function (_self)
762 _this.actionSel = _self;
764 select : function (combo, record, index)
766 _this.grid.footer.onClick('first');
774 sortInfo : { field : 'action' , direction : 'ASC' },
776 beforeload : function (_self, o)
778 o.params = o.params || {};
779 // staff can see all logs, other companies can only see their own.
780 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
781 o.params.company_id = Pman.Login.authUser.company_id;
783 o.params._distinct = 'action';
784 o.params._columns ='action';
792 url : baseURL + '/Roo/Events.php',
797 xtype : 'JsonReader',
804 'name': 'person_name',
808 'name': 'event_when',
810 'dateFormat': 'Y-m-d'
837 'name': 'person_id_id',
841 'name': 'person_id_office_id',
845 'name': 'person_id_name',
849 'name': 'person_id_phone',
853 'name': 'person_id_fax',
857 'name': 'person_id_email',
861 'name': 'person_id_company_id',
865 'name': 'person_id_role',
869 'name': 'person_id_active',
873 'name': 'person_id_remarks',
877 'name': 'person_id_passwd',
881 'name': 'person_id_owner_id',
885 'name': 'person_id_lang',
889 'name': 'person_id_no_reset_sent',
893 'name': 'person_id_action_type',
897 'name': 'person_id_project_id',
901 'name': 'person_id_deleted_by',
905 'name': 'person_id_deleted_dt',
911 totalProperty : 'total',
920 displayField : 'on_table',
922 emptyText : _this._strings['679308a758de538c5f39c4c6cdba6593'] /* Select Affects */,
923 forceSelection : true,
925 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
929 qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
930 queryParam : 'query[on_table]',
931 selectOnFocus : true,
932 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
933 triggerAction : 'all',
935 valueField : 'action',
938 render : function (_self)
940 _this.affectSel = _self;
942 if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){
946 select : function (combo, record, index)
948 _this.grid.footer.onClick('first');
956 sortInfo : { field : 'on_table' , direction : 'ASC' },
958 beforeload : function (_self, o)
960 o.params = o.params || {};
961 // staff can see all logs, other companies can only see their own.
962 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
963 o.params.company_id = Pman.Login.authUser.company_id;
965 o.params._distinct = 'on_table';
966 o.params._columns ='on_table';
974 url : baseURL + '/Roo/Events.php',
979 xtype : 'JsonReader',
986 'name': 'person_name',
990 'name': 'event_when',
992 'dateFormat': 'Y-m-d'
1011 'name': 'person_id',
1019 'name': 'person_id_id',
1023 'name': 'person_id_office_id',
1027 'name': 'person_id_name',
1031 'name': 'person_id_phone',
1035 'name': 'person_id_fax',
1039 'name': 'person_id_email',
1043 'name': 'person_id_company_id',
1047 'name': 'person_id_role',
1051 'name': 'person_id_active',
1055 'name': 'person_id_remarks',
1059 'name': 'person_id_passwd',
1063 'name': 'person_id_owner_id',
1067 'name': 'person_id_lang',
1071 'name': 'person_id_no_reset_sent',
1075 'name': 'person_id_action_type',
1079 'name': 'person_id_project_id',
1083 'name': 'person_id_deleted_by',
1087 'name': 'person_id_deleted_dt',
1093 totalProperty : 'total',
1101 text : _this._strings['39b9e051f9fe75e65c7a330bb00499d4'] /* Date Range */,
1103 '|xns' : 'Roo.Toolbar'
1106 xtype : 'DateField',
1109 change : function (_self, newValue, oldValue)
1111 _this.grid.footer.onClick('first');
1113 render : function (_self)
1115 _this.dateFrom = _self;
1122 xtype : 'DateField',
1125 change : function (_self, newValue, oldValue)
1127 _this.grid.footer.onClick('first');
1129 render : function (_self)
1131 _this.dateTo = _self;
1142 sortInfo : { field: 'event_when', direction: 'DESC'},
1144 beforeload : function (_self, o)
1146 if (!Pman.buildCompleted) {
1151 if (! _this.personSel) {
1154 o.params = o.params || {};
1155 o.params.person_id = _this.personSel.getValue();
1156 o.params.person_table = _this.tableSel.getValue();
1157 var act = _this.actionSel.getValue();
1159 o.params.action = act;
1161 var tbl = _this.affectSel.getValue();
1163 o.params.on_table = tbl;
1165 act = _this.dateFrom.getValue();
1167 o.params['query[from]'] = act.format('Y-m-d');
1169 act = _this.dateTo.getValue();
1171 o.params['query[to]'] = act.format('Y-m-d');
1176 act = _this.groupedCombo.getValue();
1177 o.params['query[grouped]'] = act;
1178 if (o.params['query[grouped]'] == 'gr') {
1181 Roo.MessageBox.alert("Error", "Select a table to group results on");
1184 // o.params['_columns'] =
1185 o.params['_distinct'] = 'on_id';
1196 '|xns' : 'Roo.data',
1198 xtype : 'HttpProxy',
1200 url : baseURL + '/Roo/Events.php',
1205 xtype : 'JsonReader',
1212 'name': 'person_name',
1216 'name': 'event_when',
1218 'dateFormat': 'Y-m-d'
1237 'name': 'person_id',
1245 'name': 'person_id_id',
1249 'name': 'person_id_office_id',
1253 'name': 'person_id_name',
1257 'name': 'person_id_phone',
1261 'name': 'person_id_fax',
1265 'name': 'person_id_email',
1269 'name': 'person_id_company_id',
1273 'name': 'person_id_role',
1277 'name': 'person_id_active',
1281 'name': 'person_id_remarks',
1285 'name': 'person_id_passwd',
1289 'name': 'person_id_owner_id',
1293 'name': 'person_id_lang',
1297 'name': 'person_id_no_reset_sent',
1301 'name': 'person_id_action_type',
1305 'name': 'person_id_project_id',
1309 'name': 'person_id_deleted_by',
1313 'name': 'person_id_deleted_dt',
1319 totalProperty : 'total',
1325 xtype : 'RowSelectionModel',
1326 singleSelect : true,
1328 afterselectionchange : function (_self)
1330 // load detail log in _this.viewPanel;
1331 if (!this.getSelected()) {
1332 this.viewPanel.setContent("Nothing Selected");
1335 var id = this.getSelected().data.id;
1336 _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
1345 xtype : 'ColumnModel',
1346 dataIndex : 'event_when',
1347 header : _this._strings['4e97aeeaa8b15ca1180fcd1f3ac478d1'] /* When */,
1348 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1354 xtype : 'ColumnModel',
1356 header : _this._strings['1b7f7d24575cdbfadb83b9587fa1bf97'] /* #id */,
1357 hidden : (function() {
1358 return typeof(Pman.Tab.AdminLogEvents.hide_cols) == 'undefined' ?
1360 ((Pman.Tab.AdminLogEvents.hide_cols.indexOf('id') > -1) ? true : false);
1367 xtype : 'ColumnModel',
1368 dataIndex : 'person_id_name',
1369 header : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person */,
1370 renderer : function(v,x,r) {
1372 var ptable = _this.tableSel.getValue();
1374 var efield = 'person_id_email';
1375 var nfield = 'person_id_name';
1379 ptable != 'Person' &&
1380 typeof(r.data[ptable + '_id_email']) != 'undefined' &&
1381 typeof(r.data[ptable + '_id_name']) != 'undefined'
1383 efield = ptable + '_id_email';
1384 nfield = ptable + '_id_name';
1387 var email = r.data[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1388 var name = r.data[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1389 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1399 xtype : 'ColumnModel',
1400 dataIndex : 'action',
1401 header : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
1402 renderer : function(v) { return String.format('{0}', v); },
1408 xtype : 'ColumnModel',
1409 dataIndex : 'ipaddr',
1410 header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
1411 renderer : function(v) { return String.format('{0}', v); },
1417 xtype : 'ColumnModel',
1418 dataIndex : 'on_table',
1419 header : _this._strings['2c92a9a6a5dbf570825e62eabcdecd8d'] /* Affected */,
1420 hidden : (function() {
1421 return typeof(Pman.Tab.AdminLogEvents.hide_cols) == 'undefined' ?
1423 ((Pman.Tab.AdminLogEvents.hide_cols.indexOf('on_table') > -1) ? true : false);
1425 renderer : function(v, x, r) {
1426 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1433 xtype : 'ColumnModel',
1434 dataIndex : 'remarks',
1435 header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
1436 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },