From: David ‘Bombe’ Roden Date: Thu, 15 Sep 2011 14:36:43 +0000 (+0200) Subject: Show enabled and disabled identities on the index page. X-Git-Tag: 0.0.1~11 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=24003baffbff36d768eeba877948449e84edd90e;p=WoTNS.git Show enabled and disabled identities on the index page. --- diff --git a/src/main/java/net/pterodactylus/wotns/ui/web/IndexPage.java b/src/main/java/net/pterodactylus/wotns/ui/web/IndexPage.java index 933f9a6..172cfa8 100644 --- a/src/main/java/net/pterodactylus/wotns/ui/web/IndexPage.java +++ b/src/main/java/net/pterodactylus/wotns/ui/web/IndexPage.java @@ -17,8 +17,13 @@ package net.pterodactylus.wotns.ui.web; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; +import net.pterodactylus.wotns.freenet.wot.OwnIdentity; import net.pterodactylus.wotns.web.FreenetRequest; /** @@ -48,6 +53,20 @@ public class IndexPage extends BasicPage { @Override protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); + + Set ownIdentities = identityManager.getAllOwnIdentities(); + List enabledIdentities = new ArrayList(); + List disabledIdentities = new ArrayList(); + for (OwnIdentity ownIdentity : ownIdentities) { + if (ownIdentity.hasContext("WoTNS")) { + enabledIdentities.add(ownIdentity); + } else { + disabledIdentities.add(ownIdentity); + } + } + templateContext.set("enabledIdentities", enabledIdentities); + templateContext.set("disabledIdentities", disabledIdentities); + } } diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index a0c8bee..2da3f2d 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -1,12 +1,26 @@

WoTNS

Yay, Index!

-

Manage Names

-
- - -
+ +<%foreach enabledIdentities identity> + <%first> +

Enabled Identities

+ <%/first> +
+ + + <%identity.nickname|html> + +
+<%/foreach> + +<%foreach disabledIdentities identity> + <%first> +

Disabled Identities

+ <%/first> +
+ + + <%identity.nickname|html> + +
+<%/foreach>