try {
ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_OPEN, getClass());
if (lockEntry.isSuccess()) {
ICourse course = CourseFactory.openCourseEditSession(ores.getResourceableId());
main = createVelocityContainer("index");
undelButton = LinkFactory.createButton("undeletenode.button", main, this);
keepClosedErrorButton = LinkFactory.createCustomLink("keepClosedErrorButton", CMD_KEEPCLOSED_ERROR, "keep.closed", Link.BUTTON_SMALL, main, this);
keepOpenErrorButton = LinkFactory.createCustomLink("keepOpenErrorButton", CMD_KEEPOPEN_ERROR, "keep.open", Link.BUTTON_SMALL, main, this);
keepClosedWarningButton = LinkFactory.createCustomLink("keepClosedWarningButton", CMD_KEEPCLOSED_WARNING, "keep.closed", Link.BUTTON_SMALL, main, this);
keepOpenWarningButton = LinkFactory.createCustomLink("keepOpenWarningButton", CMD_KEEPOPEN_WARNING, "keep.open", Link.BUTTON_SMALL, main, this);
// set the custom course css
enableCustomCss(ureq);
menuTree = new MenuTree("luTree");
/*
* create editor user course environment for enhanced syntax/semantic
* checks. Initialize it with the current course node id, which is not set
* yet. Furthermore the course is refreshed, e.g. as it get's loaded by
* XSTREAM constructors are not called, but transient data must be
* caculated and initialized
*/
cetm = CourseFactory.getCourseEditSession(ores.getResourceableId()).getEditorTreeModel();
CourseEditorEnv cev = new CourseEditorEnvImpl(cetm, course.getCourseEnvironment().getCourseGroupManager(), ureq.getLocale());
euce = new EditorUserCourseEnvironmentImpl(cev);
euce.getCourseEditorEnv().setCurrentCourseNodeId(null);
/*
* validate course and update course status
*/
euce.getCourseEditorEnv().validateCourse();
StatusDescription[] courseStatus = euce.getCourseEditorEnv().getCourseStatus();
updateCourseStatusMessages(ureq.getLocale(), courseStatus);
long lpTimeStamp = cetm.getLatestPublishTimestamp();
if (lpTimeStamp == -1) {
showInfo(NLS_PUBLISHED_NEVER_YET);
} else { // course has been published before
Date d = new Date(lpTimeStamp);
getWindowControl().setInfo(translate(NLS_PUBLISHED_LATEST, Formatter.getInstance(ureq.getLocale()).formatDateAndTime(d)));
}
menuTree.setTreeModel(cetm);
menuTree.addListener(this);
selTree = new SelectionTree("selection", getTranslator());
selTree.setTreeModel(cetm);
selTree.setActionCommand("processpublish");
selTree.setFormButtonKey("publizieren");
selTree.addListener(this);
tabbedNodeConfig = new TabbedPane("tabbedNodeConfig", ureq.getLocale());
main.put(tabbedNodeConfig.getComponentName(), tabbedNodeConfig);
toolC = ToolFactory.createToolController(getWindowControl());
listenTo(toolC);
toolC.addHeader(translate(NLS_HEADER_TOOLS));
toolC.addLink(CMD_COURSEFOLDER, translate(NLS_COMMAND_COURSEFOLDER), CMD_COURSEFOLDER, "o_toolbox_coursefolder");
toolC.addLink(CMD_COURSEPREVIEW, translate(NLS_COMMAND_COURSEPREVIEW), CMD_COURSEPREVIEW, "b_toolbox_preview" );
toolC.addLink(CMD_PUBLISH, translate(NLS_COMMAND_PUBLISH), CMD_PUBLISH,"b_toolbox_publish" );
toolC.addLink(CMD_CLOSEEDITOR, translate(NLS_COMMAND_CLOSEEDITOR), null, "b_toolbox_close");
toolC.addHeader(translate(NLS_HEADER_INSERTNODES));
CourseNodeFactory cnf = CourseNodeFactory.getInstance();
for (Iterator<String> iter = cnf.getRegisteredCourseNodeAliases().iterator(); iter.hasNext();) {
String courseNodeAlias = iter.next();
CourseNodeConfiguration cnConfig = cnf.getCourseNodeConfiguration(courseNodeAlias);
toolC.addLink(TB_ACTION + courseNodeAlias, cnConfig.getLinkText(ureq.getLocale()), courseNodeAlias, cnConfig.getIconCSSClass());
}
toolC.addHeader(translate(NLS_COMMAND_DELETENODE_HEADER));
toolC.addLink(CMD_DELNODE, translate(NLS_COMMAND_DELETENODE), CMD_DELNODE, "b_toolbox_delete");
toolC.addLink(CMD_MOVENODE, translate(NLS_COMMAND_MOVENODE), CMD_MOVENODE, "b_toolbox_move");
toolC.addLink(CMD_COPYNODE, translate(NLS_COMMAND_COPYNODE), CMD_COPYNODE, "b_toolbox_copy");
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), menuTree, toolC.getInitialComponent(), main, "course" + course.getResourceableId());
columnLayoutCtr.addCssClassToMain("o_editor");
listenTo(columnLayoutCtr);
putInitialPanel(columnLayoutCtr.getInitialComponent());
// add as listener to course so we are being notified about course events: