use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class GTACoachRevisionAndCorrectionsController method doConfirmCollect.
private void doConfirmCollect(UserRequest ureq) {
String toName = null;
if (assessedGroup != null) {
toName = assessedGroup.getName();
} else if (assessedIdentity != null) {
toName = userManager.getUserDisplayName(assessedIdentity);
}
File[] submittedDocuments;
VFSContainer documentsContainer;
int iteration = assignedTask.getRevisionLoop();
if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, assessedGroup);
File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedGroup);
submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
} else {
documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, getIdentity());
File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, getIdentity());
submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
}
FilesLocked lockedBy = TaskHelper.getDocumentsLocked(documentsContainer, submittedDocuments);
if (lockedBy != null) {
showWarning("warning.submit.documents.edited", new String[] { lockedBy.getLockedBy(), lockedBy.getLockedFiles() });
} else {
String title = translate("coach.collect.revisions.confirm.title");
String text = translate("coach.collect.revisions.confirm.text", new String[] { toName });
text = "<div class='o_warning'>" + text + "</div>";
confirmCollectCtrl = activateOkCancelDialog(ureq, title, text, confirmCollectCtrl);
listenTo(confirmCollectCtrl);
}
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class GTAParticipantController method setSubmitController.
private void setSubmitController(UserRequest ureq, Task task) {
File documentsDir;
VFSContainer documentsContainer;
if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
} else {
documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, getIdentity());
}
DueDate dueDate = getSubmissionDueDate(task);
Date deadline = dueDate == null ? null : dueDate.getDueDate();
int maxDocs = config.getIntegerSafe(GTACourseNode.GTASK_MAX_SUBMITTED_DOCS, -1);
submitDocCtrl = new SubmitDocumentsController(ureq, getWindowControl(), task, documentsDir, documentsContainer, maxDocs, gtaNode, courseEnv, userCourseEnv.isCourseReadOnly(), deadline, "document");
listenTo(submitDocCtrl);
mainVC.put("submitDocs", submitDocCtrl.getInitialComponent());
submitButton = LinkFactory.createCustomLink("run.submit.button", "submit", "run.submit.button", Link.BUTTON, mainVC, this);
submitButton.setElementCssClass("o_sel_course_gta_submit_docs");
submitButton.setCustomEnabledLinkCSS(submitDocCtrl.hasUploadDocuments() ? "btn btn-primary" : "btn btn-default");
submitButton.setIconLeftCSS("o_icon o_icon_submit");
submitButton.setVisible(!userCourseEnv.isCourseReadOnly());
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class GTAParticipantController method setSolutions.
private void setSolutions(UserRequest ureq, Task assignedTask) {
DueDate availableDate = getSolutionDueDate(assignedTask);
boolean visible = availableDate == null || (availableDate.getDueDate() != null && availableDate.getDueDate().compareTo(new Date()) <= 0);
if (visible) {
File documentsDir = gtaManager.getSolutionsDirectory(courseEnv, gtaNode);
VFSContainer documentsContainer = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
if ((availableDate != null && !availableDate.isRelative() && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_ALL, false)) || TaskHelper.hasDocuments(documentsDir)) {
solutionsCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "run.solutions.description", "bulk.solutions", "solutions");
listenTo(solutionsCtrl);
mainVC.put("solutions", solutionsCtrl.getInitialComponent());
}
} else {
VelocityContainer waitVC = createVelocityContainer("wait_for_solutions");
mainVC.put("solutions", waitVC);
}
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class CourseGlossaryFactory method createCourseGlossaryMainRunController.
/**
* The glossarymaincontroller allows browsing in the glossary. A flag enables
* the edit mode.
*
* @param windowControl
* @param ureq
* @param courseConfig use the glossary configuration from the given course
* configuration
* @param hasGlossaryEditRights
* @return
*/
public static GlossaryMainController createCourseGlossaryMainRunController(WindowControl lwControl, UserRequest lureq, CourseConfig cc, boolean hasGlossaryRights) {
if (cc.hasGlossary()) {
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
if (repoEntry == null) {
// seems to be removed
return null;
}
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
boolean owner = repositoryService.hasRole(lureq.getIdentity(), repoEntry, GroupRoles.owner.name());
VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(repoEntry.getOlatResource());
Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
boolean editUsersEnabled = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
GlossarySecurityCallback secCallback;
if (lureq.getUserSession().getRoles().isGuestOnly()) {
secCallback = new GlossarySecurityCallbackImpl();
} else {
secCallback = new GlossarySecurityCallbackImpl(hasGlossaryRights, owner, editUsersEnabled, lureq.getIdentity().getKey());
}
return new GlossaryMainController(lwControl, lureq, glossaryFolder, repoEntry.getOlatResource(), secCallback, true);
}
return null;
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class ConvertToGTACourseNode method convertDropbox.
private void convertDropbox(TaskList taskList, TACourseNode sourceNode, GTACourseNode gtaNode, CourseEnvironment courseEnv) {
String dropbox = DropboxController.getDropboxPathRelToFolderRoot(courseEnv, sourceNode);
OlatRootFolderImpl dropboxContainer = new OlatRootFolderImpl(dropbox, null);
for (VFSItem userDropbox : dropboxContainer.getItems()) {
if (userDropbox instanceof VFSContainer) {
VFSContainer userDropContainer = (VFSContainer) userDropbox;
String username = userDropContainer.getName();
Identity assessedIdentity = securityManager.findIdentityByName(username);
if (assessedIdentity != null) {
VFSContainer sumbitContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedIdentity);
boolean dropped = false;
for (VFSItem dropppedItem : userDropContainer.getItems()) {
if (dropppedItem instanceof VFSLeaf) {
VFSLeaf submittedDocument = sumbitContainer.createChildLeaf(dropppedItem.getName());
VFSManager.copyContent((VFSLeaf) dropppedItem, submittedDocument);
convertMetada(userDropContainer, sumbitContainer, dropppedItem.getName(), null, null);
dropped = true;
}
}
if (dropped) {
setTaskStatus(taskList, assessedIdentity, TaskProcess.submit, gtaNode);
}
}
}
}
}
Aggregations