From 3dd1b715950ddec586d3f6d3654f4cacdaff05d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 20 Oct 2010 14:56:45 +0200 Subject: [PATCH] =?utf8?q?Streamline=20adding=20Sones,=20remove=20?= =?utf8?q?=E2=80=9Cadd=20Sone=E2=80=9D=20from=20menu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/web/AddSonePage.java | 9 +++++++-- src/main/java/net/pterodactylus/sone/web/WebInterface.java | 2 +- src/main/resources/i18n/sone.en.properties | 2 -- src/main/resources/templates/knownSones.html | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/AddSonePage.java b/src/main/java/net/pterodactylus/sone/web/AddSonePage.java index 3d5d1f9..9fdf122 100644 --- a/src/main/java/net/pterodactylus/sone/web/AddSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/AddSonePage.java @@ -17,6 +17,7 @@ package net.pterodactylus.sone.web; +import net.pterodactylus.sone.web.page.Page.Request.Method; import net.pterodactylus.util.template.Template; /** @@ -48,8 +49,12 @@ public class AddSonePage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); - final String soneKey = request.getHttpRequest().getPartAsStringFailsafe("request-uri", 256); - webInterface.core().loadSone(soneKey); + if (request.getMethod() == Method.POST) { + String soneKey = request.getHttpRequest().getPartAsStringFailsafe("request-uri", 256); + String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); + webInterface.core().loadSone(soneKey); + throw new RedirectException(returnPage); + } } } diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 6eb993d..2120096 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -178,7 +178,7 @@ public class WebInterface extends AbstractService { PageToadletFactory pageToadletFactory = new PageToadletFactory(sonePlugin.pluginRespirator().getHLSimpleClient(), "/Sone/"); 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 AddSonePage(addSoneTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new KnownSonesPage(knownSonesTemplate, this), "KnownSones")); pageToadlets.add(pageToadletFactory.createPageToadlet(new EditProfilePage(editProfileTemplate, this), "EditProfile")); pageToadlets.add(pageToadletFactory.createPageToadlet(new BackupProfilePage(backupProfileTemplate, this))); diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index ed1cbd1..d67d3b3 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -6,8 +6,6 @@ Navigation.Menu.Item.Index.Name=Your Sone Navigation.Menu.Item.Index.Tooltip=Show your Sone Navigation.Menu.Item.CreateSone.Name=Create Sone 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 diff --git a/src/main/resources/templates/knownSones.html b/src/main/resources/templates/knownSones.html index 26a98ac..f26e15a 100644 --- a/src/main/resources/templates/knownSones.html +++ b/src/main/resources/templates/knownSones.html @@ -6,6 +6,7 @@
+
-- 2.7.4