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;
/**
super("login.html", template, "Page.Login.Title", webInterface);
}
+ //
+ // TEMPLATEPAGE METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void processTemplate(Request request, Template template) {
+ Set<Sone> 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;
+ }
+
}
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
--- /dev/null
+/* Sone Main CSS File */
+
+#sone h1 {
+ font-family: inherit;
+ font-size: 200%;
+ font-weight: bold;
+}
-<div id="Sone">
- <h1>Login</h1>
+<div id="sone">
+ <%if !sones.empty>
+ <h1><%= Page.Login.Page.Title|l10n|html></h1>
+ <form method="post">
+ <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+ <label for="sone-id"><%= Page.Login.Label.SelectSone|l10n|html></label>
+ <select name="sone-id">
+ <option disabled="disabled"><%= Page.Login.Option.NoSone|l10n|html></option>
+ <%foreach sones sone>
+ <option value="<% sone.id|html>"><% sone.name|html></option>
+ <%/foreach>
+ </select>
+ <button type="submit">Select</button>
+ </form>
+ <%/if>
+ <h1><%= Page.Login.LoadSone.Title|l10n|html></h1>
+ <div><%= Page.Login.LoadSone.Description|l10n|html|replace needle="{mark}" replacement="<i>"|replace needle="{/mark}" replacement="</i>"></div>
+ <form action="loadSone.html" method="post">
+ <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+ <div>
+ <label for="insert-uri"><%= Page.Login.LoadSone.Label.InsertURI|l10n|html></label>
+ <input type="text" name="insert-uri" />
+ <button type="submit"><%= Page.Login.LoadSone.Button.LoadSone|l10n|html></button>
+ </div>
+ </form>
+ <h1><%= Page.Login.CreateSone.Title|l10n|html></h1>
+ <div><%= Page.Login.CreateSone.Description|l10n|html></div>
+ <form action="createSone.html" method="post">
+ <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+ <div>
+ <label for="name"><%= Page.Login.CreateSone.Label.Name|l10n|html></label>
+ <input type="text" name="name" />
+ </div>
+ <div>
+ <label for="insert-uri"><%= Page.Login.CreateSone.Label.InsertURI|l10n|html></label>
+ <input type="text" name="insert-uri" value="" />
+ <button type="submit" name="create-from-uri" value="1"><%= Page.Login.CreateSone.Button.CreateFromURI|l10n|html></button>
+ </div>
+ <div>
+ <button type="submit" name="create-random" value="1"><%= Page.Login.CreateSone.Button.CreateRandom|l10n|html></button>
+ </div>
+ </form>
</div>