aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/controller/Root.js10
-rw-r--r--web/app/model/Server.js3
-rw-r--r--web/app/model/User.js3
-rw-r--r--web/app/store/CommonUserAttributes.js6
-rw-r--r--web/app/store/MapTypes.js9
-rw-r--r--web/app/view/MainController.js4
-rw-r--r--web/app/view/ReportController.js6
-rw-r--r--web/app/view/State.js15
-rw-r--r--web/app/view/StateController.js3
-rw-r--r--web/app/view/dialog/Login.js41
-rw-r--r--web/app/view/dialog/Server.js6
-rw-r--r--web/app/view/dialog/User.js8
-rw-r--r--web/app/view/dialog/UserController.js1
-rw-r--r--web/app/view/map/BaseMap.js32
-rw-r--r--web/app/view/map/Map.js16
-rw-r--r--web/app/view/map/MapController.js8
16 files changed, 145 insertions, 26 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 65b56fa6..a37bc06f 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2022 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
@@ -308,7 +308,7 @@ Ext.define('Traccar.controller.Root', {
},
updatePositions: function (array, first) {
- var i, store, entity, deviceId, device;
+ var i, store, entity, uniqueId, device;
store = Ext.getStore('LatestPositions');
for (i = 0; i < array.length; i++) {
entity = store.findRecord('deviceId', array[i].deviceId, 0, false, false, true);
@@ -322,9 +322,9 @@ Ext.define('Traccar.controller.Root', {
}
}
if (first) {
- deviceId = Ext.Object.fromQueryString(window.location.search).deviceId;
- if (deviceId) {
- device = Ext.getStore('VisibleDevices').findRecord('id', deviceId, 0, false, true, true);
+ uniqueId = Ext.Object.fromQueryString(window.location.search).deviceId;
+ if (uniqueId) {
+ device = Ext.getStore('VisibleDevices').findRecord('uniqueId', uniqueId, 0, false, true, true);
if (device) {
this.fireEvent('selectdevice', device, true);
}
diff --git a/web/app/model/Server.js b/web/app/model/Server.js
index afafe908..177b4fc4 100644
--- a/web/app/model/Server.js
+++ b/web/app/model/Server.js
@@ -35,6 +35,9 @@ Ext.define('Traccar.model.Server', {
name: 'limitCommands',
type: 'boolean'
}, {
+ name: 'disableReports',
+ type: 'boolean'
+ }, {
name: 'map',
type: 'string'
}, {
diff --git a/web/app/model/User.js b/web/app/model/User.js
index 76f2a366..fcaff007 100644
--- a/web/app/model/User.js
+++ b/web/app/model/User.js
@@ -81,6 +81,9 @@ Ext.define('Traccar.model.User', {
name: 'limitCommands',
type: 'boolean'
}, {
+ name: 'disableReports',
+ type: 'boolean'
+ }, {
name: 'poiLayer',
type: 'string'
}, {
diff --git a/web/app/store/CommonUserAttributes.js b/web/app/store/CommonUserAttributes.js
index a8e92825..7d0ea969 100644
--- a/web/app/store/CommonUserAttributes.js
+++ b/web/app/store/CommonUserAttributes.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2022 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
@@ -39,10 +39,6 @@ Ext.define('Traccar.store.CommonUserAttributes', {
minValue: Traccar.Style.mapDefaultZoom,
maxValue: Traccar.Style.mapMaxZoom
}, {
- key: 'ui.disableReport',
- name: Strings.attributeUiDisableReport,
- valueType: 'boolean'
- }, {
key: 'ui.disableEvents',
name: Strings.attributeUiDisableEvents,
valueType: 'boolean'
diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js
index 9cca525e..01657565 100644
--- a/web/app/store/MapTypes.js
+++ b/web/app/store/MapTypes.js
@@ -20,6 +20,15 @@ Ext.define('Traccar.store.MapTypes', {
fields: ['key', 'name'],
data: [{
+ key: 'locationIqStreets',
+ name: Strings.mapLocationIqStreets
+ }, {
+ key: 'locationIqEarth',
+ name: Strings.mapLocationIqEarth
+ }, {
+ key: 'locationIqHybrid',
+ name: Strings.mapLocationIqHybrid
+ }, {
key: 'osm',
name: Strings.mapOsm
}, {
diff --git a/web/app/view/MainController.js b/web/app/view/MainController.js
index 7cd03050..8ed986af 100644
--- a/web/app/view/MainController.js
+++ b/web/app/view/MainController.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2022 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
@@ -20,7 +20,7 @@ Ext.define('Traccar.view.MainController', {
alias: 'controller.mainController',
init: function () {
- this.lookupReference('reportView').setHidden(Traccar.app.getBooleanAttributePreference('ui.disableReport'));
+ this.lookupReference('reportView').setHidden(Traccar.app.getPreference('disableReports', false));
this.lookupReference('eventsView').setHidden(Traccar.app.getBooleanAttributePreference('ui.disableEvents'));
}
});
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index cc0fd4ac..4241df35 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -528,6 +528,12 @@ Ext.define('Traccar.view.ReportController', {
return Traccar.app.getEventString(value);
}
}, {
+ text: Strings.positionAlarm,
+ dataIndex: 'attributes',
+ renderer: function (value) {
+ return value['alarm'];
+ }
+ }, {
text: Strings.sharedGeofence,
dataIndex: 'geofenceId',
renderer: Traccar.AttributeFormatter.getFormatter('geofenceId')
diff --git a/web/app/view/State.js b/web/app/view/State.js
index ed9951b5..c0a430d9 100644
--- a/web/app/view/State.js
+++ b/web/app/view/State.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2022 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
@@ -61,19 +61,20 @@ Ext.define('Traccar.view.State', {
dataIndex: 'value',
cellWrap: true,
renderer: function (value, metaData, record) {
- var position, device;
- if (record.get('attribute') === 'alarm') {
+ var position, device, attribute;
+ attribute = record.get('attribute');
+ if (attribute === 'alarm') {
metaData.tdCls = 'view-color-red';
- } else if (record.get('name') === Strings.positionAddress && !value) {
+ } else if (attribute === 'address' && !value) {
return '<a href="#" onclick="Ext.fireEvent(\'stategeocode\')" >' +
Strings.sharedShowAddress + '</a>';
- } else if (record.get('name') === Strings.positionImage || record.get('name') === Strings.positionAudio) {
+ } else if (attribute === 'image' || attribute === 'video' || attribute === 'audio') {
position = this.getController().position;
if (position) {
device = Ext.getStore('Devices').getById(position.get('deviceId'));
if (device) {
- return '<a target="_blank" href="/api/media/' + device.get('uniqueId') + '/' + value + '" >' +
- value + '</a>';
+ return '<a target="_blank" href="/api/media/' +
+ device.get('uniqueId') + '/' + value + '" >' + value + '</a>';
}
}
}
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 1ab1aa2f..f04d7185 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2022 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
@@ -128,6 +128,7 @@ Ext.define('Traccar.view.StateController', {
store.add(Ext.create('Traccar.model.Attribute', {
priority: this.keys[key].priority,
name: this.keys[key].name,
+ attribute: key,
value: Traccar.AttributeFormatter.getFormatter(key)(this.position.get(key))
}));
}
diff --git a/web/app/view/dialog/Login.js b/web/app/view/dialog/Login.js
index 86917b94..d5658914 100644
--- a/web/app/view/dialog/Login.js
+++ b/web/app/view/dialog/Login.js
@@ -50,6 +50,47 @@ Ext.define('Traccar.view.dialog.Login', {
margin: '10px auto 25px'
}
}, {
+ xtype: 'pickerfield',
+ fieldLabel: Strings.settingsServer,
+ editable: false,
+ value: window.location.host,
+ hidden: !window.appInterface && !(window.webkit && window.webkit.messageHandlers.appInterface),
+ createPicker: function () {
+ var self = this, popup = Ext.create({
+ xtype: 'window',
+ closeAction: 'hide',
+ referenceHolder: true,
+ minWidth: 204,
+ layout: 'form',
+ header: false,
+ resizable: true,
+ items: [{
+ xtype: 'textfield',
+ anchor: '100%',
+ reference: 'serverAddress',
+ value: window.location.href
+ }],
+ fbar: [{
+ text: Strings.sharedSet,
+ handler: function () {
+ var message = 'server|' + popup.lookupReference('serverAddress').getValue();
+ if (window.webkit && window.webkit.messageHandlers.appInterface) {
+ window.webkit.messageHandlers.appInterface.postMessage(message);
+ }
+ if (window.appInterface) {
+ window.appInterface.postMessage(message);
+ }
+ }
+ }, {
+ text: Strings.sharedCancel,
+ handler: function () {
+ self.collapse();
+ }
+ }]
+ });
+ return popup;
+ }
+ }, {
xtype: 'combobox',
name: 'language',
fieldLabel: Strings.loginLanguage,
diff --git a/web/app/view/dialog/Server.js b/web/app/view/dialog/Server.js
index d9e225ec..6ee250b6 100644
--- a/web/app/view/dialog/Server.js
+++ b/web/app/view/dialog/Server.js
@@ -122,6 +122,12 @@ Ext.define('Traccar.view.dialog.Server', {
uncheckedValue: false,
name: 'limitCommands',
fieldLabel: Strings.userLimitCommands
+ }, {
+ xtype: 'checkboxfield',
+ inputValue: true,
+ uncheckedValue: false,
+ name: 'disableReports',
+ fieldLabel: Strings.userDisableReports
}]
}]
},
diff --git a/web/app/view/dialog/User.js b/web/app/view/dialog/User.js
index 917f110c..7335ee79 100644
--- a/web/app/view/dialog/User.js
+++ b/web/app/view/dialog/User.js
@@ -145,6 +145,14 @@ Ext.define('Traccar.view.dialog.User', {
disabled: true,
reference: 'limitCommandsField'
}, {
+ xtype: 'checkboxfield',
+ inputValue: true,
+ uncheckedValue: false,
+ name: 'disableReports',
+ fieldLabel: Strings.userDisableReports,
+ disabled: true,
+ reference: 'disableReportsField'
+ }, {
xtype: 'datefield',
name: 'expirationTime',
fieldLabel: Strings.userExpirationTime,
diff --git a/web/app/view/dialog/UserController.js b/web/app/view/dialog/UserController.js
index 7383f9ee..4ba48563 100644
--- a/web/app/view/dialog/UserController.js
+++ b/web/app/view/dialog/UserController.js
@@ -31,6 +31,7 @@ Ext.define('Traccar.view.dialog.UserController', {
this.lookupReference('expirationTimeField').setDisabled(false);
this.lookupReference('deviceReadonlyField').setDisabled(false);
this.lookupReference('limitCommandsField').setDisabled(false);
+ this.lookupReference('disableReportsField').setDisabled(false);
}
},
diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js
index efd05021..c27a8d79 100644
--- a/web/app/view/map/BaseMap.js
+++ b/web/app/view/map/BaseMap.js
@@ -30,12 +30,13 @@ Ext.define('Traccar.view.map.BaseMap', {
},
initMap: function () {
- var server, layer, type, bingKey, lat, lon, zoom, maxZoom, target, poiLayer, self = this;
+ var server, layer, type, bingKey, locationIqKey, lat, lon, zoom, maxZoom, target, poiLayer, self = this;
server = Traccar.app.getServer();
type = Traccar.app.getPreference('map', null);
bingKey = server.get('bingKey');
+ locationIqKey = Traccar.app.getAttributePreference('locationIqKey', 'pk.0f147952a41c555a5b70614039fd148b');
layer = new ol.layer.Group({
title: Strings.mapLayer,
@@ -125,8 +126,35 @@ Ext.define('Traccar.view.map.BaseMap', {
new ol.layer.Tile({
title: Strings.mapOsm,
type: 'base',
- visible: type === 'osm' || type === 'wikimedia' || !type,
+ visible: type === 'osm',
source: new ol.source.OSM({})
+ }),
+ new ol.layer.Tile({
+ title: Strings.mapLocationIqHybrid,
+ type: 'base',
+ visible: type === 'locationIqHybrid',
+ source: new ol.source.XYZ({
+ url: 'https://{a-c}-tiles.locationiq.com/v3/hybrid/r/{z}/{x}/{y}.jpg?key=' + locationIqKey,
+ attributions: '&copy; <a href="https://locationiq.com/">LocationIQ</a>'
+ })
+ }),
+ new ol.layer.Tile({
+ title: Strings.mapLocationIqEarth,
+ type: 'base',
+ visible: type === 'locationIqEarth',
+ source: new ol.source.XYZ({
+ url: 'https://{a-c}-tiles.locationiq.com/v3/earth/r/{z}/{x}/{y}.jpg?key=' + locationIqKey,
+ attributions: '&copy; <a href="https://locationiq.com/">LocationIQ</a>'
+ })
+ }),
+ new ol.layer.Tile({
+ title: Strings.mapLocationIqStreets,
+ type: 'base',
+ visible: type === 'locationIqStreets' || type === 'wikimedia' || !type,
+ source: new ol.source.XYZ({
+ url: 'https://{a-c}-tiles.locationiq.com/v3/streets/r/{z}/{x}/{y}.png?key=' + locationIqKey,
+ attributions: '&copy; <a href="https://locationiq.com/">LocationIQ</a>'
+ })
})
]
});
diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js
index fbaa7587..36e81de7 100644
--- a/web/app/view/map/Map.js
+++ b/web/app/view/map/Map.js
@@ -66,6 +66,13 @@ Ext.define('Traccar.view.map.Map', {
stateId: 'show-geofences-button',
tooltip: Strings.sharedGeofences
}, {
+ handler: 'showAccuracy',
+ reference: 'showAccuracyButton',
+ glyph: 'xf140@FontAwesome',
+ pressed: true,
+ stateId: 'show-accuracy-button',
+ tooltip: Strings.positionAccuracy
+ }, {
handler: 'showCurrentLocation',
glyph: 'xf124@FontAwesome',
tooltip: Strings.mapCurrentLocation
@@ -95,6 +102,10 @@ Ext.define('Traccar.view.map.Map', {
return this.accuracySource;
},
+ getAccuracyLayer: function () {
+ return this.accuracyLayer;
+ },
+
getRouteSource: function () {
return this.routeSource;
},
@@ -133,10 +144,11 @@ Ext.define('Traccar.view.map.Map', {
}));
this.accuracySource = new ol.source.Vector({});
- this.map.addLayer(new ol.layer.Vector({
+ this.accuracyLayer = new ol.layer.Vector({
name: 'accuracyLayer',
source: this.accuracySource
- }));
+ });
+ this.map.addLayer(this.accuracyLayer);
this.markersSource = new ol.source.Vector({});
this.map.addLayer(new ol.layer.Vector({
diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js
index 7ba0ee3b..f6d88eed 100644
--- a/web/app/view/map/MapController.js
+++ b/web/app/view/map/MapController.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2022 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
@@ -45,7 +45,7 @@ Ext.define('Traccar.view.map.MapController', {
init: function () {
this.callParent();
this.lookupReference('showReportsButton').setVisible(
- Traccar.app.isMobile() && !Traccar.app.getBooleanAttributePreference('ui.disableReport'));
+ Traccar.app.isMobile() && !Traccar.app.getPreference('disableReports', false));
this.lookupReference('showEventsButton').setVisible(
Traccar.app.isMobile() && !Traccar.app.getBooleanAttributePreference('ui.disableEvents'));
},
@@ -68,6 +68,10 @@ Ext.define('Traccar.view.map.MapController', {
this.getView().getLiveRouteLayer().setVisible(button.pressed);
},
+ showAccuracy: function (button) {
+ this.getView().getAccuracyLayer().setVisible(button.pressed);
+ },
+
getMapState: function () {
var zoom, center, projection;
projection = this.getView().getMapView().getProjection();