From 6422cbef5728dd18dfe22f1cc02e72e7ae0a8f60 Mon Sep 17 00:00:00 2001 From: Christoph Krey Date: Sat, 14 Apr 2018 18:48:41 +0200 Subject: [NEW] Feature Request: Add Odometer to Summary, Trips, and Stops Reports #652 --- web/app/view/ReportController.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'web/app/view') diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 42e099da..9ec75ce2 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -520,6 +520,14 @@ Ext.define('Traccar.view.ReportController', { text: Strings.sharedDistance, dataIndex: 'distance', renderer: Traccar.AttributeFormatter.getFormatter('distance') + }, { + text: Strings.reportStartOdometer, + dataIndex: 'startOdometer', + renderer: Traccar.AttributeFormatter.getFormatter('distance'), + }, { + text: Strings.reportEndOdometer, + dataIndex: 'endOdometer', + renderer: Traccar.AttributeFormatter.getFormatter('distance'), }, { text: Strings.reportAverageSpeed, dataIndex: 'averageSpeed', @@ -547,6 +555,10 @@ Ext.define('Traccar.view.ReportController', { dataIndex: 'startTime', xtype: 'datecolumn', renderer: Traccar.AttributeFormatter.getFormatter('startTime') + }, { + text: Strings.reportStartOdometer, + dataIndex: 'startOdometer', + renderer: Traccar.AttributeFormatter.getFormatter('distance'), }, { text: Strings.reportStartAddress, dataIndex: 'startAddress', @@ -556,6 +568,10 @@ Ext.define('Traccar.view.ReportController', { dataIndex: 'endTime', xtype: 'datecolumn', renderer: Traccar.AttributeFormatter.getFormatter('endTime') + }, { + text: Strings.reportEndOdometer, + dataIndex: 'endOdometer', + renderer: Traccar.AttributeFormatter.getFormatter('distance'), }, { text: Strings.reportEndAddress, dataIndex: 'endAddress', @@ -595,6 +611,10 @@ Ext.define('Traccar.view.ReportController', { dataIndex: 'startTime', xtype: 'datecolumn', renderer: Traccar.AttributeFormatter.getFormatter('startTime') + }, { + text: Strings.reportStartOdometer, + dataIndex: 'startOdometer', + renderer: Traccar.AttributeFormatter.getFormatter('distance'), }, { text: Strings.positionAddress, dataIndex: 'address', -- cgit v1.2.3 From 99a0b3892410809452250fb1535316afd14bbbcb Mon Sep 17 00:00:00 2001 From: Christoph Krey Date: Mon, 6 Aug 2018 18:21:44 +0200 Subject: [FIX] re-use Odometer string from positions in reports --- web/app/view/ReportController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 6079da77..6a160b23 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -630,7 +630,7 @@ Ext.define('Traccar.view.ReportController', { xtype: 'datecolumn', renderer: Traccar.AttributeFormatter.getFormatter('startTime') }, { - text: Strings.reportStartOdometer, + text: Strings.positionOdometer, dataIndex: 'startOdometer', renderer: Traccar.AttributeFormatter.getFormatter('distance'), }, { -- cgit v1.2.3 From 32a04766f2c42fd575c3aeab6141635fcb53509f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 30 Sep 2018 10:45:28 +1300 Subject: Option to mail reports --- web/app/view/Report.js | 5 +++++ web/app/view/ReportController.js | 12 +++++++----- web/l10n/en.json | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/Report.js b/web/app/view/Report.js index f77cfca6..deedb747 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -62,6 +62,11 @@ Ext.define('Traccar.view.Report', { reference: 'exportButton', disabled: true, handler: 'onReportClick' + }, { + text: Strings.reportEmail, + reference: 'emailButton', + disabled: true, + handler: 'onReportClick' }, { text: Strings.reportClear, handler: 'onClearClick' diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 72e7e37e..2cbfcbc6 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -145,6 +145,7 @@ Ext.define('Traccar.view.ReportController', { disabled = !reportType || !devices || !time || this.reportProgress; this.lookupReference('showButton').setDisabled(disabled); this.lookupReference('exportButton').setDisabled(reportType === 'chart' || disabled); + this.lookupReference('emailButton').setDisabled(reportType === 'chart' || disabled); }, onReportClick: function (button) { @@ -187,14 +188,15 @@ Ext.define('Traccar.view.ReportController', { to: to.toISOString() } }); - } else if (button.reference === 'exportButton') { + } else { url = this.getGrid().getStore().getProxy().url; - this.downloadFile(url, { + this.excelReport(url, { deviceId: this.deviceId, groupId: this.groupId, type: this.eventType, from: Ext.Date.format(from, 'c'), - to: Ext.Date.format(to, 'c') + to: Ext.Date.format(to, 'c'), + mail: button.reference === 'emailButton' }); } } @@ -371,7 +373,7 @@ Ext.define('Traccar.view.ReportController', { }); }, - downloadFile: function (requestUrl, requestParams) { + excelReport: function (requestUrl, requestParams) { Ext.Ajax.request({ url: requestUrl, method: 'GET', @@ -384,7 +386,7 @@ Ext.define('Traccar.view.ReportController', { scope: this, callback: function (options, success, response) { var disposition, filename, type, blob, url, downloadUrl; - if (success) { + if (success && !requestParams.mail) { disposition = response.getResponseHeader('Content-Disposition'); filename = disposition.slice(disposition.indexOf('=') + 1, disposition.length); type = response.getResponseHeader('Content-Type'); diff --git a/web/l10n/en.json b/web/l10n/en.json index 05e0d1b4..12305b67 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -372,6 +372,7 @@ "reportChartType": "Chart Type", "reportShowMarkers": "Show Markers", "reportExport": "Export", + "reportEmail": "Email Report", "reportPeriod": "Period", "reportCustom": "Custom", "reportToday": "Today", -- cgit v1.2.3 From d15fa5e2316b62884e48830c6c0bacb54ed1cd52 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 12 Oct 2018 14:55:56 +1300 Subject: Restrict access to computed attributes (AC-2018-10-8-1) --- web/app/view/SettingsMenuController.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 37e0634c..fdc1e538 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -45,6 +45,8 @@ Ext.define('Traccar.view.SettingsMenuController', { if (admin) { this.lookupReference('settingsServerButton').setHidden(false); this.lookupReference('settingsStatisticsButton').setHidden(false); + this.lookupReference('settingsComputedAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); } if (admin || manager) { this.lookupReference('settingsUsersButton').setHidden(false); @@ -62,10 +64,6 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsMaintenancesButton').setHidden( Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances')); } - if (admin || !deviceReadonly && !readonly) { - this.lookupReference('settingsComputedAttributesButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); - } }, onUserClick: function () { -- cgit v1.2.3 From 2273341a2d22ac86dbc2c23481c06fe7d2c91a0f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 12 Oct 2018 15:04:16 +1300 Subject: Remove unused variable --- web/app/view/SettingsMenuController.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index fdc1e538..b838fb40 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -37,11 +37,10 @@ Ext.define('Traccar.view.SettingsMenuController', { ], init: function () { - var admin, manager, readonly, deviceReadonly; + var admin, manager, readonly; admin = Traccar.app.getUser().get('administrator'); manager = Traccar.app.getUser().get('userLimit') !== 0; readonly = Traccar.app.getPreference('readonly', false); - deviceReadonly = Traccar.app.getUser().get('deviceReadonly'); if (admin) { this.lookupReference('settingsServerButton').setHidden(false); this.lookupReference('settingsStatisticsButton').setHidden(false); -- cgit v1.2.3 From ca151426b29a262f7917682a7b6c54967546dabd Mon Sep 17 00:00:00 2001 From: Christoph Krey Date: Mon, 15 Oct 2018 08:49:27 +0200 Subject: [FIX] dangling commas --- web/app/view/ReportController.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 6a160b23..7ecb15e2 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -541,11 +541,11 @@ Ext.define('Traccar.view.ReportController', { }, { text: Strings.reportStartOdometer, dataIndex: 'startOdometer', - renderer: Traccar.AttributeFormatter.getFormatter('distance'), + renderer: Traccar.AttributeFormatter.getFormatter('distance') }, { text: Strings.reportEndOdometer, dataIndex: 'endOdometer', - renderer: Traccar.AttributeFormatter.getFormatter('distance'), + renderer: Traccar.AttributeFormatter.getFormatter('distance') }, { text: Strings.reportAverageSpeed, dataIndex: 'averageSpeed', @@ -576,7 +576,7 @@ Ext.define('Traccar.view.ReportController', { }, { text: Strings.reportStartOdometer, dataIndex: 'startOdometer', - renderer: Traccar.AttributeFormatter.getFormatter('distance'), + renderer: Traccar.AttributeFormatter.getFormatter('distance') }, { text: Strings.reportStartAddress, dataIndex: 'startAddress', @@ -589,7 +589,7 @@ Ext.define('Traccar.view.ReportController', { }, { text: Strings.reportEndOdometer, dataIndex: 'endOdometer', - renderer: Traccar.AttributeFormatter.getFormatter('distance'), + renderer: Traccar.AttributeFormatter.getFormatter('distance') }, { text: Strings.reportEndAddress, dataIndex: 'endAddress', @@ -632,7 +632,7 @@ Ext.define('Traccar.view.ReportController', { }, { text: Strings.positionOdometer, dataIndex: 'startOdometer', - renderer: Traccar.AttributeFormatter.getFormatter('distance'), + renderer: Traccar.AttributeFormatter.getFormatter('distance') }, { text: Strings.positionAddress, dataIndex: 'address', -- cgit v1.2.3 From bf0e2a0be1b78690cba8aa9fab5fdde2359d90f4 Mon Sep 17 00:00:00 2001 From: "Godwin peter .O" Date: Tue, 16 Oct 2018 02:45:56 +0100 Subject: Create TouchFix62.js --- web/app/view/TouchFix62.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 web/app/view/TouchFix62.js (limited to 'web/app/view') diff --git a/web/app/view/TouchFix62.js b/web/app/view/TouchFix62.js new file mode 100644 index 00000000..59c9baf2 --- /dev/null +++ b/web/app/view/TouchFix62.js @@ -0,0 +1,49 @@ +/* + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * workaround for bug in ExtJs 6.2.0. + * Resolved in current yet unreleased version + */ + +Ext.define('Traccar.view.TouchFix62', { + override: 'Ext.dom.Element' +}, +function(){ + var additiveEvents = this.prototype.additiveEvents, + eventMap = this.prototype.eventMap; + if(Ext.supports.TouchEvents && Ext.firefoxVersion >= 52 && Ext.os.is.Desktop){ + eventMap['touchstart'] = 'mousedown'; + eventMap['touchmove'] = 'mousemove'; + eventMap['touchend'] = 'mouseup'; + eventMap['touchcancel'] = 'mouseup'; + eventMap['click'] = 'click'; + eventMap['dblclick'] = 'dblclick'; + additiveEvents['mousedown'] = 'mousedown'; + additiveEvents['mousemove'] = 'mousemove'; + additiveEvents['mouseup'] = 'mouseup'; + additiveEvents['touchstart'] = 'touchstart'; + additiveEvents['touchmove'] = 'touchmove'; + additiveEvents['touchend'] = 'touchend'; + additiveEvents['touchcancel'] = 'touchcancel'; + + additiveEvents['pointerdown'] = 'mousedown'; + additiveEvents['pointermove'] = 'mousemove'; + additiveEvents['pointerup'] = 'mouseup'; + additiveEvents['pointercancel'] = 'mouseup'; + } +}) -- cgit v1.2.3 From f4b596869e8f5e9af19f18fb33cb146742a8c252 Mon Sep 17 00:00:00 2001 From: "Godwin peter .O" Date: Tue, 16 Oct 2018 02:58:09 +0100 Subject: Update TouchFix62.js --- web/app/view/TouchFix62.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/TouchFix62.js b/web/app/view/TouchFix62.js index 59c9baf2..300d4f70 100644 --- a/web/app/view/TouchFix62.js +++ b/web/app/view/TouchFix62.js @@ -15,18 +15,18 @@ * along with this program. If not, see . */ -/** - * workaround for bug in ExtJs 6.2.0. +/* + * Workaround for bug in ExtJs 6.2.0. * Resolved in current yet unreleased version */ Ext.define('Traccar.view.TouchFix62', { override: 'Ext.dom.Element' }, -function(){ +function () { var additiveEvents = this.prototype.additiveEvents, eventMap = this.prototype.eventMap; - if(Ext.supports.TouchEvents && Ext.firefoxVersion >= 52 && Ext.os.is.Desktop){ + if (Ext.supports.TouchEvents && Ext.firefoxVersion >= 52 && Ext.os.is.Desktop) { eventMap['touchstart'] = 'mousedown'; eventMap['touchmove'] = 'mousemove'; eventMap['touchend'] = 'mouseup'; @@ -40,10 +40,9 @@ function(){ additiveEvents['touchmove'] = 'touchmove'; additiveEvents['touchend'] = 'touchend'; additiveEvents['touchcancel'] = 'touchcancel'; - additiveEvents['pointerdown'] = 'mousedown'; additiveEvents['pointermove'] = 'mousemove'; additiveEvents['pointerup'] = 'mouseup'; additiveEvents['pointercancel'] = 'mouseup'; } -}) +}); -- cgit v1.2.3 From 49b8e313bb70fd93ab15c4c316f98ce9bfe7aea5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 21 Oct 2018 14:46:05 +0400 Subject: Un-escape custom map URL link --- web/app/view/map/BaseMap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 07e391ff..42b4bc17 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -41,7 +41,8 @@ Ext.define('Traccar.view.map.BaseMap', { case 'custom': layer = new ol.layer.Tile({ source: new ol.source.XYZ({ - url: server.get('mapUrl'), + url: new DOMParser() + .parseFromString(server.get('mapUrl'), 'text/html').documentElement.textContent, attributions: '' }) }); -- cgit v1.2.3 From 4bc1650ebe680520c9fc95b1c627fe5b7b8fa22c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 21 Oct 2018 14:51:37 +0400 Subject: Fix indentation problem --- web/app/view/map/BaseMap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 42b4bc17..26b9f7c1 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -42,7 +42,7 @@ Ext.define('Traccar.view.map.BaseMap', { layer = new ol.layer.Tile({ source: new ol.source.XYZ({ url: new DOMParser() - .parseFromString(server.get('mapUrl'), 'text/html').documentElement.textContent, + .parseFromString(server.get('mapUrl'), 'text/html').documentElement.textContent, attributions: '' }) }); -- cgit v1.2.3 From 3df9db8f0a841e5f1020d6797083c73cc68e512c Mon Sep 17 00:00:00 2001 From: alex-petkevich Date: Thu, 25 Oct 2018 11:09:23 +0300 Subject: Fix bug with selecting device second times from the devices grid --- web/app/view/edit/Devices.js | 3 ++- web/app/view/edit/DevicesController.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index 21fdb32a..2b2a874b 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -75,7 +75,8 @@ Ext.define('Traccar.view.edit.Devices', { }, listeners: { - selectionchange: 'onSelectionChange' + selectionchange: 'onSelectionChange', + rowclick: 'onClick' }, viewConfig: { diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 2b4ff14f..c1e46b79 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -118,6 +118,13 @@ Ext.define('Traccar.view.edit.DevicesController', { } }, + onClick: function (el, record) { + if (record !== undefined) { + this.updateButtons([record]); + this.fireEvent('selectdevice', record, true); + } + }, + selectDevice: function (device) { this.getView().getSelectionModel().select([device], false, true); this.updateButtons(this.getView().getSelectionModel().getSelected().items); -- cgit v1.2.3 From f953873700235a416f69eeed909cd73c59e1f32b Mon Sep 17 00:00:00 2001 From: alex-petkevich Date: Thu, 25 Oct 2018 16:24:52 +0300 Subject: Fix bug with selecting device second times from the devices grid --- web/app/view/edit/Devices.js | 4 ++-- web/app/view/edit/DevicesController.js | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index 2b2a874b..dfa855c8 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -75,8 +75,8 @@ Ext.define('Traccar.view.edit.Devices', { }, listeners: { - selectionchange: 'onSelectionChange', - rowclick: 'onClick' + rowclick: 'onSelectionChange', + itemkeyup: 'onSelectionChange' }, viewConfig: { diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index c1e46b79..120944b8 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -109,16 +109,7 @@ Ext.define('Traccar.view.edit.DevicesController', { this.lookupReference('deviceCommandButton').setDisabled(empty || readonly); }, - onSelectionChange: function (selection, selected) { - this.updateButtons(selected); - if (selected.length > 0) { - this.fireEvent('selectdevice', selected[0], true); - } else { - this.fireEvent('deselectfeature'); - } - }, - - onClick: function (el, record) { + onSelectionChange: function (el, record) { if (record !== undefined) { this.updateButtons([record]); this.fireEvent('selectdevice', record, true); -- cgit v1.2.3 From 3b87c6ea876b58ccd54bdde7ed644c7aaf2d5f61 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 31 Oct 2018 15:40:42 +1300 Subject: Use correct column name --- web/app/view/edit/Drivers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/Drivers.js b/web/app/view/edit/Drivers.js index 9aac8cd6..7bd10a68 100644 --- a/web/app/view/edit/Drivers.js +++ b/web/app/view/edit/Drivers.js @@ -46,7 +46,7 @@ Ext.define('Traccar.view.edit.Drivers', { dataIndex: 'name', filter: 'string' }, { - text: Strings.sharedDescription, + text: Strings.deviceIdentifier, dataIndex: 'uniqueId', filter: 'string' }] -- cgit v1.2.3 From 97d1cbef1e75714b4a2c68c763b4e137a6fb2d10 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 2 Nov 2018 10:19:53 +1300 Subject: Fix missing strings --- web/app/view/Statistics.js | 4 ++-- web/app/view/dialog/SavedCommand.js | 2 +- web/app/view/dialog/SendCommand.js | 2 +- web/app/view/edit/SavedCommands.js | 2 +- web/app/view/permissions/SavedCommands.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/Statistics.js b/web/app/view/Statistics.js index f033e03a..31ec5e9d 100644 --- a/web/app/view/Statistics.js +++ b/web/app/view/Statistics.js @@ -77,10 +77,10 @@ Ext.define('Traccar.view.Statistics', { text: Strings.statisticsMessagesStored, dataIndex: 'messagesStored' }, { - text: Strings.notificationMail, + text: Strings.notificatorSms, dataIndex: 'mailSent' }, { - text: Strings.notificationSms, + text: Strings.notificatorSms, dataIndex: 'smsSent' }, { text: Strings.statisticsGeocoder, diff --git a/web/app/view/dialog/SavedCommand.js b/web/app/view/dialog/SavedCommand.js index 4759143a..a7693871 100644 --- a/web/app/view/dialog/SavedCommand.js +++ b/web/app/view/dialog/SavedCommand.js @@ -42,7 +42,7 @@ Ext.define('Traccar.view.dialog.SavedCommand', { name: 'textChannel', inputValue: true, uncheckedValue: false, - fieldLabel: Strings.notificationSms + fieldLabel: Strings.commandSendSms }, { xtype: 'combobox', name: 'type', diff --git a/web/app/view/dialog/SendCommand.js b/web/app/view/dialog/SendCommand.js index 9e07cbf3..79954739 100644 --- a/web/app/view/dialog/SendCommand.js +++ b/web/app/view/dialog/SendCommand.js @@ -54,7 +54,7 @@ Ext.define('Traccar.view.dialog.SendCommand', { reference: 'textChannelCheckBox', inputValue: true, uncheckedValue: false, - fieldLabel: Strings.notificationSms, + fieldLabel: Strings.commandSendSms, listeners: { change: 'onTextChannelChange' } diff --git a/web/app/view/edit/SavedCommands.js b/web/app/view/edit/SavedCommands.js index 794e95e4..9e5f4869 100644 --- a/web/app/view/edit/SavedCommands.js +++ b/web/app/view/edit/SavedCommands.js @@ -56,7 +56,7 @@ Ext.define('Traccar.view.edit.SavedCommands', { }, renderer: Traccar.AttributeFormatter.getFormatter('commandType') }, { - text: Strings.notificationSms, + text: Strings.commandSendSms, dataIndex: 'textChannel', renderer: Traccar.AttributeFormatter.getFormatter('textChannel'), filter: 'boolean' diff --git a/web/app/view/permissions/SavedCommands.js b/web/app/view/permissions/SavedCommands.js index 52b759bb..b57c07a0 100644 --- a/web/app/view/permissions/SavedCommands.js +++ b/web/app/view/permissions/SavedCommands.js @@ -40,7 +40,7 @@ Ext.define('Traccar.view.permissions.SavedCommands', { }, renderer: Traccar.AttributeFormatter.getFormatter('commandType') }, { - text: Strings.notificationSms, + text: Strings.commandSendSms, dataIndex: 'textChannel', flex: 1, minWidth: Traccar.Style.columnWidthNormal, -- cgit v1.2.3 From c3f8353377eedecab9f3b973645e613c9ff2c80a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 4 Nov 2018 14:38:49 +1300 Subject: Alarm types filtering option --- web/app/Application.js | 1 + web/app/store/AlarmTypes.js | 34 +++++++++++++++++++++++++++ web/app/view/dialog/Notification.js | 21 +++++++++++++++-- web/app/view/dialog/NotificationController.js | 26 ++++++++++++++++++++ web/app/view/edit/Notifications.js | 17 ++++++++++++++ web/l10n/en.json | 1 + 6 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 web/app/store/AlarmTypes.js (limited to 'web/app/view') diff --git a/web/app/Application.js b/web/app/Application.js index 9b718807..91bdc584 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -52,6 +52,7 @@ Ext.define('Traccar.Application', { 'Devices', 'AllGroups', 'AllDevices', + 'AlarmTypes', 'Positions', 'LatestPositions', 'EventPositions', diff --git a/web/app/store/AlarmTypes.js b/web/app/store/AlarmTypes.js new file mode 100644 index 00000000..9520359f --- /dev/null +++ b/web/app/store/AlarmTypes.js @@ -0,0 +1,34 @@ +/* + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.store.AlarmTypes', { + extend: 'Ext.data.Store', + fields: ['key', 'name'], + + data: function () { + var items = []; + for (key in Strings) { + if (Strings.hasOwnProperty(key) && key.lastIndexOf('alarm', 0) === 0) { + items.push({ + key: key.charAt(5).toLowerCase() + key.slice(6), + name: Strings[key] + }); + } + } + return items; + }() +}); diff --git a/web/app/view/dialog/Notification.js b/web/app/view/dialog/Notification.js index dc4362d9..51af5b8e 100644 --- a/web/app/view/dialog/Notification.js +++ b/web/app/view/dialog/Notification.js @@ -41,7 +41,10 @@ Ext.define('Traccar.view.dialog.Notification', { displayField: 'name', valueField: 'type', editable: false, - allowBlank: false + allowBlank: false, + listeners: { + change: 'onTypeChange' + } }, { xtype: 'checkboxfield', inputValue: true, @@ -49,8 +52,22 @@ Ext.define('Traccar.view.dialog.Notification', { name: 'always', fieldLabel: Strings.notificationAlways }, { - fieldLabel: Strings.notificationNotificators, xtype: 'tagfield', + reference: 'alarmsField', + fieldLabel: Strings.sharedAlarms, + maxWidth: Traccar.Style.formFieldWidth, + store: 'AlarmTypes', + valueField: 'key', + displayField: 'name', + queryMode: 'local', + hidden: true, + listeners: { + beforerender: 'onAlarmsLoad', + change: 'onAlarmsChange' + } + }, { + xtype: 'tagfield', + fieldLabel: Strings.notificationNotificators, name: 'notificators', maxWidth: Traccar.Style.formFieldWidth, store: 'AllNotificators', diff --git a/web/app/view/dialog/NotificationController.js b/web/app/view/dialog/NotificationController.js index ad65c333..5da669a4 100644 --- a/web/app/view/dialog/NotificationController.js +++ b/web/app/view/dialog/NotificationController.js @@ -23,5 +23,31 @@ Ext.define('Traccar.view.dialog.NotificationController', { init: function () { this.lookupReference('calendarCombo').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); + }, + + onTypeChange: function (view, value) { + this.lookupReference('alarmsField').setHidden(value !== 'alarm'); + }, + + onAlarmsLoad: function (view) { + var attributes, record = view.up('form').getRecord(); + attributes = record.get('attributes') || {}; + if (attributes['alarms']) { + view.suspendEvents(false); + view.setValue(attributes['alarms'].split(',')); + view.resumeEvents(); + } + }, + + onAlarmsChange: function (view, value) { + var attributes, record = view.up('window').down('form').getRecord(); + attributes = record.get('attributes') || {}; + + value = value.join(); + if (attributes['alarms'] !== value) { + attributes['alarms'] = value; + record.set('attributes', attributes); + record.dirty = true; + } } }); diff --git a/web/app/view/edit/Notifications.js b/web/app/view/edit/Notifications.js index 9e24d3d0..7983c4db 100644 --- a/web/app/view/edit/Notifications.js +++ b/web/app/view/edit/Notifications.js @@ -59,6 +59,23 @@ Ext.define('Traccar.view.edit.Notifications', { dataIndex: 'always', renderer: Traccar.AttributeFormatter.getFormatter('always'), filter: 'boolean' + }, { + text: Strings.sharedAlarms, + dataIndex: 'attributes', + renderer: function (value) { + var i, key, result = '', alarms = value && value['alarms']; + if (alarms) { + alarms = alarms.split(','); + for (i = 0; i < alarms.length; i++) { + var key = 'alarm' + alarms[i].charAt(0).toUpperCase() + alarms[i].slice(1); + if (result) { + result += ', '; + } + result += Strings[key] || key; + } + } + return result; + } }, { text: Strings.notificationNotificators, dataIndex: 'notificators', diff --git a/web/l10n/en.json b/web/l10n/en.json index 6db2376a..b885d513 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -77,6 +77,7 @@ "sharedMaintenance": "Maintenance", "sharedMaintenances": "Maintenances", "sharedDeviceAccumulators": "Accumulators", + "sharedAlarms": "Alarms", "attributeSpeedLimit": "Speed Limit", "attributePolylineDistance": "Polyline Distance", "attributeReportIgnoreOdometer": "Report: Ignore Odometer", -- cgit v1.2.3 From 4ca21e3fa14c211d3ecbe1f4edb91143373e9595 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 4 Nov 2018 14:42:46 +1300 Subject: Fix lint issues --- web/app/store/AlarmTypes.js | 6 +++--- web/app/view/edit/Notifications.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/store/AlarmTypes.js b/web/app/store/AlarmTypes.js index 9520359f..1ee7ffe8 100644 --- a/web/app/store/AlarmTypes.js +++ b/web/app/store/AlarmTypes.js @@ -19,8 +19,8 @@ Ext.define('Traccar.store.AlarmTypes', { extend: 'Ext.data.Store', fields: ['key', 'name'], - data: function () { - var items = []; + data: (function () { + var key, items = []; for (key in Strings) { if (Strings.hasOwnProperty(key) && key.lastIndexOf('alarm', 0) === 0) { items.push({ @@ -30,5 +30,5 @@ Ext.define('Traccar.store.AlarmTypes', { } } return items; - }() + })() }); diff --git a/web/app/view/edit/Notifications.js b/web/app/view/edit/Notifications.js index 7983c4db..9cf97b19 100644 --- a/web/app/view/edit/Notifications.js +++ b/web/app/view/edit/Notifications.js @@ -67,7 +67,7 @@ Ext.define('Traccar.view.edit.Notifications', { if (alarms) { alarms = alarms.split(','); for (i = 0; i < alarms.length; i++) { - var key = 'alarm' + alarms[i].charAt(0).toUpperCase() + alarms[i].slice(1); + key = 'alarm' + alarms[i].charAt(0).toUpperCase() + alarms[i].slice(1); if (result) { result += ', '; } -- cgit v1.2.3 From 62db06b85439b21a7851016f3e9c17f0abfe7185 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 12 Nov 2018 15:18:13 +1300 Subject: Rename maintenances to maintenance --- web/app/store/AllMaintenances.js | 2 +- web/app/store/CommonUserAttributes.js | 4 ++-- web/app/store/Maintenances.js | 2 +- web/app/view/DeviceMenu.js | 2 +- web/app/view/DeviceMenuController.js | 4 ++-- web/app/view/SettingsMenu.js | 2 +- web/app/view/SettingsMenuController.js | 4 ++-- web/app/view/edit/Groups.js | 2 +- web/app/view/edit/GroupsController.js | 4 ++-- web/app/view/edit/Users.js | 2 +- web/app/view/edit/UsersController.js | 4 ++-- web/l10n/en.json | 3 +-- 12 files changed, 17 insertions(+), 18 deletions(-) (limited to 'web/app/view') diff --git a/web/app/store/AllMaintenances.js b/web/app/store/AllMaintenances.js index 745b5d64..8435ad40 100644 --- a/web/app/store/AllMaintenances.js +++ b/web/app/store/AllMaintenances.js @@ -22,7 +22,7 @@ Ext.define('Traccar.store.AllMaintenances', { proxy: { type: 'rest', - url: 'api/maintenances', + url: 'api/maintenance', extraParams: { all: true } diff --git a/web/app/store/CommonUserAttributes.js b/web/app/store/CommonUserAttributes.js index 0ee9e163..a8e92825 100644 --- a/web/app/store/CommonUserAttributes.js +++ b/web/app/store/CommonUserAttributes.js @@ -63,8 +63,8 @@ Ext.define('Traccar.store.CommonUserAttributes', { name: Strings.attributeUiDisableCalendars, valueType: 'boolean' }, { - key: 'ui.disableMaintenances', - name: Strings.attributeUiDisableMaintenances, + key: 'ui.disableMaintenance', + name: Strings.attributeUiDisableMaintenance, valueType: 'boolean' }, { key: 'ui.hidePositionAttributes', diff --git a/web/app/store/Maintenances.js b/web/app/store/Maintenances.js index 43d6ba5b..a7aa4a07 100644 --- a/web/app/store/Maintenances.js +++ b/web/app/store/Maintenances.js @@ -22,7 +22,7 @@ Ext.define('Traccar.store.Maintenances', { proxy: { type: 'rest', - url: 'api/maintenances', + url: 'api/maintenance', writer: { writeAllFields: true } diff --git a/web/app/view/DeviceMenu.js b/web/app/view/DeviceMenu.js index e4623b94..06b272ad 100644 --- a/web/app/view/DeviceMenu.js +++ b/web/app/view/DeviceMenu.js @@ -57,7 +57,7 @@ Ext.define('Traccar.view.DeviceMenu', { handler: 'onCommandsClick', reference: 'menuCommandsButton' }, { - text: Strings.sharedMaintenances, + text: Strings.sharedMaintenance, glyph: 'xf0ad@FontAwesome', handler: 'onMaintenancesClick', reference: 'menuMaintenancesButton' diff --git a/web/app/view/DeviceMenuController.js b/web/app/view/DeviceMenuController.js index 9355571c..830ea7ec 100644 --- a/web/app/view/DeviceMenuController.js +++ b/web/app/view/DeviceMenuController.js @@ -40,7 +40,7 @@ Ext.define('Traccar.view.DeviceMenuController', { this.lookupReference('menuDeviceAccumulatorsButton').setHidden( !Traccar.app.getUser().get('administrator') && Traccar.app.getUser().get('userLimit') === 0 || Traccar.app.getVehicleFeaturesDisabled()); this.lookupReference('menuMaintenancesButton').setHidden( - Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances')); + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance')); }, onGeofencesClick: function () { @@ -110,7 +110,7 @@ Ext.define('Traccar.view.DeviceMenuController', { onMaintenancesClick: function () { Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedMaintenances, + title: Strings.sharedMaintenance, items: { xtype: 'linkMaintenancesView', baseObjectName: 'deviceId', diff --git a/web/app/view/SettingsMenu.js b/web/app/view/SettingsMenu.js index 309133c1..0a81d520 100644 --- a/web/app/view/SettingsMenu.js +++ b/web/app/view/SettingsMenu.js @@ -98,7 +98,7 @@ Ext.define('Traccar.view.SettingsMenu', { reference: 'settingsCommandsButton' }, { hidden: true, - text: Strings.sharedMaintenances, + text: Strings.sharedMaintenance, glyph: 'xf0ad@FontAwesome', handler: 'onMaintenancesClick', reference: 'settingsMaintenancesButton' diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index b838fb40..c8018f66 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -61,7 +61,7 @@ Ext.define('Traccar.view.SettingsMenuController', { Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('settingsCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false)); this.lookupReference('settingsMaintenancesButton').setHidden( - Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances')); + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance')); } }, @@ -163,7 +163,7 @@ Ext.define('Traccar.view.SettingsMenuController', { onMaintenancesClick: function () { Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedMaintenances, + title: Strings.sharedMaintenance, items: { xtype: 'maintenancesView' } diff --git a/web/app/view/edit/Groups.js b/web/app/view/edit/Groups.js index 06974201..8b09316c 100644 --- a/web/app/view/edit/Groups.js +++ b/web/app/view/edit/Groups.js @@ -76,7 +76,7 @@ Ext.define('Traccar.view.edit.Groups', { handler: 'onMaintenancesClick', reference: 'toolbarMaintenancesButton', glyph: 'xf0ad@FontAwesome', - tooltip: Strings.sharedMaintenances, + tooltip: Strings.sharedMaintenance, tooltipType: 'title' }] }, diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js index 2e62a283..ae96a248 100644 --- a/web/app/view/edit/GroupsController.js +++ b/web/app/view/edit/GroupsController.js @@ -41,7 +41,7 @@ Ext.define('Traccar.view.edit.GroupsController', { Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); this.lookupReference('toolbarCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false)); this.lookupReference('toolbarMaintenancesButton').setHidden( - Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances')); + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance')); }, onGeofencesClick: function () { @@ -117,7 +117,7 @@ Ext.define('Traccar.view.edit.GroupsController', { onMaintenancesClick: function () { var group = this.getView().getSelectionModel().getSelection()[0]; Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedMaintenances, + title: Strings.sharedMaintenance, items: { xtype: 'linkMaintenancesView', baseObjectName: 'groupId', diff --git a/web/app/view/edit/Users.js b/web/app/view/edit/Users.js index 2bcaefad..5d9a14f0 100644 --- a/web/app/view/edit/Users.js +++ b/web/app/view/edit/Users.js @@ -101,7 +101,7 @@ Ext.define('Traccar.view.edit.Users', { handler: 'onMaintenancesClick', reference: 'userMaintenancesButton', glyph: 'xf0ad@FontAwesome', - tooltip: Strings.sharedMaintenances, + tooltip: Strings.sharedMaintenance, tooltipType: 'title' }] }, diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index 9d998162..9e810435 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -51,7 +51,7 @@ Ext.define('Traccar.view.edit.UsersController', { Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); this.lookupReference('userCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false)); this.lookupReference('userMaintenancesButton').setHidden( - Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances')); + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance')); }, onEditClick: function () { @@ -215,7 +215,7 @@ Ext.define('Traccar.view.edit.UsersController', { onMaintenancesClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedMaintenances, + title: Strings.sharedMaintenance, items: { xtype: 'linkMaintenancesView', baseObjectName: 'userId', diff --git a/web/l10n/en.json b/web/l10n/en.json index b885d513..c0e202ce 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -75,7 +75,6 @@ "sharedShowAddress": "Show Address", "sharedDisabled": "Disabled", "sharedMaintenance": "Maintenance", - "sharedMaintenances": "Maintenances", "sharedDeviceAccumulators": "Accumulators", "sharedAlarms": "Alarms", "attributeSpeedLimit": "Speed Limit", @@ -105,7 +104,7 @@ "attributeUiDisableDrivers": "UI: Disable Drivers", "attributeUiDisableComputedAttributes": "UI: Disable Computed Attributes", "attributeUiDisableCalendars": "UI: Disable Calendars", - "attributeUiDisableMaintenances": "UI: Disable Maintenances", + "attributeUiDisableMaintenance": "UI: Disable Maintenance", "attributeUiHidePositionAttributes": "UI: Hide Position Attributes", "errorTitle": "Error", "errorGeneral": "Invalid parameters or constraints violation", -- cgit v1.2.3 From 58e1f370c568af64a1dcbd9af1d5541b0e9314ed Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 17 Nov 2018 15:36:34 +1300 Subject: Unescape HTML in some cases --- web/app/view/dialog/ComputedAttribute.js | 7 +++++++ web/app/view/dialog/Server.js | 7 +++++++ web/app/view/map/BaseMap.js | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/dialog/ComputedAttribute.js b/web/app/view/dialog/ComputedAttribute.js index ef6269be..22cfb829 100644 --- a/web/app/view/dialog/ComputedAttribute.js +++ b/web/app/view/dialog/ComputedAttribute.js @@ -28,6 +28,12 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { items: { xtype: 'form', + listeners: { + afterrender: function (view) { + var field = view.up('panel').lookupReference('expressionField'); + field.setValue(Ext.String.htmlDecode(field.getValue())); + } + }, items: [{ xtype: 'textfield', name: 'description', @@ -44,6 +50,7 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { } }, { xtype: 'textareafield', + reference: 'expressionField', name: 'expression', fieldLabel: Strings.sharedExpression, allowBlank: false diff --git a/web/app/view/dialog/Server.js b/web/app/view/dialog/Server.js index fbfb3c6a..8ff83992 100644 --- a/web/app/view/dialog/Server.js +++ b/web/app/view/dialog/Server.js @@ -28,6 +28,12 @@ Ext.define('Traccar.view.dialog.Server', { items: { xtype: 'form', + listeners: { + afterrender: function (view) { + var field = view.up('panel').lookupReference('mapUrlField'); + field.setValue(Ext.String.htmlDecode(field.getValue())); + } + }, items: [{ xtype: 'fieldset', title: Strings.sharedPreferences, @@ -44,6 +50,7 @@ Ext.define('Traccar.view.dialog.Server', { fieldLabel: Strings.mapBingKey }, { xtype: 'textfield', + reference: 'mapUrlField', name: 'mapUrl', fieldLabel: Strings.mapCustom }, { diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 26b9f7c1..67e08f68 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -41,8 +41,7 @@ Ext.define('Traccar.view.map.BaseMap', { case 'custom': layer = new ol.layer.Tile({ source: new ol.source.XYZ({ - url: new DOMParser() - .parseFromString(server.get('mapUrl'), 'text/html').documentElement.textContent, + url: Ext.String.htmlDecode(server.get('mapUrl')), attributions: '' }) }); -- cgit v1.2.3 From eb04caafa6e0c60d5f004826ea948528f3ae7ed4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 21 Nov 2018 08:34:23 +1300 Subject: Update statistics column label --- web/app/view/Statistics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/Statistics.js b/web/app/view/Statistics.js index 31ec5e9d..af199a02 100644 --- a/web/app/view/Statistics.js +++ b/web/app/view/Statistics.js @@ -77,7 +77,7 @@ Ext.define('Traccar.view.Statistics', { text: Strings.statisticsMessagesStored, dataIndex: 'messagesStored' }, { - text: Strings.notificatorSms, + text: Strings.notificatorMail, dataIndex: 'mailSent' }, { text: Strings.notificatorSms, -- cgit v1.2.3 From fcf8efc85971dae24ea355865ae6bd075a63837d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 22 Jan 2019 20:33:06 -0800 Subject: Use https for Baidu map --- web/app/view/map/BaseMap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 67e08f68..015cddd0 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -96,7 +96,7 @@ Ext.define('Traccar.view.map.BaseMap', { if (y < 0) { y = 'M' + -y; } - return 'http://online{}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl' + return 'https://online{}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl' .replace('{}', index).replace('{x}', x).replace('{y}', y).replace('{z}', z); }, tileGrid: new ol.tilegrid.TileGrid({ @@ -108,7 +108,7 @@ Ext.define('Traccar.view.map.BaseMap', { 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5 ] }), - attributions: '© Baidu' + attributions: '© Baidu' }) }); break; -- cgit v1.2.3 From e029756644581346a42f162a6505dda717a8c572 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 1 Feb 2019 23:55:49 -0800 Subject: Update JavaScript libraries --- web/app/view/map/BaseMap.js | 7 ++++++- web/app/view/map/MapMarkerController.js | 2 +- web/load.js | 35 ++++++++++++++------------------- 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 015cddd0..f973fb86 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -232,7 +232,12 @@ Ext.define('Traccar.view.map.BaseMap', { } } }, function () { + var projection; proj4.defs('BD-MC', '+proj=merc +lon_0=0 +units=m +ellps=clrk66 +no_defs'); proj4.defs('EPSG:3395', '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'); - ol.proj.get('EPSG:3395').setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]); + ol.proj.proj4.register(proj4); + projection = ol.proj.get('EPSG:3395'); + if (projection) { + projection.setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]); + } }); diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index bf6b0d49..28f1226e 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -217,7 +217,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { projection = mapView.getProjection(); center = ol.proj.fromLonLat([position.get('longitude'), position.get('latitude')]); pointResolution = ol.proj.getPointResolution(projection, mapView.getResolution(), center); - radius = position.get('accuracy') / ol.proj.METERS_PER_UNIT.m * mapView.getResolution() / pointResolution; + radius = position.get('accuracy') / ol.proj.Units.METERS_PER_UNIT.m * mapView.getResolution() / pointResolution; if (feature) { feature.getGeometry().setCenter(center); diff --git a/web/load.js b/web/load.js index 552b167a..e72c8baa 100644 --- a/web/load.js +++ b/web/load.js @@ -1,5 +1,5 @@ (function () { - var debugMode, touchMode, locale, localeParameter, extjsVersion, proj4jsVersion, fontAwesomeVersion, olVersion, i, language, languages, languageDefault; + var debugMode, touchMode, locale, localeParameter, extjsVersion, proj4jsVersion, olVersion, i, language, languages, languageDefault; function addStyleFile(file) { var link = document.createElement('link'); @@ -148,35 +148,30 @@ } extjsVersion = '6.2.0'; - fontAwesomeVersion = '5.2.0'; - olVersion = '4.6.5'; - proj4jsVersion = '2.4.4'; + olVersion = '5.3.0'; + proj4jsVersion = '2.5.0'; if (debugMode) { - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/ext-all-debug.js'); - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/packages/charts/classic/charts-debug.js'); + addScriptFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/ext-all-debug.js'); + addScriptFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/packages/charts/classic/charts-debug.js'); } else { - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/ext-all.js'); - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/packages/charts/classic/charts.js'); + addScriptFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/ext-all.js'); + addScriptFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/packages/charts/classic/charts.js'); } - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/classic/locale/locale-' + locale.languages[locale.language].code + '.js'); + addScriptFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/classic/locale/locale-' + locale.languages[locale.language].code + '.js'); - addStyleFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/classic/theme-triton/resources/theme-triton-all.css'); - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/classic/theme-triton/theme-triton.js'); + addStyleFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/classic/theme-triton/resources/theme-triton-all.css'); + addScriptFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/classic/theme-triton/theme-triton.js'); - addStyleFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/packages/charts/classic/triton/resources/charts-all.css'); + addStyleFile('https://cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/packages/charts/classic/triton/resources/charts-all.css'); - addStyleFile('//cdnjs.cloudflare.com/ajax/libs/ol3/' + olVersion + '/ol.css'); - if (debugMode) { - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/ol3/' + olVersion + '/ol-debug.js'); - } else { - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/ol3/' + olVersion + '/ol.js'); - } + addStyleFile('https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v' + olVersion + '/css/ol.css'); + addScriptFile('https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v' + olVersion + '/build/ol.js'); if (debugMode) { - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/proj4js/' + proj4jsVersion + '/proj4-src.js'); + addScriptFile('https://cdn.jsdelivr.net/npm/proj4@' + proj4jsVersion + '/dist/proj4-src.js'); } else { - addScriptFile('//cdnjs.cloudflare.com/ajax/libs/proj4js/' + proj4jsVersion + '/proj4.js'); + addScriptFile('https://cdn.jsdelivr.net/npm/proj4@' + proj4jsVersion + '/dist/proj4.js'); } window.Images = ['arrow', 'default', 'animal', 'bicycle', 'boat', 'bus', 'car', 'crane', 'helicopter', 'motorcycle', -- cgit v1.2.3 From fe47299d6cc02a4e43a1d2f3a788897be8a6f5ce Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 2 Feb 2019 12:55:29 -0800 Subject: Fix openlayers upgrade issues (fix #724) --- web/app/GeofenceConverter.js | 7 +++---- web/app/view/map/BaseMap.js | 10 +++++----- web/app/view/map/GeofenceMap.js | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'web/app/view') diff --git a/web/app/GeofenceConverter.js b/web/app/GeofenceConverter.js index 4891e7b1..1f6ad377 100644 --- a/web/app/GeofenceConverter.js +++ b/web/app/GeofenceConverter.js @@ -45,7 +45,7 @@ Ext.define('Traccar.GeofenceConverter', { resolutionAtEquator = mapView.getResolution(); pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center); resolutionFactor = resolutionAtEquator / pointResolution; - radius = Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m * resolutionFactor; + radius = Number(coordinates[2]) / ol.proj.Units.METERS_PER_UNIT.m * resolutionFactor; geometry = new ol.geom.Circle(center, radius); } } @@ -74,9 +74,8 @@ Ext.define('Traccar.GeofenceConverter', { radius = geometry.getRadius(); edgeCoordinate = [center[0] + radius, center[1]]; center = ol.proj.transform(center, projection, 'EPSG:4326'); - earthSphere = new ol.Sphere(6378137); - groundRadius = earthSphere.haversineDistance(center, - ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326')); + groundRadius = ol.sphere.getDistance( + center, ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326'), 6378137) result = 'CIRCLE ('; result += center[1] + ' ' + center[0] + ', '; result += groundRadius.toFixed(1) + ')'; diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index f973fb86..4f0c8d48 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -30,7 +30,7 @@ Ext.define('Traccar.view.map.BaseMap', { }, initMap: function () { - var server, layer, type, bingKey, lat, lon, zoom, maxZoom, target, poiLayer; + var server, layer, type, bingKey, lat, lon, zoom, maxZoom, target, poiLayer, self = this; server = Traccar.app.getServer(); @@ -207,19 +207,19 @@ Ext.define('Traccar.view.map.BaseMap', { }); this.map.on('click', function (e) { - var i, features = this.map.getFeaturesAtPixel(e.pixel, { + var i, features = self.map.getFeaturesAtPixel(e.pixel, { layerFilter: function (layer) { return !layer.get('name'); } }); if (features) { for (i = 0; i < features.length; i++) { - this.fireEvent('selectfeature', features[i]); + self.fireEvent('selectfeature', features[i]); } } else { - this.fireEvent('deselectfeature'); + self.fireEvent('deselectfeature'); } - }, this); + }); }, listeners: { diff --git a/web/app/view/map/GeofenceMap.js b/web/app/view/map/GeofenceMap.js index 6b06ae98..8cef574b 100644 --- a/web/app/view/map/GeofenceMap.js +++ b/web/app/view/map/GeofenceMap.js @@ -105,13 +105,14 @@ Ext.define('Traccar.view.map.GeofenceMap', { }, addInteraction: function (type) { + var self = this; this.draw = new ol.interaction.Draw({ features: this.features, type: type }); this.draw.on('drawstart', function () { - this.features.clear(); - }, this); + self.features.clear(); + }); this.map.addInteraction(this.draw); }, -- cgit v1.2.3 From 9a14f9599659c587a646ee322db5b65fa65d801d Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Mon, 25 Feb 2019 20:46:48 +0300 Subject: Add connection between event and its state --- web/app/view/StateController.js | 9 +++++++++ web/app/view/map/MapMarkerController.js | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 6363fc9c..58478d28 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -33,6 +33,7 @@ Ext.define('Traccar.view.StateController', { '*': { selectdevice: 'selectDevice', selectreport: 'selectReport', + selectevent: 'selectEvent', deselectfeature: 'deselectFeature' } }, @@ -175,6 +176,14 @@ Ext.define('Traccar.view.StateController', { } }, + selectEvent: function (position) { + if (position instanceof Traccar.model.Position) { + this.deviceId = null; + this.position = position; + this.updatePosition(); + } + }, + deselectFeature: function () { this.deviceId = null; this.position = null; diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 28f1226e..b7a1e296 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -501,7 +501,6 @@ Ext.define('Traccar.view.map.MapMarkerController', { selectEvent: function (position) { var marker; - this.fireEvent('deselectfeature'); if (position) { marker = this.addReportMarker(position); marker.set('event', true); -- cgit v1.2.3 From af41d034854a8d267463759a72fe1f610c9d297d Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Tue, 26 Feb 2019 12:21:51 +0300 Subject: Implementation fixes --- web/app/view/EventsController.js | 15 +++++++++++++-- web/app/view/ReportController.js | 21 +++++++++++---------- web/app/view/StateController.js | 14 +++----------- web/app/view/edit/DevicesController.js | 7 ++++--- web/app/view/map/MapMarkerController.js | 5 ++--- 5 files changed, 33 insertions(+), 29 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index 8eb4363f..9bce2bf4 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -24,7 +24,11 @@ Ext.define('Traccar.view.EventsController', { listen: { controller: { '*': { - deselectevent: 'deselectEvent' + selectdevice: 'deselectEvent', + selectreport: 'deselectEvent', + }, + 'map': { + deselectfeature: 'deselectFeature' } }, store: { @@ -79,7 +83,14 @@ Ext.define('Traccar.view.EventsController', { Traccar.app.showEvents(false); }, - deselectEvent: function () { + + deselectEvent: function (object) { + if (object !== undefined) { + this.deselectFeature(); + } + }, + + deselectFeature: function () { this.getView().getSelectionModel().deselectAll(); }, diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 5d43007a..2ffca966 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -32,12 +32,13 @@ Ext.define('Traccar.view.ReportController', { listen: { controller: { '*': { - selectdevice: 'selectDevice', - showsingleevent: 'showSingleEvent', - deselectfeature: 'deselectFeature' + selectdevice: 'deselectReport', + selectevent: 'deselectReport', + showsingleevent: 'showSingleEvent' }, 'map': { - selectreport: 'selectReport' + selectreport: 'selectReport', + deselectfeature: 'deselectFeature' } }, global: { @@ -231,12 +232,6 @@ Ext.define('Traccar.view.ReportController', { } }, - selectDevice: function (device) { - if (device) { - this.getGrid().getSelectionModel().deselectAll(); - } - }, - selectReport: function (object) { var positionRelated, reportType = this.lookupReference('reportTypeField').getValue(); if (object instanceof Traccar.model.Position) { @@ -251,6 +246,12 @@ Ext.define('Traccar.view.ReportController', { } }, + deselectReport: function (object) { + if (object !== undefined) { + this.deselectFeature(); + } + }, + deselectFeature: function () { if (this.lookupReference('reportTypeField').getValue() !== 'trips') { this.getGrid().getSelectionModel().deselectAll(); diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 58478d28..1ab1aa2f 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -32,8 +32,8 @@ Ext.define('Traccar.view.StateController', { controller: { '*': { selectdevice: 'selectDevice', - selectreport: 'selectReport', - selectevent: 'selectEvent', + selectreport: 'selectPosition', + selectevent: 'selectPosition', deselectfeature: 'deselectFeature' } }, @@ -168,15 +168,7 @@ Ext.define('Traccar.view.StateController', { } }, - selectReport: function (position) { - if (position instanceof Traccar.model.Position) { - this.deviceId = null; - this.position = position; - this.updatePosition(); - } - }, - - selectEvent: function (position) { + selectPosition: function (position) { if (position instanceof Traccar.model.Position) { this.deviceId = null; this.position = position; diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 120944b8..79cbe2fa 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -35,7 +35,8 @@ Ext.define('Traccar.view.edit.DevicesController', { listen: { controller: { '*': { - selectreport: 'selectReport' + selectreport: 'deselectDevice', + selectevent: 'deselectDevice' }, 'root': { selectdevice: 'selectDevice' @@ -122,8 +123,8 @@ Ext.define('Traccar.view.edit.DevicesController', { this.getView().getView().focusRow(device); }, - selectReport: function (position) { - if (position !== undefined) { + deselectDevice: function (object) { + if (object !== undefined) { this.deselectFeature(); } }, diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index b7a1e296..295d2f50 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -457,9 +457,6 @@ Ext.define('Traccar.view.map.MapMarkerController', { if (this.selectedMarker) { if (this.selectedMarker.get('event')) { this.getView().getMarkersSource().removeFeature(this.selectedMarker); - if (!marker || !marker.get('event')) { - this.fireEvent('deselectevent'); - } } else if (!Ext.getStore('ReportRoute').showMarkers && this.selectedMarker.get('record') instanceof Traccar.model.Position) { this.getView().getMarkersSource().removeFeature(this.selectedMarker); @@ -496,6 +493,8 @@ Ext.define('Traccar.view.map.MapMarkerController', { this.reportMarkers[position.get('id')] = this.addReportMarker(position); } this.selectMarker(this.reportMarkers[position.get('id')], center); + } else if (this.selectedMarker) { + this.selectMarker(null, false); } }, -- cgit v1.2.3 From e3e14d53eb06240577600aa6179489e4a3a36957 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Tue, 26 Feb 2019 12:32:39 +0300 Subject: Fix comma error --- web/app/view/EventsController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index 9bce2bf4..d9e0c1ed 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -25,7 +25,7 @@ Ext.define('Traccar.view.EventsController', { controller: { '*': { selectdevice: 'deselectEvent', - selectreport: 'deselectEvent', + selectreport: 'deselectEvent' }, 'map': { deselectfeature: 'deselectFeature' -- cgit v1.2.3 From ff0194c227975faa5e2f1eca3007f82c5eefc620 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Tue, 26 Feb 2019 21:36:43 +0300 Subject: Small improvements --- web/app/view/EventsController.js | 2 +- web/app/view/ReportController.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index d9e0c1ed..e11b4ff6 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -85,7 +85,7 @@ Ext.define('Traccar.view.EventsController', { deselectEvent: function (object) { - if (object !== undefined) { + if (object) { this.deselectFeature(); } }, diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 2ffca966..2f10cde1 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -247,7 +247,7 @@ Ext.define('Traccar.view.ReportController', { }, deselectReport: function (object) { - if (object !== undefined) { + if (object) { this.deselectFeature(); } }, -- cgit v1.2.3 From d80f545048225e4b0d9ab0a60f3bdc74ec997731 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Wed, 27 Feb 2019 16:12:44 +0300 Subject: Small improvements --- web/app/view/edit/DevicesController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 79cbe2fa..82e471c2 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -111,7 +111,7 @@ Ext.define('Traccar.view.edit.DevicesController', { }, onSelectionChange: function (el, record) { - if (record !== undefined) { + if (record) { this.updateButtons([record]); this.fireEvent('selectdevice', record, true); } @@ -124,7 +124,7 @@ Ext.define('Traccar.view.edit.DevicesController', { }, deselectDevice: function (object) { - if (object !== undefined) { + if (object) { this.deselectFeature(); } }, -- cgit v1.2.3 From 0c17a3d2a9aad83456b0557cf1b87eaf4ffbb675 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Wed, 27 Feb 2019 18:35:11 +0300 Subject: Bugfix for marker selfselect --- web/app/view/edit/Devices.js | 3 +-- web/app/view/edit/DevicesController.js | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index dfa855c8..21fdb32a 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -75,8 +75,7 @@ Ext.define('Traccar.view.edit.Devices', { }, listeners: { - rowclick: 'onSelectionChange', - itemkeyup: 'onSelectionChange' + selectionchange: 'onSelectionChange' }, viewConfig: { diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 82e471c2..f4e46153 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -111,9 +111,9 @@ Ext.define('Traccar.view.edit.DevicesController', { }, onSelectionChange: function (el, record) { - if (record) { - this.updateButtons([record]); - this.fireEvent('selectdevice', record, true); + if (record && record.length) { + this.updateButtons(record); + this.fireEvent('selectdevice', record[0], true); } }, -- cgit v1.2.3 From 6dd4cb71561be3d41da3d10b810fb078f10e79b3 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Wed, 27 Feb 2019 21:32:56 +0300 Subject: Code-style fix --- web/app/view/edit/DevicesController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index f4e46153..16e54b21 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -110,10 +110,10 @@ Ext.define('Traccar.view.edit.DevicesController', { this.lookupReference('deviceCommandButton').setDisabled(empty || readonly); }, - onSelectionChange: function (el, record) { - if (record && record.length) { - this.updateButtons(record); - this.fireEvent('selectdevice', record[0], true); + onSelectionChange: function (el, records) { + if (records && records.length) { + this.updateButtons(records); + this.fireEvent('selectdevice', records[0], true); } }, -- cgit v1.2.3 From 04a92f0fbae8cee0e88b56e736a6c4178d39ca35 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 18 Apr 2019 21:48:40 -0700 Subject: Unescape all text fields (fix #4283) --- web/app/view/UnescapedTextAreaField.js | 29 +++++++++++++++++++++++++++++ web/app/view/UnescapedTextField.js | 29 +++++++++++++++++++++++++++++ web/app/view/dialog/Attribute.js | 5 +++-- web/app/view/dialog/Calendar.js | 5 +++-- web/app/view/dialog/ComputedAttribute.js | 14 +++++--------- web/app/view/dialog/Device.js | 13 +++++++------ web/app/view/dialog/Driver.js | 8 ++++++-- web/app/view/dialog/Geofence.js | 7 ++++--- web/app/view/dialog/Group.js | 5 +++-- web/app/view/dialog/Maintenance.js | 5 +++-- web/app/view/dialog/SavedCommand.js | 5 +++-- web/app/view/dialog/Server.js | 15 +++++---------- web/app/view/dialog/User.js | 13 +++++++------ 13 files changed, 107 insertions(+), 46 deletions(-) create mode 100644 web/app/view/UnescapedTextAreaField.js create mode 100644 web/app/view/UnescapedTextField.js (limited to 'web/app/view') diff --git a/web/app/view/UnescapedTextAreaField.js b/web/app/view/UnescapedTextAreaField.js new file mode 100644 index 00000000..0eeaf938 --- /dev/null +++ b/web/app/view/UnescapedTextAreaField.js @@ -0,0 +1,29 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.view.UnescapedTextAreaField', { + extend: 'Ext.form.field.TextArea', + xtype: 'unescapedTextAreaField', + + initComponent: function() { + this.callParent(); + this.on('change', this.onValueChange); + }, + + onValueChange: function (field, newValue) { + field.setValue(Ext.String.htmlDecode(newValue)); + } +}); diff --git a/web/app/view/UnescapedTextField.js b/web/app/view/UnescapedTextField.js new file mode 100644 index 00000000..334b0682 --- /dev/null +++ b/web/app/view/UnescapedTextField.js @@ -0,0 +1,29 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.view.UnescapedTextField', { + extend: 'Ext.form.field.Text', + xtype: 'unescapedTextField', + + initComponent: function() { + this.callParent(); + this.on('change', this.onValueChange); + }, + + onValueChange: function (field, newValue) { + field.setValue(Ext.String.htmlDecode(newValue)); + } +}); diff --git a/web/app/view/dialog/Attribute.js b/web/app/view/dialog/Attribute.js index 2a458977..a85cad05 100644 --- a/web/app/view/dialog/Attribute.js +++ b/web/app/view/dialog/Attribute.js @@ -21,7 +21,8 @@ Ext.define('Traccar.view.dialog.Attribute', { requires: [ 'Traccar.view.dialog.AttributeController', 'Traccar.view.ColorPicker', - 'Traccar.view.CustomNumberField' + 'Traccar.view.CustomNumberField', + 'Traccar.view.UnescapedTextField' ], controller: 'attribute', @@ -33,7 +34,7 @@ Ext.define('Traccar.view.dialog.Attribute', { validitychange: 'onValidityChange' }, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', reference: 'nameTextField', name: 'name', allowBlank: false, diff --git a/web/app/view/dialog/Calendar.js b/web/app/view/dialog/Calendar.js index 9880d4e6..5f00a8be 100644 --- a/web/app/view/dialog/Calendar.js +++ b/web/app/view/dialog/Calendar.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Calendar', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.dialog.CalendarController' + 'Traccar.view.dialog.CalendarController', + 'Traccar.view.UnescapedTextField' ], controller: 'calendar', @@ -32,7 +33,7 @@ Ext.define('Traccar.view.dialog.Calendar', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false diff --git a/web/app/view/dialog/ComputedAttribute.js b/web/app/view/dialog/ComputedAttribute.js index 22cfb829..adae7f7b 100644 --- a/web/app/view/dialog/ComputedAttribute.js +++ b/web/app/view/dialog/ComputedAttribute.js @@ -20,7 +20,9 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.dialog.ComputedAttributeController' + 'Traccar.view.dialog.ComputedAttributeController', + 'Traccar.view.UnescapedTextField', + 'Traccar.view.UnescapedTextAreaField' ], controller: 'computedAttribute', @@ -28,14 +30,8 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { items: { xtype: 'form', - listeners: { - afterrender: function (view) { - var field = view.up('panel').lookupReference('expressionField'); - field.setValue(Ext.String.htmlDecode(field.getValue())); - } - }, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'description', fieldLabel: Strings.sharedDescription }, { @@ -49,7 +45,7 @@ Ext.define('Traccar.view.dialog.ComputedAttribute', { change: 'onAttributeChange' } }, { - xtype: 'textareafield', + xtype: 'unescapedTextAreaField', reference: 'expressionField', name: 'expression', fieldLabel: Strings.sharedExpression, diff --git a/web/app/view/dialog/Device.js b/web/app/view/dialog/Device.js index 50a5e79c..60a8f716 100644 --- a/web/app/view/dialog/Device.js +++ b/web/app/view/dialog/Device.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Device', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.DeviceController' + 'Traccar.view.dialog.DeviceController', + 'Traccar.view.UnescapedTextField' ], controller: 'device', @@ -32,12 +33,12 @@ Ext.define('Traccar.view.dialog.Device', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'uniqueId', fieldLabel: Strings.deviceIdentifier, allowBlank: false @@ -56,15 +57,15 @@ Ext.define('Traccar.view.dialog.Device', { displayField: 'name', valueField: 'id' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'phone', fieldLabel: Strings.sharedPhone }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'model', fieldLabel: Strings.deviceModel }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'contact', fieldLabel: Strings.deviceContact }, { diff --git a/web/app/view/dialog/Driver.js b/web/app/view/dialog/Driver.js index b67e182d..9b1c17b5 100644 --- a/web/app/view/dialog/Driver.js +++ b/web/app/view/dialog/Driver.js @@ -19,6 +19,10 @@ Ext.define('Traccar.view.dialog.Driver', { extend: 'Traccar.view.dialog.BaseEdit', + requires: [ + 'Traccar.view.UnescapedTextField' + ], + title: Strings.sharedDriver, items: { @@ -27,12 +31,12 @@ Ext.define('Traccar.view.dialog.Driver', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'uniqueId', fieldLabel: Strings.deviceIdentifier, allowBlank: false diff --git a/web/app/view/dialog/Geofence.js b/web/app/view/dialog/Geofence.js index 65c32c04..1e22cd7b 100644 --- a/web/app/view/dialog/Geofence.js +++ b/web/app/view/dialog/Geofence.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Geofence', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.GeofenceController' + 'Traccar.view.dialog.GeofenceController', + 'Traccar.view.UnescapedTextField' ], controller: 'geofence', @@ -32,7 +33,7 @@ Ext.define('Traccar.view.dialog.Geofence', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName }] @@ -42,7 +43,7 @@ Ext.define('Traccar.view.dialog.Geofence', { collapsible: true, collapsed: true, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'description', fieldLabel: Strings.sharedDescription }, { diff --git a/web/app/view/dialog/Group.js b/web/app/view/dialog/Group.js index 805b422c..61ca193d 100644 --- a/web/app/view/dialog/Group.js +++ b/web/app/view/dialog/Group.js @@ -19,7 +19,8 @@ Ext.define('Traccar.view.dialog.Group', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.ClearableComboBox' + 'Traccar.view.ClearableComboBox', + 'Traccar.view.UnescapedTextField' ], title: Strings.groupDialog, @@ -30,7 +31,7 @@ Ext.define('Traccar.view.dialog.Group', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false diff --git a/web/app/view/dialog/Maintenance.js b/web/app/view/dialog/Maintenance.js index 5705278f..d844d259 100644 --- a/web/app/view/dialog/Maintenance.js +++ b/web/app/view/dialog/Maintenance.js @@ -21,7 +21,8 @@ Ext.define('Traccar.view.dialog.Maintenance', { requires: [ 'Traccar.view.dialog.MaintenanceController', - 'Traccar.view.CustomNumberField' + 'Traccar.view.CustomNumberField', + 'Traccar.view.UnescapedTextField' ], controller: 'maintenance', @@ -37,7 +38,7 @@ Ext.define('Traccar.view.dialog.Maintenance', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName, allowBlank: false diff --git a/web/app/view/dialog/SavedCommand.js b/web/app/view/dialog/SavedCommand.js index a7693871..b1aeae73 100644 --- a/web/app/view/dialog/SavedCommand.js +++ b/web/app/view/dialog/SavedCommand.js @@ -19,7 +19,8 @@ Ext.define('Traccar.view.dialog.SavedCommand', { extend: 'Traccar.view.dialog.BaseEdit', requires: [ - 'Traccar.view.dialog.SavedCommandController' + 'Traccar.view.dialog.SavedCommandController', + 'Traccar.view.UnescapedTextField' ], controller: 'savedCommand', @@ -34,7 +35,7 @@ Ext.define('Traccar.view.dialog.SavedCommand', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'description', fieldLabel: Strings.sharedDescription }, { diff --git a/web/app/view/dialog/Server.js b/web/app/view/dialog/Server.js index 8ff83992..c9729ccf 100644 --- a/web/app/view/dialog/Server.js +++ b/web/app/view/dialog/Server.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.Server', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.MapPickerController' + 'Traccar.view.dialog.MapPickerController', + 'Traccar.view.UnescapedTextField' ], controller: 'mapPicker', @@ -28,12 +29,6 @@ Ext.define('Traccar.view.dialog.Server', { items: { xtype: 'form', - listeners: { - afterrender: function (view) { - var field = view.up('panel').lookupReference('mapUrlField'); - field.setValue(Ext.String.htmlDecode(field.getValue())); - } - }, items: [{ xtype: 'fieldset', title: Strings.sharedPreferences, @@ -45,11 +40,11 @@ Ext.define('Traccar.view.dialog.Server', { displayField: 'name', valueField: 'key' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'bingKey', fieldLabel: Strings.mapBingKey }, { - xtype: 'textfield', + xtype: 'unescapedTextField', reference: 'mapUrlField', name: 'mapUrl', fieldLabel: Strings.mapCustom @@ -90,7 +85,7 @@ Ext.define('Traccar.view.dialog.Server', { displayField: 'name', valueField: 'key' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'poiLayer', fieldLabel: Strings.mapPoiLayer }] diff --git a/web/app/view/dialog/User.js b/web/app/view/dialog/User.js index 86f91672..917f110c 100644 --- a/web/app/view/dialog/User.js +++ b/web/app/view/dialog/User.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.dialog.User', { requires: [ 'Traccar.view.ClearableComboBox', - 'Traccar.view.dialog.UserController' + 'Traccar.view.dialog.UserController', + 'Traccar.view.UnescapedTextField' ], controller: 'user', @@ -32,11 +33,11 @@ Ext.define('Traccar.view.dialog.User', { xtype: 'fieldset', title: Strings.sharedRequired, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'name', fieldLabel: Strings.sharedName }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'email', fieldLabel: Strings.userEmail, allowBlank: false @@ -53,7 +54,7 @@ Ext.define('Traccar.view.dialog.User', { collapsible: true, collapsed: true, items: [{ - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'phone', fieldLabel: Strings.sharedPhone }, { @@ -94,7 +95,7 @@ Ext.define('Traccar.view.dialog.User', { displayField: 'name', valueField: 'key' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'poiLayer', fieldLabel: Strings.mapPoiLayer }] @@ -164,7 +165,7 @@ Ext.define('Traccar.view.dialog.User', { disabled: true, reference: 'userLimitField' }, { - xtype: 'textfield', + xtype: 'unescapedTextField', name: 'token', reference: 'tokenField', fieldLabel: Strings.userToken, -- cgit v1.2.3 From 17c237aa7bfc1956ef231f42bfb31d911eb8ad3a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 18 Apr 2019 21:56:09 -0700 Subject: Fix lint issues --- web/app/view/UnescapedTextAreaField.js | 2 +- web/app/view/UnescapedTextField.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/UnescapedTextAreaField.js b/web/app/view/UnescapedTextAreaField.js index 0eeaf938..5de267ce 100644 --- a/web/app/view/UnescapedTextAreaField.js +++ b/web/app/view/UnescapedTextAreaField.js @@ -18,7 +18,7 @@ Ext.define('Traccar.view.UnescapedTextAreaField', { extend: 'Ext.form.field.TextArea', xtype: 'unescapedTextAreaField', - initComponent: function() { + initComponent: function () { this.callParent(); this.on('change', this.onValueChange); }, diff --git a/web/app/view/UnescapedTextField.js b/web/app/view/UnescapedTextField.js index 334b0682..3b1b2798 100644 --- a/web/app/view/UnescapedTextField.js +++ b/web/app/view/UnescapedTextField.js @@ -18,7 +18,7 @@ Ext.define('Traccar.view.UnescapedTextField', { extend: 'Ext.form.field.Text', xtype: 'unescapedTextField', - initComponent: function() { + initComponent: function () { this.callParent(); this.on('change', this.onValueChange); }, -- cgit v1.2.3 From eb4c3b7910312d0f75ee358cd5607dd68e5400cf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 25 Apr 2019 18:34:38 -0700 Subject: Fix map labels encoding (fix #737) --- web/app/view/map/MapController.js | 3 ++- web/app/view/map/MapMarkerController.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index 38b2340c..7ba0ee3b 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -83,7 +83,8 @@ Ext.define('Traccar.view.map.MapController', { var feature = new ol.Feature( Traccar.GeofenceConverter.wktToGeometry(this.getView().getMapView(), geofence.get('area'))); feature.setStyle(this.getAreaStyle( - geofence.get('name'), geofence.get('attributes') ? geofence.get('attributes').color : null)); + Ext.String.htmlDecode(geofence.get('name')), + geofence.get('attributes') ? geofence.get('attributes').color : null)); this.getView().getGeofencesSource().addFeature(feature); return true; }, this); diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 295d2f50..630497a2 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -130,7 +130,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, updateDevice: function (store, data) { - var i, device, deviceId, marker, style; + var i, device, deviceId, deviceName, marker, style; if (!Ext.isArray(data)) { data = [data]; @@ -148,8 +148,9 @@ Ext.define('Traccar.view.map.MapMarkerController', { this.updateDeviceMarker(style, this.getDeviceColor(device), device.get('category')); marker.changed(); } - if (style.getText().getText() !== device.get('name')) { - style.getText().setText(device.get('name')); + deviceName = Ext.String.htmlDecode(device.get('name')); + if (style.getText().getText() !== deviceName) { + style.getText().setText(deviceName); marker.changed(); } } @@ -260,7 +261,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { style = this.getLatestMarker(this.getDeviceColor(device), position.get('course'), device.get('category')); - style.getText().setText(device.get('name')); + style.getText().setText(Ext.String.htmlDecode(device.get('name'))); marker.setStyle(style); marker.setId(device.get('id')); this.latestMarkers[deviceId] = marker; -- cgit v1.2.3 From e6013751d88cbfaac6c03a070d88cfd5c3e16921 Mon Sep 17 00:00:00 2001 From: Edward Valley Date: Fri, 12 Jul 2019 23:53:29 -0400 Subject: Add support for ArcGIS REST map services --- web/app/store/MapTypes.js | 7 +++++-- web/app/view/map/BaseMap.js | 9 ++++++++- web/l10n/en.json | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js index 3d322438..211cc81f 100644 --- a/web/app/store/MapTypes.js +++ b/web/app/store/MapTypes.js @@ -47,7 +47,10 @@ Ext.define('Traccar.store.MapTypes', { key: 'wikimedia', name: Strings.mapWikimedia }, { - key: 'custom', - name: Strings.mapCustom + key: 'customXyzFormat', + name: Strings.mapCustomXyzFormat + }, { + key: 'customArcgisRest', + name: Strings.mapCustomArcgisRest }] }); diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 4f0c8d48..0b39ae33 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -38,7 +38,7 @@ Ext.define('Traccar.view.map.BaseMap', { bingKey = server.get('bingKey'); switch (type) { - case 'custom': + case 'customXyzFormat': layer = new ol.layer.Tile({ source: new ol.source.XYZ({ url: Ext.String.htmlDecode(server.get('mapUrl')), @@ -46,6 +46,13 @@ Ext.define('Traccar.view.map.BaseMap', { }) }); break; + case 'customArcgisRest': + layer = new ol.layer.Tile({ + source: new ol.source.TileArcGISRest({ + url: Ext.String.htmlDecode(server.get('mapUrl')) + }) + }); + break; case 'bingRoad': layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ diff --git a/web/l10n/en.json b/web/l10n/en.json index 69f3fed3..07e76092 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -232,6 +232,8 @@ "mapTitle": "Map", "mapLayer": "Map Layer", "mapCustom": "Custom Map", + "mapCustomXyzFormat": "Custom (XYZ)", + "mapCustomArcgisRest": "Custom (ArcGIS REST)", "mapCarto": "Carto Basemaps", "mapOsm": "Open Street Map", "mapBingKey": "Bing Maps Key", @@ -427,4 +429,4 @@ "categoryScooter": "Scooter", "maintenanceStart": "Start", "maintenancePeriod": "Period" -} \ No newline at end of file +} -- cgit v1.2.3 From 3b0f7304db66d560e241511f3c9dc6ebaf31013d Mon Sep 17 00:00:00 2001 From: Edward Valley Date: Sun, 14 Jul 2019 20:36:11 -0400 Subject: Changes after first review --- web/app/store/MapTypes.js | 8 ++++---- web/app/view/map/BaseMap.js | 4 ++-- web/l10n/en.json | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'web/app/view') diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js index f75bbaa5..88d54bfa 100644 --- a/web/app/store/MapTypes.js +++ b/web/app/store/MapTypes.js @@ -47,10 +47,10 @@ Ext.define('Traccar.store.MapTypes', { key: 'wikimedia', name: Strings.mapWikimedia }, { - key: 'customXyzFormat', - name: Strings.mapCustomXyzFormat + key: 'custom', + name: Strings.mapCustom }, { - key: 'customArcgisRest', - name: Strings.mapCustomArcgisRest + key: 'customArcgis', + name: Strings.mapCustomArcgis }] }); diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 0b39ae33..0ab48e87 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -38,7 +38,7 @@ Ext.define('Traccar.view.map.BaseMap', { bingKey = server.get('bingKey'); switch (type) { - case 'customXyzFormat': + case 'custom': layer = new ol.layer.Tile({ source: new ol.source.XYZ({ url: Ext.String.htmlDecode(server.get('mapUrl')), @@ -46,7 +46,7 @@ Ext.define('Traccar.view.map.BaseMap', { }) }); break; - case 'customArcgisRest': + case 'customArcgis': layer = new ol.layer.Tile({ source: new ol.source.TileArcGISRest({ url: Ext.String.htmlDecode(server.get('mapUrl')) diff --git a/web/l10n/en.json b/web/l10n/en.json index 07e76092..73747852 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -231,9 +231,8 @@ "serverForceSettings": "Force Settings", "mapTitle": "Map", "mapLayer": "Map Layer", - "mapCustom": "Custom Map", - "mapCustomXyzFormat": "Custom (XYZ)", - "mapCustomArcgisRest": "Custom (ArcGIS REST)", + "mapCustom": "Custom (XYZ)", + "mapCustomArcgis": "Custom (ArcGIS)", "mapCarto": "Carto Basemaps", "mapOsm": "Open Street Map", "mapBingKey": "Bing Maps Key", -- cgit v1.2.3 From 34fd688c0c9bde351824de56bec83ad4583daf7a Mon Sep 17 00:00:00 2001 From: jcardus Date: Wed, 17 Jul 2019 06:32:42 +0200 Subject: Animate marker on updateLatest (#748) --- web/app/Style.js | 3 +++ web/app/view/map/MapMarkerController.js | 39 ++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) (limited to 'web/app/view') diff --git a/web/app/Style.js b/web/app/Style.js index 47c49a96..371e05a1 100644 --- a/web/app/Style.js +++ b/web/app/Style.js @@ -81,6 +81,9 @@ Ext.define('Traccar.Style', { mapGeofenceWidth: 5, mapGeofenceRadius: 9, + mapAnimateMarkerDuration: 2000, + mapAnimateMarkerTimeout: 40, + coordinatePrecision: 6, numberPrecision: 2, diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 630497a2..9c61fa61 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -188,6 +188,39 @@ Ext.define('Traccar.view.map.MapMarkerController', { } }, + animateMarker: function (marker, geometry, course) { + var start, end, duration, timeout, line, updatePosition, self; + + start = marker.getGeometry().getCoordinates(); + end = geometry.getCoordinates(); + line = new ol.geom.LineString([start, end]); + duration = Traccar.Style.mapAnimateMarkerDuration; + timeout = Traccar.Style.mapAnimateMarkerTimeout; + self = this; + + updatePosition = function (position, marker) { + var coordinate, style; + coordinate = marker.get('line').getCoordinateAt(position / (duration / timeout)); + style = marker.getStyle(); + marker.setGeometry(new ol.geom.Point(coordinate)); + if (position < duration / timeout) { + setTimeout(updatePosition, timeout, position + 1, marker); + } else { + if (style.getImage().angle !== marker.get('nextCourse')) { + self.rotateMarker(style, marker.get('nextCourse')); + } + marker.set('animating', false); + } + }; + + marker.set('line', line); + marker.set('nextCourse', course); + if (!marker.get('animating')) { + marker.set('animating', true); + updatePosition(1, marker); + } + }, + updateLatest: function (store, data) { var i, position, device, deviceStore; @@ -249,11 +282,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { deviceId = position.get('deviceId'); if (deviceId in this.latestMarkers) { marker = this.latestMarkers[deviceId]; - style = marker.getStyle(); - if (style.getImage().angle !== position.get('course')) { - this.rotateMarker(style, position.get('course')); - } - marker.setGeometry(geometry); + this.animateMarker(marker, geometry, position.get('course')); } else { marker = new ol.Feature(geometry); marker.set('record', device); -- cgit v1.2.3 From 67f7f30d2e646f2caf7bdc9b8a4af6522ee90693 Mon Sep 17 00:00:00 2001 From: edvalley <52469633+edvalley@users.noreply.github.com> Date: Thu, 18 Jul 2019 21:49:15 -0400 Subject: Fix misleading displayed label (#751) --- web/app/view/dialog/Server.js | 2 +- web/l10n/en.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/dialog/Server.js b/web/app/view/dialog/Server.js index c9729ccf..b72dbb0c 100644 --- a/web/app/view/dialog/Server.js +++ b/web/app/view/dialog/Server.js @@ -47,7 +47,7 @@ Ext.define('Traccar.view.dialog.Server', { xtype: 'unescapedTextField', reference: 'mapUrlField', name: 'mapUrl', - fieldLabel: Strings.mapCustom + fieldLabel: Strings.mapCustomLabel }, { xtype: 'numberfield', reference: 'latitude', diff --git a/web/l10n/en.json b/web/l10n/en.json index 73747852..a670b0b7 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -233,6 +233,7 @@ "mapLayer": "Map Layer", "mapCustom": "Custom (XYZ)", "mapCustomArcgis": "Custom (ArcGIS)", + "mapCustomLabel": "Custom map", "mapCarto": "Carto Basemaps", "mapOsm": "Open Street Map", "mapBingKey": "Bing Maps Key", -- cgit v1.2.3 From 5a115dbbb249d4b38822cce053698fb12225663c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 31 Jan 2020 21:32:34 -0800 Subject: Fix accuracy radius (fix #765) --- web/app/view/map/MapMarkerController.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 9c61fa61..64efdeef 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -243,15 +243,14 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, updateAccuracy: function (position, device) { - var center, radius, feature, mapView, projection, pointResolution; + var center, radius, feature, mapView; mapView = this.getView().getMapView(); feature = this.accuracyCircles[position.get('deviceId')]; if (position.get('accuracy')) { - projection = mapView.getProjection(); center = ol.proj.fromLonLat([position.get('longitude'), position.get('latitude')]); - pointResolution = ol.proj.getPointResolution(projection, mapView.getResolution(), center); - radius = position.get('accuracy') / ol.proj.Units.METERS_PER_UNIT.m * mapView.getResolution() / pointResolution; + radius = Ext.getStore('DistanceUnits').convertValue( + position.get('accuracy'), Traccar.app.getAttributePreference('distanceUnit'), true); if (feature) { feature.getGeometry().setCenter(center); -- cgit v1.2.3 From 5549ec84fc341b1ea076720e4d18a709573f9ada Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 31 Jan 2020 21:42:22 -0800 Subject: Fix lint warning --- web/app/view/map/MapMarkerController.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 64efdeef..785fcc68 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -243,8 +243,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, updateAccuracy: function (position, device) { - var center, radius, feature, mapView; - mapView = this.getView().getMapView(); + var center, radius, feature; feature = this.accuracyCircles[position.get('deviceId')]; if (position.get('accuracy')) { -- cgit v1.2.3 From e8479d77f13acc3b3738a180a7990b06c495f1ba Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 5 Feb 2020 20:50:47 -0800 Subject: Make OSM default map --- web/app/view/map/BaseMap.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 0ab48e87..6c6522bd 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -137,16 +137,16 @@ Ext.define('Traccar.view.map.BaseMap', { }) }); break; - case 'osm': + case 'wikimedia': layer = new ol.layer.Tile({ - source: new ol.source.OSM({}) + source: new ol.source.OSM({ + url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png' + }) }); break; default: layer = new ol.layer.Tile({ - source: new ol.source.OSM({ - url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png' - }) + source: new ol.source.OSM({}) }); break; } -- cgit v1.2.3