From a99f688a0fce1d02e634d1fc3ad9364a635b8b1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Apr 2011 20:20:56 +0200 Subject: [PATCH] Add accessor for the age text of a Sone. --- src/main/java/net/pterodactylus/sone/template/SoneAccessor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java index 23b2227..76fdcc1 100644 --- a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java @@ -25,6 +25,8 @@ import net.pterodactylus.sone.core.Core.SoneStatus; import net.pterodactylus.sone.data.Profile; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.freenet.wot.Trust; +import net.pterodactylus.sone.web.WebInterface; +import net.pterodactylus.sone.web.ajax.GetTimesAjaxPage; import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.template.Accessor; import net.pterodactylus.util.template.ReflectionAccessor; @@ -97,6 +99,8 @@ public class SoneAccessor extends ReflectionAccessor { return core.isNewSone(sone.getId()); } else if (member.equals("locked")) { return core.isLocked(sone); + } else if (member.equals("lastUpdatedText")) { + return GetTimesAjaxPage.getTime((WebInterface) templateContext.get("webInterface"), System.currentTimeMillis() - sone.getTime()); } else if (member.equals("trust")) { Sone currentSone = (Sone) templateContext.get("currentSone"); if (currentSone == null) { -- 2.7.4