From eea8e3cde73b7fe2640c6fe187ffb4d899381a60 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Mon, 19 Dec 2016 14:53:16 +0100 Subject: #2702 [WIP] Implement SET_TIMEZONE for watch Protocol Problem: Positive time zone needs to be + prepended, custom formatter does not seem to be called --- web/app/view/CommandDialog.js | 14 ++++++++++++++ web/app/view/CommandDialogController.js | 10 ++++++++++ web/l10n/de.json | 1 + web/l10n/en.json | 1 + 4 files changed, 26 insertions(+) diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index af36f55..cb6fed2 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -89,6 +89,20 @@ Ext.define('Traccar.view.CommandDialog', { name: 'message', hidden: true }] + }, { + xtype: 'fieldcontainer', + reference: 'paramSetTimezone', + name: 'attributes', + hidden: true, + + items: [{ + xtype: 'numberfield', + fieldLabel: Strings.commandTimezoneOffset, + name: 'timezone', + minValue: -12, + step: 0.5, + maxValue: +14 + }] }, { xtype: 'textfield', reference: 'paramCustom', diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index 9442e4f..ca50361 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -28,6 +28,8 @@ Ext.define('Traccar.view.CommandDialogController', { selected.getValue() !== 'sendSms' && selected.getValue() !== 'sendUssd'); this.lookupReference('paramSmsMessage').setHidden( selected.getValue() !== 'sendSms'); + this.lookupReference('paramSetTimezone').setHidden( + selected.getValue() !== 'setTimezone'); this.lookupReference('paramCustom').setHidden( selected.getValue() !== 'custom'); }, @@ -78,6 +80,14 @@ Ext.define('Traccar.view.CommandDialogController', { }); } + if (record.get('type') === 'setTimezone') { + attributes = this.lookupReference('paramSetTimezone'); + value = attributes.down('numberfield[name="timezone"]').getValue(); + record.set('attributes', { + timezone: value + }); + } + if (record.get('type') === 'custom') { value = this.lookupReference('paramCustom').getValue(); record.set('attributes', { diff --git a/web/l10n/de.json b/web/l10n/de.json index 1379c39..e8c8671 100644 --- a/web/l10n/de.json +++ b/web/l10n/de.json @@ -144,6 +144,7 @@ "commandData": "Daten", "commandPhone": "Rufnummer", "commandMessage": "Nachricht", + "commandTimezoneOffset": "Zeitverschiebung zu UTC", "eventAll": "Alle Ereignisse", "eventDeviceOnline": "Gerät ist online", "eventDeviceOffline": "Gerät ist offline", diff --git a/web/l10n/en.json b/web/l10n/en.json index baff8b0..e7ff00b 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -144,6 +144,7 @@ "commandData": "Data", "commandPhone": "Phone Number", "commandMessage": "Message", + "commandTimezoneOffset": "Timezone Offset to UTC", "eventAll": "All Events", "eventDeviceOnline": "Device is online", "eventDeviceOffline": "Device is offline", -- cgit v1.2.3 From c14eda96bc3d7ebbd36f325d648087fdf4ae6572 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Tue, 20 Dec 2016 08:41:59 +0100 Subject: #2702Implement setHearts for watch Protocol Using this function you can display a certain amount of hearts on the watch. Nothing more, nothing less. --- web/app/view/CommandDialog.js | 13 +++++++++++++ web/app/view/CommandDialogController.js | 10 ++++++++++ web/l10n/de.json | 1 + web/l10n/en.json | 1 + 4 files changed, 25 insertions(+) diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index cb6fed2..1450dc2 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -103,6 +103,19 @@ Ext.define('Traccar.view.CommandDialog', { step: 0.5, maxValue: +14 }] + }, { + xtype: 'fieldcontainer', + reference: 'paramSetHearts', + name: 'attributes', + hidden: true, + + items: [{ + xtype: 'numberfield', + fieldLabel: Strings.commandHearts, + name: 'hearts', + minValue: 0, + maxValue: 99 + }] }, { xtype: 'textfield', reference: 'paramCustom', diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index ca50361..c719b5e 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -30,6 +30,8 @@ Ext.define('Traccar.view.CommandDialogController', { selected.getValue() !== 'sendSms'); this.lookupReference('paramSetTimezone').setHidden( selected.getValue() !== 'setTimezone'); + this.lookupReference('paramSetHearts').setHidden( + selected.getValue() !== 'setHearts'); this.lookupReference('paramCustom').setHidden( selected.getValue() !== 'custom'); }, @@ -88,6 +90,14 @@ Ext.define('Traccar.view.CommandDialogController', { }); } + if (record.get('type') === 'setHearts') { + attributes = this.lookupReference('paramSetHearts'); + value = attributes.down('numberfield[name="hearts"]').getValue(); + record.set('attributes', { + hearts: value + }); + } + if (record.get('type') === 'custom') { value = this.lookupReference('paramCustom').getValue(); record.set('attributes', { diff --git a/web/l10n/de.json b/web/l10n/de.json index e8c8671..c0b3653 100644 --- a/web/l10n/de.json +++ b/web/l10n/de.json @@ -145,6 +145,7 @@ "commandPhone": "Rufnummer", "commandMessage": "Nachricht", "commandTimezoneOffset": "Zeitverschiebung zu UTC", + "commandHearts": "Herzen / Blumen", "eventAll": "Alle Ereignisse", "eventDeviceOnline": "Gerät ist online", "eventDeviceOffline": "Gerät ist offline", diff --git a/web/l10n/en.json b/web/l10n/en.json index e7ff00b..23b75de 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -145,6 +145,7 @@ "commandPhone": "Phone Number", "commandMessage": "Message", "commandTimezoneOffset": "Timezone Offset to UTC", + "commandHearts": "Hearts / Flowers", "eventAll": "All Events", "eventDeviceOnline": "Device is online", "eventDeviceOffline": "Device is offline", -- cgit v1.2.3 From fef9d5331bbcd19d51dcf1f4d1e9355c67952004 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Tue, 20 Dec 2016 10:43:32 +0100 Subject: Revert DE Strings (from #2702) --- web/l10n/de.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/web/l10n/de.json b/web/l10n/de.json index c0b3653..1379c39 100644 --- a/web/l10n/de.json +++ b/web/l10n/de.json @@ -144,8 +144,6 @@ "commandData": "Daten", "commandPhone": "Rufnummer", "commandMessage": "Nachricht", - "commandTimezoneOffset": "Zeitverschiebung zu UTC", - "commandHearts": "Herzen / Blumen", "eventAll": "Alle Ereignisse", "eventDeviceOnline": "Gerät ist online", "eventDeviceOffline": "Gerät ist offline", -- cgit v1.2.3 From d3cf54f1f77b3552b4f12fbde73463159cf1b359 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Tue, 20 Dec 2016 11:00:21 +0100 Subject: #2702 Rename "Hearts" function to "Indicator" to be more general --- web/app/view/CommandDialog.js | 6 +++--- web/app/view/CommandDialogController.js | 12 ++++++------ web/l10n/en.json | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index 1450dc2..ffe9095 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -105,14 +105,14 @@ Ext.define('Traccar.view.CommandDialog', { }] }, { xtype: 'fieldcontainer', - reference: 'paramSetHearts', + reference: 'paramSetIndicator', name: 'attributes', hidden: true, items: [{ xtype: 'numberfield', - fieldLabel: Strings.commandHearts, - name: 'hearts', + fieldLabel: Strings.commandData, + name: 'data', minValue: 0, maxValue: 99 }] diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index c719b5e..9d7bb2b 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -30,8 +30,8 @@ Ext.define('Traccar.view.CommandDialogController', { selected.getValue() !== 'sendSms'); this.lookupReference('paramSetTimezone').setHidden( selected.getValue() !== 'setTimezone'); - this.lookupReference('paramSetHearts').setHidden( - selected.getValue() !== 'setHearts'); + this.lookupReference('paramSetIndicator').setHidden( + selected.getValue() !== 'setIndicator'); this.lookupReference('paramCustom').setHidden( selected.getValue() !== 'custom'); }, @@ -90,11 +90,11 @@ Ext.define('Traccar.view.CommandDialogController', { }); } - if (record.get('type') === 'setHearts') { - attributes = this.lookupReference('paramSetHearts'); - value = attributes.down('numberfield[name="hearts"]').getValue(); + if (record.get('type') === 'setIndicator') { + attributes = this.lookupReference('paramSetIndicator'); + value = attributes.down('numberfield[name="data"]').getValue(); record.set('attributes', { - hearts: value + data: value }); } diff --git a/web/l10n/en.json b/web/l10n/en.json index 23b75de..b700cf4 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -145,7 +145,7 @@ "commandPhone": "Phone Number", "commandMessage": "Message", "commandTimezoneOffset": "Timezone Offset to UTC", - "commandHearts": "Hearts / Flowers", + "commandSetIndicator": "Set Indicator", "eventAll": "All Events", "eventDeviceOnline": "Device is online", "eventDeviceOffline": "Device is offline", -- cgit v1.2.3 From 13cdf25f6afbd8f77f851bc002021ddc08727eb1 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 20 Dec 2016 15:35:39 +0500 Subject: - Migrate to openlayers 3.20.0 - use style.setImage() - style fixes --- web/app/DeviceImages.js | 6 ------ web/app/GeofenceConverter.js | 2 +- web/app/controller/Root.js | 8 ++++---- web/app/view/BaseMap.js | 2 +- web/app/view/MapMarkerController.js | 32 ++++++++++++++++++-------------- web/load.js | 2 +- 6 files changed, 25 insertions(+), 27 deletions(-) diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index b31f3ed..e58c4f6 100644 --- a/web/app/DeviceImages.js +++ b/web/app/DeviceImages.js @@ -95,11 +95,5 @@ Ext.define('Traccar.DeviceImages', { image.category = category; return image; - }, - - rotateImageIcon: function (image, angle) { - var svg = this.getImageSvg(image.fill, image.zoom, angle, image.category); - image.getImage().src = this.formatSrc(svg); - image.angle = angle; } }); diff --git a/web/app/GeofenceConverter.js b/web/app/GeofenceConverter.js index 9e3c132..0abefbc 100644 --- a/web/app/GeofenceConverter.js +++ b/web/app/GeofenceConverter.js @@ -43,7 +43,7 @@ Ext.define('Traccar.GeofenceConverter', { projection = mapView.getProjection(); center = ol.proj.transform([Number(coordinates[1]), Number(coordinates[0])], 'EPSG:4326', projection); resolutionAtEquator = mapView.getResolution(); - pointResolution = projection.getPointResolution(resolutionAtEquator, center); + pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center); resolutionFactor = resolutionAtEquator / pointResolution; radius = (Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m) * resolutionFactor; geometry = new ol.geom.Circle(center, radius); diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 0cc2a14..404fb7c 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -134,7 +134,7 @@ Ext.define('Traccar.controller.Root', { Ext.Ajax.request({ url: 'api/devices', - success: function(response) { + success: function (response) { self.updateDevices(Ext.decode(response.responseText)); } }); @@ -144,12 +144,12 @@ Ext.define('Traccar.controller.Root', { headers: { Accept: 'application/json' }, - success: function(response) { + success: function (response) { self.updatePositions(Ext.decode(response.responseText)); } }); - setTimeout(function() { + setTimeout(function () { self.asyncUpdate(false); }, Traccar.Style.reconnectTimeout); }; @@ -186,7 +186,7 @@ Ext.define('Traccar.controller.Root', { }, updatePositions: function (array) { - var i, store, data, entity; + var i, store, entity; store = Ext.getStore('LatestPositions'); for (i = 0; i < array.length; i++) { entity = store.findRecord('deviceId', array[i].deviceId, 0, false, false, true); diff --git a/web/app/view/BaseMap.js b/web/app/view/BaseMap.js index 2e981f0..f0d51d5 100644 --- a/web/app/view/BaseMap.js +++ b/web/app/view/BaseMap.js @@ -122,7 +122,7 @@ Ext.define('Traccar.view.BaseMap', { this.map.on('click', function (e) { this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { this.fireEvent('selectfeature', feature); - }, this); + }.bind(this)); }, this); }, diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js index 5fa9f4c..b978aaf 100644 --- a/web/app/view/MapMarkerController.js +++ b/web/app/view/MapMarkerController.js @@ -92,7 +92,8 @@ Ext.define('Traccar.view.MapMarkerController', { style = marker.getStyle(); if (style.getImage().fill !== this.getDeviceColor(device) || style.getImage().category !== device.get('category')) { - marker.setStyle(this.updateDeviceMarker(style, this.getDeviceColor(device), device.get('category'))); + this.updateDeviceMarker(style, this.getDeviceColor(device), device.get('category')); + marker.changed(); } if (style.getText().getText() !== device.get('name')) { style.getText().setText(device.get('name')); @@ -144,7 +145,7 @@ Ext.define('Traccar.view.MapMarkerController', { marker = this.latestMarkers[deviceId]; style = marker.getStyle(); if (style.getImage().angle !== position.get('course')) { - Traccar.DeviceImages.rotateImageIcon(style.getImage(), position.get('course')); + this.rotateMarker(style, position.get('course')); } marker.setGeometry(geometry); } else { @@ -327,10 +328,15 @@ Ext.define('Traccar.view.MapMarkerController', { style.getImage().category); text = style.getText(); text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); - return new ol.style.Style({ - image: image, - text: text - }); + style.setText(text); + style.setImage(image); + }, + + rotateMarker: function (style, angle) { + style.setImage(Traccar.DeviceImages.getImageIcon(style.getImage().fill, + style.getImage().zoom, + angle, + style.getImage().category)); }, updateDeviceMarker: function (style, color, category) { @@ -341,21 +347,19 @@ Ext.define('Traccar.view.MapMarkerController', { category); text = style.getText(); text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); - return new ol.style.Style({ - image: image, - text: text - }); + style.setText(text); + style.setImage(image); }, selectMarker: function (marker, center) { if (this.selectedMarker) { - this.selectedMarker.setStyle( - this.resizeMarker(this.selectedMarker.getStyle(), false)); + this.resizeMarker(this.selectedMarker.getStyle(), false); + this.selectedMarker.changed(); } if (marker) { - marker.setStyle( - this.resizeMarker(marker.getStyle(), true)); + this.resizeMarker(marker.getStyle(), true); + marker.changed(); if (center) { this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates()); } diff --git a/web/load.js b/web/load.js index 0fe7ce5..c329295 100644 --- a/web/load.js +++ b/web/load.js @@ -111,7 +111,7 @@ extjsVersion = '6.2.0'; fontAwesomeVersion = '4.7.0'; - olVersion = '3.19.1'; + olVersion = '3.20.0'; if (debugMode) { addScriptFile('//cdnjs.cloudflare.com/ajax/libs/extjs/' + extjsVersion + '/ext-all-debug.js'); -- cgit v1.2.3 From 07716fdd0bc9fb5329f2a6cd80acb6106b9f4e7c Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Tue, 20 Dec 2016 12:03:09 +0100 Subject: #2702 SetTimezone: Rename String, Reordering --- web/app/view/CommandDialog.js | 2 +- web/l10n/en.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index ffe9095..24e0e19 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -97,7 +97,7 @@ Ext.define('Traccar.view.CommandDialog', { items: [{ xtype: 'numberfield', - fieldLabel: Strings.commandTimezoneOffset, + fieldLabel: Strings.commandTimezone, name: 'timezone', minValue: -12, step: 0.5, diff --git a/web/l10n/en.json b/web/l10n/en.json index b700cf4..220c1d6 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -136,6 +136,7 @@ "commandSosNumber": "Set SOS Number", "commandSilenceTime": "Set Silence Time", "commandSetPhonebook": "Set Phonebook", + "commandSetIndicator": "Set Indicator", "commandVoiceMessage": "Voice Message", "commandOutputControl": "Output Control", "commandAlarmSpeed": "Overspeed Alarm", @@ -144,8 +145,7 @@ "commandData": "Data", "commandPhone": "Phone Number", "commandMessage": "Message", - "commandTimezoneOffset": "Timezone Offset to UTC", - "commandSetIndicator": "Set Indicator", + "commandTimezone": "Timezone Offset", "eventAll": "All Events", "eventDeviceOnline": "Device is online", "eventDeviceOffline": "Device is offline", -- cgit v1.2.3 From 34fdca37d4a5a2d058345c60af028acad4edf8d8 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Tue, 20 Dec 2016 12:47:19 +0100 Subject: #2702 SetTimezone: Conversion to Seconds, Formating improvement (+ sign) --- web/app/view/CommandDialogController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index 9d7bb2b..e6823d3 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -86,7 +86,7 @@ Ext.define('Traccar.view.CommandDialogController', { attributes = this.lookupReference('paramSetTimezone'); value = attributes.down('numberfield[name="timezone"]').getValue(); record.set('attributes', { - timezone: value + timezone: value * 60 }); } -- cgit v1.2.3 From c7d69869cd13f9d0434703e5eef60a29aba8de90 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Wed, 21 Dec 2016 09:45:02 +0100 Subject: #2702 SetTimezone: Really - Conversion to Seconds NOT Minutes --- web/app/view/CommandDialogController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index e6823d3..6e809fa 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -86,7 +86,7 @@ Ext.define('Traccar.view.CommandDialogController', { attributes = this.lookupReference('paramSetTimezone'); value = attributes.down('numberfield[name="timezone"]').getValue(); record.set('attributes', { - timezone: value * 60 + timezone: value * 3600 }); } -- cgit v1.2.3 From d3d8e6aed0f880a0077a5aa0b5bd2fcd189a5525 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 21 Dec 2016 15:35:34 +0500 Subject: Also migrate "simple" to 3.20.0 --- web/simple/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/simple/index.html b/web/simple/index.html index d4bfe50..d52e518 100644 --- a/web/simple/index.html +++ b/web/simple/index.html @@ -4,11 +4,11 @@ Traccar - +
- + -- cgit v1.2.3