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',
339 url : baseURL + '/Roo/Person.php',
348 xtype : 'JsonReader',
375 'name': 'company_id',
403 'name': 'no_reset_sent',
407 'name': 'action_type',
411 'name': 'project_id',
415 'name': 'deleted_by',
419 'name': 'deleted_dt',
421 'dateFormat': 'Y-m-d'
424 'name': 'office_id_id',
428 'name': 'office_id_company_id',
432 'name': 'office_id_name',
436 'name': 'office_id_address',
440 'name': 'office_id_phone',
444 'name': 'office_id_fax',
448 'name': 'office_id_email',
452 'name': 'office_id_role',
456 'name': 'company_id_code',
460 'name': 'company_id_name',
464 'name': 'company_id_remarks',
468 'name': 'company_id_owner_id',
472 'name': 'company_id_address',
476 'name': 'company_id_tel',
480 'name': 'company_id_fax',
484 'name': 'company_id_email',
488 'name': 'company_id_id',
492 'name': 'company_id_isOwner',
496 'name': 'company_id_logo_id',
500 'name': 'company_id_background_color',
504 'name': 'company_id_comptype',
508 'name': 'company_id_url',
512 'name': 'company_id_main_office_id',
516 'name': 'company_id_created_by',
520 'name': 'company_id_created_dt',
524 'name': 'company_id_updated_by',
528 'name': 'company_id_updated_dt',
532 'name': 'company_id_passwd',
536 'name': 'company_id_dispatch_port',
540 'name': 'company_id_province',
544 'name': 'company_id_country',
548 'name': 'project_id_id',
552 'name': 'project_id_name',
556 'name': 'project_id_remarks',
560 'name': 'project_id_owner_id',
564 'name': 'project_id_code',
568 'name': 'project_id_active',
572 'name': 'project_id_type',
576 'name': 'project_id_client_id',
580 'name': 'project_id_team_id',
584 'name': 'project_id_file_location',
588 'name': 'project_id_open_date',
592 'name': 'project_id_open_by',
596 'name': 'project_id_close_date',
600 'name': 'project_id_countries',
604 'name': 'project_id_languages',
608 'name': 'project_id_agency_id',
612 'name': 'owner_id_id',
616 'name': 'owner_id_office_id',
620 'name': 'owner_id_name',
624 'name': 'owner_id_phone',
628 'name': 'owner_id_fax',
632 'name': 'owner_id_email',
636 'name': 'owner_id_company_id',
640 'name': 'owner_id_role',
644 'name': 'owner_id_active',
648 'name': 'owner_id_remarks',
652 'name': 'owner_id_passwd',
656 'name': 'owner_id_owner_id',
660 'name': 'owner_id_lang',
664 'name': 'owner_id_no_reset_sent',
668 'name': 'owner_id_action_type',
672 'name': 'owner_id_project_id',
676 'name': 'owner_id_deleted_by',
680 'name': 'owner_id_deleted_dt',
685 totalProperty : 'total'
690 sortInfo : { field : 'name' , direction : 'ASC' },
693 beforeload : function (_self, o)
695 o.params = o.params || {};
696 o.params.company_id = Pman.Login.authUser.company_id;
706 triggerAction : 'all',
707 fieldLabel : 'Person ',
708 forceSelection : true,
709 selectOnFocus : true,
711 displayField : 'name',
712 emptyText : "Select Person ",
721 name : 'person_id_name',
722 qtip : "Select Person ",
723 queryParam : 'query[name]',
724 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
725 loadingText : "Searching...",
727 render : function (_self)
729 _this.personSel = _self;
731 select : function (combo, record, index)
733 _this.grid.footer.onClick('first');
746 url : baseURL + '/Roo/Events.php',
755 xtype : 'JsonReader',
762 'name': 'person_name',
766 'name': 'event_when',
768 'dateFormat': 'Y-m-d'
795 'name': 'person_id_id',
799 'name': 'person_id_office_id',
803 'name': 'person_id_name',
807 'name': 'person_id_phone',
811 'name': 'person_id_fax',
815 'name': 'person_id_email',
819 'name': 'person_id_company_id',
823 'name': 'person_id_role',
827 'name': 'person_id_active',
831 'name': 'person_id_remarks',
835 'name': 'person_id_passwd',
839 'name': 'person_id_owner_id',
843 'name': 'person_id_lang',
847 'name': 'person_id_no_reset_sent',
851 'name': 'person_id_action_type',
855 'name': 'person_id_project_id',
859 'name': 'person_id_deleted_by',
863 'name': 'person_id_deleted_dt',
868 totalProperty : 'total'
873 sortInfo : { field : 'action' , direction : 'ASC' },
876 beforeload : function (_self, o)
878 o.params = o.params || {};
879 // staff can see all logs, other companies can only see their own.
880 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
881 o.params.company_id = Pman.Login.authUser.company_id;
883 o.params._distinct = 'action';
884 o.params._columns ='action';
894 triggerAction : 'all',
895 forceSelection : true,
896 selectOnFocus : true,
898 displayField : 'action',
899 emptyText : "Select Action",
901 valueField : 'action',
909 qtip : "Select Action",
910 queryParam : 'query[action]',
911 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
912 loadingText : "Searching...",
914 render : function (_self)
916 _this.actionSel = _self;
918 select : function (combo, record, index)
920 _this.grid.footer.onClick('first');
932 url : baseURL + '/Roo/Events.php',
941 xtype : 'JsonReader',
949 'name': 'person_name',
953 'name': 'event_when',
955 'dateFormat': 'Y-m-d'
982 'name': 'person_id_id',
986 'name': 'person_id_office_id',
990 'name': 'person_id_name',
994 'name': 'person_id_phone',
998 'name': 'person_id_fax',
1002 'name': 'person_id_email',
1006 'name': 'person_id_company_id',
1010 'name': 'person_id_role',
1014 'name': 'person_id_active',
1018 'name': 'person_id_remarks',
1022 'name': 'person_id_passwd',
1026 'name': 'person_id_owner_id',
1030 'name': 'person_id_lang',
1034 'name': 'person_id_no_reset_sent',
1038 'name': 'person_id_action_type',
1042 'name': 'person_id_project_id',
1046 'name': 'person_id_deleted_by',
1050 'name': 'person_id_deleted_dt',
1054 totalProperty : 'total'
1056 '|xns' : 'Roo.data',
1059 sortInfo : { field : 'on_table' , direction : 'ASC' },
1062 beforeload : function (_self, o)
1064 o.params = o.params || {};
1065 // staff can see all logs, other companies can only see their own.
1066 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
1067 o.params.company_id = Pman.Login.authUser.company_id;
1069 o.params._distinct = 'on_table';
1070 o.params._columns ='on_table';
1078 '|xns' : 'Roo.form',
1080 triggerAction : 'all',
1081 forceSelection : true,
1082 selectOnFocus : true,
1084 displayField : 'on_table',
1085 emptyText : "Select Affects",
1087 valueField : 'action',
1095 qtip : "Select Action",
1096 queryParam : 'query[on_table]',
1097 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
1098 loadingText : "Searching...",
1100 render : function (_self)
1102 _this.affectSel = _self;
1104 select : function (combo, record, index)
1106 _this.grid.footer.onClick('first');
1115 '|xns' : 'Roo.Toolbar',
1116 text : "Date Range",
1121 '|xns' : 'Roo.form',
1123 xtype : 'DateField',
1126 render : function (_self)
1128 _this.dateFrom = _self;
1130 change : function (_self, newValue, oldValue)
1132 _this.grid.footer.onClick('first');
1137 '|xns' : 'Roo.form',
1139 xtype : 'DateField',
1142 render : function (_self)
1144 _this.dateTo = _self;
1146 change : function (_self, newValue, oldValue)
1148 _this.grid.footer.onClick('first');
1155 '|xns' : 'Roo.grid',
1156 autoExpandColumn : 'remarks',
1162 '|xns' : 'Roo.grid',
1163 xtype : 'ColumnModel',
1166 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1168 dataIndex : 'event_when'
1171 '|xns' : 'Roo.grid',
1172 xtype : 'ColumnModel',
1179 '|xns' : 'Roo.grid',
1180 xtype : 'ColumnModel',
1183 renderer : function(v,x,r) {
1185 var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;
1186 var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;
1188 Roo.log([r, efield, nfield]);
1190 var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1191 var name = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1192 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1198 dataIndex : 'person_id_name'
1201 '|xns' : 'Roo.grid',
1202 xtype : 'ColumnModel',
1205 renderer : function(v) { return String.format('{0}', v); },
1207 dataIndex : 'action'
1210 '|xns' : 'Roo.grid',
1211 xtype : 'ColumnModel',
1214 renderer : function(v) { return String.format('{0}', v); },
1216 dataIndex : 'ipaddr'
1219 '|xns' : 'Roo.grid',
1220 xtype : 'ColumnModel',
1221 header : 'Affected',
1223 renderer : function(v, x, r) {
1224 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1227 dataIndex : 'on_table'
1230 '|xns' : 'Roo.grid',
1231 xtype : 'ColumnModel',
1234 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },
1236 dataIndex : 'remarks'
1240 render : function() {
1242 //_this.dialog = Pman.Dialog.FILL_IN
1243 if (_this.panel.active) {
1244 this.footer.onClick('first');
1258 xtype : 'GridPanel',
1259 fitContainer : true,
1261 tableName : 'Events',
1263 activate : function() {
1266 _this.grid.footer.onClick('first');
1280 xtype : 'NestedLayoutPanel',