X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FSoneTemplatePage.java;h=fa439456abe16354bb09bf5287c8f69dc6ff511b;hp=9619531fd7b2e58a2b751f4e596af1e7387c118c;hb=ecf753a31601e558b681daab0598009fe9eec99a;hpb=92e44c7068d88f23a29a4f82da3b91135c3ef2f2 diff --git a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index 9619531..fa43945 100644 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@ -24,8 +24,8 @@ 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.DataProvider; import net.pterodactylus.util.template.Template; +import net.pterodactylus.util.template.TemplateContext; import freenet.clients.http.SessionManager.Session; import freenet.clients.http.ToadletContext; @@ -74,10 +74,10 @@ public class SoneTemplatePage extends TemplatePage { * Whether this page requires a login */ public SoneTemplatePage(String path, Template template, String pageTitleKey, WebInterface webInterface, boolean requireLogin) { - super(path, template, webInterface.getL10n(), pageTitleKey, "noPermission.html"); + super(path, webInterface.getTemplateContextFactory(), template, webInterface.getL10n(), pageTitleKey, "noPermission.html"); this.webInterface = webInterface; this.requireLogin = requireLogin; - template.set("webInterface", webInterface); + template.getInitialContext().set("webInterface", webInterface); } // @@ -186,15 +186,15 @@ public class SoneTemplatePage extends TemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException { - super.processTemplate(request, dataProvider); - dataProvider.set("currentSone", getCurrentSone(request.getToadletContext(), false)); - dataProvider.set("localSones", webInterface.getCore().getLocalSones()); - dataProvider.set("request", request); - dataProvider.set("currentVersion", SonePlugin.VERSION); - dataProvider.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion()); - dataProvider.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion()); - dataProvider.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate()); + protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); + templateContext.set("currentSone", getCurrentSone(request.getToadletContext(), false)); + templateContext.set("localSones", webInterface.getCore().getLocalSones()); + templateContext.set("request", request); + templateContext.set("currentVersion", SonePlugin.VERSION); + templateContext.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion()); + templateContext.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion()); + templateContext.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate()); } /**