From e954e95547d05a34bbd36e3aa5003f4ddaf2ccd0 Mon Sep 17 00:00:00 2001 From: ninioe Date: Tue, 19 Jul 2016 15:12:38 +0300 Subject: changes Anton asked me --- src/org/traccar/BasePipelineFactory.java | 6 +++++- src/org/traccar/Main.java | 4 +++- src/org/traccar/database/DataManager.java | 4 +--- web/app/controller/Root.js | 13 ++++++++----- web/beep.wav | Bin 0 -> 3047 bytes web/l10n/en.json | 17 +++++++++-------- 6 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 web/beep.wav diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index eb08c7e08..31845290f 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -29,7 +29,11 @@ import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.channel.SimpleChannelHandler; import org.jboss.netty.handler.logging.LoggingHandler; import org.jboss.netty.handler.timeout.IdleStateHandler; -import org.traccar.events.*; +import org.traccar.events.CommandResultEventHandler; +import org.traccar.events.GeofenceEventHandler; +import org.traccar.events.MotionEventHandler; +import org.traccar.events.OverspeedEventHandler; +import org.traccar.events.AlertEventHandler; import org.traccar.helper.Log; import java.net.InetSocketAddress; diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 45374ca15..baad9d040 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -16,6 +16,8 @@ package org.traccar; import org.traccar.helper.Log; + +import java.sql.SQLException; import java.util.Timer; import java.util.TimerTask; import java.util.Locale; @@ -44,7 +46,7 @@ public final class Main { public void run() { try { Context.getDataManager().clearPositionsHistory(); - } catch (Exception error) { + } catch (SQLException error) { Log.warning(error); } } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index e5a245568..3c8529eff 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -399,7 +399,6 @@ public class DataManager { } public void clearPositionsHistory() throws SQLException { - //SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd"); int histDays = config.getInteger("database.positionsHistoryDays"); if (histDays == 0) { return; @@ -414,8 +413,7 @@ public class DataManager { Date lastUpdate = device.getLastUpdate(); if(lastUpdate != null){ - Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000 ); - //String dt = s.format(dateBefore); + Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000); QueryBuilder.create(dataSource, sql) .setLong("deviceId", device.getId()) diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index b508cc5ef..3a7f24bca 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -91,7 +91,7 @@ Ext.define('Traccar.controller.Root', { beep: function() { if(this.snd == null){ - this.snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeo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AAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU="); + this.snd = new Audio("beep.wav"); } this.snd.play(); }, @@ -110,7 +110,7 @@ Ext.define('Traccar.controller.Root', { }; socket.onmessage = function (event) { - var i, j, store, data, array, entity, device, typeKey, text, geofence; + var i, j, store, data, array, entity, device, typeKey, alarmKey, text, geofence; data = Ext.decode(event.data); @@ -157,16 +157,19 @@ Ext.define('Traccar.controller.Root', { } text = Strings.eventCommandResult + ': ' + text; } else if (array[i].type === 'alarm' && data.positions) { - text = 'Alarm'; + alarmKey = 'alarm'; + text = Strings[alarmKey]; + if (typeof text === 'undefined') { + text = alarmKey; + } for (j = 0; j < data.positions.length; j++) { if (data.positions[j].id === array[i].positionId && data.positions[j].attributes.alarm != null) { if (typeof data.positions[j].attributes.alarm === 'string' && data.positions[j].attributes.alarm.length >= 2){ - var alarmKey = 'alarm' + data.positions[j].attributes.alarm.charAt(0).toUpperCase() + data.positions[j].attributes.alarm.slice(1); + alarmKey = 'alarm' + data.positions[j].attributes.alarm.charAt(0).toUpperCase() + data.positions[j].attributes.alarm.slice(1); text = Strings[alarmKey]; if (typeof text === 'undefined') { text = alarmKey; } - text = 'Alarm: ' + text; } break; } diff --git a/web/beep.wav b/web/beep.wav new file mode 100644 index 000000000..c2364f114 Binary files /dev/null and b/web/beep.wav differ diff --git a/web/l10n/en.json b/web/l10n/en.json index ff432d444..c5d67e8c1 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -119,14 +119,15 @@ "eventGeofenceEnter": "Device has entered geofence", "eventGeofenceExit": "Device has exited geofence", "eventAlarm": "Alarms", - "alarmSos": "sos", - "alarmVibration": "vibration", - "alarmMovement": "movement", - "alarmOverspeed": "overspeed", - "alarmFallDown": "fallDown", - "alarmLowBattery": "lowBattery", - "alarmMotion": "motion", - "alarmFault": "fault", + "alarm": "Alarm", + "alarmSos": "SOS Alarm", + "alarmVibration": "Vibration Alarm", + "alarmMovement": "Movement Alarm", + "alarmOverspeed": "Overspeed Alarm", + "alarmFallDown": "FallDown Alarm", + "alarmLowBattery": "LowBattery Alarm", + "alarmMotion": "Motion Alarm", + "alarmFault": "Fault Alarm", "notificationType": "Type of Notification", "notificationWeb": "Send via Web", "notificationMail": "Send via Mail" -- cgit v1.2.3