Search in sources :

Example 1 with EditorMainController

use of org.olat.course.editor.EditorMainController in project OpenOLAT by OpenOLAT.

the class CourseRuntimeController method doEdit.

@Override
protected void doEdit(UserRequest ureq) {
    if ((reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR))) {
        removeCustomCSS();
        popToRoot(ureq);
        cleanUp();
        CourseNode currentCourseNode = getCurrentCourseNode();
        WindowControl bwControl = getSubWindowControl("Editor");
        EditorMainController ctrl = CourseFactory.createEditorController(ureq, addToHistory(ureq, bwControl), toolbarPanel, getRepositoryEntry(), currentCourseNode);
        // user activity logger which was initialized with course run
        if (ctrl != null) {
            editorCtrl = pushController(ureq, "Editor", ctrl);
            listenTo(editorCtrl);
            setIsInEditor(true);
            currentToolCtr = editorCtrl;
            setActiveTool(editLink);
        }
    }
}
Also used : ENCourseNode(org.olat.course.nodes.ENCourseNode) CourseNode(org.olat.course.nodes.CourseNode) WindowControl(org.olat.core.gui.control.WindowControl) EditorMainController(org.olat.course.editor.EditorMainController)

Example 2 with EditorMainController

use of org.olat.course.editor.EditorMainController in project OpenOLAT by OpenOLAT.

the class ModifyCourseEvent method createEditorController.

/**
 * Create an editor controller for the given course resourceable
 *
 * @param ureq
 * @param wControl
 * @param courseEntry
 * @return editor controller for the given course resourceable; if the editor
 *         is already locked, it returns a controller with a lock message
 */
public static EditorMainController createEditorController(UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar, RepositoryEntry courseEntry, CourseNode selectedNode) {
    ICourse course = loadCourse(courseEntry);
    EditorMainController emc = new EditorMainController(ureq, wControl, toolbar, course, selectedNode);
    if (emc.getLockEntry() == null) {
        Translator translator = Util.createPackageTranslator(RunMainController.class, ureq.getLocale());
        wControl.setWarning(translator.translate("error.editoralreadylocked", new String[] { "?" }));
        return null;
    } else if (!emc.getLockEntry().isSuccess()) {
        // get i18n from the course runmaincontroller to say that this editor is
        // already locked by another person
        Translator translator = Util.createPackageTranslator(RunMainController.class, ureq.getLocale());
        String lockerName = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(emc.getLockEntry().getOwner());
        wControl.setWarning(translator.translate("error.editoralreadylocked", new String[] { lockerName }));
        return null;
    }
    // set the logger if editor is started
    // since 5.2 groups / areas can be created from the editor -> should be logged.
    emc.addLoggingResourceable(LoggingResourceable.wrap(course));
    return emc;
}
Also used : Translator(org.olat.core.gui.translator.Translator) RunMainController(org.olat.course.run.RunMainController) EditorMainController(org.olat.course.editor.EditorMainController)

Example 3 with EditorMainController

use of org.olat.course.editor.EditorMainController in project openolat by klemens.

the class CourseRuntimeController method doEdit.

@Override
protected void doEdit(UserRequest ureq) {
    if ((reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR))) {
        removeCustomCSS();
        popToRoot(ureq);
        cleanUp();
        CourseNode currentCourseNode = getCurrentCourseNode();
        WindowControl bwControl = getSubWindowControl("Editor");
        EditorMainController ctrl = CourseFactory.createEditorController(ureq, addToHistory(ureq, bwControl), toolbarPanel, getRepositoryEntry(), currentCourseNode);
        // user activity logger which was initialized with course run
        if (ctrl != null) {
            editorCtrl = pushController(ureq, "Editor", ctrl);
            listenTo(editorCtrl);
            setIsInEditor(true);
            currentToolCtr = editorCtrl;
            setActiveTool(editLink);
        }
    }
}
Also used : ENCourseNode(org.olat.course.nodes.ENCourseNode) CourseNode(org.olat.course.nodes.CourseNode) WindowControl(org.olat.core.gui.control.WindowControl) EditorMainController(org.olat.course.editor.EditorMainController)

Example 4 with EditorMainController

use of org.olat.course.editor.EditorMainController in project openolat by klemens.

the class ModifyCourseEvent method createEditorController.

/**
 * Create an editor controller for the given course resourceable
 *
 * @param ureq
 * @param wControl
 * @param courseEntry
 * @return editor controller for the given course resourceable; if the editor
 *         is already locked, it returns a controller with a lock message
 */
public static EditorMainController createEditorController(UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar, RepositoryEntry courseEntry, CourseNode selectedNode) {
    ICourse course = loadCourse(courseEntry);
    EditorMainController emc = new EditorMainController(ureq, wControl, toolbar, course, selectedNode);
    if (emc.getLockEntry() == null) {
        Translator translator = Util.createPackageTranslator(RunMainController.class, ureq.getLocale());
        wControl.setWarning(translator.translate("error.editoralreadylocked", new String[] { "?" }));
        return null;
    } else if (!emc.getLockEntry().isSuccess()) {
        // get i18n from the course runmaincontroller to say that this editor is
        // already locked by another person
        Translator translator = Util.createPackageTranslator(RunMainController.class, ureq.getLocale());
        String lockerName = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(emc.getLockEntry().getOwner());
        wControl.setWarning(translator.translate("error.editoralreadylocked", new String[] { lockerName }));
        return null;
    }
    // set the logger if editor is started
    // since 5.2 groups / areas can be created from the editor -> should be logged.
    emc.addLoggingResourceable(LoggingResourceable.wrap(course));
    return emc;
}
Also used : Translator(org.olat.core.gui.translator.Translator) RunMainController(org.olat.course.run.RunMainController) EditorMainController(org.olat.course.editor.EditorMainController)

Aggregations

EditorMainController (org.olat.course.editor.EditorMainController)4 WindowControl (org.olat.core.gui.control.WindowControl)2 Translator (org.olat.core.gui.translator.Translator)2 CourseNode (org.olat.course.nodes.CourseNode)2 ENCourseNode (org.olat.course.nodes.ENCourseNode)2 RunMainController (org.olat.course.run.RunMainController)2