-
- });
- int page = request.getHttpRequest().getIntParam("page", 0);
- Pagination<Post> postPagination = new Pagination<Post>(allPosts, 25).setPage(page);
- List<Post> postsOnPage = postPagination.getItems();
- template.set("posts", postsOnPage);
- template.set("pagination", postPagination);
- }
-
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
+ }
+ allPosts = Collections2.filter(allPosts, postVisibilityFilter.isVisible(currentSone));
+ List<Post> sortedPosts = new ArrayList<Post>(allPosts);
+ Collections.sort(sortedPosts, Post.NEWEST_FIRST);
+ Pagination<Post> pagination = new Pagination<Post>(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("page"), 0));
+ templateContext.set("pagination", pagination);
+ templateContext.set("posts", pagination.getItems());