2 * Sone - ImageBrowserPage.java - Copyright © 2011 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.web;
22 import net.pterodactylus.sone.data.Album;
23 import net.pterodactylus.sone.data.Image;
24 import net.pterodactylus.sone.data.Sone;
25 import net.pterodactylus.sone.web.page.FreenetRequest;
26 import net.pterodactylus.util.template.Template;
27 import net.pterodactylus.util.template.TemplateContext;
30 * The image browser page is the entry page for the image management.
32 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
34 public class ImageBrowserPage extends SoneTemplatePage {
37 * Creates a new image browser page.
40 * The template to render
42 * The Sone web interface
44 public ImageBrowserPage(Template template, WebInterface webInterface) {
45 super("imageBrowser.html", template, "Page.ImageBrowser.Title", webInterface, true);
49 // SONETEMPLATEPAGE METHODS
56 protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
57 super.processTemplate(request, templateContext);
58 String albumId = request.getHttpRequest().getParam("album", null);
59 if (albumId != null) {
60 Album album = webInterface.getCore().getAlbum(albumId, false);
61 templateContext.set("albumRequested", true);
62 templateContext.set("album", album);
65 String imageId = request.getHttpRequest().getParam("image", null);
66 if (imageId != null) {
67 Image image = webInterface.getCore().getImage(imageId, false);
68 templateContext.set("imageRequested", true);
69 templateContext.set("image", image);
72 Sone sone = getCurrentSone(request.getToadletContext(), false);
73 String soneId = request.getHttpRequest().getParam("sone", null);
75 sone = webInterface.getCore().getSone(soneId, false);
77 templateContext.set("soneRequested", true);
78 templateContext.set("sone", sone);
85 public boolean isLinkExcepted(URI link) {