use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class DialogElementsManagerImpl method getDialogContainer.
@Override
public VFSContainer getDialogContainer(DialogElement element) {
Forum forum = element.getForum();
StringBuilder sb = new StringBuilder();
sb.append("/forum/").append(forum.getKey()).append("/");
String pathToForumDir = sb.toString();
return new OlatRootFolderImpl(pathToForumDir, null);
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class FeedRuntimeController method doQuota.
private void doQuota(UserRequest ureq) {
if (quotaManager.hasQuotaEditRights(ureq.getIdentity())) {
RepositoryEntry entry = getRepositoryEntry();
OlatRootFolderImpl feedRoot = FileResourceManager.getInstance().getFileResourceRootImpl(entry.getOlatResource());
WindowControl bwControl = getSubWindowControl("Quota");
Controller quotaCtrl = quotaManager.getQuotaEditorInstance(ureq, addToHistory(ureq, bwControl), feedRoot.getRelPath());
pushController(ureq, translate("tab.quota.edit"), quotaCtrl);
setActiveTool(quotaLink);
}
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl 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.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class PFCourseNode method createPeekViewRunController.
@Override
public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
VFSContainer rootFolder = null;
CourseEnvironment courseEnv = userCourseEnv.getCourseEnvironment();
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
Path folderRelPath = null;
OlatRootFolderImpl baseContainer = courseEnv.getCourseBaseContainer();
PFManager pfManager = CoreSpringFactory.getImpl(PFManager.class);
if (userCourseEnv.isCoach() || userCourseEnv.isAdmin()) {
folderRelPath = Paths.get(baseContainer.getBasefile().toPath().toString(), PFManager.FILENAME_PARTICIPANTFOLDER, getIdent());
rootFolder = new LocalFolderImpl(folderRelPath.toFile());
} else if (userCourseEnv.isParticipant()) {
folderRelPath = Paths.get(baseContainer.getBasefile().toPath().toString(), PFManager.FILENAME_PARTICIPANTFOLDER, getIdent(), pfManager.getIdFolderName(identity));
rootFolder = new LocalFolderImpl(folderRelPath.toFile());
}
if (rootFolder == null) {
return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
} else {
return new PFPeekviewController(ureq, wControl, rootFolder, getIdent(), 4);
}
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class ProjectBrokerCourseNode method archiveNodeData.
@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
boolean dataFound = false;
String dropboxPath = DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), this);
OlatRootFolderImpl dropboxDir = new OlatRootFolderImpl(dropboxPath, null);
String returnboxPath = ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), this);
OlatRootFolderImpl returnboxDir = new OlatRootFolderImpl(returnboxPath, null);
if (!dropboxDir.exists() && !returnboxDir.exists()) {
return false;
}
String exportDirName = "projectbroker_" + Formatter.makeStringFilesystemSave(getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
try {
String projectBrokerTableExport = ProjectBrokerExportGenerator.createCourseResultsOverviewTable(this, course, locale);
String tableExportFileName = ExportUtil.createFileNameWithTimeStamp(getShortTitle() + "-projectbroker_overview", "xls");
exportStream.putNextEntry(new ZipEntry(exportDirName + "/" + tableExportFileName));
IOUtils.write(projectBrokerTableExport, exportStream, "UTF-8");
exportStream.closeEntry();
} catch (IOException e) {
log.error("", e);
}
// copy dropboxes to tmp dir
if (dropboxDir.exists()) {
// OLAT-6426 archive only dropboxes of users that handed in at least one file -> prevent empty folders in archive
for (VFSItem themaItem : dropboxDir.getItems()) {
if (!(themaItem instanceof VFSContainer))
continue;
List<VFSItem> userFolderArray = ((VFSContainer) themaItem).getItems();
for (VFSItem userFolder : userFolderArray) {
if (!VFSManager.isDirectoryAndNotEmpty(userFolder))
continue;
String path = exportDirName + "/dropboxes/" + themaItem.getName();
ZipUtil.addToZip(userFolder, path, exportStream);
}
}
}
// copy returnboxes to tmp dir
if (returnboxDir.exists()) {
for (VFSItem themaItem : returnboxDir.getItems()) {
if (!(themaItem instanceof VFSContainer))
continue;
List<VFSItem> userFolderArray = ((VFSContainer) themaItem).getItems();
for (VFSItem userFolder : userFolderArray) {
if (!VFSManager.isDirectoryAndNotEmpty(userFolder))
continue;
String path = exportDirName + "/returnboxes/" + themaItem.getName();
ZipUtil.addToZip(userFolder, path, exportStream);
}
}
}
return dataFound;
}
Aggregations