aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/app/DeviceImages.js6
-rw-r--r--web/app/GeofenceConverter.js2
-rw-r--r--web/app/controller/Root.js8
-rw-r--r--web/app/view/BaseMap.js2
-rw-r--r--web/app/view/CommandDialog.js27
-rw-r--r--web/app/view/CommandDialogController.js20
-rw-r--r--web/app/view/MapMarkerController.js32
-rw-r--r--web/l10n/en.json2
-rw-r--r--web/load.js2
-rw-r--r--web/simple/index.html4
10 files changed, 76 insertions, 29 deletions
diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js
index b31f3ed3..e58c4f60 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 9e3c1327..0abefbce 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 0cc2a148..404fb7cc 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 2e981f08..f0d51d52 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/CommandDialog.js b/web/app/view/CommandDialog.js
index af36f558..24e0e191 100644
--- a/web/app/view/CommandDialog.js
+++ b/web/app/view/CommandDialog.js
@@ -90,6 +90,33 @@ Ext.define('Traccar.view.CommandDialog', {
hidden: true
}]
}, {
+ xtype: 'fieldcontainer',
+ reference: 'paramSetTimezone',
+ name: 'attributes',
+ hidden: true,
+
+ items: [{
+ xtype: 'numberfield',
+ fieldLabel: Strings.commandTimezone,
+ name: 'timezone',
+ minValue: -12,
+ step: 0.5,
+ maxValue: +14
+ }]
+ }, {
+ xtype: 'fieldcontainer',
+ reference: 'paramSetIndicator',
+ name: 'attributes',
+ hidden: true,
+
+ items: [{
+ xtype: 'numberfield',
+ fieldLabel: Strings.commandData,
+ name: 'data',
+ minValue: 0,
+ maxValue: 99
+ }]
+ }, {
xtype: 'textfield',
reference: 'paramCustom',
fieldLabel: Strings.commandCustom,
diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js
index 9442e4f4..6e809fa1 100644
--- a/web/app/view/CommandDialogController.js
+++ b/web/app/view/CommandDialogController.js
@@ -28,6 +28,10 @@ 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('paramSetIndicator').setHidden(
+ selected.getValue() !== 'setIndicator');
this.lookupReference('paramCustom').setHidden(
selected.getValue() !== 'custom');
},
@@ -78,6 +82,22 @@ 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 * 3600
+ });
+ }
+
+ if (record.get('type') === 'setIndicator') {
+ attributes = this.lookupReference('paramSetIndicator');
+ value = attributes.down('numberfield[name="data"]').getValue();
+ record.set('attributes', {
+ data: value
+ });
+ }
+
if (record.get('type') === 'custom') {
value = this.lookupReference('paramCustom').getValue();
record.set('attributes', {
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index 5fa9f4ca..b978aafd 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/l10n/en.json b/web/l10n/en.json
index 4b883c7a..39376bea 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -144,6 +144,7 @@
"commandSosNumber": "Set SOS Number",
"commandSilenceTime": "Set Silence Time",
"commandSetPhonebook": "Set Phonebook",
+ "commandSetIndicator": "Set Indicator",
"commandVoiceMessage": "Voice Message",
"commandOutputControl": "Output Control",
"commandAlarmSpeed": "Overspeed Alarm",
@@ -152,6 +153,7 @@
"commandData": "Data",
"commandPhone": "Phone Number",
"commandMessage": "Message",
+ "commandTimezone": "Timezone Offset",
"eventAll": "All Events",
"eventDeviceOnline": "Device is online",
"eventDeviceUnknown": "Device status is unknown",
diff --git a/web/load.js b/web/load.js
index 03b85430..cd012f18 100644
--- a/web/load.js
+++ b/web/load.js
@@ -117,7 +117,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');
diff --git a/web/simple/index.html b/web/simple/index.html
index d4bfe504..d52e518e 100644
--- a/web/simple/index.html
+++ b/web/simple/index.html
@@ -4,11 +4,11 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Traccar</title>
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.css" type="text/css">
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.0/ol.css" type="text/css">
</head>
<body style="margin: 0; padding: 0;">
<div id="map" style="width: 100%; height: 100%; position:fixed;"></div>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.js" type="text/javascript"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.0/ol.js" type="text/javascript"></script>
<script id="loadScript" src="app.js"></script>
</body>
</html>