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){
344 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",
363 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)
381 _this.grid.footer.onClick('first');
393 url : baseURL + '/Roo/Person.php',
402 xtype : 'JsonReader',
429 'name': 'company_id',
457 'name': 'no_reset_sent',
461 'name': 'action_type',
465 'name': 'project_id',
469 'name': 'deleted_by',
473 'name': 'deleted_dt',
475 'dateFormat': 'Y-m-d'
478 'name': 'office_id_id',
482 'name': 'office_id_company_id',
486 'name': 'office_id_name',
490 'name': 'office_id_address',
494 'name': 'office_id_phone',
498 'name': 'office_id_fax',
502 'name': 'office_id_email',
506 'name': 'office_id_role',
510 'name': 'company_id_code',
514 'name': 'company_id_name',
518 'name': 'company_id_remarks',
522 'name': 'company_id_owner_id',
526 'name': 'company_id_address',
530 'name': 'company_id_tel',
534 'name': 'company_id_fax',
538 'name': 'company_id_email',
542 'name': 'company_id_id',
546 'name': 'company_id_isOwner',
550 'name': 'company_id_logo_id',
554 'name': 'company_id_background_color',
558 'name': 'company_id_comptype',
562 'name': 'company_id_url',
566 'name': 'company_id_main_office_id',
570 'name': 'company_id_created_by',
574 'name': 'company_id_created_dt',
578 'name': 'company_id_updated_by',
582 'name': 'company_id_updated_dt',
586 'name': 'company_id_passwd',
590 'name': 'company_id_dispatch_port',
594 'name': 'company_id_province',
598 'name': 'company_id_country',
602 'name': 'project_id_id',
606 'name': 'project_id_name',
610 'name': 'project_id_remarks',
614 'name': 'project_id_owner_id',
618 'name': 'project_id_code',
622 'name': 'project_id_active',
626 'name': 'project_id_type',
630 'name': 'project_id_client_id',
634 'name': 'project_id_team_id',
638 'name': 'project_id_file_location',
642 'name': 'project_id_open_date',
646 'name': 'project_id_open_by',
650 'name': 'project_id_close_date',
654 'name': 'project_id_countries',
658 'name': 'project_id_languages',
662 'name': 'project_id_agency_id',
666 'name': 'owner_id_id',
670 'name': 'owner_id_office_id',
674 'name': 'owner_id_name',
678 'name': 'owner_id_phone',
682 'name': 'owner_id_fax',
686 'name': 'owner_id_email',
690 'name': 'owner_id_company_id',
694 'name': 'owner_id_role',
698 'name': 'owner_id_active',
702 'name': 'owner_id_remarks',
706 'name': 'owner_id_passwd',
710 'name': 'owner_id_owner_id',
714 'name': 'owner_id_lang',
718 'name': 'owner_id_no_reset_sent',
722 'name': 'owner_id_action_type',
726 'name': 'owner_id_project_id',
730 'name': 'owner_id_deleted_by',
734 'name': 'owner_id_deleted_dt',
739 totalProperty : 'total'
744 sortInfo : { field : 'name' , direction : 'ASC' },
747 beforeload : function (_self, o)
749 o.params = o.params || {};
750 o.params.company_id = Pman.Login.authUser.company_id;
760 triggerAction : 'all',
761 fieldLabel : 'Person ',
762 forceSelection : true,
763 selectOnFocus : true,
765 displayField : 'name',
766 emptyText : "Select Person ",
775 name : 'person_id_name',
776 qtip : "Select Person ",
777 queryParam : 'query[name]',
778 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
779 loadingText : "Searching...",
781 render : function (_self)
783 _this.personSel = _self;
785 select : function (combo, record, index)
787 _this.grid.footer.onClick('first');
800 url : baseURL + '/Roo/Events.php',
809 xtype : 'JsonReader',
816 'name': 'person_name',
820 'name': 'event_when',
822 'dateFormat': 'Y-m-d'
849 'name': 'person_id_id',
853 'name': 'person_id_office_id',
857 'name': 'person_id_name',
861 'name': 'person_id_phone',
865 'name': 'person_id_fax',
869 'name': 'person_id_email',
873 'name': 'person_id_company_id',
877 'name': 'person_id_role',
881 'name': 'person_id_active',
885 'name': 'person_id_remarks',
889 'name': 'person_id_passwd',
893 'name': 'person_id_owner_id',
897 'name': 'person_id_lang',
901 'name': 'person_id_no_reset_sent',
905 'name': 'person_id_action_type',
909 'name': 'person_id_project_id',
913 'name': 'person_id_deleted_by',
917 'name': 'person_id_deleted_dt',
922 totalProperty : 'total'
927 sortInfo : { field : 'action' , direction : 'ASC' },
930 beforeload : function (_self, o)
932 o.params = o.params || {};
933 // staff can see all logs, other companies can only see their own.
934 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
935 o.params.company_id = Pman.Login.authUser.company_id;
937 o.params._distinct = 'action';
938 o.params._columns ='action';
948 triggerAction : 'all',
949 forceSelection : true,
950 selectOnFocus : true,
952 displayField : 'action',
953 emptyText : "Select Action",
955 valueField : 'action',
963 qtip : "Select Action",
964 queryParam : 'query[action]',
965 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
966 loadingText : "Searching...",
968 render : function (_self)
970 _this.actionSel = _self;
972 select : function (combo, record, index)
974 _this.grid.footer.onClick('first');
986 url : baseURL + '/Roo/Events.php',
995 xtype : 'JsonReader',
1003 'name': 'person_name',
1007 'name': 'event_when',
1009 'dateFormat': 'Y-m-d'
1028 'name': 'person_id',
1036 'name': 'person_id_id',
1040 'name': 'person_id_office_id',
1044 'name': 'person_id_name',
1048 'name': 'person_id_phone',
1052 'name': 'person_id_fax',
1056 'name': 'person_id_email',
1060 'name': 'person_id_company_id',
1064 'name': 'person_id_role',
1068 'name': 'person_id_active',
1072 'name': 'person_id_remarks',
1076 'name': 'person_id_passwd',
1080 'name': 'person_id_owner_id',
1084 'name': 'person_id_lang',
1088 'name': 'person_id_no_reset_sent',
1092 'name': 'person_id_action_type',
1096 'name': 'person_id_project_id',
1100 'name': 'person_id_deleted_by',
1104 'name': 'person_id_deleted_dt',
1108 totalProperty : 'total'
1110 '|xns' : 'Roo.data',
1113 sortInfo : { field : 'on_table' , direction : 'ASC' },
1116 beforeload : function (_self, o)
1118 o.params = o.params || {};
1119 // staff can see all logs, other companies can only see their own.
1120 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
1121 o.params.company_id = Pman.Login.authUser.company_id;
1123 o.params._distinct = 'on_table';
1124 o.params._columns ='on_table';
1132 '|xns' : 'Roo.form',
1134 triggerAction : 'all',
1135 forceSelection : true,
1136 selectOnFocus : true,
1138 displayField : 'on_table',
1139 emptyText : "Select Affects",
1141 valueField : 'action',
1149 qtip : "Select Action",
1150 queryParam : 'query[on_table]',
1151 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
1152 loadingText : "Searching...",
1154 render : function (_self)
1156 _this.affectSel = _self;
1158 select : function (combo, record, index)
1160 _this.grid.footer.onClick('first');
1169 '|xns' : 'Roo.Toolbar',
1170 text : "Date Range",
1175 '|xns' : 'Roo.form',
1177 xtype : 'DateField',
1180 render : function (_self)
1182 _this.dateFrom = _self;
1184 change : function (_self, newValue, oldValue)
1186 _this.grid.footer.onClick('first');
1191 '|xns' : 'Roo.form',
1193 xtype : 'DateField',
1196 render : function (_self)
1198 _this.dateTo = _self;
1200 change : function (_self, newValue, oldValue)
1202 _this.grid.footer.onClick('first');
1209 '|xns' : 'Roo.grid',
1210 autoExpandColumn : 'remarks',
1216 '|xns' : 'Roo.grid',
1217 xtype : 'ColumnModel',
1220 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1222 dataIndex : 'event_when'
1225 '|xns' : 'Roo.grid',
1226 xtype : 'ColumnModel',
1233 '|xns' : 'Roo.grid',
1234 xtype : 'ColumnModel',
1237 renderer : function(v,x,r) {
1239 var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;
1240 var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;
1242 Roo.log([r, efield, nfield]);
1244 var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1245 var name = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1246 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1252 dataIndex : 'person_id_name'
1255 '|xns' : 'Roo.grid',
1256 xtype : 'ColumnModel',
1259 renderer : function(v) { return String.format('{0}', v); },
1261 dataIndex : 'action'
1264 '|xns' : 'Roo.grid',
1265 xtype : 'ColumnModel',
1268 renderer : function(v) { return String.format('{0}', v); },
1270 dataIndex : 'ipaddr'
1273 '|xns' : 'Roo.grid',
1274 xtype : 'ColumnModel',
1275 header : 'Affected',
1277 renderer : function(v, x, r) {
1278 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1281 dataIndex : 'on_table'
1284 '|xns' : 'Roo.grid',
1285 xtype : 'ColumnModel',
1288 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },
1290 dataIndex : 'remarks'
1294 render : function() {
1296 //_this.dialog = Pman.Dialog.FILL_IN
1297 if (_this.panel.active) {
1298 this.footer.onClick('first');
1312 xtype : 'GridPanel',
1313 fitContainer : true,
1315 tableName : 'Events',
1317 activate : function() {
1320 _this.grid.footer.onClick('first');
1334 xtype : 'NestedLayoutPanel',