use of org.olat.core.commons.modules.bc.FolderRunController in project openolat by klemens.
the class TaskFolderCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (log.isDebug())
log.debug("event source=" + source + " " + event.toString());
if (source == btfButton) {
// check if there are already assigned tasks
CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
List<Property> assignedProps = cpm.listCourseNodeProperties(node, null, null, TaskController.PROP_ASSIGNED);
if (assignedProps.size() == 0) {
// no task assigned
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, ureq, getWindowControl());
// listenTo(frc);
frc.addControllerListener(this);
CloseableModalController cmc = new CloseableModalController(getWindowControl(), translate("folder.close"), frc.getInitialComponent());
cmc.activate();
} else {
// already assigned task => open dialog with warn
String[] args = new String[] { new Integer(assignedProps.size()).toString() };
dialogBoxController = activateOkCancelDialog(ureq, "", getTranslator().translate("taskfolder.overwriting.confirm", args), dialogBoxController);
}
} else if (source == vfButton) {
// switch to new dialog
OlatNamedContainerImpl namedContainer = TACourseNode.getNodeFolderContainer(node, course.getCourseEnvironment());
Quota quota = QuotaManager.getInstance().getCustomQuota(namedContainer.getRelPath());
if (quota == null) {
Quota defQuota = QuotaManager.getInstance().getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES);
quota = QuotaManager.getInstance().createQuota(namedContainer.getRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
SubscriptionContext subContext = SolutionFileUploadNotificationHandler.getSubscriptionContext(course.getCourseEnvironment(), node);
VFSSecurityCallback secCallback = new FullAccessWithQuotaCallback(quota, subContext);
namedContainer.setLocalSecurityCallback(secCallback);
FolderRunController folderCtrl = new FolderRunController(namedContainer, false, ureq, getWindowControl());
CloseableModalController cmc = new CloseableModalController(getWindowControl(), translate("close"), folderCtrl.getInitialComponent());
cmc.activate();
} else if (source == editScoringConfigButton) {
scoringController.setDisplayOnly(false);
editScoring.contextPut("isOverwriting", new Boolean(true));
}
}
use of org.olat.core.commons.modules.bc.FolderRunController in project openolat by klemens.
the class ReturnboxController method initReturnbox.
protected void initReturnbox(UserRequest ureq, WindowControl wControl, CourseNode node, UserCourseEnvironment userCourseEnv, boolean previewMode) {
// returnbox display
myContent = createVelocityContainer("returnbox");
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(getReturnboxPathFor(userCourseEnv.getCourseEnvironment(), node, ureq.getIdentity()), null);
String fullName = StringHelper.escapeHtml(userManager.getUserDisplayName(getIdentity()));
OlatNamedContainerImpl namedContainer = new OlatNamedContainerImpl(fullName, rootFolder);
namedContainer.setLocalSecurityCallback(new ReadOnlyCallback());
returnboxFolderRunController = new FolderRunController(namedContainer, false, ureq, wControl);
returnboxFolderRunController.addControllerListener(this);
myContent.put("returnbox", returnboxFolderRunController.getInitialComponent());
// notification
if (!previewMode && !ureq.getUserSession().getRoles().isGuestOnly()) {
// offer subscription, but not to guests
subsContext = ReturnboxFileUploadNotificationHandler.getSubscriptionContext(userCourseEnv.getCourseEnvironment(), node, ureq.getIdentity());
if (subsContext != null) {
contextualSubscriptionCtr = AbstractTaskNotificationHandler.createContextualSubscriptionController(ureq, wControl, getReturnboxPathFor(userCourseEnv.getCourseEnvironment(), node, ureq.getIdentity()), subsContext, ReturnboxController.class);
myContent.put("subscription", contextualSubscriptionCtr.getInitialComponent());
myContent.contextPut("hasNotification", Boolean.TRUE);
}
} else {
myContent.contextPut("hasNotification", Boolean.FALSE);
}
putInitialPanel(myContent);
}
Aggregations