diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/Map.js | 2 | ||||
-rw-r--r-- | web/app/view/MapController.js | 20 | ||||
-rw-r--r-- | web/app/view/MapPickerDialogController.js | 12 | ||||
-rw-r--r-- | web/app/view/ServerDialog.js | 6 | ||||
-rw-r--r-- | web/app/view/UserDialog.js | 6 |
5 files changed, 42 insertions, 4 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js index be17b889..2cc37ecb 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -48,7 +48,6 @@ Ext.define('Traccar.view.Map', { reference: 'showGeofencesButton', glyph: 'xf21d@FontAwesome', enableToggle: true, - pressed: true, tooltip: Strings.sharedGeofences }, { xtype: 'button', @@ -70,7 +69,6 @@ Ext.define('Traccar.view.Map', { glyph: 'xf1f7@FontAwesome', tooltip: Strings.sharedMute, tooltipType: 'title', - pressed : true, enableToggle: true, listeners: { toggle: function (button, pressed) { 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({ diff --git a/web/app/view/MapPickerDialogController.js b/web/app/view/MapPickerDialogController.js index 1dc48ea0..6a3b1a51 100644 --- a/web/app/view/MapPickerDialogController.js +++ b/web/app/view/MapPickerDialogController.js @@ -24,7 +24,8 @@ Ext.define('Traccar.view.MapPickerDialogController', { listen: { controller: { '*': { - mapstate: 'setMapState' + mapstate: 'setMapState', + togglestate: 'setToggleState' } } } @@ -34,9 +35,18 @@ Ext.define('Traccar.view.MapPickerDialogController', { this.fireEvent('mapstaterequest'); }, + getToggleState: function (button) { + this.fireEvent('togglestaterequest'); + }, + setMapState: function (lat, lon, zoom) { this.lookupReference('latitude').setValue(lat); this.lookupReference('longitude').setValue(lon); this.lookupReference('zoom').setValue(zoom); + }, + + setToggleState: function (state) { + var record = this.getView().down('form').getRecord(); + record.set('attributes', Ext.merge(record.get('attributes'), state)); } }); diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js index 0a05876e..667bf47f 100644 --- a/web/app/view/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -125,6 +125,12 @@ Ext.define('Traccar.view.ServerDialog', { tooltip: Strings.sharedGetMapState, tooltipType: 'title' }, { + glyph: 'xf205@FontAwesome', + minWidth: 0, + handler: 'getToggleState', + tooltip: Strings.sharedGetToggleState, + tooltipType: 'title' + }, { xtype: 'tbfill' }, { glyph: 'xf00c@FontAwesome', diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 8ee12437..02e7b2fc 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -163,6 +163,12 @@ Ext.define('Traccar.view.UserDialog', { tooltip: Strings.sharedGetMapState, tooltipType: 'title' }, { + glyph: 'xf205@FontAwesome', + minWidth: 0, + handler: 'getToggleState', + tooltip: Strings.sharedGetToggleState, + tooltipType: 'title' + }, { glyph: 'xf003@FontAwesome', minWidth: 0, handler: 'testMail', |