Search in sources :

Example 6 with RunMainController

use of org.olat.course.run.RunMainController 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

RunMainController (org.olat.course.run.RunMainController)6 WindowControl (org.olat.core.gui.control.WindowControl)4 Translator (org.olat.core.gui.translator.Translator)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 RepositoryManager (org.olat.repository.RepositoryManager)4 RepositoryService (org.olat.repository.RepositoryService)4 RepositoryEntrySecurity (org.olat.repository.model.RepositoryEntrySecurity)4 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 UserRequest (org.olat.core.gui.UserRequest)2 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)2 Controller (org.olat.core.gui.control.Controller)2 MainLayoutController (org.olat.core.gui.control.generic.layout.MainLayoutController)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 StateSite (org.olat.core.id.context.StateSite)2 UserSession (org.olat.core.util.UserSession)2 ICourse (org.olat.course.ICourse)2 AssessmentMode (org.olat.course.assessment.AssessmentMode)2 EditorMainController (org.olat.course.editor.EditorMainController)2 CourseNode (org.olat.course.nodes.CourseNode)2 CourseRuntimeController (org.olat.course.run.CourseRuntimeController)2