From: David ‘Bombe’ Roden Date: Wed, 20 Oct 2010 12:56:45 +0000 (+0200) Subject: Streamline adding Sones, remove “add Sone” from menu. X-Git-Tag: 0.1-RC1~153 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3dd1b715950ddec586d3f6d3654f4cacdaff05d3;p=Sone.git Streamline adding Sones, remove “add Sone” from menu. --- 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 @@
+