From 69bde20c9d91feada988690d3a5a59bc3e086fce Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 23 Jun 2015 06:40:31 +0200 Subject: [PATCH] Store the current year at time of release in the source code --- .../net/pterodactylus/sone/main/SonePlugin.java | 7 +++++++ .../java/net/pterodactylus/sone/web/AboutPage.java | 23 ++++------------------ .../net/pterodactylus/sone/web/WebInterface.java | 2 +- src/main/resources/templates/about.html | 2 +- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index 392cc40..ff72f86 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -118,6 +118,9 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr /** The version. */ public static final Version VERSION = new Version("rc1", 0, 9); + /** The current year at time of release. */ + private static final int YEAR = 2015; + /** The logger. */ private static final Logger logger = getLogger("Sone.Plugin"); @@ -170,6 +173,10 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr return l10n; } + public static int getYear() { + return YEAR; + } + // // FREDPLUGIN METHODS // diff --git a/src/main/java/net/pterodactylus/sone/web/AboutPage.java b/src/main/java/net/pterodactylus/sone/web/AboutPage.java index 6a6bc63..74c6a03 100644 --- a/src/main/java/net/pterodactylus/sone/web/AboutPage.java +++ b/src/main/java/net/pterodactylus/sone/web/AboutPage.java @@ -29,35 +29,20 @@ import net.pterodactylus.util.version.Version; */ public class AboutPage extends SoneTemplatePage { - /** The version to display. */ private final Version version; + private final int year; - /** - * Creates a new “about” page. - * - * @param template - * The template to render - * @param webInterface - * The Sone web interface - * @param version - * The version to display - */ - public AboutPage(Template template, WebInterface webInterface, Version version) { + public AboutPage(Template template, WebInterface webInterface, Version version, int year) { super("about.html", template, "Page.About.Title", webInterface, false); this.version = version; + this.year = year; } - // - // TEMPLATEPAGE METHODS - // - - /** - * {@inheritDoc} - */ @Override protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); templateContext.set("version", version); + templateContext.set("year", year); } } diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 9fe5bba..bd6a604 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -692,7 +692,7 @@ public class WebInterface { pageToadlets.add(pageToadletFactory.createPageToadlet(new LogoutPage(emptyTemplate, this), "Logout")); pageToadlets.add(pageToadletFactory.createPageToadlet(new OptionsPage(optionsTemplate, this), "Options")); pageToadlets.add(pageToadletFactory.createPageToadlet(new RescuePage(rescueTemplate, this), "Rescue")); - pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, SonePlugin.VERSION), "About")); + pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, SonePlugin.VERSION, SonePlugin.getYear()), "About")); pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("noPermission.html", noPermissionTemplate, "Page.NoPermission.Title", this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyImageTitle.html", emptyImageTitleTemplate, "Page.EmptyImageTitle.Title", this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyAlbumTitle.html", emptyAlbumTitleTemplate, "Page.EmptyAlbumTitle.Title", this))); diff --git a/src/main/resources/templates/about.html b/src/main/resources/templates/about.html index 74ea9f0..e6f809b 100644 --- a/src/main/resources/templates/about.html +++ b/src/main/resources/templates/about.html @@ -2,7 +2,7 @@

<%= Page.About.Page.Title|l10n|html>

-

Sone – The Freenet Social Network Plugin, Version <% version|html>, © 2010–2012 by David ‘Bombe’ Roden.

+

Sone – The Freenet Social Network Plugin, Version <% version|html>, © 2010–<% year|html> by David ‘Bombe’ Roden.

<%= Page.About.Flattr.Description|l10n|html|replace needle=="{link}" replacement==''|replace needle=="{/link}" replacement==''> -- 2.7.4