Search in sources :

Example 31 with CourseEditorTreeNode

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();
}
Also used : CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode)

Example 32 with CourseEditorTreeNode

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()));
}
Also used : CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode)

Example 33 with CourseEditorTreeNode

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");
    }
}
Also used : CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode)

Example 34 with CourseEditorTreeNode

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();
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode)

Example 35 with CourseEditorTreeNode

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);
    }
}
Also used : CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CourseNode(org.olat.course.nodes.CourseNode)

Aggregations

CourseEditorTreeNode (org.olat.course.tree.CourseEditorTreeNode)88 CourseNode (org.olat.course.nodes.CourseNode)54 ICourse (org.olat.course.ICourse)38 CourseEditorTreeModel (org.olat.course.tree.CourseEditorTreeModel)24 INode (org.olat.core.util.nodes.INode)22 Test (org.junit.Test)20 RepositoryEntry (org.olat.repository.RepositoryEntry)18 Identity (org.olat.core.id.Identity)14 TreeVisitor (org.olat.core.util.tree.TreeVisitor)14 Visitor (org.olat.core.util.tree.Visitor)14 CourseNodeVO (org.olat.restapi.support.vo.CourseNodeVO)12 TreeNode (org.olat.core.gui.components.tree.TreeNode)10 STCourseNode (org.olat.course.nodes.STCourseNode)10 ArrayList (java.util.ArrayList)9 File (java.io.File)8 URI (java.net.URI)8 HttpResponse (org.apache.http.HttpResponse)8 HttpPut (org.apache.http.client.methods.HttpPut)8 Structure (org.olat.course.Structure)8 BCCourseNode (org.olat.course.nodes.BCCourseNode)8