aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-04-15 16:25:51 -0700
committerGitHub <noreply@github.com>2023-04-15 16:25:51 -0700
commitfa7ad831379aecff4f5295fc2341c83d1a389fd6 (patch)
tree8958a34ca44a52b40e9afabc7e1e141fea2735c3
parentc024d09744dea2db2d60f51bc6c1532284ffca4e (diff)
parentd898163368bdaaee17a2982ec219e997fd0c9b1f (diff)
downloadtrackermap-server-fa7ad831379aecff4f5295fc2341c83d1a389fd6.tar.gz
trackermap-server-fa7ad831379aecff4f5295fc2341c83d1a389fd6.tar.bz2
trackermap-server-fa7ad831379aecff4f5295fc2341c83d1a389fd6.zip
Merge pull request #5070 from gustavofcalmeida/fix_alarm_names
Readable alarm names in notifications
-rw-r--r--templates/full/alarm.vm80
-rw-r--r--templates/short/alarm.vm80
2 files changed, 158 insertions, 2 deletions
diff --git a/templates/full/alarm.vm b/templates/full/alarm.vm
index 9fae1f13b..fb596ecde 100644
--- a/templates/full/alarm.vm
+++ b/templates/full/alarm.vm
@@ -1,9 +1,87 @@
#set($subject = "$device.name: alarm!")
+#set($alarmName = $position.getString("alarm"))
+#if( $alarmName == "general")
+ #set($alarmName = "General")
+#elseif($alarmName == "sos")
+ #set($alarmName = "SOS")
+#elseif($alarmName == "vibration")
+ #set($alarmName = "Vibration")
+#elseif($alarmName == "movement")
+ #set($alarmName = "Movement")
+#elseif($alarmName == "lowspeed")
+ #set($alarmName = "Low Speed")
+#elseif($alarmName == "overspeed")
+ #set($alarmName = "Overspeed")
+#elseif($alarmName == "fallDown")
+ #set($alarmName = "Fall Down")
+#elseif($alarmName == "lowPower")
+ #set($alarmName = "Low Power")
+#elseif($alarmName == "lowBattery")
+ #set($alarmName = "Low Battery")
+#elseif($alarmName == "fault")
+ #set($alarmName = "Fault")
+#elseif($alarmName == "powerOff")
+ #set($alarmName = "Power Off")
+#elseif($alarmName == "powerOn")
+ #set($alarmName = "Power On")
+#elseif($alarmName == "door")
+ #set($alarmName = "Door")
+#elseif($alarmName == "lock")
+ #set($alarmName = "Lock")
+#elseif($alarmName == "unlock")
+ #set($alarmName = "Unlock")
+#elseif($alarmName == "geofence")
+ #set($alarmName = "Geofence")
+#elseif($alarmName == "geofenceEnter")
+ #set($alarmName = "Geofence Enter")
+#elseif($alarmName == "geofenceExit")
+ #set($alarmName = "Geofence Exit")
+#elseif($alarmName == "gpsAntennaCut")
+ #set($alarmName = "GPS Antenna Cut")
+#elseif($alarmName == "accident")
+ #set($alarmName = "Accident")
+#elseif($alarmName == "tow")
+ #set($alarmName = "Tow")
+#elseif($alarmName == "idle")
+ #set($alarmName = "Idle")
+#elseif($alarmName == "highRpm")
+ #set($alarmName = "High RPM")
+#elseif($alarmName == "hardAcceleration")
+ #set($alarmName = "Hard Acceleration")
+#elseif($alarmName == "hardBraking")
+ #set($alarmName = "Hard Braking")
+#elseif($alarmName == "hardCornering")
+ #set($alarmName = "Hard Cornering")
+#elseif($alarmName == "laneChange")
+ #set($alarmName = "Lane Change")
+#elseif($alarmName == "fatigueDriving")
+ #set($alarmName = "Fatigue Driving")
+#elseif($alarmName == "powerCut")
+ #set($alarmName = "Power Cut")
+#elseif($alarmName == "powerRestored")
+ #set($alarmName = "Power Restored")
+#elseif($alarmName == "jamming")
+ #set($alarmName = "Jamming")
+#elseif($alarmName == "temperature")
+ #set($alarmName = "Temperature")
+#elseif($alarmName == "parking")
+ #set($alarmName = "Parking")
+#elseif($alarmName == "bonnet")
+ #set($alarmName = "Bonnet")
+#elseif($alarmName == "footBrake")
+ #set($alarmName = "Foot Brake")
+#elseif($alarmName == "fuelLeak")
+ #set($alarmName = "Fuel Leak")
+#elseif($alarmName == "tampering")
+ #set($alarmName = "Tampering")
+#elseif($alarmName == "removing")
+ #set($alarmName = "Removing")
+#end
<!DOCTYPE html>
<html>
<body>
Device: $device.name<br>
-Alarm: $position.getString("alarm")<br>
+Alarm: $alarmName<br>
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)<br>
Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude&deg;, $position.longitude&deg;#{end}</a><br>
<br>
diff --git a/templates/short/alarm.vm b/templates/short/alarm.vm
index 15970dab8..effcb8f15 100644
--- a/templates/short/alarm.vm
+++ b/templates/short/alarm.vm
@@ -1,2 +1,80 @@
#set($subject = "$device.name: alarm!")
-$device.name alarm: $position.getString("alarm") at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)
+#set($alarmName = $position.getString("alarm"))
+#if( $alarmName == "general")
+ #set($alarmName = "General")
+#elseif($alarmName == "sos")
+ #set($alarmName = "SOS")
+#elseif($alarmName == "vibration")
+ #set($alarmName = "Vibration")
+#elseif($alarmName == "movement")
+ #set($alarmName = "Movement")
+#elseif($alarmName == "lowspeed")
+ #set($alarmName = "Low Speed")
+#elseif($alarmName == "overspeed")
+ #set($alarmName = "Overspeed")
+#elseif($alarmName == "fallDown")
+ #set($alarmName = "Fall Down")
+#elseif($alarmName == "lowPower")
+ #set($alarmName = "Low Power")
+#elseif($alarmName == "lowBattery")
+ #set($alarmName = "Low Battery")
+#elseif($alarmName == "fault")
+ #set($alarmName = "Fault")
+#elseif($alarmName == "powerOff")
+ #set($alarmName = "Power Off")
+#elseif($alarmName == "powerOn")
+ #set($alarmName = "Power On")
+#elseif($alarmName == "door")
+ #set($alarmName = "Door")
+#elseif($alarmName == "lock")
+ #set($alarmName = "Lock")
+#elseif($alarmName == "unlock")
+ #set($alarmName = "Unlock")
+#elseif($alarmName == "geofence")
+ #set($alarmName = "Geofence")
+#elseif($alarmName == "geofenceEnter")
+ #set($alarmName = "Geofence Enter")
+#elseif($alarmName == "geofenceExit")
+ #set($alarmName = "Geofence Exit")
+#elseif($alarmName == "gpsAntennaCut")
+ #set($alarmName = "GPS Antenna Cut")
+#elseif($alarmName == "accident")
+ #set($alarmName = "Accident")
+#elseif($alarmName == "tow")
+ #set($alarmName = "Tow")
+#elseif($alarmName == "idle")
+ #set($alarmName = "Idle")
+#elseif($alarmName == "highRpm")
+ #set($alarmName = "High RPM")
+#elseif($alarmName == "hardAcceleration")
+ #set($alarmName = "Hard Acceleration")
+#elseif($alarmName == "hardBraking")
+ #set($alarmName = "Hard Braking")
+#elseif($alarmName == "hardCornering")
+ #set($alarmName = "Hard Cornering")
+#elseif($alarmName == "laneChange")
+ #set($alarmName = "Lane Change")
+#elseif($alarmName == "fatigueDriving")
+ #set($alarmName = "Fatigue Driving")
+#elseif($alarmName == "powerCut")
+ #set($alarmName = "Power Cut")
+#elseif($alarmName == "powerRestored")
+ #set($alarmName = "Power Restored")
+#elseif($alarmName == "jamming")
+ #set($alarmName = "Jamming")
+#elseif($alarmName == "temperature")
+ #set($alarmName = "Temperature")
+#elseif($alarmName == "parking")
+ #set($alarmName = "Parking")
+#elseif($alarmName == "bonnet")
+ #set($alarmName = "Bonnet")
+#elseif($alarmName == "footBrake")
+ #set($alarmName = "Foot Brake")
+#elseif($alarmName == "fuelLeak")
+ #set($alarmName = "Fuel Leak")
+#elseif($alarmName == "tampering")
+ #set($alarmName = "Tampering")
+#elseif($alarmName == "removing")
+ #set($alarmName = "Removing")
+#end
+$device.name alarm: $alarmName at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)