From 9f7b998c50b304205858973fe542b49b0e705be5 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 1 Aug 2017 11:57:54 +0500 Subject: Implemented attribute to disable reports --- web/app/controller/Root.js | 12 ++++++++++-- web/app/store/ServerAttributes.js | 4 ++++ web/app/store/UserAttributes.js | 4 ++++ web/app/view/map/MapController.js | 3 ++- web/l10n/en.json | 1 + 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index d85102a7..27455b39 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -103,7 +103,7 @@ Ext.define('Traccar.controller.Root', { }, loadApp: function () { - var attribution, eventId; + var attribution, eventId, main, i; Ext.getStore('Groups').load(); Ext.getStore('Drivers').load(); Ext.getStore('Geofences').load(); @@ -124,7 +124,15 @@ Ext.define('Traccar.controller.Root', { if (Traccar.app.isMobile()) { Ext.create('widget.mainMobile'); } else { - Ext.create('widget.main'); + main = Ext.create('widget.main'); + if (Traccar.app.getAttributePreference('web.disableReport', false)) { + for (i = 0; i < main.items.length; i++) { + if (main.items.items[i].xtype === 'reportView') { + main.items.items[i].hide(); + break; + } + } + } } eventId = Ext.Object.fromQueryString(window.location.search).eventId; if (eventId) { diff --git a/web/app/store/ServerAttributes.js b/web/app/store/ServerAttributes.js index 05002f16..7d720836 100644 --- a/web/app/store/ServerAttributes.js +++ b/web/app/store/ServerAttributes.js @@ -47,5 +47,9 @@ Ext.define('Traccar.store.ServerAttributes', { allowDecimals: false, minValue: Traccar.Style.mapDefaultZoom, maxValue: Traccar.Style.mapMaxZoom + }, { + key: 'web.disableReport', + name: Strings.attributeWebDisableReport, + valueType: 'boolean' }] }); diff --git a/web/app/store/UserAttributes.js b/web/app/store/UserAttributes.js index 91a54d04..928a9be8 100644 --- a/web/app/store/UserAttributes.js +++ b/web/app/store/UserAttributes.js @@ -79,5 +79,9 @@ Ext.define('Traccar.store.UserAttributes', { allowDecimals: false, minValue: Traccar.Style.mapDefaultZoom, maxValue: Traccar.Style.mapMaxZoom + }, { + key: 'web.disableReport', + name: Strings.attributeWebDisableReport, + valueType: 'boolean' }] }); diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index 02d4e382..39cf5101 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -44,7 +44,8 @@ Ext.define('Traccar.view.map.MapController', { init: function () { this.callParent(); - this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile()); + this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile() && + !Traccar.app.getAttributePreference('web.disableReport', false)); this.lookupReference('showEventsButton').setVisible(Traccar.app.isMobile()); }, diff --git a/web/l10n/en.json b/web/l10n/en.json index ba34d066..05239354 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -88,6 +88,7 @@ "attributeMailSmtpAuth": "Mail: SMTP Auth Enable", "attributeMailSmtpUsername": "Mail: SMTP Username", "attributeMailSmtpPassword": "Mail: SMTP Password", + "attributeWebDisableReport": "Web: Disable Report", "errorTitle": "Error", "errorGeneral": "Invalid parameters or constraints violation", "errorConnection": "Connection error", -- cgit v1.2.3