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;
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) {
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;
});
$("#edit-album label").hide();
+ /* hide non-js image move buttons. */
+ $(".move-buttons").hide();
+
hideAndShowBlock("div.edit-album", ".show-edit-album", ".hide-edit-album");
hideAndShowBlock("div.create-album", ".show-create-album", ".hide-create-album");
hideAndShowBlock("div.upload-image", ".show-upload-image", ".hide-upload-image");
<input type="hidden" name="returnPage" value="<%request.uri|html>" />
<input type="hidden" name="image" value="<%image.id|html>" />
+ <div class="move-buttons">
+ <button <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+ <button <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+ </div>
+
<div class="edit-data hidden">
<div>
<input type="text" name="title" value="<%image.title|html>" />
});
$("#create-album label").hide();
+ /* hide non-js move buttons. */
+ $(".move-buttons").hide();
+
hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
prepareAlbums();
<input type="hidden" name="returnPage" value="<%request.uri|html>" />
<input type="hidden" name="album" value="<%album.id|html>" />
+ <div class="move-buttons">
+ <button <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+ <button <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+ </div>
+
<div class="edit-data hidden">
<div>
<input type="text" name="title" value="<%album.title|html>" />