use of org.olat.course.tree.CourseEditorTreeNode in project OpenOLAT by OpenOLAT.
the class EditorMainController method launchSinglePagesWizard.
private void launchSinglePagesWizard(UserRequest ureq, ICourse course) {
removeAsListenerAndDispose(multiSPChooserCtr);
removeAsListenerAndDispose(cmc);
VFSContainer rootContainer = course.getCourseEnvironment().getCourseFolderContainer();
CourseEditorTreeNode selectedNode = (CourseEditorTreeNode) menuTree.getSelectedNode();
multiSPChooserCtr = new MultiSPController(ureq, getWindowControl(), rootContainer, ores, selectedNode);
listenTo(multiSPChooserCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), multiSPChooserCtr.getInitialComponent(), true, translate("multi.sps.title"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.course.tree.CourseEditorTreeNode in project OpenOLAT by OpenOLAT.
the class EditorMainController method updateViewForSelectedNodeId.
/**
* helper to update menu tree, content area, tools to a selected tree node
* @param ureq
* @param nodeId
*/
private void updateViewForSelectedNodeId(UserRequest ureq, String nodeId) {
CourseEditorTreeNode cetn = (CourseEditorTreeNode) cetm.getNodeById(nodeId);
// udpate the current node in the course editor environment
euce.getCourseEditorEnv().setCurrentCourseNodeId(nodeId);
if (cetn.isDeleted()) {
tabbedNodeConfig.setVisible(false);
deleteNodeLink.setEnabled(false);
moveNodeLink.setEnabled(false);
copyNodeLink.setEnabled(false);
if (((CourseEditorTreeNode) cetn.getParent()).isDeleted()) {
main.setPage(VELOCITY_ROOT + "/deletednode.html");
} else {
main.setPage(VELOCITY_ROOT + "/undeletenode.html");
}
} else {
tabbedNodeConfig.setVisible(true);
deleteNodeLink.setEnabled(true);
moveNodeLink.setEnabled(true);
copyNodeLink.setEnabled(true);
initNodeEditor(ureq, cetn.getCourseNode());
main.setPage(VELOCITY_ROOT + "/index.html");
}
}
use of org.olat.course.tree.CourseEditorTreeNode in project OpenOLAT by OpenOLAT.
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.tree.CourseEditorTreeNode in project OpenOLAT by OpenOLAT.
the class EditorMainController method doUndelete.
private void doUndelete(UserRequest ureq, ICourse course) {
String ident = menuTree.getSelectedNode().getIdent();
CourseEditorTreeNode activeNode = (CourseEditorTreeNode) cetm.getNodeById(ident);
euce.getCourseEditorEnv().setCurrentCourseNodeId(activeNode.getIdent());
CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());
cetm.markUnDeleted(activeNode);
menuTree.setDirty(true);
// show edit panels again
initNodeEditor(ureq, activeNode.getCourseNode());
tabbedNodeConfig.setVisible(true);
deleteNodeLink.setEnabled(true);
moveNodeLink.setEnabled(true);
copyNodeLink.setEnabled(true);
main.setPage(VELOCITY_ROOT + "/index.html");
// validate course and update course status
euce.getCourseEditorEnv().validateCourse();
StatusDescription[] courseStatus = euce.getCourseEditorEnv().getCourseStatus();
updateCourseStatusMessages(ureq.getLocale(), courseStatus);
// do logging
ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_NODE_RESTORED, getClass(), LoggingResourceable.wrap(activeNode.getCourseNode()));
}
use of org.olat.course.tree.CourseEditorTreeNode in project OpenOLAT by OpenOLAT.
the class MoveCopySubtreeController method recursiveCopy.
private void recursiveCopy(CourseEditorTreeNode copyFrom2, CourseEditorTreeNode insertParent, int pos, boolean firstIteration, ICourse course) {
// create copy of course node
CourseNode copyOfNode = copyFrom2.getCourseNode().createInstanceForCopy(firstIteration, course, getIdentity());
copyNodeId = copyOfNode.getIdent();
// Insert at desired position
course.getEditorTreeModel().insertCourseNodeAt(copyOfNode, insertParent.getCourseNode(), pos);
CourseEditorTreeNode insertedEditorTreeNode = course.getEditorTreeModel().getCourseEditorNodeById(copyOfNode.getIdent());
for (int i = 0; i < copyFrom2.getChildCount(); i++) {
recursiveCopy(course.getEditorTreeModel().getCourseEditorNodeById(copyFrom2.getChildAt(i).getIdent()), insertedEditorTreeNode, i, false, course);
}
}
Aggregations