if (cnAlias == null) throw new AssertException("Received event from ButtonController which is not registered with the toolbox.");
Codepoint.codepoint(EditorMainController.class, "startInsertNode");
insertNodeController = new InsertNodeController(ureq, getWindowControl(), course, cnAlias);
listenTo(insertNodeController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), insertNodeController.getInitialComponent(), true, translate(NLS_INSERTNODE_TITLE));
cmc.activate();
} else if (event.getCommand().equals(CMD_DELNODE)) {
TreeNode tn = menuTree.getSelectedNode();
if (tn == null) {
showError(NLS_DELETENODE_ERROR_SELECTFIRST);
return;
}
if (tn.getParent() == null) {
showError(NLS_DELETENODE_ERROR_ROOTNODE);
return;
}
// deletion is possible, start asking if really to delete.
tabbedNodeConfig.setVisible(false);
deleteDialogController = activateYesNoDialog(ureq, translate("deletenode.header", tn.getTitle()), translate("deletenode.confirm"), deleteDialogController);
} else if (event.getCommand().equals(CMD_MOVENODE) || event.getCommand().equals(CMD_COPYNODE)) {
TreeNode tn = menuTree.getSelectedNode();
if (tn == null) {
showError(NLS_MOVECOPYNODE_ERROR_SELECTFIRST);
return;
}
if (tn.getParent() == null) {
showError(NLS_MOVECOPYNODE_ERROR_ROOTNODE);
return;
}
CourseEditorTreeNode cetn = cetm.getCourseEditorNodeById(tn.getIdent());
moveCopyController = new MoveCopySubtreeController(ureq, getWindowControl(), course, cetn, event.getCommand().equals(CMD_COPYNODE));
this.listenTo(moveCopyController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), moveCopyController.getInitialComponent(), true, translate(NLS_INSERTNODE_TITLE));
cmc.activate();
}
else if (event.getCommand().equals(CMD_CLOSEEDITOR)) {
doReleaseEditLock();
fireEvent(ureq, Event.DONE_EVENT);
} else if (event.getCommand().equals(CMD_PUBLISH)) {
/*
* start follwoing steps -> cancel wizardf does not touch data
* (M) Mandatory (O) Optional
* - (M)Step 00 -> show selection tree to choose changed nodes to be published
* ...........-> calculate errors & warnings
* ...........(next|finish) available if no errors or nothing to publish
* - (O)Step 00A -> review errors & warnings
* ...........(previous|next|finish) available
* - (O)Step 00B -> review publish changes that will happen
* ...........(previous|next|finish) available
* - (O)Step 01 -> change general access to course
* ...........(previous|finish) available
* - FinishCallback -> apply course nodes change set
* .................-> apply general access changes.
*/
Step start = new PublishStep00(ureq, cetm, course);
/*
* callback executed in case wizard is finished.
*/
StepRunnerCallback finish = new StepRunnerCallback(){
@SuppressWarnings("unchecked")
public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
/*
* all information to do now is within the runContext saved
*/
boolean hasChanges = false;
if (runContext.containsKey("validPublish") && ((Boolean) runContext.get("validPublish")).booleanValue()) {
Set<String> selectedNodeIds = (Set<String>) runContext.get("publishSetCreatedFor");
hasChanges = (selectedNodeIds != null) && (selectedNodeIds.size() > 0);
if (hasChanges) {
PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
publishManager.applyPublishSet(ureq1.getIdentity(), ureq1.getLocale());
}
}
if (runContext.containsKey("changedaccess")) {
// there were changes made to the general course access
String newAccessStr = (String) runContext.get("changedaccess");
int newAccess = Integer.valueOf(newAccessStr);
PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
// fires an EntryChangedEvent for repository entry notifying
// about modification.
publishManager.changeGeneralAccess(ureq1, newAccess);
hasChanges = true;
}
// signal correct completion and tell if changes were made or not.
return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
}
};
publishStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("publish.wizard.title") );
listenTo(publishStepsController);
getWindowControl().pushAsModalDialog(publishStepsController.getInitialComponent());
} else if (event.getCommand().equals(CMD_COURSEPREVIEW)) {
previewController = new PreviewConfigController(ureq, getWindowControl(), course);
listenTo(previewController);
previewController.activate();
} else if (event.getCommand().equals(CMD_COURSEFOLDER)) {
// folder for course
VFSContainer namedCourseFolder = new NamedContainerImpl(translate(NLS_COURSEFOLDER_NAME), course.getCourseFolderContainer());
FolderRunController bcrun = new FolderRunController(namedCourseFolder, true, ureq, getWindowControl());
bcrun.addLoggingResourceable(LoggingResourceable.wrap(course));
Component folderComponent = bcrun.getInitialComponent();
CloseableModalController clc = new CloseableModalController(getWindowControl(), translate(NLS_COURSEFOLDER_CLOSE),
folderComponent);
clc.activate();
}
} else if (source == nodeEditCntrllr) {
// event from the tabbed pane (any tab)
if (event == NodeEditController.NODECONFIG_CHANGED_EVENT) {