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 var table = uiConfig.events_person_table;
345 Roo.each(uiConfig.xtuple_offices, function(o) {
349 ret.push( [ 'office-' + o, "Transfers from " + Pman.Xtuple.offices[o] ] );
357 xtype : 'SimpleStore',
358 fields : [ 'value' ],
364 triggerAction : 'all',
365 forceSelection : true,
366 selectOnFocus : true,
368 displayField : 'value',
369 emptyText : "Select Person Table",
372 valueField : 'value',
379 name : 'person_table',
380 qtip : "Select Person Table",
381 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>',
382 loadingText : "Searching...",
384 render : function (_self)
386 _this.tableSel = _self;
388 select : function (combo, record, index)
390 _this.grid.footer.onClick('first');
402 url : baseURL + '/Roo/Person.php',
411 xtype : 'JsonReader',
438 'name': 'company_id',
466 'name': 'no_reset_sent',
470 'name': 'action_type',
474 'name': 'project_id',
478 'name': 'deleted_by',
482 'name': 'deleted_dt',
484 'dateFormat': 'Y-m-d'
487 'name': 'office_id_id',
491 'name': 'office_id_company_id',
495 'name': 'office_id_name',
499 'name': 'office_id_address',
503 'name': 'office_id_phone',
507 'name': 'office_id_fax',
511 'name': 'office_id_email',
515 'name': 'office_id_role',
519 'name': 'company_id_code',
523 'name': 'company_id_name',
527 'name': 'company_id_remarks',
531 'name': 'company_id_owner_id',
535 'name': 'company_id_address',
539 'name': 'company_id_tel',
543 'name': 'company_id_fax',
547 'name': 'company_id_email',
551 'name': 'company_id_id',
555 'name': 'company_id_isOwner',
559 'name': 'company_id_logo_id',
563 'name': 'company_id_background_color',
567 'name': 'company_id_comptype',
571 'name': 'company_id_url',
575 'name': 'company_id_main_office_id',
579 'name': 'company_id_created_by',
583 'name': 'company_id_created_dt',
587 'name': 'company_id_updated_by',
591 'name': 'company_id_updated_dt',
595 'name': 'company_id_passwd',
599 'name': 'company_id_dispatch_port',
603 'name': 'company_id_province',
607 'name': 'company_id_country',
611 'name': 'project_id_id',
615 'name': 'project_id_name',
619 'name': 'project_id_remarks',
623 'name': 'project_id_owner_id',
627 'name': 'project_id_code',
631 'name': 'project_id_active',
635 'name': 'project_id_type',
639 'name': 'project_id_client_id',
643 'name': 'project_id_team_id',
647 'name': 'project_id_file_location',
651 'name': 'project_id_open_date',
655 'name': 'project_id_open_by',
659 'name': 'project_id_close_date',
663 'name': 'project_id_countries',
667 'name': 'project_id_languages',
671 'name': 'project_id_agency_id',
675 'name': 'owner_id_id',
679 'name': 'owner_id_office_id',
683 'name': 'owner_id_name',
687 'name': 'owner_id_phone',
691 'name': 'owner_id_fax',
695 'name': 'owner_id_email',
699 'name': 'owner_id_company_id',
703 'name': 'owner_id_role',
707 'name': 'owner_id_active',
711 'name': 'owner_id_remarks',
715 'name': 'owner_id_passwd',
719 'name': 'owner_id_owner_id',
723 'name': 'owner_id_lang',
727 'name': 'owner_id_no_reset_sent',
731 'name': 'owner_id_action_type',
735 'name': 'owner_id_project_id',
739 'name': 'owner_id_deleted_by',
743 'name': 'owner_id_deleted_dt',
748 totalProperty : 'total'
753 sortInfo : { field : 'name' , direction : 'ASC' },
756 beforeload : function (_self, o)
758 o.params = o.params || {};
759 o.params.company_id = Pman.Login.authUser.company_id;
769 triggerAction : 'all',
770 fieldLabel : 'Person ',
771 forceSelection : true,
772 selectOnFocus : true,
774 displayField : 'name',
775 emptyText : "Select Person ",
784 name : 'person_id_name',
785 qtip : "Select Person ",
786 queryParam : 'query[name]',
787 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
788 loadingText : "Searching...",
790 render : function (_self)
792 _this.personSel = _self;
794 select : function (combo, record, index)
796 _this.grid.footer.onClick('first');
809 url : baseURL + '/Roo/Events.php',
818 xtype : 'JsonReader',
825 'name': 'person_name',
829 'name': 'event_when',
831 'dateFormat': 'Y-m-d'
858 'name': 'person_id_id',
862 'name': 'person_id_office_id',
866 'name': 'person_id_name',
870 'name': 'person_id_phone',
874 'name': 'person_id_fax',
878 'name': 'person_id_email',
882 'name': 'person_id_company_id',
886 'name': 'person_id_role',
890 'name': 'person_id_active',
894 'name': 'person_id_remarks',
898 'name': 'person_id_passwd',
902 'name': 'person_id_owner_id',
906 'name': 'person_id_lang',
910 'name': 'person_id_no_reset_sent',
914 'name': 'person_id_action_type',
918 'name': 'person_id_project_id',
922 'name': 'person_id_deleted_by',
926 'name': 'person_id_deleted_dt',
931 totalProperty : 'total'
936 sortInfo : { field : 'action' , direction : 'ASC' },
939 beforeload : function (_self, o)
941 o.params = o.params || {};
942 // staff can see all logs, other companies can only see their own.
943 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
944 o.params.company_id = Pman.Login.authUser.company_id;
946 o.params._distinct = 'action';
947 o.params._columns ='action';
957 triggerAction : 'all',
958 forceSelection : true,
959 selectOnFocus : true,
961 displayField : 'action',
962 emptyText : "Select Action",
964 valueField : 'action',
972 qtip : "Select Action",
973 queryParam : 'query[action]',
974 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
975 loadingText : "Searching...",
977 render : function (_self)
979 _this.actionSel = _self;
981 select : function (combo, record, index)
983 _this.grid.footer.onClick('first');
995 url : baseURL + '/Roo/Events.php',
1001 '|xns' : 'Roo.data',
1004 xtype : 'JsonReader',
1012 'name': 'person_name',
1016 'name': 'event_when',
1018 'dateFormat': 'Y-m-d'
1037 'name': 'person_id',
1045 'name': 'person_id_id',
1049 'name': 'person_id_office_id',
1053 'name': 'person_id_name',
1057 'name': 'person_id_phone',
1061 'name': 'person_id_fax',
1065 'name': 'person_id_email',
1069 'name': 'person_id_company_id',
1073 'name': 'person_id_role',
1077 'name': 'person_id_active',
1081 'name': 'person_id_remarks',
1085 'name': 'person_id_passwd',
1089 'name': 'person_id_owner_id',
1093 'name': 'person_id_lang',
1097 'name': 'person_id_no_reset_sent',
1101 'name': 'person_id_action_type',
1105 'name': 'person_id_project_id',
1109 'name': 'person_id_deleted_by',
1113 'name': 'person_id_deleted_dt',
1117 totalProperty : 'total'
1119 '|xns' : 'Roo.data',
1122 sortInfo : { field : 'on_table' , direction : 'ASC' },
1125 beforeload : function (_self, o)
1127 o.params = o.params || {};
1128 // staff can see all logs, other companies can only see their own.
1129 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
1130 o.params.company_id = Pman.Login.authUser.company_id;
1132 o.params._distinct = 'on_table';
1133 o.params._columns ='on_table';
1141 '|xns' : 'Roo.form',
1143 triggerAction : 'all',
1144 forceSelection : true,
1145 selectOnFocus : true,
1147 displayField : 'on_table',
1148 emptyText : "Select Affects",
1150 valueField : 'action',
1158 qtip : "Select Action",
1159 queryParam : 'query[on_table]',
1160 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
1161 loadingText : "Searching...",
1163 render : function (_self)
1165 _this.affectSel = _self;
1167 select : function (combo, record, index)
1169 _this.grid.footer.onClick('first');
1178 '|xns' : 'Roo.Toolbar',
1179 text : "Date Range",
1184 '|xns' : 'Roo.form',
1186 xtype : 'DateField',
1189 render : function (_self)
1191 _this.dateFrom = _self;
1193 change : function (_self, newValue, oldValue)
1195 _this.grid.footer.onClick('first');
1200 '|xns' : 'Roo.form',
1202 xtype : 'DateField',
1205 render : function (_self)
1207 _this.dateTo = _self;
1209 change : function (_self, newValue, oldValue)
1211 _this.grid.footer.onClick('first');
1218 '|xns' : 'Roo.grid',
1219 autoExpandColumn : 'remarks',
1225 '|xns' : 'Roo.grid',
1226 xtype : 'ColumnModel',
1229 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1231 dataIndex : 'event_when'
1234 '|xns' : 'Roo.grid',
1235 xtype : 'ColumnModel',
1242 '|xns' : 'Roo.grid',
1243 xtype : 'ColumnModel',
1246 renderer : function(v,x,r) {
1248 var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;
1249 var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;
1251 Roo.log([r, efield, nfield]);
1253 var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1254 var name = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1255 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1261 dataIndex : 'person_id_name'
1264 '|xns' : 'Roo.grid',
1265 xtype : 'ColumnModel',
1268 renderer : function(v) { return String.format('{0}', v); },
1270 dataIndex : 'action'
1273 '|xns' : 'Roo.grid',
1274 xtype : 'ColumnModel',
1277 renderer : function(v) { return String.format('{0}', v); },
1279 dataIndex : 'ipaddr'
1282 '|xns' : 'Roo.grid',
1283 xtype : 'ColumnModel',
1284 header : 'Affected',
1286 renderer : function(v, x, r) {
1287 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1290 dataIndex : 'on_table'
1293 '|xns' : 'Roo.grid',
1294 xtype : 'ColumnModel',
1297 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },
1299 dataIndex : 'remarks'
1303 render : function() {
1305 //_this.dialog = Pman.Dialog.FILL_IN
1306 if (_this.panel.active) {
1307 this.footer.onClick('first');
1321 xtype : 'GridPanel',
1322 fitContainer : true,
1324 tableName : 'Events',
1326 activate : function() {
1329 _this.grid.footer.onClick('first');
1343 xtype : 'NestedLayoutPanel',