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