use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
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.vfs.OlatRootFolderImpl in project openolat by klemens.
the class PFManager method resolveOrCreateDropFolder.
/**
* Resolve or create drop folder.
*
* @param courseEnv
* @param pfNode
* @param identity
* @return the VFSContainer
*/
private VFSContainer resolveOrCreateDropFolder(CourseEnvironment courseEnv, PFCourseNode pfNode, Identity identity) {
Path relPath = Paths.get(FILENAME_PARTICIPANTFOLDER, pfNode.getIdent(), getIdFolderName(identity), FILENAME_DROPBOX);
OlatRootFolderImpl baseContainer = courseEnv.getCourseBaseContainer();
VFSContainer dropboxContainer = VFSManager.resolveOrCreateContainerFromPath(baseContainer, relPath.toString());
return dropboxContainer;
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class PFManager method provideParticipantFolder.
/**
* Provide participant folder in GUI.
*
* @param pfNode
* @param pfView
* @param courseEnv
* @param identity
* @param isCoach
* @return the VFS container
*/
public VFSContainer provideParticipantFolder(PFCourseNode pfNode, PFView pfView, Translator translator, CourseEnvironment courseEnv, Identity identity, boolean isCoach, boolean readOnly) {
SubscriptionContext nodefolderSubContext = CourseModule.createSubscriptionContext(courseEnv, pfNode);
String path = courseEnv.getCourseBaseContainer().getRelPath() + "/" + FILENAME_PARTICIPANTFOLDER;
VFSContainer courseElementBaseContainer = new OlatRootFolderImpl(path, null);
Path relPath = Paths.get(pfNode.getIdent(), getIdFolderName(identity));
VFSContainer userBaseContainer = VFSManager.resolveOrCreateContainerFromPath(courseElementBaseContainer, relPath.toString());
String baseContainerName = userManager.getUserDisplayName(identity);
VirtualContainer namedCourseFolder = new VirtualContainer(baseContainerName);
namedCourseFolder.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
VFSContainer dropContainer = new NamedContainerImpl(PFView.onlyDrop.equals(pfView) || PFView.onlyReturn.equals(pfView) ? baseContainerName : translator.translate("drop.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_DROPBOX));
if (pfNode.hasParticipantBoxConfigured()) {
namedCourseFolder.addItem(dropContainer);
}
VFSContainer returnContainer = new NamedContainerImpl(PFView.onlyDrop.equals(pfView) || PFView.onlyReturn.equals(pfView) ? baseContainerName : translator.translate("return.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_RETURNBOX));
if (pfNode.hasCoachBoxConfigured()) {
namedCourseFolder.addItem(returnContainer);
}
if (readOnly) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
} else {
if (isCoach) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
returnContainer.setLocalSecurityCallback(new ReadWriteDeleteCallback(nodefolderSubContext));
} else {
VFSContainer dropbox = resolveOrCreateDropFolder(courseEnv, pfNode, identity);
VFSSecurityCallback callback = calculateCallback(courseEnv, pfNode, dropbox, false);
dropContainer.setLocalSecurityCallback(callback);
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
}
}
VFSContainer folderRunContainer;
switch(pfView) {
case dropAndReturn:
folderRunContainer = namedCourseFolder;
break;
case onlyDrop:
folderRunContainer = dropContainer;
break;
case onlyReturn:
folderRunContainer = returnContainer;
break;
default:
folderRunContainer = namedCourseFolder;
break;
}
return folderRunContainer;
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class PFManager method provideParticipantContainer.
/**
* Provide participant view in webdav.
*
* @param pfNode
* @param courseEnv
* @param identity
* @return the VFS container
*/
private VFSContainer provideParticipantContainer(PFCourseNode pfNode, CourseEnvironment courseEnv, Identity identity, boolean courseReadOnly) {
Locale locale = I18nManager.getInstance().getLocaleOrDefault(identity.getUser().getPreferences().getLanguage());
Translator translator = Util.createPackageTranslator(PFRunController.class, locale);
SubscriptionContext subsContext = CourseModule.createSubscriptionContext(courseEnv, pfNode);
String path = courseEnv.getCourseBaseContainer().getRelPath() + "/" + FILENAME_PARTICIPANTFOLDER;
VFSContainer courseElementBaseContainer = new OlatRootFolderImpl(path, null);
VirtualContainer namedCourseFolder = new VirtualContainer(identity.getName());
Path relPath = Paths.get(pfNode.getIdent(), getIdFolderName(identity));
VFSContainer userBaseContainer = VFSManager.resolveOrCreateContainerFromPath(courseElementBaseContainer, relPath.toString());
if (pfNode.hasParticipantBoxConfigured()) {
VFSContainer dropContainer = new NamedContainerImpl(translator.translate("drop.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_DROPBOX));
if (courseReadOnly) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(subsContext));
} else {
VFSContainer dropbox = resolveOrCreateDropFolder(courseEnv, pfNode, identity);
VFSSecurityCallback callback = calculateCallback(courseEnv, pfNode, dropbox, true);
dropContainer.setLocalSecurityCallback(callback);
}
namedCourseFolder.addItem(dropContainer);
}
if (pfNode.hasCoachBoxConfigured()) {
VFSContainer returnContainer = new NamedContainerImpl(translator.translate("return.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_RETURNBOX));
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(subsContext));
namedCourseFolder.addItem(returnContainer);
}
return namedCourseFolder;
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class CPRuntimeController method doQuota.
private void doQuota(UserRequest ureq) {
if (quotaManager.hasQuotaEditRights(ureq.getIdentity())) {
RepositoryEntry entry = getRepositoryEntry();
OLATResource resource = entry.getOlatResource();
OlatRootFolderImpl cpRoot = FileResourceManager.getInstance().unzipContainerResource(resource);
WindowControl bwControl = getSubWindowControl("Quota");
Controller quotaCtrl = quotaManager.getQuotaEditorInstance(ureq, addToHistory(ureq, bwControl), cpRoot.getRelPath());
pushController(ureq, translate("tab.quota.edit"), quotaCtrl);
setActiveTool(quotaLink);
}
}
Aggregations