Add buttons to move an image up or down in an album.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 23 Sep 2011 09:01:54 +0000 (11:01 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 23 Sep 2011 09:01:54 +0000 (11:01 +0200)
src/main/java/net/pterodactylus/sone/web/EditImagePage.java
src/main/resources/i18n/sone.en.properties
src/main/resources/templates/imageBrowser.html

index 8bb5a44..7e9eb7e 100644 (file)
@@ -62,13 +62,19 @@ public class EditImagePage extends SoneTemplatePage {
                        if (!webInterface.getCore().isLocalSone(image.getSone())) {
                                throw new RedirectException("noPermission.html");
                        }
-                       String title = request.getHttpRequest().getPartAsStringFailsafe("title", 100).trim();
-                       String description = request.getHttpRequest().getPartAsStringFailsafe("description", 1024).trim();
-                       if (title.length() == 0) {
-                               templateContext.set("titleMissing", true);
+                       if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("moveLeft", 4))) {
+                               image.getAlbum().moveImageUp(image);
+                       } else  if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("moveRight", 4))) {
+                               image.getAlbum().moveImageDown(image);
+                       } else {
+                               String title = request.getHttpRequest().getPartAsStringFailsafe("title", 100).trim();
+                               String description = request.getHttpRequest().getPartAsStringFailsafe("description", 1024).trim();
+                               if (title.length() == 0) {
+                                       templateContext.set("titleMissing", true);
+                               }
+                               image.setTitle(title);
+                               image.setDescription(description);
                        }
-                       image.setTitle(title);
-                       image.setDescription(description);
                        webInterface.getCore().touchConfiguration();
                        throw new RedirectException(returnPage);
                }
index 943e640..e3a2e8a 100644 (file)
@@ -199,7 +199,9 @@ Page.ImageBrowser.Album.Button.Delete=Delete Album
 Page.ImageBrowser.Image.Edit.Title=Edit Image
 Page.ImageBrowser.Image.Title.Label=Title:
 Page.ImageBrowser.Image.Description.Label=Description:
+Page.ImageBrowser.Image.Button.MoveLeft=◀
 Page.ImageBrowser.Image.Button.Save=Save Image
+Page.ImageBrowser.Image.Button.MoveRight=►
 Page.ImageBrowser.Image.Delete.Title=Delete Image
 Page.ImageBrowser.Image.Button.Delete=Delete Image
 
index ba8220d..a63f1a7 100644 (file)
                                                                        <textarea name="description"><%image.description|html></textarea>
                                                                </div>
                                                                <div>
+                                                                       <%notfirst><button type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button><%/notfirst>
                                                                        <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
+                                                                       <%notlast><button type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button><%/notlast>
                                                                </div>
                                                        </div>
                                                </form>