use of net.jforum.entities.Forum in project jforum2 by rafaelsteil.
the class ForumOrderComparator method compare.
public final int compare(Object a, Object b) {
Forum f1 = (Forum) a;
Forum f2 = (Forum) b;
if (f1.getOrder() > f2.getOrder()) {
return 1;
} else if (f1.getOrder() < f2.getOrder()) {
return -1;
} else {
return f1.getName().compareTo(f2.getName());
}
}
use of net.jforum.entities.Forum in project jforum2 by rafaelsteil.
the class ConfigAction method updateData.
void updateData(Properties p) {
int oldTopicsPerPage = SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE);
for (Iterator iter = p.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
SystemGlobals.setValue((String) entry.getKey(), (String) entry.getValue());
}
SystemGlobals.saveInstallation();
I18n.changeBoardDefault(SystemGlobals.getValue(ConfigKeys.I18N_DEFAULT));
// If topicsPerPage has changed, force a reload in all forums
if (oldTopicsPerPage != SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE)) {
List categories = ForumRepository.getAllCategories();
for (Iterator iter = categories.iterator(); iter.hasNext(); ) {
Category c = (Category) iter.next();
for (Iterator iter2 = c.getForums().iterator(); iter2.hasNext(); ) {
Forum f = (Forum) iter2.next();
TopicRepository.clearCache(f.getId());
}
}
}
}
use of net.jforum.entities.Forum in project jforum2 by rafaelsteil.
the class ForumAction method insertSave.
// A new one
public void insertSave() {
Forum f = new Forum();
f.setDescription(this.request.getParameter("description"));
f.setIdCategories(this.request.getIntParameter("categories_id"));
f.setName(this.request.getParameter("forum_name"));
f.setModerated("1".equals(this.request.getParameter("moderate")));
int forumId = DataAccessDriver.getInstance().newForumDAO().addNew(f);
f.setId(forumId);
ForumRepository.addForum(f);
GroupSecurityDAO gmodel = DataAccessDriver.getInstance().newGroupSecurityDAO();
PermissionControl pc = new PermissionControl();
pc.setSecurityModel(gmodel);
String[] allGroups = this.request.getParameterValues("groups");
// Access
String[] groups = this.request.getParameterValues("groupsAccess");
if (groups != null) {
this.addRole(pc, SecurityConstants.PERM_FORUM, f.getId(), groups);
} else {
this.addRole(pc, SecurityConstants.PERM_FORUM, f.getId(), allGroups);
}
// Anonymous posts
groups = this.request.getParameterValues("groupsAnonymous");
if (groups != null) {
this.addRole(pc, SecurityConstants.PERM_ANONYMOUS_POST, f.getId(), groups);
} else {
this.addRole(pc, SecurityConstants.PERM_ANONYMOUS_POST, f.getId(), allGroups);
}
// Read-only
groups = this.request.getParameterValues("groupsReadOnly");
if (groups != null) {
this.addRole(pc, SecurityConstants.PERM_READ_ONLY_FORUMS, f.getId(), groups);
} else {
this.addRole(pc, SecurityConstants.PERM_READ_ONLY_FORUMS, f.getId(), allGroups);
}
// Reply-only
this.addRole(pc, SecurityConstants.PERM_REPLY_ONLY, f.getId(), allGroups);
// HTML
groups = this.request.getParameterValues("groupsHtml");
if (groups != null) {
this.addRole(pc, SecurityConstants.PERM_HTML_DISABLED, f.getId(), groups);
} else {
this.addRole(pc, SecurityConstants.PERM_HTML_DISABLED, f.getId(), allGroups);
}
SecurityRepository.clean();
RolesRepository.clear();
//this.handleMailIntegration();
this.list();
}
Aggregations