use of net.jforum.util.rss.RSSAware in project jforum2 by rafaelsteil.
the class RSSAction method forumTopics.
/**
* RSS for all N first topics for some given forum
*/
public void forumTopics() {
int forumId = this.request.getIntParameter("forum_id");
if (!TopicsCommon.isTopicAccessible(forumId)) {
JForumExecutionContext.requestBasicAuthentication();
return;
}
List posts = DataAccessDriver.getInstance().newPostDAO().selectLatestByForumForRSS(forumId, SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE));
Forum forum = ForumRepository.getForum(forumId);
String[] p = { forum.getName() };
RSSAware rss = new TopicRSS(I18n.getMessage("RSS.ForumTopics.title", p), I18n.getMessage("RSS.ForumTopics.description", p), forumId, posts);
this.context.put("rssContents", rss.createRSS());
}
use of net.jforum.util.rss.RSSAware in project jforum2 by rafaelsteil.
the class RSSAction method topicPosts.
/**
* RSS for all N first posts for some given topic
*/
public void topicPosts() {
int topicId = this.request.getIntParameter("topic_id");
PostDAO pm = DataAccessDriver.getInstance().newPostDAO();
TopicDAO tm = DataAccessDriver.getInstance().newTopicDAO();
Topic topic = tm.selectById(topicId);
if (!TopicsCommon.isTopicAccessible(topic.getForumId()) || topic.getId() == 0) {
JForumExecutionContext.requestBasicAuthentication();
return;
}
tm.incrementTotalViews(topic.getId());
List posts = pm.selectAllByTopic(topicId);
String[] p = { topic.getTitle() };
String title = I18n.getMessage("RSS.TopicPosts.title", p);
String description = I18n.getMessage("RSS.TopicPosts.description", p);
RSSAware rss = new TopicPostsRSS(title, description, topic.getForumId(), posts);
this.context.put("rssContents", rss.createRSS());
}
use of net.jforum.util.rss.RSSAware in project jforum2 by rafaelsteil.
the class RSSAction method recentTopics.
public void recentTopics() {
String title = I18n.getMessage("RSS.RecentTopics.title", new Object[] { SystemGlobals.getValue(ConfigKeys.FORUM_NAME) });
String description = I18n.getMessage("RSS.RecentTopics.description");
List posts = DataAccessDriver.getInstance().newPostDAO().selectHotForRSS(SystemGlobals.getIntValue(ConfigKeys.POSTS_PER_PAGE));
RSSAware rss = new RecentTopicsRSS(title, description, posts);
this.context.put("rssContents", rss.createRSS());
}
Aggregations