X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FImageBrowserPage.java;h=406a762affa54517929c195670670999e3386354;hb=7bfd17c9c8b2fd5717308019bd2821ca643b4814;hp=ed31283dd640f0f0fdbd8392fc31743742a2f886;hpb=38cb6c5ec82298ee351d0eb15ddd8331db273af2;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index ed31283..406a762 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -17,6 +17,10 @@ package net.pterodactylus.sone.web; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; + import net.pterodactylus.sone.data.Album; import net.pterodactylus.sone.data.Image; import net.pterodactylus.sone.data.Sone; @@ -67,13 +71,34 @@ public class ImageBrowserPage extends SoneTemplatePage { templateContext.set("image", image); return; } - Sone sone = getCurrentSone(request.getToadletContext(), false); String soneId = request.getHttpRequest().getParam("sone", null); if (soneId != null) { - sone = webInterface.getCore().getSone(soneId, false); + Sone sone = webInterface.getCore().getSone(soneId, false); + templateContext.set("soneRequested", true); + templateContext.set("sone", sone); + return; } + String mode = request.getHttpRequest().getParam("mode", null); + if ("gallery".equals(mode)) { + templateContext.set("galleryRequested", true); + Set albums = new HashSet(); + for (Sone sone : webInterface.getCore().getSones()) { + albums.addAll(sone.getAllAlbums()); + } + templateContext.set("albums", albums); + return; + } + Sone sone = getCurrentSone(request.getToadletContext(), false); templateContext.set("soneRequested", true); templateContext.set("sone", sone); } + /** + * {@inheritDoc} + */ + @Override + public boolean isLinkExcepted(URI link) { + return true; + } + }