Search in sources :

Example 21 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project OpenOLAT by OpenOLAT.

the class QTIStatisticResourceResult method createAssessmentController.

private Controller createAssessmentController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, boolean printMode) {
    Controller ctrl;
    if (type == null) {
        Translator translator = Util.createPackageTranslator(QTI12AssessmentStatisticsController.class, ureq.getLocale());
        String text = translator.translate("error.notfound.text");
        ctrl = MessageUIFactory.createErrorMessage(ureq, wControl, null, text);
    } else if (type == QTIType.onyx) {
        ctrl = new QTI21OnyxAssessmentStatisticsController(ureq, wControl, this, printMode);
    } else {
        ctrl = new QTI12AssessmentStatisticsController(ureq, wControl, stackPanel, this, printMode);
    }
    CourseNodeConfiguration cnConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType());
    String iconCssClass = cnConfig.getIconCSSClass();
    return TitledWrapperHelper.getWrapper(ureq, wControl, ctrl, courseNode, iconCssClass);
}
Also used : QTI21OnyxAssessmentStatisticsController(org.olat.ims.qti.statistics.ui.QTI21OnyxAssessmentStatisticsController) Translator(org.olat.core.gui.translator.Translator) CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration) QTI21OnyxAssessmentStatisticsController(org.olat.ims.qti.statistics.ui.QTI21OnyxAssessmentStatisticsController) QTI12ItemStatisticsController(org.olat.ims.qti.statistics.ui.QTI12ItemStatisticsController) Controller(org.olat.core.gui.control.Controller) QTI12AssessmentStatisticsController(org.olat.ims.qti.statistics.ui.QTI12AssessmentStatisticsController) QTI12AssessmentStatisticsController(org.olat.ims.qti.statistics.ui.QTI12AssessmentStatisticsController)

Example 22 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project OpenOLAT by OpenOLAT.

the class PublishProcess method assemblePublishConfirmation.

String assemblePublishConfirmation() {
    List<String> nodeIdsToPublish = originalNodeIdsToPublish;
    StringBuilder msg = new StringBuilder();
    OLATResourceable courseRunOres = OresHelper.createOLATResourceableInstance(RunMainController.ORES_TYPE_COURSE_RUN, repositoryEntry.getOlatResource().getResourceableId());
    // -1: Remove myself from list
    int cnt = CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres) - 1;
    if (cnt > 0) {
        msg.append(translate("pbl.confirm.users", String.valueOf(cnt)));
    } else {
        msg.append(translator.translate("pbl.confirm"));
    }
    if (nodeIdsToPublish != null && nodeIdsToPublish.size() > 0) {
        msg.append("<ul class='list-unstyled'>");
        CourseEditorTreeModel cetm = course.getEditorTreeModel();
        for (int i = 0; i < nodeIdsToPublish.size(); i++) {
            msg.append("<li>");
            String nodeId = nodeIdsToPublish.get(i);
            CourseEditorTreeNode cetn = (CourseEditorTreeNode) cetm.getNodeById(nodeId);
            CourseNode cn = cetm.getCourseNode(nodeId);
            if (cetn.isDeleted() && !cetn.isNewnode()) {
                msg.append("<i class='o_icon o_icon_delete_item'> </i> ");
            } else {
                CourseNodeConfiguration nodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(cn.getType());
                if (nodeConfig != null) {
                    msg.append("<i class='o_icon ").append(nodeConfig.getIconCSSClass()).append("'> </i> ");
                }
            }
            msg.append(cn.getShortTitle()).append("</li>");
        }
        msg.append("</ul>");
    }
    return msg.toString();
}
Also used : CourseEditorTreeModel(org.olat.course.tree.CourseEditorTreeModel) OLATResourceable(org.olat.core.id.OLATResourceable) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CourseNode(org.olat.course.nodes.CourseNode) CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration)

Example 23 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project OpenOLAT by OpenOLAT.

the class EditorMainController method initNodeEditor.

/**
 * Initializes the node edit tabbed pane and its controller for this
 * particular node
 *
 * @param ureq
 * @param chosenNode
 * @param groupMgr
 */
private void initNodeEditor(UserRequest ureq, CourseNode chosenNode) {
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    tabbedNodeConfig.removeAll();
    // dispose old one, if there was one
    removeAsListenerAndDispose(nodeEditCntrllr);
    String type = chosenNode.getType();
    CourseNodeConfiguration cnConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(type);
    if (cnConfig.isEnabled()) {
        nodeEditCntrllr = chosenNode.createEditController(ureq, getWindowControl(), stackPanel, course, euce);
        listenTo(nodeEditCntrllr);
        nodeEditCntrllr.addTabs(tabbedNodeConfig);
    }
    boolean disabled = !cnConfig.isEnabled();
    boolean deprecated = cnConfig.isDeprecated();
    main.contextPut("courseNodeDisabled", disabled);
    main.contextPut("courseNodeDeprecated", deprecated);
    alternativeLink.setVisible((disabled || deprecated) && !cnConfig.getAlternativeCourseNodes().isEmpty());
    alternativeLink.setUserObject(chosenNode);
    String nodeCssClass = null;
    if (this.cetm.getRootNode().getIdent().equals(chosenNode.getIdent())) {
        // Special case for root node
        nodeCssClass = "o_CourseModule_icon";
    } else {
        nodeCssClass = cnConfig.getIconCSSClass();
    }
    main.contextPut("courseNodeCss", nodeCssClass);
    main.contextPut("courseNode", chosenNode);
}
Also used : ICourse(org.olat.course.ICourse) CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration)

Example 24 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project OpenOLAT by OpenOLAT.

the class MultiSPController method createCourseNode.

private CourseNode createCourseNode(VFSItem item, String type) {
    CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type);
    CourseNode newNode = newNodeConfig.getInstance();
    newNode.setShortTitle(item.getName());
    newNode.setLearningObjectives(item.getName());
    newNode.setNoAccessExplanation("You don't have access");
    return newNode;
}
Also used : CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration) CourseNode(org.olat.course.nodes.CourseNode)

Example 25 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project OpenOLAT by OpenOLAT.

the class ChooseNodeController method doCreateNode.

private void doCreateNode(String type) {
    ICourse course = CourseFactory.getCourseEditSession(courseOres.getResourceableId());
    // user chose a position to insert a new node
    CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type);
    createdNode = newNodeConfig.getInstance();
    // Set some default values
    String title = new String(newNodeConfig.getLinkText(getLocale()));
    createdNode.setShortTitle(title);
    createdNode.setNoAccessExplanation(translate("form.noAccessExplanation.default"));
    // Insert it now
    CourseEditorTreeModel editorTreeModel = course.getEditorTreeModel();
    if (editorTreeModel.getRootNode().equals(currentNode)) {
        // root, add as last child
        int pos = currentNode.getChildCount();
        CourseNode selectedNode = currentNode.getCourseNode();
        editorTreeModel.insertCourseNodeAt(createdNode, selectedNode, pos);
    } else {
        CourseEditorTreeNode parentNode = (CourseEditorTreeNode) currentNode.getParent();
        CourseNode selectedNode = parentNode.getCourseNode();
        int pos = currentNode.getPosition();
        editorTreeModel.insertCourseNodeAt(createdNode, selectedNode, pos + 1);
    }
    CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());
}
Also used : CourseEditorTreeModel(org.olat.course.tree.CourseEditorTreeModel) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) ICourse(org.olat.course.ICourse) CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration) CourseNode(org.olat.course.nodes.CourseNode)

Aggregations

CourseNodeConfiguration (org.olat.course.nodes.CourseNodeConfiguration)38 CourseNode (org.olat.course.nodes.CourseNode)16 ICourse (org.olat.course.ICourse)10 CourseEditorTreeNode (org.olat.course.tree.CourseEditorTreeNode)8 Controller (org.olat.core.gui.control.Controller)6 CourseEditorTreeModel (org.olat.course.tree.CourseEditorTreeModel)6 ArrayList (java.util.ArrayList)4 UriBuilder (javax.ws.rs.core.UriBuilder)4 HttpResponse (org.apache.http.HttpResponse)4 HttpGet (org.apache.http.client.methods.HttpGet)4 Before (org.junit.Before)4 Test (org.junit.Test)4 PublisherData (org.olat.core.commons.services.notifications.PublisherData)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)4 SubscriptionInfoVO (org.olat.core.commons.services.notifications.restapi.vo.SubscriptionInfoVO)4 SubscriptionListItemVO (org.olat.core.commons.services.notifications.restapi.vo.SubscriptionListItemVO)4 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)4 Identity (org.olat.core.id.Identity)4 STCourseNode (org.olat.course.nodes.STCourseNode)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4