From 4e384f552ca6e6b49fd0eb3315a3708e0f8a32fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 23 Sep 2011 11:01:54 +0200 Subject: [PATCH] Add buttons to move an image up or down in an album. --- .../java/net/pterodactylus/sone/web/EditImagePage.java | 18 ++++++++++++------ src/main/resources/i18n/sone.en.properties | 2 ++ src/main/resources/templates/imageBrowser.html | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/EditImagePage.java b/src/main/java/net/pterodactylus/sone/web/EditImagePage.java index 8bb5a44..7e9eb7e 100644 --- a/src/main/java/net/pterodactylus/sone/web/EditImagePage.java +++ b/src/main/java/net/pterodactylus/sone/web/EditImagePage.java @@ -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); } diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index 943e640..e3a2e8a 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -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 diff --git a/src/main/resources/templates/imageBrowser.html b/src/main/resources/templates/imageBrowser.html index ba8220d..a63f1a7 100644 --- a/src/main/resources/templates/imageBrowser.html +++ b/src/main/resources/templates/imageBrowser.html @@ -194,7 +194,9 @@
+ <%notfirst><%/notfirst> + <%notlast><%/notlast>
-- 2.7.4