aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-08 16:16:55 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-10-08 16:16:55 +1300
commitefbaeb0393df7532dd7865f0e77171209f4e9363 (patch)
tree39c1523d5e89ac2ac40738dbfab369cc23fc5bde
parent58d7f195375a8d32f5260da7d4cea437ad564223 (diff)
downloadetbsa-traccar-web-efbaeb0393df7532dd7865f0e77171209f4e9363.tar.gz
etbsa-traccar-web-efbaeb0393df7532dd7865f0e77171209f4e9363.tar.bz2
etbsa-traccar-web-efbaeb0393df7532dd7865f0e77171209f4e9363.zip
Option to force server settings
-rw-r--r--web/app/Application.js6
-rw-r--r--web/app/model/Server.js3
-rw-r--r--web/app/view/BaseMap.js11
-rw-r--r--web/app/view/ServerDialog.js5
-rw-r--r--web/l10n/en.json1
5 files changed, 19 insertions, 7 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index aab9bc8..4671a82 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -97,7 +97,11 @@ Ext.define('Traccar.Application', {
},
getPreference: function (key, defaultValue) {
- return this.getUser().get(key) || this.getServer().get(key) || defaultValue;
+ if (this.getServer().get('forceSettings')) {
+ return this.getServer().get(key) || this.getUser().get(key) || defaultValue;
+ } else {
+ return this.getUser().get(key) || this.getServer().get(key) || defaultValue;
+ }
},
showError: function (response) {
diff --git a/web/app/model/Server.js b/web/app/model/Server.js
index eb04c8c..4fe8efd 100644
--- a/web/app/model/Server.js
+++ b/web/app/model/Server.js
@@ -56,6 +56,9 @@ Ext.define('Traccar.model.Server', {
name: 'twelveHourFormat',
type: 'boolean'
}, {
+ name: 'forceSettings',
+ type: 'boolean'
+ }, {
name: 'attributes'
}],
diff --git a/web/app/view/BaseMap.js b/web/app/view/BaseMap.js
index 3a0f442..e37b5cf 100644
--- a/web/app/view/BaseMap.js
+++ b/web/app/view/BaseMap.js
@@ -30,12 +30,11 @@ Ext.define('Traccar.view.BaseMap', {
},
initMap: function () {
- var user, server, layer, type, bingKey, lat, lon, zoom, target;
+ var server, layer, type, bingKey, lat, lon, zoom, target;
- user = Traccar.app.getUser();
server = Traccar.app.getServer();
- type = user.get('map') || server.get('map');
+ type = Traccar.app.getPreference('map', null);
bingKey = server.get('bingKey');
if (type === 'custom') {
@@ -88,9 +87,9 @@ Ext.define('Traccar.view.BaseMap', {
});
}
- lat = user.get('latitude') || server.get('latitude') || Traccar.Style.mapDefaultLat;
- lon = user.get('longitude') || server.get('longitude') || Traccar.Style.mapDefaultLon;
- zoom = user.get('zoom') || server.get('zoom') || Traccar.Style.mapDefaultZoom;
+ lat = Traccar.app.getPreference('latitude', Traccar.Style.mapDefaultLat);
+ lon = Traccar.app.getPreference('longitude', Traccar.Style.mapDefaultLon);
+ zoom = Traccar.app.getPreference('zoom', Traccar.Style.mapDefaultZoom);
this.mapView = new ol.View({
center: ol.proj.fromLonLat([lon, lat]),
diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js
index a08851c..14af183 100644
--- a/web/app/view/ServerDialog.js
+++ b/web/app/view/ServerDialog.js
@@ -91,6 +91,11 @@ Ext.define('Traccar.view.ServerDialog', {
name: 'twelveHourFormat',
fieldLabel: Strings.settingsTwelveHourFormat,
allowBlank: false
+ }, {
+ xtype: 'checkboxfield',
+ name: 'forceSettings',
+ fieldLabel: Strings.serverForceSettings,
+ allowBlank: false
}]
},
diff --git a/web/l10n/en.json b/web/l10n/en.json
index 11b2e83..c9c65eb 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -83,6 +83,7 @@
"serverZoom": "Zoom",
"serverRegistration": "Registration",
"serverReadonly": "Readonly",
+ "serverForceSettings": "Force Settings",
"mapTitle": "Map",
"mapLayer": "Map Layer",
"mapCustom": "Custom Map",