<dependency>
<groupId>net.pterodactylus</groupId>
<artifactId>utils</artifactId>
- <version>0.7.6</version>
+ <version>0.7.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
import java.util.Collection;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.main.SonePlugin;
import net.pterodactylus.sone.web.page.Page;
import net.pterodactylus.sone.web.page.TemplatePage;
import net.pterodactylus.util.template.Template;
super.processTemplate(request, template);
template.set("currentSone", getCurrentSone(request.getToadletContext(), false));
template.set("request", request);
+ template.set("currentVersion", SonePlugin.VERSION);
+ template.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion());
+ template.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion());
+ template.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate());
}
/**
/** The “Sone locked” notification. */
private final ListNotification<Sone> lockedSonesNotification;
+ /** The “new version” notification. */
+ private final TemplateNotification newVersionNotification;
+
/**
* Creates a new web interface.
*
Template lockedSonesTemplate = templateFactory.createTemplate(createReader("/templates/notify/lockedSonesNotification.html"));
lockedSonesNotification = new ListNotification<Sone>("sones-locked-notification", "sones", lockedSonesTemplate);
+
+ Template newVersionTemplate = templateFactory.createTemplate(createReader("/templates/notify/newVersionNotification.html"));
+ newVersionNotification = new TemplateNotification("new-version-notification", newVersionTemplate);
}
//
*/
@Override
public void updateFound(Version version, long releaseTime) {
+ newVersionNotification.set("version", version);
+ newVersionNotification.set("releaseTime", releaseTime);
+ notificationManager.addNotification(newVersionNotification);
}
/**
Notification.SoneRescued.Text=The following Sones have been rescued:
Notification.SoneRescued.Text.RememberToUnlock=Please remember to control the posts and replies you have given and don’t forget to unlock your Sones!
Notification.LockedSones.Text=The following Sones have been locked for more than 5 minutes. Please check if you really want to keep these Sones locked:
+Notification.NewVersion.Text=A new version of the Sone plugin was found: Version {version}.
--- /dev/null
+<div class="text"><%= Notification.NewVersion.Text|l10n|html|replace needle="{version}" replacementKey=version></div>