+ String mode = request.getHttpRequest().getParam("mode", null);
+ if ("gallery".equals(mode)) {
+ templateContext.set("galleryRequested", true);
+ List<Album> albums = new ArrayList<Album>();
+ for (Sone sone : webInterface.getCore().getSones()) {
+ albums.addAll(sone.getAllAlbums());
+ }
+ Collections.sort(albums, Album.TITLE_COMPARATOR);
+ Pagination<Album> albumPagination = new Pagination<Album>(albums, 12).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0));
+ templateContext.set("albumPagination", albumPagination);
+ templateContext.set("albums", albumPagination.getItems());
+ return;
+ }
+ Sone sone = getCurrentSone(request.getToadletContext(), false);