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({
8 part : ["Admin", "LogEvents" ],
9 order : '001-Pman.Tab.AdminLogEvents',
11 parent : 'Pman.Tab.AdminLogs',
12 name : "Admin - Logs - Events",
14 permname : 'Admin.Logs',
23 xtype : 'LayoutRegion',
29 xtype : 'LayoutRegion',
35 xtype : 'BorderLayout',
42 xtype : 'ContentPanel',
45 render : function (_self)
47 _this.viewPanel = _self;
55 xtype : 'RowSelectionModel',
59 afterselectionchange : function (_self)
61 // load detail log in _this.viewPanel;
62 if (!this.getSelected()) {
63 this.viewPanel.setContent("Nothing Selected");
66 var id = this.getSelected().data.id;
67 _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
85 'name': 'person_name',
118 'name': 'person_id_id',
122 'name': 'person_id_office_id',
126 'name': 'person_id_name',
130 'name': 'person_id_phone',
134 'name': 'person_id_fax',
138 'name': 'person_id_email',
142 'name': 'person_id_company_id',
146 'name': 'person_id_role',
150 'name': 'person_id_active',
154 'name': 'person_id_remarks',
158 'name': 'person_id_passwd',
162 'name': 'person_id_owner_id',
166 'name': 'person_id_lang',
170 'name': 'person_id_no_reset_sent',
174 'name': 'person_id_action_type',
178 'name': 'person_id_project_id',
182 'name': 'person_id_deleted_by',
186 'name': 'person_id_deleted_dt',
190 totalProperty : 'total'
194 url : baseURL + '/Roo/Events.php',
202 sortInfo : { field: 'event_when', direction: 'DESC'},
205 beforeload : function (_self, o)
207 if (!Pman.buildCompleted) {
212 if (! _this.personSel) {
215 o.params = o.params || {};
216 o.params.person_id = _this.personSel.getValue();
217 var act = _this.actionSel.getValue();
219 o.params.action = act;
221 var tbl = _this.affectSel.getValue();
223 o.params.on_table = tbl;
225 act = _this.dateFrom.getValue();
227 o.params['query[from]'] = act.format('Y-m-d');
229 act = _this.dateTo.getValue();
231 o.params['query[to]'] = act.format('Y-m-d');
236 act = _this.groupedCombo.getValue();
237 o.params['query[grouped]'] = act;
238 if (o.params['query[grouped]'] == 'gr') {
241 Roo.MessageBox.alert("Error", "Select a table to group results on");
244 // o.params['_columns'] =
245 o.params['_distinct'] = 'on_id';
263 xtype : 'PagingToolbar',
264 emptyMsg : "No Events found",
267 displayMsg : "Displaying Events {0} - {1} of {2}",
270 '|xns' : 'Roo.Toolbar',
271 text : "Download to Excel",
275 click : function (_self, e)
279 'sort' : 'event_when',
283 person_id : _this.personSel.getValue(),
284 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when',
285 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name',
286 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action',
287 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' ,
288 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table',
289 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks'
292 params.person_id = _this.personSel.getValue();
293 var act = _this.actionSel.getValue();
297 var tbl = _this.affectSel.getValue();
299 params.on_table = tbl;
301 act = _this.dateFrom.getValue();
303 params['query[from]'] = act.format('Y-m-d');
305 act = _this.dateTo.getValue();
307 params['query[to]'] = act.format('Y-m-d');
313 url : baseURL + '/Roo/Events.php',
330 '|xns' : 'Roo.Toolbar',
340 if(typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){
345 return uiConfig.events_person_table;
348 xtype : 'SimpleStore',
349 fields : [ 'value' ],
355 triggerAction : 'all',
356 forceSelection : true,
357 selectOnFocus : true,
359 displayField : 'value',
360 emptyText : "Select Person Table",
362 valueField : 'value',
370 name : 'person_table',
371 qtip : "Select Person Table",
372 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>',
373 loadingText : "Searching...",
375 render : function (_self)
377 _this.tableSel = _self;
379 select : function (combo, record, index)
382 _this.grid.footer.onClick('first');
394 url : baseURL + '/Roo/Person.php',
403 xtype : 'JsonReader',
430 'name': 'company_id',
458 'name': 'no_reset_sent',
462 'name': 'action_type',
466 'name': 'project_id',
470 'name': 'deleted_by',
474 'name': 'deleted_dt',
476 'dateFormat': 'Y-m-d'
479 'name': 'office_id_id',
483 'name': 'office_id_company_id',
487 'name': 'office_id_name',
491 'name': 'office_id_address',
495 'name': 'office_id_phone',
499 'name': 'office_id_fax',
503 'name': 'office_id_email',
507 'name': 'office_id_role',
511 'name': 'company_id_code',
515 'name': 'company_id_name',
519 'name': 'company_id_remarks',
523 'name': 'company_id_owner_id',
527 'name': 'company_id_address',
531 'name': 'company_id_tel',
535 'name': 'company_id_fax',
539 'name': 'company_id_email',
543 'name': 'company_id_id',
547 'name': 'company_id_isOwner',
551 'name': 'company_id_logo_id',
555 'name': 'company_id_background_color',
559 'name': 'company_id_comptype',
563 'name': 'company_id_url',
567 'name': 'company_id_main_office_id',
571 'name': 'company_id_created_by',
575 'name': 'company_id_created_dt',
579 'name': 'company_id_updated_by',
583 'name': 'company_id_updated_dt',
587 'name': 'company_id_passwd',
591 'name': 'company_id_dispatch_port',
595 'name': 'company_id_province',
599 'name': 'company_id_country',
603 'name': 'project_id_id',
607 'name': 'project_id_name',
611 'name': 'project_id_remarks',
615 'name': 'project_id_owner_id',
619 'name': 'project_id_code',
623 'name': 'project_id_active',
627 'name': 'project_id_type',
631 'name': 'project_id_client_id',
635 'name': 'project_id_team_id',
639 'name': 'project_id_file_location',
643 'name': 'project_id_open_date',
647 'name': 'project_id_open_by',
651 'name': 'project_id_close_date',
655 'name': 'project_id_countries',
659 'name': 'project_id_languages',
663 'name': 'project_id_agency_id',
667 'name': 'owner_id_id',
671 'name': 'owner_id_office_id',
675 'name': 'owner_id_name',
679 'name': 'owner_id_phone',
683 'name': 'owner_id_fax',
687 'name': 'owner_id_email',
691 'name': 'owner_id_company_id',
695 'name': 'owner_id_role',
699 'name': 'owner_id_active',
703 'name': 'owner_id_remarks',
707 'name': 'owner_id_passwd',
711 'name': 'owner_id_owner_id',
715 'name': 'owner_id_lang',
719 'name': 'owner_id_no_reset_sent',
723 'name': 'owner_id_action_type',
727 'name': 'owner_id_project_id',
731 'name': 'owner_id_deleted_by',
735 'name': 'owner_id_deleted_dt',
740 totalProperty : 'total'
745 sortInfo : { field : 'name' , direction : 'ASC' },
748 beforeload : function (_self, o)
750 o.params = o.params || {};
751 o.params.company_id = Pman.Login.authUser.company_id;
761 triggerAction : 'all',
762 fieldLabel : 'Person ',
763 forceSelection : true,
764 selectOnFocus : true,
766 displayField : 'name',
767 emptyText : "Select Person ",
776 name : 'person_id_name',
777 qtip : "Select Person ",
778 queryParam : 'query[name]',
779 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
780 loadingText : "Searching...",
782 render : function (_self)
784 _this.personSel = _self;
786 select : function (combo, record, index)
788 _this.grid.footer.onClick('first');
801 url : baseURL + '/Roo/Events.php',
810 xtype : 'JsonReader',
817 'name': 'person_name',
821 'name': 'event_when',
823 'dateFormat': 'Y-m-d'
850 'name': 'person_id_id',
854 'name': 'person_id_office_id',
858 'name': 'person_id_name',
862 'name': 'person_id_phone',
866 'name': 'person_id_fax',
870 'name': 'person_id_email',
874 'name': 'person_id_company_id',
878 'name': 'person_id_role',
882 'name': 'person_id_active',
886 'name': 'person_id_remarks',
890 'name': 'person_id_passwd',
894 'name': 'person_id_owner_id',
898 'name': 'person_id_lang',
902 'name': 'person_id_no_reset_sent',
906 'name': 'person_id_action_type',
910 'name': 'person_id_project_id',
914 'name': 'person_id_deleted_by',
918 'name': 'person_id_deleted_dt',
923 totalProperty : 'total'
928 sortInfo : { field : 'action' , direction : 'ASC' },
931 beforeload : function (_self, o)
933 o.params = o.params || {};
934 // staff can see all logs, other companies can only see their own.
935 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
936 o.params.company_id = Pman.Login.authUser.company_id;
938 o.params._distinct = 'action';
939 o.params._columns ='action';
949 triggerAction : 'all',
950 forceSelection : true,
951 selectOnFocus : true,
953 displayField : 'action',
954 emptyText : "Select Action",
956 valueField : 'action',
964 qtip : "Select Action",
965 queryParam : 'query[action]',
966 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
967 loadingText : "Searching...",
969 render : function (_self)
971 _this.actionSel = _self;
973 select : function (combo, record, index)
975 _this.grid.footer.onClick('first');
987 url : baseURL + '/Roo/Events.php',
996 xtype : 'JsonReader',
1004 'name': 'person_name',
1008 'name': 'event_when',
1010 'dateFormat': 'Y-m-d'
1029 'name': 'person_id',
1037 'name': 'person_id_id',
1041 'name': 'person_id_office_id',
1045 'name': 'person_id_name',
1049 'name': 'person_id_phone',
1053 'name': 'person_id_fax',
1057 'name': 'person_id_email',
1061 'name': 'person_id_company_id',
1065 'name': 'person_id_role',
1069 'name': 'person_id_active',
1073 'name': 'person_id_remarks',
1077 'name': 'person_id_passwd',
1081 'name': 'person_id_owner_id',
1085 'name': 'person_id_lang',
1089 'name': 'person_id_no_reset_sent',
1093 'name': 'person_id_action_type',
1097 'name': 'person_id_project_id',
1101 'name': 'person_id_deleted_by',
1105 'name': 'person_id_deleted_dt',
1109 totalProperty : 'total'
1111 '|xns' : 'Roo.data',
1114 sortInfo : { field : 'on_table' , direction : 'ASC' },
1117 beforeload : function (_self, o)
1119 o.params = o.params || {};
1120 // staff can see all logs, other companies can only see their own.
1121 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
1122 o.params.company_id = Pman.Login.authUser.company_id;
1124 o.params._distinct = 'on_table';
1125 o.params._columns ='on_table';
1133 '|xns' : 'Roo.form',
1135 triggerAction : 'all',
1136 forceSelection : true,
1137 selectOnFocus : true,
1139 displayField : 'on_table',
1140 emptyText : "Select Affects",
1142 valueField : 'action',
1150 qtip : "Select Action",
1151 queryParam : 'query[on_table]',
1152 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
1153 loadingText : "Searching...",
1155 render : function (_self)
1157 _this.affectSel = _self;
1159 select : function (combo, record, index)
1161 _this.grid.footer.onClick('first');
1170 '|xns' : 'Roo.Toolbar',
1171 text : "Date Range",
1176 '|xns' : 'Roo.form',
1178 xtype : 'DateField',
1181 render : function (_self)
1183 _this.dateFrom = _self;
1185 change : function (_self, newValue, oldValue)
1187 _this.grid.footer.onClick('first');
1192 '|xns' : 'Roo.form',
1194 xtype : 'DateField',
1197 render : function (_self)
1199 _this.dateTo = _self;
1201 change : function (_self, newValue, oldValue)
1203 _this.grid.footer.onClick('first');
1210 '|xns' : 'Roo.grid',
1211 autoExpandColumn : 'remarks',
1217 '|xns' : 'Roo.grid',
1218 xtype : 'ColumnModel',
1221 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1223 dataIndex : 'event_when'
1226 '|xns' : 'Roo.grid',
1227 xtype : 'ColumnModel',
1234 '|xns' : 'Roo.grid',
1235 xtype : 'ColumnModel',
1238 renderer : function(v,x,r) {
1240 var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;
1241 var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;
1243 //Roo.log([r, efield, nfield]);
1245 var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1246 var name = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1247 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1253 dataIndex : 'person_id_name'
1256 '|xns' : 'Roo.grid',
1257 xtype : 'ColumnModel',
1260 renderer : function(v) { return String.format('{0}', v); },
1262 dataIndex : 'action'
1265 '|xns' : 'Roo.grid',
1266 xtype : 'ColumnModel',
1269 renderer : function(v) { return String.format('{0}', v); },
1271 dataIndex : 'ipaddr'
1274 '|xns' : 'Roo.grid',
1275 xtype : 'ColumnModel',
1276 header : 'Affected',
1278 renderer : function(v, x, r) {
1279 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1282 dataIndex : 'on_table'
1285 '|xns' : 'Roo.grid',
1286 xtype : 'ColumnModel',
1289 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },
1291 dataIndex : 'remarks'
1295 render : function() {
1297 //_this.dialog = Pman.Dialog.FILL_IN
1298 if (_this.panel.active) {
1299 this.footer.onClick('first');
1313 xtype : 'GridPanel',
1314 fitContainer : true,
1316 tableName : 'Events',
1318 activate : function() {
1321 _this.grid.footer.onClick('first');
1335 xtype : 'NestedLayoutPanel',