Add return page to form parameters.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 22 Sep 2011 05:53:54 +0000 (07:53 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 22 Sep 2011 05:53:54 +0000 (07:53 +0200)
src/main/java/net/pterodactylus/sone/web/EditImagePage.java
src/main/resources/templates/imageBrowser.html

index afb8787..8bb5a44 100644 (file)
@@ -54,6 +54,7 @@ public class EditImagePage extends SoneTemplatePage {
                super.processTemplate(request, templateContext);
                if (request.getMethod() == Method.POST) {
                        String imageId = request.getHttpRequest().getPartAsStringFailsafe("image", 36);
+                       String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
                        Image image = webInterface.getCore().getImage(imageId, false);
                        if (image == null) {
                                throw new RedirectException("invalid.html");
@@ -69,7 +70,7 @@ public class EditImagePage extends SoneTemplatePage {
                        image.setTitle(title);
                        image.setDescription(description);
                        webInterface.getCore().touchConfiguration();
-                       throw new RedirectException("imageBrowser.html?image=" + image.getId());
+                       throw new RedirectException(returnPage);
                }
        }
 
index 6adb3dd..5a26c1a 100644 (file)
 
                                        <form id="edit-image" action="editImage.html" method="post">
                                                <input type="hidden" name="formPassword" value="<%formPassword|html>" />
+                                               <input type="hidden" name="returnPage" value="<%request.uri|html>" />
                                                <input type="hidden" name="image" value="<%image.id|html>" />
 
                                                <div>