Search in sources :

Example 21 with Dropdown

use of org.olat.core.gui.components.dropdown.Dropdown in project OpenOLAT by OpenOLAT.

the class TableOfContentController method forgeSectionRow.

private SectionRow forgeSectionRow(Section section, AssessmentSection assessmentSection, List<Assignment> assignemnts, boolean first, boolean last) {
    String sectionId = "section" + (++counter);
    String title = StringHelper.escapeHtml(section.getTitle());
    List<Assignment> notAssignedAssignments = new ArrayList<>();
    if (secCallback.canViewPendingAssignments(section)) {
        if (assignemnts != null) {
            for (Assignment assignemnt : assignemnts) {
                if (assignemnt.getPage() == null) {
                    notAssignedAssignments.add(assignemnt);
                }
            }
        }
    }
    Link sectionLink = LinkFactory.createCustomLink(sectionId, "open_section", title, Link.LINK | Link.NONTRANSLATED, mainVC, this);
    SectionRow sectionRow = new SectionRow(section, sectionLink, assessmentSection, notAssignedAssignments);
    sectionLink.setUserObject(sectionRow);
    Dropdown editDropdown = new Dropdown(sectionId.concat("_dropdown"), null, false, getTranslator());
    editDropdown.setElementCssClass("o_sel_pf_section_tools");
    editDropdown.setTranslatedLabel("");
    editDropdown.setOrientation(DropdownOrientation.right);
    editDropdown.setIconCSS("o_icon o_icon_actions");
    if (secCallback.canCloseSection(section)) {
        if (SectionStatus.isClosed(section)) {
            Link reopenLink = LinkFactory.createLink(sectionId.concat("_ropens"), "reopen.section", "reopen.section", mainVC, this);
            reopenLink.setUserObject(sectionRow);
            editDropdown.addComponent(reopenLink);
        } else {
            Link closeLink = LinkFactory.createLink(sectionId.concat("_closes"), "close.section", "close.section", mainVC, this);
            closeLink.setUserObject(sectionRow);
            editDropdown.addComponent(closeLink);
        }
        if (section.getEndDate() != null) {
            Link overrideDatesLink = LinkFactory.createLink(sectionId.concat("_overd"), "override.dates.section", "override.dates.section", mainVC, this);
            overrideDatesLink.setUserObject(sectionRow);
            editDropdown.addComponent(overrideDatesLink);
        }
    }
    if (secCallback.canEditSection()) {
        Link editSectionLink = LinkFactory.createLink(sectionId.concat("_edit"), "section.edit", "edit_section", mainVC, this);
        editSectionLink.setIconLeftCSS("o_icon o_icon_edit");
        editSectionLink.setUserObject(sectionRow);
        editDropdown.addComponent(editSectionLink);
        Link deleteSectionLink = LinkFactory.createLink(sectionId.concat("_delete"), "section.delete", "delete_section", mainVC, this);
        deleteSectionLink.setElementCssClass("o_sel_pf_delete_section");
        deleteSectionLink.setIconLeftCSS("o_icon o_icon_delete_item");
        deleteSectionLink.setUserObject(sectionRow);
        editDropdown.addComponent(deleteSectionLink);
        Link upSectionLink = LinkFactory.createCustomLink(sectionId.concat("_up"), "up_section", "", Link.LINK | Link.NONTRANSLATED, mainVC, this);
        upSectionLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_up");
        upSectionLink.setUserObject(sectionRow);
        upSectionLink.setEnabled(!first);
        sectionRow.setUpSectionLink(upSectionLink);
        Link downSectionLink = LinkFactory.createCustomLink(sectionId.concat("_down"), "down_section", "", Link.LINK | Link.NONTRANSLATED, mainVC, this);
        downSectionLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_down");
        downSectionLink.setUserObject(sectionRow);
        downSectionLink.setEnabled(!last);
        sectionRow.setDownSectionLink(downSectionLink);
    }
    if (editDropdown.getComponents().iterator().hasNext()) {
        mainVC.put(editDropdown.getComponentName(), editDropdown);
        sectionRow.setEditDropdown(editDropdown);
    }
    return sectionRow;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) ArrayList(java.util.ArrayList) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) Link(org.olat.core.gui.components.link.Link)

Example 22 with Dropdown

use of org.olat.core.gui.components.dropdown.Dropdown in project OpenOLAT by OpenOLAT.

the class TableOfContentController method initTools.

@Override
public void initTools() {
    if (secCallback.canEditMetadataBinder()) {
        editBinderMetadataLink = LinkFactory.createToolLink("edit.binder.metadata", translate("edit.binder.metadata"), this);
        editBinderMetadataLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
        stackPanel.addTool(editBinderMetadataLink, Align.left);
    }
    if (secCallback.canMoveToTrashBinder(binder)) {
        moveToTrashBinderLink = LinkFactory.createToolLink("delete.binder", translate("delete.binder"), this);
        moveToTrashBinderLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
        stackPanel.addTool(moveToTrashBinderLink, Align.left);
    }
    if (secCallback.canExportBinder()) {
        Dropdown exportTools = new Dropdown("export.binder", "export.binder", false, getTranslator());
        exportTools.setElementCssClass("o_sel_pf_export_tools");
        exportTools.setIconCSS("o_icon o_icon_download");
        stackPanel.addTool(exportTools, Align.left);
        exportBinderAsCpLink = LinkFactory.createToolLink("export.binder.cp", translate("export.binder.cp"), this);
        exportBinderAsCpLink.setIconLeftCSS("o_icon o_icon_download");
        exportTools.addComponent(exportBinderAsCpLink);
        printLink = LinkFactory.createToolLink("export.binder.onepage", translate("export.binder.onepage"), this);
        printLink.setIconLeftCSS("o_icon o_icon_print");
        printLink.setPopup(new LinkPopupSettings(950, 750, "binder"));
        exportTools.addComponent(printLink);
    }
    if (secCallback.canDeleteBinder(binder)) {
        deleteBinderLink = LinkFactory.createToolLink("delete.binder", translate("delete.binder"), this);
        deleteBinderLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
        stackPanel.addTool(deleteBinderLink, Align.left);
        restoreBinderLink = LinkFactory.createToolLink("restore.binder", translate("restore.binder"), this);
        restoreBinderLink.setIconLeftCSS("o_icon o_icon-lg o_icon_restore");
        stackPanel.addTool(restoreBinderLink, Align.left);
    }
    if (secCallback.canAddSection()) {
        newSectionTool = LinkFactory.createToolLink("new.section", translate("create.new.section"), this);
        newSectionTool.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
        newSectionTool.setElementCssClass("o_sel_pf_new_section");
        stackPanel.addTool(newSectionTool, Align.right);
    }
    if (secCallback.canAddPage(null)) {
        newEntryLink = LinkFactory.createToolLink("new.page", translate("create.new.page"), this);
        newEntryLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
        newEntryLink.setElementCssClass("o_sel_pf_new_entry");
        newEntryLink.setVisible(sectionList != null && sectionList.size() > 0);
        stackPanel.addTool(newEntryLink, Align.right);
    }
    if (secCallback.canNewAssignment()) {
        newAssignmentLink = LinkFactory.createToolLink("new.assignment", translate("create.new.assignment"), this);
        newAssignmentLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
        newAssignmentLink.setElementCssClass("o_sel_pf_new_assignment");
        newAssignmentLink.setVisible(sectionList != null && sectionList.size() > 0);
        stackPanel.addTool(newAssignmentLink, Align.right);
    }
}
Also used : LinkPopupSettings(org.olat.core.gui.components.link.LinkPopupSettings) Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 23 with Dropdown

use of org.olat.core.gui.components.dropdown.Dropdown in project OpenOLAT by OpenOLAT.

the class PageRunController method initTools.

@Override
public void initTools() {
    editLink(!openInEditMode);
    stackPanel.addTool(editLink, Align.left);
    editMetadataLink = LinkFactory.createToolLink("edit.page.metadata", translate("edit.page.metadata"), this);
    editMetadataLink.setIconLeftCSS("o_icon o_icon-lg o_icon_edit_metadata");
    editMetadataLink.setVisible(secCallback.canEditPageMetadata(page, assignments));
    stackPanel.addTool(editMetadataLink, Align.left);
    if (secCallback.canExportBinder()) {
        Dropdown exportTools = new Dropdown("export.page", "export.page", false, getTranslator());
        exportTools.setElementCssClass("o_sel_pf_export_tools");
        exportTools.setIconCSS("o_icon o_icon_download");
        stackPanel.addTool(exportTools, Align.left);
        printLink = LinkFactory.createToolLink("export.page.onepage", translate("export.page.onepage"), this);
        printLink.setIconLeftCSS("o_icon o_icon_print");
        printLink.setPopup(new LinkPopupSettings(950, 750, "binder"));
        exportTools.addComponent(printLink);
    }
    moveToTrashLink = LinkFactory.createToolLink("delete.page", translate("delete.page"), this);
    moveToTrashLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
    moveToTrashLink.setElementCssClass("o_sel_pf_move_page_to_trash");
    moveToTrashLink.setVisible(secCallback.canDeletePage(page));
    stackPanel.addTool(moveToTrashLink, Align.right);
    if (secCallback.canRestorePage(page)) {
        restoreLink = LinkFactory.createToolLink("restore.page", translate("restore.page"), this);
        restoreLink.setIconLeftCSS("o_icon o_icon-lg o_icon_restore");
        stackPanel.addTool(restoreLink, Align.left);
        deleteLink = LinkFactory.createToolLink("delete.def.page", translate("delete.def.page"), this);
        deleteLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
        deleteLink.setElementCssClass("o_sel_pf_delete_page");
        stackPanel.addTool(deleteLink, Align.left);
    }
}
Also used : LinkPopupSettings(org.olat.core.gui.components.link.LinkPopupSettings) Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 24 with Dropdown

use of org.olat.core.gui.components.dropdown.Dropdown in project openolat by klemens.

the class QuestionItemDetailsController method buildStatusDrowdown.

private Dropdown buildStatusDrowdown() {
    QuestionStatus actualStatus = metadatasCtrl.getItem().getQuestionStatus();
    Dropdown statusDropdown = new Dropdown("process.states", "lifecycle.status." + actualStatus.name(), false, getTranslator());
    statusDropdown.setElementCssClass("o_qpool_tools_status o_qpool_status_" + actualStatus.name());
    statusDropdown.setIconCSS("o_icon o_icon-fw o_icon_qitem_" + actualStatus.name());
    statusDropdown.setOrientation(DropdownOrientation.normal);
    statusDraftLink = LinkFactory.createToolLink("lifecycle.status.draft", translate("lifecycle.status.draft"), this);
    statusDraftLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_draft");
    statusDraftLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_draft");
    statusDraftLink.setVisible(qItemSecurityCallback.canSetDraft() && !QuestionStatus.draft.equals(actualStatus));
    statusDropdown.addComponent(statusDraftLink);
    statusRevisedLink = LinkFactory.createToolLink("lifecycle.status.revised", translate("lifecycle.status.revised"), this);
    statusRevisedLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_revised");
    statusRevisedLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_revised");
    statusRevisedLink.setVisible(qItemSecurityCallback.canSetRevised() && !QuestionStatus.revised.equals(actualStatus));
    statusDropdown.addComponent(statusRevisedLink);
    statusReviewLink = LinkFactory.createToolLink("lifecycle.status.review", translate("lifecycle.status.review"), this);
    statusReviewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_review");
    statusReviewLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_review");
    statusReviewLink.setVisible(qItemSecurityCallback.canSetReview() && !QuestionStatus.review.equals(actualStatus));
    statusDropdown.addComponent(statusReviewLink);
    statusFinalLink = LinkFactory.createToolLink("lifecycle.status.finalVersion", translate("lifecycle.status.finalVersion"), this);
    statusFinalLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_finalVersion");
    statusFinalLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_finalVersion");
    statusFinalLink.setVisible(qItemSecurityCallback.canSetFinal() && !QuestionStatus.finalVersion.equals(actualStatus));
    statusDropdown.addComponent(statusFinalLink);
    statusEndOfLifeLink = LinkFactory.createToolLink("lifecycle.status.endOfLife", translate("lifecycle.status.endOfLife"), this);
    statusEndOfLifeLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_endOfLife");
    statusEndOfLifeLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_endOfLife");
    statusEndOfLifeLink.setVisible(qItemSecurityCallback.canSetEndOfLife() && !QuestionStatus.endOfLife.equals(actualStatus));
    statusDropdown.addComponent(statusEndOfLifeLink);
    return statusDropdown;
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus) Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 25 with Dropdown

use of org.olat.core.gui.components.dropdown.Dropdown in project openolat by klemens.

the class TableOfContentController method forgeSectionRow.

private SectionRow forgeSectionRow(Section section, AssessmentSection assessmentSection, List<Assignment> assignemnts, boolean first, boolean last) {
    String sectionId = "section" + (++counter);
    String title = StringHelper.escapeHtml(section.getTitle());
    List<Assignment> notAssignedAssignments = new ArrayList<>();
    if (secCallback.canViewPendingAssignments(section)) {
        if (assignemnts != null) {
            for (Assignment assignemnt : assignemnts) {
                if (assignemnt.getPage() == null) {
                    notAssignedAssignments.add(assignemnt);
                }
            }
        }
    }
    Link sectionLink = LinkFactory.createCustomLink(sectionId, "open_section", title, Link.LINK | Link.NONTRANSLATED, mainVC, this);
    SectionRow sectionRow = new SectionRow(section, sectionLink, assessmentSection, notAssignedAssignments);
    sectionLink.setUserObject(sectionRow);
    Dropdown editDropdown = new Dropdown(sectionId.concat("_dropdown"), null, false, getTranslator());
    editDropdown.setElementCssClass("o_sel_pf_section_tools");
    editDropdown.setTranslatedLabel("");
    editDropdown.setOrientation(DropdownOrientation.right);
    editDropdown.setIconCSS("o_icon o_icon_actions");
    if (secCallback.canCloseSection(section)) {
        if (SectionStatus.isClosed(section)) {
            Link reopenLink = LinkFactory.createLink(sectionId.concat("_ropens"), "reopen.section", "reopen.section", mainVC, this);
            reopenLink.setUserObject(sectionRow);
            editDropdown.addComponent(reopenLink);
        } else {
            Link closeLink = LinkFactory.createLink(sectionId.concat("_closes"), "close.section", "close.section", mainVC, this);
            closeLink.setUserObject(sectionRow);
            editDropdown.addComponent(closeLink);
        }
        if (section.getEndDate() != null) {
            Link overrideDatesLink = LinkFactory.createLink(sectionId.concat("_overd"), "override.dates.section", "override.dates.section", mainVC, this);
            overrideDatesLink.setUserObject(sectionRow);
            editDropdown.addComponent(overrideDatesLink);
        }
    }
    if (secCallback.canEditSection()) {
        Link editSectionLink = LinkFactory.createLink(sectionId.concat("_edit"), "section.edit", "edit_section", mainVC, this);
        editSectionLink.setIconLeftCSS("o_icon o_icon_edit");
        editSectionLink.setUserObject(sectionRow);
        editDropdown.addComponent(editSectionLink);
        Link deleteSectionLink = LinkFactory.createLink(sectionId.concat("_delete"), "section.delete", "delete_section", mainVC, this);
        deleteSectionLink.setElementCssClass("o_sel_pf_delete_section");
        deleteSectionLink.setIconLeftCSS("o_icon o_icon_delete_item");
        deleteSectionLink.setUserObject(sectionRow);
        editDropdown.addComponent(deleteSectionLink);
        Link upSectionLink = LinkFactory.createCustomLink(sectionId.concat("_up"), "up_section", "", Link.LINK | Link.NONTRANSLATED, mainVC, this);
        upSectionLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_up");
        upSectionLink.setUserObject(sectionRow);
        upSectionLink.setEnabled(!first);
        sectionRow.setUpSectionLink(upSectionLink);
        Link downSectionLink = LinkFactory.createCustomLink(sectionId.concat("_down"), "down_section", "", Link.LINK | Link.NONTRANSLATED, mainVC, this);
        downSectionLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_down");
        downSectionLink.setUserObject(sectionRow);
        downSectionLink.setEnabled(!last);
        sectionRow.setDownSectionLink(downSectionLink);
    }
    if (editDropdown.getComponents().iterator().hasNext()) {
        mainVC.put(editDropdown.getComponentName(), editDropdown);
        sectionRow.setEditDropdown(editDropdown);
    }
    return sectionRow;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) ArrayList(java.util.ArrayList) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) Link(org.olat.core.gui.components.link.Link)

Aggregations

Dropdown (org.olat.core.gui.components.dropdown.Dropdown)28 LinkPopupSettings (org.olat.core.gui.components.link.LinkPopupSettings)10 Spacer (org.olat.core.gui.components.dropdown.Dropdown.Spacer)6 Link (org.olat.core.gui.components.link.Link)6 CourseConfig (org.olat.course.config.CourseConfig)4 ArrayList (java.util.ArrayList)2 Component (org.olat.core.gui.components.Component)2 Tool (org.olat.core.gui.components.stack.TooledStackedPanel.Tool)2 BusinessGroup (org.olat.group.BusinessGroup)2 Assignment (org.olat.modules.portfolio.Assignment)2 QuestionStatus (org.olat.modules.qpool.QuestionStatus)2 RepositoryHandler (org.olat.repository.handlers.RepositoryHandler)2 OrderedRepositoryHandler (org.olat.repository.handlers.RepositoryHandlerFactory.OrderedRepositoryHandler)2