Also show “unknown” when updating a Sone from the web interface.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 16 Jan 2011 19:36:49 +0000 (20:36 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 16 Jan 2011 19:36:49 +0000 (20:36 +0100)
This fixes #20.

src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java
src/main/resources/static/javascript/sone.js

index 659c8d2..28da894 100644 (file)
@@ -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())));
                }
index e790e9e..9d00c5a 100644 (file)
@@ -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) {