Add web interface to all template contexts more reliably.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 25 May 2011 17:46:11 +0000 (19:46 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 25 May 2011 17:46:11 +0000 (19:46 +0200)
src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index 42c0129..a0174a9 100644 (file)
@@ -120,7 +120,6 @@ public class SoneTemplatePage extends FreenetTemplatePage {
                this.pageTitleKey = pageTitleKey;
                this.webInterface = webInterface;
                this.requireLogin = requireLogin;
-               template.getInitialContext().set("webInterface", webInterface);
        }
 
        //
index e155944..b4fffd9 100644 (file)
@@ -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. */