aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/MapController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-12-21 17:48:08 +0500
committerAbyss777 <abyss@fox5.ru>2016-12-21 18:05:28 +0500
commitb9fda5b5d6630fec90b263a0dbcdcdaf24ed43e7 (patch)
tree372b47bd8f30216f9eb369a885e76e67378eb979 /web/app/view/MapController.js
parent19d6e1c9cc916ed4c1ed72fe168909770a657db2 (diff)
downloadtrackermap-web-b9fda5b5d6630fec90b263a0dbcdcdaf24ed43e7.tar.gz
trackermap-web-b9fda5b5d6630fec90b263a0dbcdcdaf24ed43e7.tar.bz2
trackermap-web-b9fda5b5d6630fec90b263a0dbcdcdaf24ed43e7.zip
Save toggles state in user/server attributes
Diffstat (limited to 'web/app/view/MapController.js')
-rw-r--r--web/app/view/MapController.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index c52fdd5f..b8e2657d 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -27,7 +27,8 @@ Ext.define('Traccar.view.MapController', {
listen: {
controller: {
'*': {
- mapstaterequest: 'getMapState'
+ mapstaterequest: 'getMapState',
+ togglestaterequest: 'getToggleState'
}
},
store: {
@@ -44,6 +45,14 @@ Ext.define('Traccar.view.MapController', {
init: function () {
this.callParent();
this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile());
+ this.lookupReference('deviceFollowButton').setPressed(
+ Traccar.app.getAttributePreference('web.followToggle', 'false') === 'true');
+ this.lookupReference('showGeofencesButton').setPressed(
+ Traccar.app.getAttributePreference('web.geofenceToggle', 'true') === 'true');
+ this.lookupReference('showLiveRoutes').setPressed(
+ Traccar.app.getAttributePreference('web.liveRouteToggle', 'false') === 'true');
+ Ext.getCmp('muteButton').setPressed(
+ Traccar.app.getAttributePreference('web.muteToggle', 'true') === 'true');
},
showReports: function () {
@@ -68,6 +77,15 @@ Ext.define('Traccar.view.MapController', {
this.fireEvent('mapstate', center[1], center[0], zoom);
},
+ getToggleState: function () {
+ var state = {};
+ state['web.followToggle'] = this.lookupReference('deviceFollowButton').pressed.toString();
+ state['web.geofenceToggle'] = this.lookupReference('showGeofencesButton').pressed.toString();
+ state['web.liveRouteToggle'] = this.lookupReference('showLiveRoutes').pressed.toString();
+ state['web.muteToggle'] = Ext.getCmp('muteButton').pressed.toString();
+ this.fireEvent('togglestate', state);
+ },
+
getGeofenceStyle: function (label) {
return new ol.style.Style({
fill: new ol.style.Fill({