Search in sources :

Example 1 with AttachmentExtensionGroup

use of net.jforum.entities.AttachmentExtensionGroup in project jforum2 by rafaelsteil.

the class GenericAttachmentDAO method getExtensionGroup.

protected AttachmentExtensionGroup getExtensionGroup(ResultSet rs) throws SQLException {
    AttachmentExtensionGroup g = new AttachmentExtensionGroup();
    g.setId(rs.getInt("extension_group_id"));
    g.setName(rs.getString("name"));
    g.setUploadIcon(rs.getString("upload_icon"));
    g.setAllow(rs.getInt("allow") == 1);
    g.setDownloadMode(rs.getInt("download_mode"));
    return g;
}
Also used : AttachmentExtensionGroup(net.jforum.entities.AttachmentExtensionGroup)

Example 2 with AttachmentExtensionGroup

use of net.jforum.entities.AttachmentExtensionGroup in project jforum2 by rafaelsteil.

the class AttachmentsAction method extensionGroupsSave.

public void extensionGroupsSave() {
    AttachmentExtensionGroup g = new AttachmentExtensionGroup();
    g.setAllow(this.request.getParameter("allow") != null);
    g.setDownloadMode(this.request.getIntParameter("download_mode"));
    g.setName(this.request.getParameter("name"));
    g.setUploadIcon(this.request.getParameter("upload_icon"));
    DataAccessDriver.getInstance().newAttachmentDAO().addExtensionGroup(g);
    this.extensionGroups();
}
Also used : AttachmentExtensionGroup(net.jforum.entities.AttachmentExtensionGroup)

Example 3 with AttachmentExtensionGroup

use of net.jforum.entities.AttachmentExtensionGroup 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)

Aggregations

AttachmentExtensionGroup (net.jforum.entities.AttachmentExtensionGroup)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AttachmentDAO (net.jforum.dao.AttachmentDAO)1