From 87156d38c250abd9a1cba9b9af289d5ff0acb075 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 25 Jul 2015 19:05:33 +1200 Subject: Add server and user attributes --- web/app/Application.js | 4 +++- web/app/store/DistanceUnits.js | 24 ++++++++++++++++++++++++ web/app/store/MapTypes.js | 4 ++-- web/app/store/SpeedUnits.js | 24 ++++++++++++++++++++++++ web/app/view/admin/ServerDialog.js | 14 ++++++++++++++ web/app/view/user/UserDialog.js | 33 +++++++++++++++++++++++++++++++++ web/l10n/en.js | 8 ++++++++ 7 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 web/app/store/DistanceUnits.js create mode 100644 web/app/store/SpeedUnits.js (limited to 'web') diff --git a/web/app/Application.js b/web/app/Application.js index f18c2768a..55b8f774c 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -37,7 +37,9 @@ Ext.define('Traccar.Application', { 'LiveData', 'Users', 'Parameters', - 'MapTypes' + 'MapTypes', + 'DistanceUnits', + 'SpeedUnits' ], controllers: [ diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js new file mode 100644 index 000000000..b3d342fc6 --- /dev/null +++ b/web/app/store/DistanceUnits.js @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.store.DistanceUnits', { + extend: 'Ext.data.Store', + fields: ['key', 'name'], + data : [ + {'key': 'km', 'name': strings.shared_km}, + {'key': 'mi', 'name': strings.shared_mi} + ] +}); diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js index 58e0a739c..09636e3a0 100644 --- a/web/app/store/MapTypes.js +++ b/web/app/store/MapTypes.js @@ -18,7 +18,7 @@ Ext.define('Traccar.store.MapTypes', { extend: 'Ext.data.Store', fields: ['key', 'name'], data : [ - {"key": "osm", "name": "OpenStreetMap"}, - {"key": "bing", "name": "Bing Maps"} + {'key': 'osm', 'name': strings.map_osm}, + {'key': 'bing', 'name': strings.map_bing} ] }); diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js new file mode 100644 index 000000000..b658fc936 --- /dev/null +++ b/web/app/store/SpeedUnits.js @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.store.SpeedUnits', { + extend: 'Ext.data.Store', + fields: ['key', 'name'], + data : [ + {'key': 'kph', 'name': strings.shared_kph}, + {'key': 'mph', 'name': strings.shared_mph} + ] +}); diff --git a/web/app/view/admin/ServerDialog.js b/web/app/view/admin/ServerDialog.js index 12170dc03..de3efd6fa 100644 --- a/web/app/view/admin/ServerDialog.js +++ b/web/app/view/admin/ServerDialog.js @@ -43,6 +43,20 @@ Ext.define('Traccar.view.admin.ServerDialog', { store: 'MapTypes', displayField: 'name', valueField: 'key' + }, { + xtype: 'combobox', + name: 'distanceUnit', + fieldLabel: strings.settings_distance_unit, + store: 'DistanceUnits', + displayField: 'name', + valueField: 'key' + }, { + xtype: 'combobox', + name: 'speedUnit', + fieldLabel: strings.settings_speed_unit, + store: 'SpeedUnits', + displayField: 'name', + valueField: 'key' }, { xtype: 'numberfield', name: 'latitude', diff --git a/web/app/view/user/UserDialog.js b/web/app/view/user/UserDialog.js index 3db21de6c..67bf2ccf1 100644 --- a/web/app/view/user/UserDialog.js +++ b/web/app/view/user/UserDialog.js @@ -53,6 +53,39 @@ Ext.define('Traccar.view.user.UserDialog', { allowBlank: false, disabled: true, reference: 'adminField' + }, { + xtype: 'combobox', + name: 'map', + fieldLabel: strings.map_layer, + store: 'MapTypes', + displayField: 'name', + valueField: 'key' + }, { + xtype: 'combobox', + name: 'distanceUnit', + fieldLabel: strings.settings_distance_unit, + store: 'DistanceUnits', + displayField: 'name', + valueField: 'key' + }, { + xtype: 'combobox', + name: 'speedUnit', + fieldLabel: strings.settings_speed_unit, + store: 'SpeedUnits', + displayField: 'name', + valueField: 'key' + }, { + xtype: 'numberfield', + name: 'latitude', + fieldLabel: strings.position_latitude + }, { + xtype: 'numberfield', + name: 'longitude', + fieldLabel: strings.position_longitude + }, { + xtype: 'numberfield', + name: 'zoom', + fieldLabel: strings.server_zoom }] }, diff --git a/web/l10n/en.js b/web/l10n/en.js index 7f169cf81..2fedbb754 100644 --- a/web/l10n/en.js +++ b/web/l10n/en.js @@ -6,6 +6,10 @@ var strings = { shared_edit: 'Edit', shared_remove: 'Remove', shared_remove_confirm: 'Remove item?', + shared_km: 'km', + shared_mi: 'mi', + shared_kph: 'km/h', + shared_mph: 'mph', error_title: 'Error', error_unknown: 'Unknown error', @@ -31,6 +35,8 @@ var strings = { settings_user: 'Account', settings_server: 'Server', settings_users: 'Users', + settings_distance_unit: 'Distance', + settings_speed_unit: 'Speed', report_title: 'Reports', report_device: 'Device', @@ -55,6 +61,8 @@ var strings = { map_title: 'Map', map_layer: 'Map Layer', + map_osm: 'OpenStreetMap', + map_bing: 'Bing Maps', state_title: 'State', state_name: 'Parameter', -- cgit v1.2.3