use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class EditorMainController method launchSinglePagesWizard.
private void launchSinglePagesWizard(UserRequest ureq, ICourse course) {
removeAsListenerAndDispose(multiSPChooserCtr);
removeAsListenerAndDispose(cmc);
VFSContainer rootContainer = course.getCourseEnvironment().getCourseFolderContainer();
CourseEditorTreeNode selectedNode = (CourseEditorTreeNode) menuTree.getSelectedNode();
multiSPChooserCtr = new MultiSPController(ureq, getWindowControl(), rootContainer, ores, selectedNode);
listenTo(multiSPChooserCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), multiSPChooserCtr.getInitialComponent(), true, translate("multi.sps.title"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class GTAAssignedTaskController method doPreview.
private void doPreview(UserRequest ureq) {
if (viewTaskCtrl != null)
return;
VFSContainer tasksContainer = gtaManager.getTasksContainer(courseEnv, gtaNode);
viewTaskCtrl = new SinglePageController(ureq, getWindowControl(), tasksContainer, taskFile.getName(), false, null, null, TaskHelper.getStandardDeliveryOptions(), false);
listenTo(viewTaskCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), viewTaskCtrl.getInitialComponent(), true, taskFile.getName());
listenTo(cmc);
cmc.activate();
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class GTANotifications method createParticipantSolutionItems.
private boolean createParticipantSolutionItems(Task task, Identity assessedIdentity, BusinessGroup group) {
// copy solutions
if (gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION)) {
RepositoryEntry re = courseEnv.getCourseGroupManager().getCourseEntry();
DueDate dueDate = gtaManager.getSolutionDueDate(task, assessedIdentity, group, gtaNode, re, true);
Date solutionDate = null;
if (dueDate == null) {
if (inStep(task, TaskProcess.solution, TaskProcess.grading, TaskProcess.graded)) {
solutionDate = task.getSolutionDate();
} else {
return false;
}
} else if (dueDate != null && dueDate.getDueDate() != null) {
if (task == null) {
if (inStep(task, TaskProcess.assignment, TaskProcess.submit, TaskProcess.review, TaskProcess.correction, TaskProcess.revision) && !dueDate.isRelative() && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_ALL, false)) {
solutionDate = dueDate.getDueDate();
} else {
return false;
}
} else {
solutionDate = dueDate.getDueDate();
}
} else if (task != null) {
solutionDate = task.getSolutionDate();
}
if (solutionDate != null) {
if (task.getSolutionDate() != null && task.getSolutionDate().after(solutionDate)) {
solutionDate = task.getSolutionDate();
}
File solutionDirectory = gtaManager.getSolutionsDirectory(courseEnv, gtaNode);
VFSContainer solutionContainer = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
File[] solutions = solutionDirectory.listFiles(SystemFileFilter.FILES_ONLY);
for (File solution : solutions) {
Date date = solutionDate;
// check if there are new solutions too
cal.setTimeInMillis(solution.lastModified());
Date modificationDate = cal.getTime();
if (date.before(modificationDate)) {
date = modificationDate;
}
if (date.after(compareDate)) {
String author = getAuthor(solution, solutionContainer);
if (task != null) {
String[] params = new String[] { getTaskName(task), displayName, solution.getName(), author };
appendSubscriptionItemForFile("notifications.solution.task", params, assessedIdentity, "[solution:0]", solution, date, false);
} else {
String[] params = new String[] { displayName, solution.getName(), author };
appendSubscriptionItemForFile("notifications.solution", params, assessedIdentity, "[solution:0]", solution, date, false);
}
}
}
return true;
}
}
return false;
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class GTANotifications method createReviewAndRevisionsItems.
private void createReviewAndRevisionsItems(Task task, Identity assessedIdentity, BusinessGroup group, boolean coach) {
if (task == null)
return;
String name;
if (group != null) {
name = group.getName();
} else {
name = userManager.getUserDisplayName(assessedIdentity);
}
boolean sendNotificationDueDate = true;
List<TaskRevisionDate> taskRevisions = gtaManager.getTaskRevisions(task);
if (!coach && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_REVIEW_AND_CORRECTION)) {
// check task revision 1
if (task != null && notInStep(task, TaskProcess.assignment, TaskProcess.submit, TaskProcess.review) && checkRevisionLoop(TaskProcess.revision, 1, taskRevisions)) {
File correctionDirectory;
VFSContainer correctionContainer;
if (group != null) {
correctionDirectory = gtaManager.getCorrectionDirectory(courseEnv, gtaNode, group);
correctionContainer = gtaManager.getCorrectionContainer(courseEnv, gtaNode, group);
} else {
correctionDirectory = gtaManager.getCorrectionDirectory(courseEnv, gtaNode, assessedIdentity);
correctionContainer = gtaManager.getCorrectionContainer(courseEnv, gtaNode, assessedIdentity);
}
Date correctionDate = getRevisionLoopDate(TaskProcess.revision, 1, taskRevisions);
if (sendNotificationDueDate) {
if (task.getRevisionsDueDate() != null) {
String[] params = new String[] { getTaskName(task), displayName, formatter.formatDateAndTime(task.getRevisionsDueDate()) };
if (group != null) {
appendSubscriptionItem("notifications.correction.duedate", params, group, correctionDate, coach);
} else {
appendSubscriptionItem("notifications.correction.duedate", params, assessedIdentity, correctionDate, coach);
}
} else {
String[] params = new String[] { getTaskName(task), displayName };
if (group != null) {
appendSubscriptionItem("notifications.correction", params, group, correctionDate, coach);
} else {
appendSubscriptionItem("notifications.correction", params, assessedIdentity, correctionDate, coach);
}
}
sendNotificationDueDate = false;
}
File[] corrections = correctionDirectory.listFiles(SystemFileFilter.FILES_ONLY);
for (File correction : corrections) {
String author = getAuthor(correction, correctionContainer);
String[] params = new String[] { getTaskName(task), displayName, correction.getName(), author };
if (group != null) {
appendSubscriptionItemForFile("notifications.correction.doc", params, group, "[correction:0]", correction, correctionDate, coach);
} else {
appendSubscriptionItemForFile("notifications.correction.doc", params, assessedIdentity, "[correction:0]", correction, correctionDate, coach);
}
}
}
}
if (gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD)) {
task = checkRevisionStep(assessedIdentity, null, task);
if (task != null && notInStep(task, TaskProcess.assignment, TaskProcess.submit, TaskProcess.review)) {
int currentIteration = task.getRevisionLoop();
for (int i = 1; i <= currentIteration; i++) {
if (coach) {
// revision of the students
if (checkRevisionLoop(TaskProcess.correction, i, taskRevisions)) {
File revisionDirectory;
VFSContainer revisionContainer;
if (group != null) {
revisionDirectory = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, i, group);
revisionContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, i, group);
} else {
revisionDirectory = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, i, assessedIdentity);
revisionContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, i, assessedIdentity);
}
Date revisionDate = getRevisionLoopDate(TaskProcess.correction, i, taskRevisions);
File[] revisions = revisionDirectory.listFiles(SystemFileFilter.FILES_ONLY);
if (revisions.length == 0) {
String[] params = new String[] { getTaskName(task), displayName, name };
if (group != null) {
appendSubscriptionItem("notifications.revision.group", params, group, revisionDate, coach);
} else {
appendSubscriptionItem("notifications.revision.individual", params, assessedIdentity, revisionDate, coach);
}
} else {
for (File revision : revisions) {
String author = getAuthor(revision, revisionContainer);
String[] params = new String[] { getTaskName(task), displayName, revision.getName(), name, author };
if (group != null) {
appendSubscriptionItemForFile("notifications.revision.group.doc", params, group, "[revision:" + i + "]", revision, revisionDate, coach);
} else {
appendSubscriptionItemForFile("notifications.revision.individual.doc", params, assessedIdentity, "[revision:" + i + "]", revision, revisionDate, coach);
}
}
}
}
} else if (checkRevisionLoop(TaskProcess.revision, i, taskRevisions)) {
// corrections of the coach
File correctionDirectory;
VFSContainer correctionContainer;
if (group != null) {
correctionDirectory = gtaManager.getRevisedDocumentsCorrectionsDirectory(courseEnv, gtaNode, i, group);
correctionContainer = gtaManager.getRevisedDocumentsCorrectionsContainer(courseEnv, gtaNode, i, group);
} else {
correctionDirectory = gtaManager.getRevisedDocumentsCorrectionsDirectory(courseEnv, gtaNode, i, assessedIdentity);
correctionContainer = gtaManager.getRevisedDocumentsCorrectionsContainer(courseEnv, gtaNode, i, assessedIdentity);
}
Date correctionDate = getRevisionLoopDate(TaskProcess.revision, i, taskRevisions);
if (sendNotificationDueDate) {
if (task.getRevisionsDueDate() != null) {
String[] params = new String[] { getTaskName(task), displayName, formatter.formatDateAndTime(task.getRevisionsDueDate()) };
if (group != null) {
appendSubscriptionItem("notifications.correction.duedate", params, group, correctionDate, coach);
} else {
appendSubscriptionItem("notifications.correction.duedate", params, assessedIdentity, correctionDate, coach);
}
} else {
String[] params = new String[] { getTaskName(task), displayName };
if (group != null) {
appendSubscriptionItem("notifications.correction", params, group, correctionDate, coach);
} else {
appendSubscriptionItem("notifications.correction", params, assessedIdentity, correctionDate, coach);
}
}
sendNotificationDueDate = false;
}
File[] corrections = correctionDirectory.listFiles(SystemFileFilter.FILES_ONLY);
for (File correction : corrections) {
String author = getAuthor(correction, correctionContainer);
String[] params = new String[] { getTaskName(task), displayName, correction.getName(), author };
if (group != null) {
appendSubscriptionItemForFile("notifications.correction.doc", params, group, "[correction:" + i + "]", correction, correctionDate, coach);
} else {
appendSubscriptionItemForFile("notifications.correction.doc", params, assessedIdentity, "[correction:" + i + "]", correction, correctionDate, coach);
}
}
}
}
}
}
}
use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.
the class DialogElementsEditController method doUpload.
private void doUpload(UserRequest ureq) {
removeAsListenerAndDispose(fileUplCtr);
VFSContainer tmpContainer = new LocalFolderImpl(new File(WebappHelper.getTmpDir(), "poster_" + UUID.randomUUID()));
fileUplCtr = new FileUploadController(getWindowControl(), tmpContainer, ureq, FolderConfig.getLimitULKB(), Quota.UNLIMITED, null, false, false, false, false, true, false);
listenTo(fileUplCtr);
cmc = new CloseableModalController(getWindowControl(), "close", fileUplCtr.getInitialComponent(), true, translate("dialog.upload.file"));
listenTo(cmc);
cmc.activate();
}
Aggregations