use of org.olat.course.nodes.gta.model.DueDate 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.course.nodes.gta.model.DueDate 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.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.
the class GTAParticipantController method resetTask.
@Override
protected void resetTask(UserRequest ureq, Task task) {
resetTaskButton.setUserObject(task);
DueDate assignmentDueDate = getAssignementDueDate(task);
boolean allowed = task != null && (StringHelper.containsNonWhitespace(task.getTaskName()) || (!StringHelper.containsNonWhitespace(task.getTaskName()) && task.getTaskStatus() == TaskProcess.submit)) && (task.getTaskStatus() == TaskProcess.assignment || task.getTaskStatus() == TaskProcess.submit) && task.getAllowResetDate() != null && (assignmentDueDate == null || assignmentDueDate.getDueDate() == null || assignmentDueDate.getDueDate().after(new Date())) && GTACourseNode.GTASK_ASSIGNEMENT_TYPE_MANUAL.equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_ASSIGNEMENT_TYPE));
resetTaskButton.setVisible(allowed);
}
use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.
the class GTAAbstractController method stepSubmit.
protected Task stepSubmit(@SuppressWarnings("unused") UserRequest ureq, Task assignedTask) {
DueDate dueDate = getSubmissionDueDate(assignedTask);
if (dueDate != null) {
if (dueDate.getDueDate() != null) {
Date date = dueDate.getDueDate();
String dateAsString = formatDueDate(dueDate, true);
mainVC.contextPut("submitDueDate", dateAsString);
mainVC.contextRemove("submitDueDateMsg");
if (assignedTask != null && assignedTask.getTaskStatus() == TaskProcess.submit && date.compareTo(new Date()) < 0) {
// push to the next step
int numOfDocs = getNumberOfSubmittedDocuments();
assignedTask = gtaManager.submitTask(assignedTask, gtaNode, numOfDocs, Role.auto);
doUpdateAttempts();
}
} else if (dueDate.getMessageKey() != null) {
mainVC.contextPut("submitDueDateMsg", translate(dueDate.getMessageKey(), dueDate.getMessageArg()));
mainVC.contextRemove("submitDueDate");
}
}
return assignedTask;
}
use of org.olat.course.nodes.gta.model.DueDate 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;
}
Aggregations