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));
}
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"));
}
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);
}
}
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);
}
}
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);
}
Aggregations