Search in sources :

Example 16 with Dropdown

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

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 17 with Dropdown

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

the class PublishController method initTools.

@Override
public void initTools() {
    if (secCallback.canEditAccessRights(binder)) {
        accessDropdown = new Dropdown("access.rights", "access.rights", false, getTranslator());
        accessDropdown.setIconCSS("o_icon o_icon-fw o_icon_new_portfolio");
        accessDropdown.setElementCssClass("o_sel_pf_access");
        accessDropdown.setOrientation(DropdownOrientation.right);
        addAccessRightsLink = LinkFactory.createToolLink("add.member", translate("add.member"), this);
        addAccessRightsLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
        addAccessRightsLink.setElementCssClass("o_sel_pf_access_member");
        accessDropdown.addComponent(addAccessRightsLink);
        if (loginModule.isInvitationEnabled()) {
            addInvitationLink = LinkFactory.createToolLink("add.invitation", translate("add.invitation"), this);
            addInvitationLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
            addInvitationLink.setElementCssClass("o_sel_pf_access_invitation");
            accessDropdown.addComponent(addInvitationLink);
        }
        stackPanel.addTool(accessDropdown, Align.right);
    }
}
Also used : Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 18 with Dropdown

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

the class AuthorListController method initTools.

protected void initTools() {
    if (!withSearch && hasAuthorRight) {
        importLink = LinkFactory.createLink("cmd.import.ressource", getTranslator(), this);
        importLink.setDomReplacementWrapperRequired(false);
        importLink.setIconLeftCSS("o_icon o_icon_import");
        importLink.setElementCssClass("o_sel_author_import");
        stackPanel.addTool(importLink, Align.left);
        List<OrderedRepositoryHandler> handlers = repositoryHandlerFactory.getOrderRepositoryHandlers();
        createDropdown = new Dropdown("cmd.create.ressource", "cmd.create.ressource", false, getTranslator());
        createDropdown.setElementCssClass("o_sel_author_create");
        createDropdown.setIconCSS("o_icon o_icon_add");
        int lastGroup = 0;
        for (OrderedRepositoryHandler orderedHandler : handlers) {
            RepositoryHandler handler = orderedHandler.getHandler();
            if (handler != null && handler.isCreate()) {
                // for each 10-group, create a separator
                int group = orderedHandler.getOrder() / 10;
                if (group > lastGroup) {
                    createDropdown.addComponent(new Spacer("spacer" + orderedHandler.getOrder()));
                    lastGroup = group;
                }
                addCreateLink(handler, createDropdown);
            }
        }
        stackPanel.addTool(createDropdown, Align.left);
    }
}
Also used : Spacer(org.olat.core.gui.components.dropdown.Dropdown.Spacer) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) OrderedRepositoryHandler(org.olat.repository.handlers.RepositoryHandlerFactory.OrderedRepositoryHandler) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) OrderedRepositoryHandler(org.olat.repository.handlers.RepositoryHandlerFactory.OrderedRepositoryHandler)

Example 19 with Dropdown

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

the class TooledStackedPanelRenderer method renderTools.

private void renderTools(List<Tool> tools, Renderer renderer, StringOutput sb, String[] args) {
    int numOfTools = tools.size();
    for (int i = 0; i < numOfTools; i++) {
        Tool tool = tools.get(i);
        Component cmp = tool.getComponent();
        String cssClass = tool.getToolCss();
        if (cssClass == null) {
            // use defaults
            if (cmp instanceof Dropdown) {
                cssClass = "o_tool_dropdown dropdown";
            } else if (cmp instanceof Link && !cmp.isEnabled()) {
                cssClass = "o_text";
            } else {
                cssClass = "o_tool";
            }
        }
        sb.append("<li class='").append(cssClass).append("'>");
        renderer.render(cmp, sb, args);
        sb.append("</li>");
    }
}
Also used : Dropdown(org.olat.core.gui.components.dropdown.Dropdown) Component(org.olat.core.gui.components.Component) Link(org.olat.core.gui.components.link.Link) Tool(org.olat.core.gui.components.stack.TooledStackedPanel.Tool)

Example 20 with Dropdown

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

the class CourseRuntimeController method initToolsMyCourse.

private void initToolsMyCourse(ICourse course, UserCourseEnvironmentImpl uce) {
    boolean assessmentLock = isAssessmentLock();
    myCourse = new Dropdown("myCourse", "header.tools.mycourse", false, getTranslator());
    myCourse.setElementCssClass("dropdown-menu-right");
    myCourse.setIconCSS("o_icon o_icon_user");
    // Personal tools on right side
    CourseConfig cc = course.getCourseConfig();
    if ((course.hasAssessableNodes() || cc.isCertificateEnabled()) && !isGuestOnly && !assessmentLock && uce != null) {
        // link to efficiency statements should
        // - not appear when not configured in course configuration
        // - not appear when configured in course configuration but no assessable
        // node exist
        // - appear but dimmed when configured, assessable node exist but no
        // assessment data exists for user
        // - appear as link when configured, assessable node exist and assessment
        // data exists for user
        efficiencyStatementsLink = LinkFactory.createToolLink("efficiencystatement", translate("command.efficiencystatement"), this, "o_icon_certificate");
        efficiencyStatementsLink.setVisible(cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled());
        myCourse.addComponent(efficiencyStatementsLink);
        if (cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled()) {
            boolean certification = uce.hasEfficiencyStatementOrCertificate(false);
            efficiencyStatementsLink.setVisible(certification);
        }
    }
    if (!isGuestOnly && !assessmentLock) {
        noteLink = LinkFactory.createToolLink("personalnote", translate("command.personalnote"), this, "o_icon_notes");
        noteLink.setPopup(new LinkPopupSettings(750, 550, "notes"));
        myCourse.addComponent(noteLink);
    }
    if (allowBookmark && !isGuestOnly) {
        boolean marked = markManager.isMarked(getRepositoryEntry(), getIdentity(), null);
        String css = marked ? Mark.MARK_CSS_ICON : Mark.MARK_ADD_CSS_ICON;
        bookmarkLink = LinkFactory.createToolLink("bookmark", translate("command.bookmark"), this, css);
        bookmarkLink.setTitle(translate(marked ? "details.bookmark.remove" : "details.bookmark"));
        myCourse.addComponent(bookmarkLink);
    }
    if (uce != null) {
        if (myCourse.size() > 0 && (uce.getCoachedGroups().size() > 0 || uce.getParticipatingGroups().size() > 0 || uce.getWaitingLists().size() > 0)) {
            myCourse.addComponent(new Spacer(""));
        }
        // 2) add coached groups
        if (uce.getCoachedGroups().size() > 0) {
            for (BusinessGroup group : uce.getCoachedGroups()) {
                Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
                link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
                link.setUserObject(group);
                link.setEnabled(!assessmentLock);
                myCourse.addComponent(link);
            }
        }
        // 3) add participating groups
        if (uce.getParticipatingGroups().size() > 0) {
            for (BusinessGroup group : uce.getParticipatingGroups()) {
                Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
                link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
                link.setUserObject(group);
                link.setEnabled(!assessmentLock);
                myCourse.addComponent(link);
            }
        }
        // 5) add waiting-list groups
        if (uce.getWaitingLists().size() > 0) {
            for (BusinessGroup group : uce.getWaitingLists()) {
                int pos = businessGroupService.getPositionInWaitingListFor(getIdentity(), group);
                String name = StringHelper.escapeHtml(group.getName()) + " (" + pos + ")";
                Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", name, this);
                link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
                link.setUserObject(group);
                link.setEnabled(false);
                myCourse.addComponent(link);
            }
        }
        if (repositoryService.isParticipantAllowedToLeave(getRepositoryEntry()) && !assessmentLock && !roles.isGuestOnly() && !uce.isCourseReadOnly() && isAllowedToLeave(uce)) {
            leaveLink = LinkFactory.createToolLink("sign.out", "leave", translate("sign.out"), this);
            leaveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_sign_out");
            myCourse.addComponent(new Spacer("leaving-space"));
            myCourse.addComponent(leaveLink);
        }
    }
    if (myCourse.size() > 0) {
        toolbarPanel.addTool(myCourse, Align.right);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) Spacer(org.olat.core.gui.components.dropdown.Dropdown.Spacer) LinkPopupSettings(org.olat.core.gui.components.link.LinkPopupSettings) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) Link(org.olat.core.gui.components.link.Link) CourseConfig(org.olat.course.config.CourseConfig)

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