X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FEditAlbumPage.java;h=dc5c8faea143ba34daa67f221134cf5cdea4de1d;hp=8f595a7dfac882e58ef83e1a8a94f4059ebf424a;hb=03a7fb4f25191e6bcb64bc953572aaf7f5958b19;hpb=de66d85cd98be2a580c7c2c05fa42a7ff0cc99ed diff --git a/src/main/java/net/pterodactylus/sone/web/EditAlbumPage.java b/src/main/java/net/pterodactylus/sone/web/EditAlbumPage.java index 8f595a7..dc5c8fa 100644 --- a/src/main/java/net/pterodactylus/sone/web/EditAlbumPage.java +++ b/src/main/java/net/pterodactylus/sone/web/EditAlbumPage.java @@ -18,6 +18,7 @@ package net.pterodactylus.sone.web; import net.pterodactylus.sone.data.Album; +import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.text.TextFilter; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; @@ -50,6 +51,7 @@ public class EditAlbumPage extends SoneTemplatePage { protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); if (request.getMethod() == Method.POST) { + Sone currentSone = getCurrentSone(request.getToadletContext()); String albumId = request.getHttpRequest().getPartAsStringFailsafe("album", 36); Album album = webInterface.getCore().getAlbum(albumId, false); if (album == null) { @@ -58,6 +60,25 @@ public class EditAlbumPage extends SoneTemplatePage { if (!webInterface.getCore().isLocalSone(album.getSone())) { throw new RedirectException("noPermission.html"); } + if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("moveLeft", 4))) { + if (album.getParent() == null) { + currentSone.moveAlbumUp(album); + webInterface.getCore().touchConfiguration(); + throw new RedirectException("imageBrowser.html?sone=" + currentSone.getId()); + } + album.getParent().moveAlbumUp(album); + webInterface.getCore().touchConfiguration(); + throw new RedirectException("imageBrowser.html?album=" + album.getParent().getId()); + } else if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("moveRight", 4))) { + if (album.getParent() == null) { + currentSone.moveAlbumDown(album); + webInterface.getCore().touchConfiguration(); + throw new RedirectException("imageBrowser.html?sone=" + currentSone.getId()); + } + album.getParent().moveAlbumDown(album); + webInterface.getCore().touchConfiguration(); + throw new RedirectException("imageBrowser.html?album=" + album.getParent().getId()); + } String albumImageId = request.getHttpRequest().getPartAsStringFailsafe("album-image", 36); if (webInterface.getCore().getImage(albumImageId, false) == null) { albumImageId = null;