import java.net.MalformedURLException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
}
/**
+ * Returns all known sones.
+ *
+ * @return All known sones
+ */
+ public Collection<Sone> getKnownSones() {
+ return soneCache.values();
+ }
+
+ /**
* Creates a new post.
*
* @param sone
--- /dev/null
+/*
+ * Sone - KnownSonesPage.java - Copyright © 2010 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.web;
+
+import net.pterodactylus.util.template.Template;
+
+/**
+ * This page shows all known Sones.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class KnownSonesPage extends SoneTemplatePage {
+
+ /**
+ * Creates a “known Sones” page.
+ *
+ * @param template
+ * The template to render
+ * @param webInterface
+ * The Sone web interface
+ */
+ public KnownSonesPage(Template template, WebInterface webInterface) {
+ super("knownSones.html", template, "Page.KnownSones.Title", webInterface);
+ }
+
+ //
+ // TEMPLATEPAGE METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void processTemplate(Request request, Template template) throws RedirectException {
+ super.processTemplate(request, template);
+ template.set("knownSones", webInterface.core().getKnownSones());
+ }
+
+}
Template addSoneTemplate = templateFactory.createTemplate(createReader("/templates/addSone.html"));
addSoneTemplate.set("formPassword", formPassword);
+ Template knownSonesTemplate = templateFactory.createTemplate(createReader("/templates/knownSones.html"));
+ knownSonesTemplate.set("formPassword", formPassword);
+
Template createSoneTemplate = templateFactory.createTemplate(createReader("/templates/createSone.html"));
createSoneTemplate.set("formPassword", formPassword);
pageToadlets.add(pageToadletFactory.createPageToadlet(new IndexPage(indexTemplate, this), "Index"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateSonePage(createSoneTemplate, this), "CreateSone"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new AddSonePage(addSoneTemplate, this), "AddSone"));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new KnownSonesPage(knownSonesTemplate, this), "KnownSones"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new EditProfilePage(editProfileTemplate, this), "EditProfile"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new CreatePostPage(createPostTemplate, this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateReplyPage(createReplyTemplate, this)));
Navigation.Menu.Item.CreateSone.Tooltip=Create a new Sone
Navigation.Menu.Item.AddSone.Name=Add Sone
Navigation.Menu.Item.AddSone.Tooltip=Add a Sone by Freenet URI
+Navigation.Menu.Item.KnownSones.Name=Known Sones
+Navigation.Menu.Item.KnownSones.Tooltip=Shows all known Sones
Navigation.Menu.Item.EditProfile.Name=Edit Profile
Navigation.Menu.Item.EditProfile.Tooltip=Edit the Profile of your Sone
Navigation.Menu.Item.DeleteSone.Name=Delete Sone
Page.AddSone.Text.AddAnotherSone=Or you can add another Sone by entering it’s Freenet URI below:
Page.AddSone.Button.AddSone=Add Sone
+Page.KnownSones.Title=Known Sones - Sone
+Page.KnownSones.Page.Title=Known Sones
+Page.KnownSones.Text.NoKnownSones=There are currently no known Sones.
+
Page.EditProfile.Title=Edit Profile - Sone
Page.EditProfile.Page.Title=Edit Profile
Page.EditProfile.Page.Description=On this page you can enter your profile data.
--- /dev/null
+<div id="sone">
+
+ <h1><%= Page.KnownSones.Page.Title|l10n|html></h1>
+
+ <div id="known-sones">
+ <%foreach knownSones sone>
+ <div><a href="viewSone.html?sone=<% sone.id>"><% sone.niceName|html></a> (<% sone.requestUri|html>)</div>
+ <%foreachelse>
+ <div><%= Page.KnownSones.Text.NoKnownSones|l10n|html></div>
+ <%/foreach>
+ </div>
+
+</div>