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);
}
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());
}
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;
}
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;
}
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;
}
Aggregations