Search in sources :

Example 1 with TopicPostsRSS

use of net.jforum.util.rss.TopicPostsRSS 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());
}
Also used : PostDAO(net.jforum.dao.PostDAO) TopicDAO(net.jforum.dao.TopicDAO) List(java.util.List) Topic(net.jforum.entities.Topic) TopicPostsRSS(net.jforum.util.rss.TopicPostsRSS) RSSAware(net.jforum.util.rss.RSSAware)

Aggregations

List (java.util.List)1 PostDAO (net.jforum.dao.PostDAO)1 TopicDAO (net.jforum.dao.TopicDAO)1 Topic (net.jforum.entities.Topic)1 RSSAware (net.jforum.util.rss.RSSAware)1 TopicPostsRSS (net.jforum.util.rss.TopicPostsRSS)1