package net.pterodactylus.sone.web;
+import net.pterodactylus.sone.web.page.Page.Request.Method;
import net.pterodactylus.util.template.Template;
/**
@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);
+ }
}
}
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)));
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
<form action="addSone.html" method="post">
<input type="hidden" name="formPassword" value="<% formPassword|html>" />
+ <input type="hidden" name="returnPage" value="<% request.url|html>" />
<input id="addsone" type="text" name="request-uri" />
<button type="submit"><%= Page.Index.AddSone.Button.Add|l10n|html></button>
</form>