use of net.jforum.dao.AttachmentDAO in project jforum2 by rafaelsteil.
the class AttachmentsAction method extensions.
public void extensions() {
AttachmentDAO am = DataAccessDriver.getInstance().newAttachmentDAO();
this.setTemplateName(TemplateKeys.ATTACHMENTS_EXTENSIONS);
this.context.put("extensions", am.selectExtensions());
this.context.put("groups", am.selectExtensionGroups());
}
use of net.jforum.dao.AttachmentDAO in project jforum2 by rafaelsteil.
the class AttachmentsAction method extensionGroupsUpdate.
public void extensionGroupsUpdate() {
AttachmentDAO am = DataAccessDriver.getInstance().newAttachmentDAO();
// Check if there are records to remove
String[] delete = this.request.getParameterValues("delete");
List deleteList = new ArrayList();
if (delete != null) {
deleteList = Arrays.asList(delete);
am.removeExtensionGroups(delete);
}
// Update
int total = this.request.getIntParameter("total_records");
for (int i = 0; i < total; i++) {
if (deleteList.contains(this.request.getParameter("id_" + i))) {
continue;
}
AttachmentExtensionGroup g = new AttachmentExtensionGroup();
g.setId(this.request.getIntParameter("id_" + i));
g.setAllow(this.request.getParameter("allow_" + i) != null);
g.setDownloadMode(this.request.getIntParameter("download_mode_" + i));
g.setName(this.request.getParameter("name_" + i));
g.setUploadIcon(this.request.getParameter("upload_icon_" + i));
am.updateExtensionGroup(g);
}
this.extensionGroups();
}
use of net.jforum.dao.AttachmentDAO in project jforum2 by rafaelsteil.
the class AttachmentsAction method quotaGroupsSave.
public void quotaGroupsSave() {
int total = this.request.getIntParameter("total_groups");
AttachmentDAO am = DataAccessDriver.getInstance().newAttachmentDAO();
am.cleanGroupQuota();
for (int i = 0; i < total; i++) {
String l = this.request.getParameter("limit_" + i);
if (l == null || l.equals("")) {
continue;
}
int limitId = Integer.parseInt(l);
int groupId = this.request.getIntParameter("group_" + i);
if (groupId > 0) {
am.setGroupQuota(groupId, limitId);
}
}
this.quotaLimit();
}
Aggregations