From 2309d53f52f25efe00f2195a58c448506a2605ab Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 13 Mar 2017 17:52:28 +0500 Subject: - Add timezone field to User and Server model - Pass Velocity DateTool to templates - Adjusted templates to use timezone --- src/org/traccar/notification/NotificationFormatter.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/org/traccar/notification') diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index cec238548..eae2681c9 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -18,10 +18,12 @@ package org.traccar.notification; import java.io.StringWriter; import java.nio.charset.StandardCharsets; +import java.util.Locale; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.tools.generic.DateTool; import org.traccar.Context; import org.traccar.helper.Log; import org.traccar.model.Device; @@ -48,6 +50,9 @@ public final class NotificationFormatter { velocityContext.put("geofence", Context.getGeofenceManager().getGeofence(event.getGeofenceId())); } velocityContext.put("webUrl", Context.getVelocityEngine().getProperty("web.url")); + velocityContext.put("dateTool", new DateTool()); + velocityContext.put("timezone", ReportUtils.getTimezone(userId)); + velocityContext.put("locale", Locale.getDefault()); return velocityContext; } -- cgit v1.2.3