From 0e598a6232e9cd7188916e06077862d6630a255b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 24 May 2017 23:43:22 +1200 Subject: Add new categories (fix #495) --- web/app/store/DeviceImages.js | 93 +++++++------------------------------------ web/app/view/dialog/Device.js | 2 +- web/images/boat.svg | 48 ++++++++++++++++++++++ web/images/crane.svg | 48 ++++++++++++++++++++++ web/images/helicopter.svg | 47 ++++++++++++++++++++++ web/images/offroad.svg | 48 ++++++++++++++++++++++ web/images/pickup.svg | 47 ++++++++++++++++++++++ web/images/tractor.svg | 47 ++++++++++++++++++++++ web/images/van.svg | 47 ++++++++++++++++++++++ web/l10n/en.json | 19 ++++++--- web/load.js | 16 +++----- 11 files changed, 366 insertions(+), 96 deletions(-) create mode 100644 web/images/boat.svg create mode 100644 web/images/crane.svg create mode 100644 web/images/helicopter.svg create mode 100644 web/images/offroad.svg create mode 100644 web/images/pickup.svg create mode 100644 web/images/tractor.svg create mode 100644 web/images/van.svg (limited to 'web') diff --git a/web/app/store/DeviceImages.js b/web/app/store/DeviceImages.js index c1a8201..6f8e8cf 100644 --- a/web/app/store/DeviceImages.js +++ b/web/app/store/DeviceImages.js @@ -19,82 +19,19 @@ Ext.define('Traccar.store.DeviceImages', { extend: 'Ext.data.Store', fields: ['key', 'name', 'svg', 'fillId', 'rotateId', 'scaleId'], - data: [{ - key: 'arrow', - name: Strings.categoryArrow, - svg: document.getElementById('arrowSvg').contentDocument, - fillId: 'arrow', - rotateId: 'arrow', - scaleId: 'arrow' - }, { - key: 'default', - name: Strings.categoryDefault, - svg: document.getElementById('defaultSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'car', - name: Strings.categoryCar, - svg: document.getElementById('carSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'bus', - name: Strings.categoryBus, - svg: document.getElementById('busSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'truck', - name: Strings.categoryTruck, - svg: document.getElementById('truckSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'ship', - name: Strings.categoryShip, - svg: document.getElementById('shipSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'plane', - name: Strings.categoryPlane, - svg: document.getElementById('planeSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'motorcycle', - name: Strings.categoryMotorcycle, - svg: document.getElementById('motorcycleSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'bicycle', - name: Strings.categoryBicycle, - svg: document.getElementById('bicycleSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'person', - name: Strings.categoryPerson, - svg: document.getElementById('personSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }, { - key: 'animal', - name: Strings.categoryAnimal, - svg: document.getElementById('animalSvg').contentDocument, - fillId: 'background', - rotateId: 'background', - scaleId: 'layer1' - }] + data: (function () { + var i, key, data = []; + for (i = 0; i < window.Images.length; i++) { + key = window.Images[i]; + data.push({ + key: key, + name: Strings['category' + key.charAt(0).toUpperCase() + key.slice(1)], + svg: document.getElementById(key + 'Svg').contentDocument, + fillId: key === 'arrow' ? 'arrow' : 'background', + rotateId: key === 'arrow' ? 'arrow' : 'background', + scaleId: key === 'arrow' ? 'arrow' : 'layer1' + }); + } + return data; + })() }); diff --git a/web/app/view/dialog/Device.js b/web/app/view/dialog/Device.js index bd4a128..054931c 100644 --- a/web/app/view/dialog/Device.js +++ b/web/app/view/dialog/Device.js @@ -75,7 +75,7 @@ Ext.define('Traccar.view.dialog.Device', { return '' + - '
' + '{[new XMLSerializer().serializeToString(Traccar.DeviceImages.getImageSvg(' + 'Traccar.Style.mapColorOnline, false, 0, values.key))]}
- {name}
'; + '{name}'; } } }] diff --git a/web/images/boat.svg b/web/images/boat.svg new file mode 100644 index 0000000..6fd77b9 --- /dev/null +++ b/web/images/boat.svg @@ -0,0 +1,48 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/crane.svg b/web/images/crane.svg new file mode 100644 index 0000000..487a2c4 --- /dev/null +++ b/web/images/crane.svg @@ -0,0 +1,48 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/helicopter.svg b/web/images/helicopter.svg new file mode 100644 index 0000000..373c7f3 --- /dev/null +++ b/web/images/helicopter.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/offroad.svg b/web/images/offroad.svg new file mode 100644 index 0000000..f175ec4 --- /dev/null +++ b/web/images/offroad.svg @@ -0,0 +1,48 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/pickup.svg b/web/images/pickup.svg new file mode 100644 index 0000000..2824f50 --- /dev/null +++ b/web/images/pickup.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/tractor.svg b/web/images/tractor.svg new file mode 100644 index 0000000..4d2b5ad --- /dev/null +++ b/web/images/tractor.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/van.svg b/web/images/van.svg new file mode 100644 index 0000000..215b9d7 --- /dev/null +++ b/web/images/van.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/l10n/en.json b/web/l10n/en.json index 754295e..bb19a1b 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -330,13 +330,20 @@ "statisticsGeolocation": "Geolocation Requests", "categoryArrow": "Arrow", "categoryDefault": "Default", - "categoryCar": "Car", + "categoryAnimal": "Animal", + "categoryBicycle": "Bicycle", + "categoryBoat": "Boat", "categoryBus": "Bus", - "categoryTruck": "Truck", - "categoryShip": "Ship", - "categoryPlane": "Plane", + "categoryCar": "Car", + "categoryCrane": "Crane", + "categoryHelicopter": "Helicopter", "categoryMotorcycle": "Motorcycle", - "categoryBicycle": "Bicycle", + "categoryOffroad": "Offroad", "categoryPerson": "Person", - "categoryAnimal": "Animal" + "categoryPickup": "Pickup", + "categoryPlane": "Plane", + "categoryShip": "Ship", + "categoryTractor": "Tractor", + "categoryTruck": "Truck", + "categoryVan": "Van" } diff --git a/web/load.js b/web/load.js index 88eb1cf..f6da4e6 100644 --- a/web/load.js +++ b/web/load.js @@ -154,16 +154,10 @@ addScriptFile('//cdnjs.cloudflare.com/ajax/libs/proj4js/' + proj4jsVersion + '/proj4.js'); } - addSvgFile('images/default.svg', 'defaultSvg'); - addSvgFile('images/arrow.svg', 'arrowSvg'); - addSvgFile('images/car.svg', 'carSvg'); - addSvgFile('images/bus.svg', 'busSvg'); - addSvgFile('images/truck.svg', 'truckSvg'); - addSvgFile('images/ship.svg', 'shipSvg'); - addSvgFile('images/plane.svg', 'planeSvg'); - addSvgFile('images/motorcycle.svg', 'motorcycleSvg'); - addSvgFile('images/bicycle.svg', 'bicycleSvg'); - addSvgFile('images/person.svg', 'personSvg'); - addSvgFile('images/animal.svg', 'animalSvg'); + window.Images = ['arrow', 'default', 'animal', 'bicycle', 'boat', 'bus', 'car', 'crane', 'helicopter', + 'motorcycle', 'offroad', 'person', 'pickup', 'plane', 'ship', 'tractor', 'truck', 'van']; + for (i = 0; i < window.Images.length; i++) { + addSvgFile('images/' + window.Images[i] + '.svg', window.Images[i] + 'Svg'); + } })(); -- cgit v1.2.3