From: David ‘Bombe’ Roden Date: Wed, 13 Oct 2010 10:07:39 +0000 (+0200) Subject: Implementation stub of the login page. X-Git-Tag: 0.1-RC1~498 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f64bdc298e7db6fa63e4141e0f1ef921f8de7971;p=Sone.git Implementation stub of the login page. --- diff --git a/src/main/java/net/pterodactylus/sone/web/LoginPage.java b/src/main/java/net/pterodactylus/sone/web/LoginPage.java index df06c87..8cebf49 100644 --- a/src/main/java/net/pterodactylus/sone/web/LoginPage.java +++ b/src/main/java/net/pterodactylus/sone/web/LoginPage.java @@ -17,6 +17,10 @@ package net.pterodactylus.sone.web; +import java.util.Set; + +import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.web.page.Page.Request.Method; import net.pterodactylus.util.template.Template; /** @@ -38,4 +42,39 @@ public class LoginPage extends SoneTemplatePage { super("login.html", template, "Page.Login.Title", webInterface); } + // + // TEMPLATEPAGE METHODS + // + + /** + * {@inheritDoc} + */ + @Override + protected void processTemplate(Request request, Template template) { + Set localSones = webInterface.core().localSones(); + template.set("sones", localSones); + } + + /** + * {@inheritDoc} + */ + @Override + protected String getRedirectTarget(Request request) { + if (request.getMethod() == Method.POST) { + String soneId = request.getHttpRequest().getParam("sone-id"); + Sone selectedSone = null; + for (Sone sone : webInterface.core().localSones()) { + if (sone.getId().equals(soneId)) { + selectedSone = sone; + break; + } + } + if (selectedSone != null) { + setCurrentSone(request, selectedSone); + return "index.html"; + } + } + return null; + } + } diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index eeb0714..826f277 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -2,3 +2,20 @@ Navigation.Menu.Name=Sone Navigation.Menu.Tooltip=Freenet Social Network Plugin Navigation.Menu.Item.Login.Name=Login Navigation.Menu.Item.Login.Tooltip=Login to your Sone + +Page.Login.Title=Login - Sone +Page.Login.Page.Title=Login +Page.Login.Label.SelectSone=Select Sone: +Page.Login.Option.NoSone=Select Sone… + +Page.Login.LoadSone.Title=Load Sone +Page.Login.LoadSone.Description=This function can be used to load an existing Sone. You need to specify the {mark}insert key{/mark} of the Sone to load it! +Page.Login.LoadSone.Label.InsertURI=Sone Insert URI: +Page.Login.LoadSone.Button.LoadSone=Load Sone + +Page.Login.CreateSone.Title=Create Sone +Page.Login.CreateSone.Description=Use this function if you want to create a completely new Sone, either at a location of your choosing or a new, random location. +Page.Login.CreateSone.Label.InsertURI=Sone Insert URI: +Page.Login.CreateSone.Label.Name=Sone name: +Page.Login.CreateSone.Button.CreateFromURI=Create at given URI +Page.Login.CreateSone.Button.CreateRandom=Create new Sone diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css new file mode 100644 index 0000000..137b9ab --- /dev/null +++ b/src/main/resources/static/css/sone.css @@ -0,0 +1,7 @@ +/* Sone Main CSS File */ + +#sone h1 { + font-family: inherit; + font-size: 200%; + font-weight: bold; +} diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 9ed93dd..aad1525 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -1,3 +1,43 @@ -
-

Login

+
+ <%if !sones.empty> +

<%= Page.Login.Page.Title|l10n|html>

+
+ + + + +
+ <%/if> +

<%= Page.Login.LoadSone.Title|l10n|html>

+
<%= Page.Login.LoadSone.Description|l10n|html|replace needle="{mark}" replacement=""|replace needle="{/mark}" replacement="">
+
+ +
+ + + +
+
+

<%= Page.Login.CreateSone.Title|l10n|html>

+
<%= Page.Login.CreateSone.Description|l10n|html>
+
+ +
+ + +
+
+ + + +
+
+ +
+