Search in sources :

Example 1 with RSSAware

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());
}
Also used : TopicRSS(net.jforum.util.rss.TopicRSS) List(java.util.List) Forum(net.jforum.entities.Forum) RSSAware(net.jforum.util.rss.RSSAware)

Example 2 with RSSAware

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());
}
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)

Example 3 with RSSAware

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());
}
Also used : List(java.util.List) RSSAware(net.jforum.util.rss.RSSAware) RecentTopicsRSS(net.jforum.util.rss.RecentTopicsRSS)

Aggregations

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