X-Git-Url: https://git.pterodactylus.net/?p=WoTNS.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Fui%2Fweb%2FBasicPage.java;h=85ad8b1199e52cf23bac0a6f69db594bc5546245;hp=fa8c06f010327b321df6a84752e5c3a8159c3d1a;hb=e17750852b6d02aeb6270f6a7e2619ced1f4f9b7;hpb=ee9da6382633b1927ecb17a9bfe8b72e965fddec diff --git a/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java b/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java index fa8c06f..85ad8b1 100644 --- a/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java +++ b/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java @@ -17,6 +17,9 @@ package net.pterodactylus.wotns.ui.web; +import java.util.Arrays; +import java.util.Collection; + import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; import net.pterodactylus.util.web.Method; @@ -36,17 +39,20 @@ public class BasicPage extends FreenetTemplatePage { protected final IdentityManager identityManager; - public BasicPage(WebInterface webInterface, String path, Template template) { + private final String title; + + public BasicPage(WebInterface webInterface, String path, String title, Template template) { super(path, webInterface.getTemplateContextFactory(), template, "noPermission.html"); this.webInterface = webInterface; this.identityManager = webInterface.getWoTNSPlugin().getIdentityManager(); + this.title = title; } // // PROTECTED METHODS // - protected OwnIdentity getIdentity(FreenetRequest request) { + protected OwnIdentity getOwnIdentity(FreenetRequest request) { if (request.getMethod() == Method.POST) { String ownIdentityId = request.getHttpRequest().getPartAsStringFailsafe("ownIdentity", 43); return identityManager.getOwnIdentity(ownIdentityId); @@ -65,9 +71,27 @@ public class BasicPage extends FreenetTemplatePage { * {@inheritDoc} */ @Override + protected String getPageTitle(FreenetRequest request) { + return title; + } + + /** + * {@inheritDoc} + */ + @Override + protected Collection getStyleSheets() { + return Arrays.asList("css/main.css"); + } + + /** + * {@inheritDoc} + */ + @Override protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); + templateContext.set("request", request.getHttpRequest()); templateContext.set("ownIdentities", identityManager.getAllOwnIdentities()); templateContext.set("formPassword", webInterface.getWoTNSPlugin().getToadletContainer().getFormPassword()); } + }