Search in sources :

Example 31 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.

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 32 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.

the class EditorMainController method doCreateAlternateBuildingBlock.

/**
 * The following operation are done:
 * <ul>
 * 	<li>create a new instance of the replacement type
 * 	<li>add the new element below the original element
 * 	<li>copy the element title, description and the generic configuration options
 * 	<li>copy the access, visibility and scoring rules (easy and expert)
 * 	<li>optionally copy some other configuration if this is possible at all
 * 	<li>move all child elements from the original to the replacement element
 * 	<li>mark the original element as deleted
 * </ul>
 *
 * @param chosenNode
 * @param selectAlternative
 */
private void doCreateAlternateBuildingBlock(UserRequest ureq, ICourse course, CourseNode chosenNode, String selectAlternative) {
    if (!StringHelper.containsNonWhitespace(selectAlternative))
        return;
    // create the alternative node
    CourseNodeConfiguration newConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(selectAlternative);
    CourseNode newNode = newConfig.getInstance();
    // copy configurations
    chosenNode.copyConfigurationTo(newNode, course);
    // insert the node
    CourseEditorTreeNode cetn = (CourseEditorTreeNode) cetm.getNodeById(chosenNode.getIdent());
    CourseEditorTreeNode parentNode = (CourseEditorTreeNode) cetn.getParent();
    int position = cetn.getPosition() + 1;
    CourseEditorTreeNode newCetn = course.getEditorTreeModel().insertCourseNodeAt(newNode, parentNode.getCourseNode(), position);
    doInsert(ureq, newNode);
    // copy the children
    while (cetn.getChildCount() > 0) {
        CourseEditorTreeNode childNode = (CourseEditorTreeNode) cetn.getChildAt(0);
        newCetn.addChild(childNode);
    }
    // set all dirty
    TreeVisitor tv = new TreeVisitor(new Visitor() {

        public void visit(INode node) {
            ((CourseEditorTreeNode) node).setDirty(true);
        }
    }, newCetn, true);
    tv.visitAll();
    // mark as deleted
    doDelete(course, chosenNode.getIdent());
    // save
    CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());
}
Also used : TreeVisitor(org.olat.core.util.tree.TreeVisitor) INode(org.olat.core.util.nodes.INode) TreeVisitor(org.olat.core.util.tree.TreeVisitor) Visitor(org.olat.core.util.tree.Visitor) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration) CourseNode(org.olat.course.nodes.CourseNode)

Example 33 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.

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 34 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.

the class CheckListStepRunnerCallback method createCourseNode.

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

Example 35 with CourseNodeConfiguration

use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.

the class AdditionalConditionManager method nextUserInputController.

/**
 * used to get the gui element for the next condition that a user can influence or sees a more detailed error-message in
 * call only if the evaluateCondtions() call answered with false or null
 * @param ureq
 * @param wControl
 * @return null if either nothing is wrong or the user is unable to influence the condition in olat (and won't get a more detailed error-message)
 */
public Controller nextUserInputController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv) {
    for (AdditionalCondition cond : node.getAdditionalConditions()) {
        cond.setNode(node);
        cond.setCourseId(courseId);
        boolean retVal = cond.evaluate(answers);
        if (!retVal) {
            Controller ctrl = cond.getUserInputController(ureq, wControl, userCourseEnv);
            CourseNodeConfiguration config = CourseNodeFactory.getInstance().getCourseNodeConfiguration(node.getType());
            return TitledWrapperHelper.getWrapper(ureq, wControl, ctrl, node, config.getIconCSSClass());
        }
    }
    return null;
}
Also used : CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration) Controller(org.olat.core.gui.control.Controller)

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