use of org.olat.core.commons.modules.bc.FolderRunController in project OpenOLAT by OpenOLAT.
the class TaskFolderCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest urequest, Controller source, Event event) {
if (source == modulesForm) {
boolean onoff = event.getCommand().endsWith("true");
if (event.getCommand().startsWith("task")) {
config.set(TACourseNode.CONF_TASK_ENABLED, new Boolean(onoff));
myTabbedPane.setEnabled(taskTabPosition, onoff);
if (onoff) {
accessabilityVC.put("taskCondition", taskConditionC.getInitialComponent());
} else {
accessabilityVC.remove(taskConditionC.getInitialComponent());
}
} else if (event.getCommand().startsWith("dropbox")) {
config.set(TACourseNode.CONF_DROPBOX_ENABLED, new Boolean(onoff));
myTabbedPane.setEnabled(dropboxTabPosition, onoff);
if (onoff) {
accessabilityVC.put("dropCondition", dropConditionC.getInitialComponent());
} else {
accessabilityVC.remove(dropConditionC.getInitialComponent());
}
} else if (event.getCommand().startsWith("returnbox")) {
config.set(TACourseNode.CONF_RETURNBOX_ENABLED, new Boolean(onoff));
if (onoff) {
accessabilityVC.put("returnboxCondition", returnboxConditionC.getInitialComponent());
} else {
accessabilityVC.remove(returnboxConditionC.getInitialComponent());
}
} else if (event.getCommand().startsWith("scoring")) {
config.set(TACourseNode.CONF_SCORING_ENABLED, new Boolean(onoff));
myTabbedPane.setEnabled(scoringTabPosition, onoff);
if (onoff) {
accessabilityVC.put("scoringCondition", scoringConditionC.getInitialComponent());
} else {
accessabilityVC.remove(scoringConditionC.getInitialComponent());
}
} else if (event.getCommand().startsWith("solution")) {
config.set(TACourseNode.CONF_SOLUTION_ENABLED, new Boolean(onoff));
myTabbedPane.setEnabled(solutionTabPosition, onoff);
if (onoff) {
accessabilityVC.put("solutionCondition", solutionConditionC.getInitialComponent());
} else {
accessabilityVC.remove(solutionConditionC.getInitialComponent());
}
}
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
} else if (source == taskConditionC) {
if (event == Event.CHANGED_EVENT) {
node.setConditionTask(taskConditionC.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == dropConditionC) {
if (event == Event.CHANGED_EVENT) {
node.setConditionDrop(dropConditionC.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == returnboxConditionC) {
if (event == Event.CHANGED_EVENT) {
node.setConditionReturnbox(returnboxConditionC.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == scoringConditionC) {
if (event == Event.CHANGED_EVENT) {
node.setConditionScoring(scoringConditionC.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == solutionConditionC) {
if (event == Event.CHANGED_EVENT) {
node.setConditionSolution(solutionConditionC.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == dialogBoxController) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// ok: open task folder
String relPath = TACourseNode.getTaskFolderPathRelToFolderRoot(course, node);
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(relPath, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(translate("taskfolder"), rootFolder);
namedFolder.setLocalSecurityCallback(getTaskFolderSecCallback(relPath));
frc = new FolderRunController(namedFolder, false, urequest, getWindowControl());
listenTo(frc);
CloseableModalController cmc = new CloseableModalController(getWindowControl(), translate("folder.close"), frc.getInitialComponent());
cmc.activate();
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == taskController) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
config.set(TACourseNode.CONF_TASK_TYPE, taskController.getTaskType());
config.set(TACourseNode.CONF_TASK_TEXT, taskController.getOptionalText());
config.set(TACourseNode.CONF_TASK_SAMPLING_WITH_REPLACEMENT, new Boolean(taskController.getIsSamplingWithReplacement()));
config.setBooleanEntry(TACourseNode.CONF_TASK_PREVIEW, taskController.isTaskPreviewMode());
config.setBooleanEntry(TACourseNode.CONF_TASK_DESELECT, taskController.isTaskDeselectMode());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
}
} else if (source == scoringController) {
if (event == Event.CANCELLED_EVENT) {
if (hasLogEntries) {
scoringController.setDisplayOnly(true);
}
editScoring.contextPut("isOverwriting", new Boolean(false));
return;
} else if (event == Event.DONE_EVENT) {
scoringController.updateModuleConfiguration(config);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == dropboxForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
config.set(TACourseNode.CONF_DROPBOX_ENABLEMAIL, new Boolean(dropboxForm.mailEnabled()));
config.set(TACourseNode.CONF_DROPBOX_CONFIRMATION, dropboxForm.getConfirmation());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
}
} else if (source == frc && (event instanceof FolderEvent) && event.getCommand().equals(FolderEvent.DELETE_EVENT)) {
String deletedTaskFile = getFileListAsComaSeparated(((FolderEvent) event).getFilename());
// cancel task assignment
identitiesToBeNotified = removeAssignedTask(course, deletedTaskFile);
if (identitiesToBeNotified.size() > 0) {
// prepare mailTemplate if they are any identities to be notified
removeAsListenerAndDispose(mailCtr);
RepositoryEntry repositoryEntry = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
String courseURL = Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + repositoryEntry.getKey();
MailTemplate mailTemplate = this.createTaskDeletedMailTemplate(urequest, course.getCourseTitle(), courseURL, deletedTaskFile);
mailCtr = new MailNotificationEditController(getWindowControl(), urequest, mailTemplate, true, false, true);
listenTo(mailCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), mailCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
} else if (source == mailCtr) {
if (event == Event.DONE_EVENT) {
cmc.deactivate();
if (identitiesToBeNotified != null && identitiesToBeNotified.size() > 0) {
// sent email to all identities that used to have the deleted task assigned
sendNotificationEmail(urequest, mailCtr.getMailTemplate(), identitiesToBeNotified);
}
} else if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
}
} else {
log.warn("Can not handle event in TACourseNodeEditController source=" + source + " " + event.toString());
}
}
use of org.olat.core.commons.modules.bc.FolderRunController in project OpenOLAT by OpenOLAT.
the class FolderCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest urequest, Controller source, Event event) {
if (source == projectBrokerConditionController) {
if (event == Event.CHANGED_EVENT) {
node.setConditionProjectBroker(projectBrokerConditionController.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == dialogBoxController) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// ok: open task folder
String relPath = TACourseNode.getTaskFolderPathRelToFolderRoot(CourseFactory.loadCourse(courseId), node);
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(relPath, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(translate("taskfolder"), rootFolder);
namedFolder.setLocalSecurityCallback(new FolderCallback(relPath, false));
removeAsListenerAndDispose(frc);
frc = new FolderRunController(namedFolder, false, urequest, getWindowControl());
listenTo(frc);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("folder.close"), frc.getInitialComponent());
listenTo(cmc);
cmc.activate();
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == scoringController) {
if (event == Event.CANCELLED_EVENT) {
if (hasLogEntries) {
scoringController.setDisplayOnly(true);
}
editScoring.contextPut("isOverwriting", new Boolean(false));
return;
} else if (event == Event.DONE_EVENT) {
scoringController.updateModuleConfiguration(config);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == modulesForm) {
boolean onoff = event.getCommand().endsWith("true");
if (event.getCommand().startsWith("dropbox")) {
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_ENABLED, onoff);
} else if (event.getCommand().startsWith("returnbox")) {
config.set(ProjectBrokerCourseNode.CONF_RETURNBOX_ENABLED, onoff);
}
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
} else if (source == accountManagerGroupController) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), urequest.getUserSession().getRoles(), identitiesAddedEvent.getAddIdentities(), accountManagerGroup, null);
identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities());
identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission());
identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup());
getLogger().info("Add users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT);
} else if (event instanceof IdentitiesRemoveEvent) {
businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), accountManagerGroup, null);
getLogger().info("Remove users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == optionsForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
projectBrokerModuleConfiguration.setNbrParticipantsPerTopic(optionsForm.getNnbrOfAttendees());
if (projectBrokerModuleConfiguration.isAcceptSelectionManually() && !optionsForm.getSelectionAccept()) {
// change 'Accept manually' to 'Accept automatically' => enroll all candidates
projectGroupManager.acceptAllCandidates(projectBrokerId, urequest.getIdentity(), projectBrokerModuleConfiguration.isAutoSignOut(), optionsForm.getSelectionAccept());
}
projectBrokerModuleConfiguration.setAcceptSelectionManaually(optionsForm.getSelectionAccept());
projectBrokerModuleConfiguration.setSelectionAutoSignOut(optionsForm.getSelectionAutoSignOut());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == customfieldsForm || source == projectEventForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (event == NodeEditController.NODECONFIG_CHANGED_EVENT) {
getLogger().debug("NODECONFIG_CHANGED_node.shortTitle=" + node.getShortTitle());
String groupName = translate("account.manager.groupname", node.getShortTitle());
String groupDescription = translate("account.manager.groupdescription", node.getShortTitle());
accountManagerGroup = projectGroupManager.updateAccountManagerGroupName(getIdentity(), groupName, groupDescription, accountManagerGroup);
} else if (source == dropboxForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_ENABLEMAIL, dropboxForm.mailEnabled());
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_CONFIRMATION, dropboxForm.getConfirmation());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
}
} else {
getLogger().warn("Can not handle event in ProjectBrokerCourseEditorController source=" + source + " " + event.toString());
}
}
use of org.olat.core.commons.modules.bc.FolderRunController in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method doCourseFolder.
private FolderRunController doCourseFolder(UserRequest ureq) {
if (delayedClose == Delayed.courseFolder || requestForClose(ureq)) {
removeCustomCSS();
// Folder for course with custom link model to jump to course nodes
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
VFSContainer courseContainer;
if (overrideReadOnly) {
courseContainer = course.getCourseFolderContainer(overrideReadOnly);
} else {
courseContainer = course.getCourseFolderContainer();
}
VFSContainer namedCourseFolder = new NamedContainerImpl(translate("command.coursefolder"), courseContainer);
CustomLinkTreeModel customLinkTreeModel = new CourseInternalLinkTreeModel(course.getEditorTreeModel());
FolderRunController ctrl = new FolderRunController(namedCourseFolder, true, true, true, true, ureq, getWindowControl(), null, customLinkTreeModel, null);
ctrl.addLoggingResourceable(LoggingResourceable.wrap(course));
courseFolderCtrl = pushController(ureq, translate("command.coursefolder"), ctrl);
setActiveTool(folderLink);
currentToolCtr = courseFolderCtrl;
} else {
delayedClose = Delayed.courseFolder;
}
return courseFolderCtrl;
}
use of org.olat.core.commons.modules.bc.FolderRunController in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
if (currentToolCtr != null) {
addToHistory(ureq, currentToolCtr);
} else {
Controller runtimeCtrl = getRuntimeController();
if (runtimeCtrl instanceof Activateable2) {
((Activateable2) runtimeCtrl).activate(ureq, entries, state);
} else {
addToHistory(ureq, runtimeCtrl);
}
}
return;
}
entries = removeRepositoryEntry(entries);
if (entries != null && entries.size() > 0) {
String type = entries.get(0).getOLATResourceable().getResourceableTypeName();
if ("Payment".equalsIgnoreCase(type)) {
doPostSuccessfullAccess(ureq);
} else if ("Editor".equalsIgnoreCase(type)) {
if (!isInEditor() && !RepositoryEntryManagedFlag.isManaged(getRepositoryEntry(), RepositoryEntryManagedFlag.editcontent)) {
doEdit(ureq);
}
} else if ("Catalog".equalsIgnoreCase(type)) {
doCatalog(ureq);
} else if ("Infos".equalsIgnoreCase(type)) {
doDetails(ureq);
} else if ("EditDescription".equalsIgnoreCase(type) || "Settings".equalsIgnoreCase(type)) {
doEditSettings(ureq);
} else if ("Settings".equalsIgnoreCase(type)) {
doOptions(ureq);
} else if ("CertificationSettings".equalsIgnoreCase(type)) {
doCertificatesOptions(ureq);
} else if ("Certification".equalsIgnoreCase(type)) {
doEfficiencyStatements(ureq);
} else if ("Reminders".equalsIgnoreCase(type) || "RemindersLogs".equalsIgnoreCase(type)) {
doReminders(ureq);
} else if ("Lectures".equalsIgnoreCase(type)) {
Activateable2 lectures = doLectures(ureq);
if (lectures != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
lectures.activate(ureq, subEntries, entries.get(0).getTransientState());
}
} else if ("LectureBlock".equalsIgnoreCase(type)) {
Activateable2 lectures = doLectures(ureq);
if (lectures != null) {
lectures.activate(ureq, entries, state);
}
} else if ("LecturesAdmin".equalsIgnoreCase(type)) {
Activateable2 lecturesAdmin = doLecturesAdmin(ureq);
if (lecturesAdmin != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
lecturesAdmin.activate(ureq, subEntries, entries.get(0).getTransientState());
}
} else if ("MembersMgmt".equalsIgnoreCase(type)) {
Activateable2 members = doMembers(ureq);
if (members != null) {
try {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
members.activate(ureq, subEntries, entries.get(0).getTransientState());
} catch (OLATSecurityException e) {
// the wrong link to the wrong person
}
}
} else if ("assessmentTool".equalsIgnoreCase(type) || "assessmentToolv2".equalsIgnoreCase(type)) {
// check the security before, the link is perhaps in the wrong hands
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
try {
Activateable2 assessmentCtrl = doAssessmentTool(ureq);
if (assessmentCtrl != null) {
List<ContextEntry> subEntries;
if (entries.size() > 1 && entries.get(1).getOLATResourceable().getResourceableTypeName().equals(type)) {
subEntries = entries.subList(2, entries.size());
} else {
subEntries = entries.subList(1, entries.size());
}
assessmentCtrl.activate(ureq, subEntries, entries.get(0).getTransientState());
}
} catch (OLATSecurityException e) {
// the wrong link to the wrong person
}
}
} else if ("TestStatistics".equalsIgnoreCase(type) || "SurveyStatistics".equalsIgnoreCase(type)) {
// check the security before, the link is perhaps in the wrong hands
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
try {
Activateable2 assessmentCtrl = null;
if ("TestStatistics".equalsIgnoreCase(type)) {
assessmentCtrl = doAssessmentTestStatistics(ureq);
} else {
assessmentCtrl = doAssessmentSurveyStatistics(ureq);
}
List<ContextEntry> subEntries;
if (entries.size() > 1 && entries.get(1).getOLATResourceable().getResourceableTypeName().equals(type)) {
subEntries = entries.subList(2, entries.size());
} else {
subEntries = entries.subList(1, entries.size());
}
assessmentCtrl.activate(ureq, subEntries, entries.get(0).getTransientState());
} catch (OLATSecurityException e) {
// the wrong link to the wrong person
}
}
} else if (type != null && type.startsWith("path=")) {
if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) {
String path = BusinessControlFactory.getInstance().getPath(entries.get(0));
FolderRunController folderCtrl = doCourseFolder(ureq);
if (folderCtrl != null) {
folderCtrl.activatePath(ureq, path);
}
}
}
}
if (getRunMainController() != null) {
getRunMainController().activate(ureq, entries, state);
}
}
use of org.olat.core.commons.modules.bc.FolderRunController in project OpenOLAT by OpenOLAT.
the class UserInfoMainController method doOpenFolder.
private FolderRunController doOpenFolder(UserRequest ureq) {
removeAsListenerAndDispose(folderRunController);
String chosenUserFolderRelPath = FolderConfig.getUserHome(chosenIdentity.getName()) + "/public";
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(chosenUserFolderRelPath, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(firstLastName, rootFolder);
// decided in plenum to have read only view in the personal visiting card, even for admin
VFSSecurityCallback secCallback = new ReadOnlyCallback();
namedFolder.setLocalSecurityCallback(secCallback);
OLATResourceable ores = OresHelper.createOLATResourceableType("userfolder");
WindowControl bwControl = addToHistory(ureq, ores, null);
folderRunController = new FolderRunController(namedFolder, false, true, false, ureq, bwControl);
folderRunController.setResourceURL("[Identity:" + chosenIdentity.getKey() + "][userfolder:0]");
listenTo(folderRunController);
return folderRunController;
}
Aggregations