Search in sources :

Example 11 with Dropdown

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

the class QuestionItemDetailsController method initCommandTools.

private void initCommandTools() {
    Dropdown commandDropdown = new Dropdown("commands", "commands", false, getTranslator());
    commandDropdown.setIconCSS("o_icon o_icon-fw o_icon_qitem_commands");
    commandDropdown.setOrientation(DropdownOrientation.normal);
    stackPanel.addTool(commandDropdown, Align.left);
    copyItemLink = LinkFactory.createToolLink("copy", translate("copy"), this);
    copyItemLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_copy");
    commandDropdown.addComponent(copyItemLink);
    if (QTIConstants.QTI_12_FORMAT.equals(metadatasCtrl.getItem().getFormat())) {
        convertItemLink = LinkFactory.createToolLink("convert", translate("convert.item"), this);
        convertItemLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_convert");
        commandDropdown.addComponent(convertItemLink);
    }
    if (qItemSecurityCallback.canDelete()) {
        deleteLink = LinkFactory.createToolLink("delete.item", translate("delete.item"), this);
        deleteLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_delete");
        commandDropdown.addComponent(deleteLink);
    }
}
Also used : Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 12 with Dropdown

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

the class RepositoryEntryRuntimeController method initToolbar.

protected final void initToolbar() {
    tools = new Dropdown("toolbox.tools", "toolbox.tools", false, getTranslator());
    tools.setElementCssClass("o_sel_repository_tools");
    tools.setIconCSS("o_icon o_icon_tools");
    String resourceType = re.getOlatResource().getResourceableTypeName();
    String name = NewControllerFactory.translateResourceableTypeName(resourceType, getLocale());
    settings = new Dropdown("settings", "toolbox.settings", false, getTranslator());
    settings.setTranslatedLabel(name);
    settings.setElementCssClass("o_sel_course_settings");
    settings.setIconCSS("o_icon o_icon_actions");
    initToolbar(tools, settings);
    if (tools.size() > 0) {
        toolbarPanel.addTool(tools, Align.left, true);
    }
    if (settings.size() > 0) {
        toolbarPanel.addTool(settings, Align.left, true);
    }
}
Also used : Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 13 with Dropdown

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

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

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

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

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

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