From: David ‘Bombe’ Roden Date: Wed, 25 May 2011 17:46:11 +0000 (+0200) Subject: Add web interface to all template contexts more reliably. X-Git-Tag: 0.6.5^2~25 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=217baee0543781a682227212118396296d96ee90 Add web interface to all template contexts more reliably. --- diff --git a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index 42c0129..a0174a9 100644 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@ -120,7 +120,6 @@ public class SoneTemplatePage extends FreenetTemplatePage { this.pageTitleKey = pageTitleKey; this.webInterface = webInterface; this.requireLogin = requireLogin; - template.getInitialContext().set("webInterface", webInterface); } // diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index e155944..b4fffd9 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -214,6 +214,7 @@ public class WebInterface implements CoreListener { templateContextFactory.addFilter("in", new ContainsFilter()); templateContextFactory.addProvider(Provider.TEMPLATE_CONTEXT_PROVIDER); templateContextFactory.addProvider(new ClassPathTemplateProvider()); + templateContextFactory.addTemplateObject("webInterface", this); templateContextFactory.addTemplateObject("formPassword", formPassword); /* create notifications. */