use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
the class NodeExportVisitor method visit.
/**
* Visitor pattern to delete the course nodes
*
* @see org.olat.core.util.tree.Visitor#visit(org.olat.core.util.nodes.INode)
*/
public void visit(INode node) {
CourseEditorTreeNode cNode = (CourseEditorTreeNode) node;
cNode.getCourseNode().exportNode(exportDirectory, course);
// OLAT-5368: do frequent intermediate commits to avoid transaction timeout
// discussion intermediatecommit vs increased transaction timeout:
// pro intermediatecommit: not much
// pro increased transaction timeout: would fix OLAT-5368 but only move the problem
// @TODO OLAT-2597: real solution is a long-running background-task concept...
DBFactory.getInstance().intermediateCommit();
}
use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
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 klemens.
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 klemens.
the class EditorMainController method doMove.
private void doMove(UserRequest ureq, ICourse course, boolean copy) {
if (moveCopyController != null)
return;
TreeNode tn = menuTree.getSelectedNode();
if (tn == null) {
showError(NLS_MOVECOPYNODE_ERROR_SELECTFIRST);
return;
}
if (tn.getParent() == null) {
showError(NLS_MOVECOPYNODE_ERROR_ROOTNODE);
return;
}
removeAsListenerAndDispose(moveCopyController);
removeAsListenerAndDispose(cmc);
CourseEditorTreeNode cetn = cetm.getCourseEditorNodeById(tn.getIdent());
moveCopyController = new MoveCopySubtreeController(ureq, getWindowControl(), course, cetn, copy);
listenTo(moveCopyController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), moveCopyController.getInitialComponent(), true, translate(NLS_INSERTNODE_TITLE));
listenTo(cmc);
cmc.activate();
}
use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
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