Search in sources :

Example 6 with AttachmentDAO

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());
}
Also used : AttachmentDAO(net.jforum.dao.AttachmentDAO)

Example 7 with AttachmentDAO

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();
}
Also used : AttachmentDAO(net.jforum.dao.AttachmentDAO) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) AttachmentExtensionGroup(net.jforum.entities.AttachmentExtensionGroup)

Example 8 with AttachmentDAO

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();
}
Also used : AttachmentDAO(net.jforum.dao.AttachmentDAO)

Aggregations

AttachmentDAO (net.jforum.dao.AttachmentDAO)8 ArrayList (java.util.ArrayList)5 List (java.util.List)4 File (java.io.File)2 Attachment (net.jforum.entities.Attachment)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 PostDAO (net.jforum.dao.PostDAO)1 AttachmentExtension (net.jforum.entities.AttachmentExtension)1 AttachmentExtensionGroup (net.jforum.entities.AttachmentExtensionGroup)1 Post (net.jforum.entities.Post)1 QuotaLimit (net.jforum.entities.QuotaLimit)1 AttachmentException (net.jforum.exceptions.AttachmentException)1 ForumException (net.jforum.exceptions.ForumException)1 TreeGroup (net.jforum.util.TreeGroup)1