Search in sources :

Example 6 with CourseEditorTreeNode

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

Example 7 with CourseEditorTreeNode

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

Example 8 with CourseEditorTreeNode

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());
}
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 9 with CourseEditorTreeNode

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

Example 10 with CourseEditorTreeNode

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