use of net.jforum.dao.ForumDAO in project jforum2 by rafaelsteil.
the class ModerationHelper method removeTopics.
private void removeTopics() {
String[] topics = JForumExecutionContext.getRequest().getParameterValues("topic_id");
List forumsList = new ArrayList();
TopicDAO tm = DataAccessDriver.getInstance().newTopicDAO();
List topicsToDelete = new ArrayList();
if (topics != null && topics.length > 0) {
ModerationLog log = this.buildModerationLogFromRequest();
for (int i = 0; i < topics.length; i++) {
Topic t = tm.selectRaw(Integer.parseInt(topics[i]));
log.setTopicId(t.getId());
log.setPosterUser(t.getPostedBy());
this.saveModerationLog(log);
if (!forumsList.contains(new Integer(t.getForumId()))) {
forumsList.add(new Integer(t.getForumId()));
}
topicsToDelete.add(t);
PostRepository.clearCache(t.getId());
}
tm.deleteTopics(topicsToDelete, false);
ForumDAO fm = DataAccessDriver.getInstance().newForumDAO();
TopicRepository.loadMostRecentTopics();
// Reload changed forums
for (Iterator iter = forumsList.iterator(); iter.hasNext(); ) {
int forumId = ((Integer) iter.next()).intValue();
TopicRepository.clearCache(forumId);
int postId = fm.getMaxPostId(forumId);
if (postId > -1) {
fm.setLastPost(forumId, postId);
} else {
logger.warn("Could not find last post id for forum " + forumId);
}
ForumRepository.reloadForum(forumId);
}
}
}
use of net.jforum.dao.ForumDAO in project jforum2 by rafaelsteil.
the class ForumAction method edit.
// Edit
public void edit() {
int forumId = this.request.getIntParameter("forum_id");
ForumDAO forumDao = DataAccessDriver.getInstance().newForumDAO();
CategoryDAO cm = DataAccessDriver.getInstance().newCategoryDAO();
this.setTemplateName(TemplateKeys.FORUM_ADMIN_EDIT);
this.context.put("categories", cm.selectAll());
this.context.put("action", "editSave");
this.context.put("forum", forumDao.selectById(forumId));
// Mail Integration
// MailIntegrationDAO integrationDao = DataAccessDriver.getInstance().newMailIntegrationDAO();
// this.context.put("mailIntegration", integrationDao.find(forumId));
}
use of net.jforum.dao.ForumDAO in project jforum2 by rafaelsteil.
the class AdminAction method main.
public void main() throws Exception {
if (this.checkAdmin()) {
this.setTemplateName(TemplateKeys.ADMIN_MAIN);
// Checks if the install module is still active
this.context.put("installModuleExists", ModulesRepository.getModuleClass("install") != null);
this.context.put("sessions", SessionFacade.getAllSessions());
ForumDAO dao = DataAccessDriver.getInstance().newForumDAO();
this.context.put("stats", dao.getBoardStatus());
this.checkBoardVersion();
}
}
Aggregations