Search in sources :

Example 41 with Forum

use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.

the class AdminPanelForumTest method verifyLockForum.

@Test
public void verifyLockForum() {
    String message = lockForum(driver, new Forum("First Test Forum"));
    assertTrue(message.equals(LOCKED_FORUM_MESSAGE));
    message = lockForum(driver, new Forum("First Test Forum"));
    assertTrue(message.equals(UNLOCKED_FORUM_MESSAGE));
}
Also used : Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) MoveForum.moveForum(it.vige.rubia.selenium.adminpanel.action.MoveForum.moveForum) UpdateForum.updateForum(it.vige.rubia.selenium.adminpanel.action.UpdateForum.updateForum) LockForum.lockForum(it.vige.rubia.selenium.adminpanel.action.LockForum.lockForum) Test(org.junit.Test)

Example 42 with Forum

use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.

the class AdminPanelForumTest method verifyMoveForum.

@Test
public void verifyMoveForum() {
    Map<String, Integer> positions = moveForum(driver, new Forum("First Test Forum"), DOWN);
    assertTrue(positions.get("newPosition") > positions.get("firstPosition"));
    positions = moveForum(driver, new Forum("First Test Forum"), UP);
    assertTrue(positions.get("newPosition") < positions.get("firstPosition"));
}
Also used : Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) MoveForum.moveForum(it.vige.rubia.selenium.adminpanel.action.MoveForum.moveForum) UpdateForum.updateForum(it.vige.rubia.selenium.adminpanel.action.UpdateForum.updateForum) LockForum.lockForum(it.vige.rubia.selenium.adminpanel.action.LockForum.lockForum) Test(org.junit.Test)

Example 43 with Forum

use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.

the class ViewCategory method processCategory.

/**
 * @return
 */
private void processCategory(Category category) throws Exception {
    Date userLastLogin = getUserLastLoginDate(userModule, userProfileModule);
    if (category != null) {
        getCategories().add(category);
        // process the forums associated with this category
        Collection<Forum> forums = forumsModule.findForumsByCategory(category);
        Collection<Forum> categoryForums = new ArrayList<Forum>();
        for (Forum currentForum : forums) {
            categoryForums.add(currentForum);
            // setup folderLook based on whats specified in the theme
            String folderImage = themeHelper.getResourceForumURL();
            // bundle key
            String folderAlt = "No_new_posts";
            if (this.forumLastPosts != null && forumLastPosts.containsKey(currentForum.getId())) {
                Post lastPost = forumLastPosts.get(currentForum.getId());
                Date lastPostDate = lastPost.getCreateDate();
                if (lastPostDate != null && userLastLogin != null && lastPostDate.compareTo(userLastLogin) > 0) {
                    // bundle key
                    folderAlt = "New_posts";
                    folderImage = themeHelper.getResourceForumNewURL();
                }
            }
            if (currentForum.getStatus() == FORUM_LOCKED) {
                folderImage = themeHelper.getResourceForumLockedURL();
                // bundle key
                folderAlt = "Forum_locked";
            }
            getForumImages().put(currentForum.getId(), folderImage);
            getForumImageDescriptions().put(currentForum.getId(), folderAlt);
        }
        getForums().put(category.getId(), categoryForums);
    }
}
Also used : Post(it.vige.rubia.model.Post) ArrayList(java.util.ArrayList) Date(java.util.Date) JSFUtil.getUserLastLoginDate(it.vige.rubia.ui.JSFUtil.getUserLastLoginDate) Forum(it.vige.rubia.model.Forum) SecureActionForum(it.vige.rubia.auth.SecureActionForum)

Example 44 with Forum

use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.

the class ViewMyForumsMain method execute.

/**
 */
@PostConstruct
public void execute() {
    try {
        super.execute();
        Collection<Forum> forums = getWatchedForums();
        Date userLastLogin = getUserLastLoginDate(userModule, userProfileModule);
        for (Forum currentForum : forums) {
            // setup folderLook based on whats specified in the theme
            String folderImage = themeHelper.getResourceForumURL();
            // bundle key
            String folderAlt = "No_new_posts";
            if (forumsLastPosts != null && forumsLastPosts.containsKey(currentForum.getId())) {
                Post lastPost = forumsLastPosts.get(currentForum.getId());
                Date lastPostDate = lastPost.getCreateDate();
                if (lastPostDate != null && userLastLogin != null && lastPostDate.compareTo(userLastLogin) > 0) {
                    // bundle key
                    folderAlt = "New_posts";
                    folderImage = themeHelper.getResourceForumNewURL();
                }
            }
            if (currentForum.getStatus() == Constants.FORUM_LOCKED) {
                folderImage = themeHelper.getResourceForumLockedURL();
                // bundle key
                folderAlt = "Forum_locked";
            }
            getForumImages().put(currentForum.getId(), folderImage);
            getForumImageDescriptions().put(currentForum.getId(), folderAlt);
        }
    } catch (Exception e) {
        log.error(e);
    }
}
Also used : Post(it.vige.rubia.model.Post) Date(java.util.Date) JSFUtil.getUserLastLoginDate(it.vige.rubia.ui.JSFUtil.getUserLastLoginDate) JSFUtil.handleException(it.vige.rubia.ui.JSFUtil.handleException) Forum(it.vige.rubia.model.Forum) SecureActionForum(it.vige.rubia.auth.SecureActionForum) PostConstruct(javax.annotation.PostConstruct)

Example 45 with Forum

use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.

the class FeedsServlet method createForumFeed.

private void createForumFeed(SyndFeed feed, Integer id, String url, String urlType) throws ModuleException {
    Forum forum = forumsModule.findForumById(id);
    feed.setTitle("Rubia Forums Forum Feed: " + forum.getName());
    feed.setLink(forumLink(id.toString(), url, urlType));
    feed.setDescription("Messages posted in forum " + forum.getName() + " in category " + forum.getCategory().getTitle());
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    List<Post> posts = forumsModule.findPostsFromForumDesc(forum, POST_LIMIT);
    for (int i = 0; i < posts.size(); i++) {
        entries.add(getEntry(posts.get(i), url, urlType));
    }
    feed.setEntries(entries);
}
Also used : SyndEntry(com.rometools.rome.feed.synd.SyndEntry) Post(it.vige.rubia.model.Post) ArrayList(java.util.ArrayList) Forum(it.vige.rubia.model.Forum)

Aggregations

Forum (it.vige.rubia.model.Forum)100 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)65 Topic (it.vige.rubia.model.Topic)63 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)55 Post (it.vige.rubia.model.Post)52 Category (it.vige.rubia.model.Category)50 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)49 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)40 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)40 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)34 Test (org.junit.Test)33 Poll (it.vige.rubia.model.Poll)23 Attachment (it.vige.rubia.model.Attachment)21 PollOption (it.vige.rubia.model.PollOption)21 SecureActionForum (it.vige.rubia.auth.SecureActionForum)16 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)15 Poster (it.vige.rubia.model.Poster)14 JSFUtil.handleException (it.vige.rubia.ui.JSFUtil.handleException)14 BeforeClass (org.junit.BeforeClass)14 AfterClass (org.junit.AfterClass)13