From d7b6e638e17b74e3f0a074ba4f36bab1774e3701 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 16 Jan 2011 20:36:49 +0100 Subject: [PATCH] =?utf8?q?Also=20show=20=E2=80=9Cunknown=E2=80=9D=20when?= =?utf8?q?=20updating=20a=20Sone=20from=20the=20web=20interface.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes #20. --- .../net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java | 1 + src/main/resources/static/javascript/sone.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java index 659c8d2..28da894 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -147,6 +147,7 @@ public class GetStatusAjaxPage extends JsonPage { jsonSone.put("status", webInterface.getCore().getSoneStatus(sone).name()); jsonSone.put("modified", webInterface.getCore().isModifiedSone(sone)); jsonSone.put("locked", webInterface.getCore().isLocked(sone)); + jsonSone.put("lastUpdatedUnknown", sone.getTime() == 0); synchronized (dateFormat) { jsonSone.put("lastUpdated", dateFormat.format(new Date(sone.getTime()))); } diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index e790e9e..9d00c5a 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -153,7 +153,13 @@ function updateSoneStatus(soneId, name, status, modified, locked, lastUpdated) { toggleClass("modified", modified); $("#sone .sone." + filterSoneId(soneId) + " .lock").toggleClass("hidden", locked); $("#sone .sone." + filterSoneId(soneId) + " .unlock").toggleClass("hidden", !locked); - $("#sone .sone." + filterSoneId(soneId) + " .last-update span.time").text(lastUpdated); + if (lastUpdated != null) { + $("#sone .sone." + filterSoneId(soneId) + " .last-update span.time").text(lastUpdated); + } else { + getTranslation("View.Sone.Text.UnknownDate", function(unknown) { + $("#sone .sone." + filterSoneId(soneId) + " .last-update span.time").text(unknown); + }); + } $("#sone .sone." + filterSoneId(soneId) + " .profile-link a").text(name); } @@ -690,7 +696,7 @@ function getStatus() { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) { - updateSoneStatus(value.id, value.name, value.status, value.modified, value.locked, value.lastUpdated); + updateSoneStatus(value.id, value.name, value.status, value.modified, value.locked, value.lastUpdatedUnknown ? null : value.lastUpdated); }); /* process notifications. */ $.each(data.notifications, function(index, value) { -- 2.7.4