Store the current year at time of release in the source code
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 23 Jun 2015 04:40:31 +0000 (06:40 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 23 Jun 2015 04:40:31 +0000 (06:40 +0200)
src/main/java/net/pterodactylus/sone/main/SonePlugin.java
src/main/java/net/pterodactylus/sone/web/AboutPage.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/resources/templates/about.html

index 392cc40..ff72f86 100644 (file)
@@ -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
        //
index 6a6bc63..74c6a03 100644 (file)
@@ -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);
        }
 
 }
index 9fe5bba..bd6a604 100644 (file)
@@ -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)));
index 74ea9f0..e6f809b 100644 (file)
@@ -2,7 +2,7 @@
 
        <h1><%= Page.About.Page.Title|l10n|html></h1>
 
-       <p>Sone – The Freenet Social Network Plugin, Version <% version|html>, © 2010–2012 by David ‘Bombe’ Roden.</p>
+       <p>Sone – The Freenet Social Network Plugin, Version <% version|html>, © 2010–<% year|html> by David ‘Bombe’ Roden.</p>
 
        <p>
                <%= Page.About.Flattr.Description|l10n|html|replace needle=="{link}" replacement=='<a href="/?_CHECKED_HTTP_=https://www.flattr.com/" title="Flattr Homepage" target="_blank">'|replace needle=="{/link}" replacement=='</a>'>