X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FImageBrowserPage.java;h=acc63540dffb61401c383eeb0fe1b9e7f730f61c;hp=766f018c770f88a46b539587dbbbfa52c3212587;hb=7b55e0be6a3283e43a9bbab98f82aebdd948eb33;hpb=7017646bf42cb265b6df539bb6def40b91d2f968 diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index 766f018..acc6354 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -1,5 +1,5 @@ /* - * Sone - ImageBrowserPage.java - Copyright © 2011–2013 David Roden + * Sone - ImageBrowserPage.java - Copyright © 2011–2016 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ import static com.google.common.collect.FluentIterable.from; import static net.pterodactylus.sone.data.Album.FLATTENER; import static net.pterodactylus.sone.data.Album.NOT_EMPTY; import static net.pterodactylus.sone.data.Album.TITLE_COMPARATOR; +import static net.pterodactylus.sone.utils.NumberParsers.parseInt; import java.net.URI; import java.util.ArrayList; @@ -34,7 +35,6 @@ import net.pterodactylus.sone.data.Image; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.collection.Pagination; -import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -65,11 +65,10 @@ public class ImageBrowserPage extends SoneTemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { - super.processTemplate(request, templateContext); + protected void handleRequest(FreenetRequest request, TemplateContext templateContext) throws RedirectException { String albumId = request.getHttpRequest().getParam("album", null); if (albumId != null) { - Album album = webInterface.getCore().getAlbum(albumId, false); + Album album = webInterface.getCore().getAlbum(albumId); templateContext.set("albumRequested", true); templateContext.set("album", album); templateContext.set("page", request.getHttpRequest().getParam("page")); @@ -97,7 +96,7 @@ public class ImageBrowserPage extends SoneTemplatePage { albums.addAll(from(sone.getRootAlbum().getAlbums()).transformAndConcat(FLATTENER).filter(NOT_EMPTY).toList()); } Collections.sort(albums, TITLE_COMPARATOR); - Pagination albumPagination = new Pagination(albums, 12).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0)); + Pagination albumPagination = new Pagination(albums, 12).setPage(parseInt(request.getHttpRequest().getParam("page"), 0)); templateContext.set("albumPagination", albumPagination); templateContext.set("albums", albumPagination.getItems()); return;