use of org.olat.course.assessment.model.BulkAssessmentDatas in project OpenOLAT by OpenOLAT.
the class DataStepForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
String val = dataEl.getValue();
if (!StringHelper.containsNonWhitespace(val) && (returnFileEl != null ? !returnFileEl.isUploadSuccess() : true)) {
// do not proceed when nothin in input field and no file uploaded
setFormWarning("form.step2.error");
return;
}
// reset error
setFormWarning(null);
BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
if (datas == null) {
datas = new BulkAssessmentDatas();
}
if (bulkAssessmentTmpDir == null) {
OlatRootFolderImpl bulkAssessmentDir = new OlatRootFolderImpl("/bulkassessment/", null);
bulkAssessmentTmpDir = bulkAssessmentDir.createChildContainer(UUID.randomUUID().toString());
}
backupInputDatas(val, datas, bulkAssessmentTmpDir);
List<String[]> splittedRows = splitRawData(val);
addToRunContext("splittedRows", splittedRows);
List<BulkAssessmentRow> rows = new ArrayList<>(100);
if (returnFileEl != null) {
processReturnFiles(datas, rows, bulkAssessmentTmpDir);
}
datas.setRows(rows);
addToRunContext("datas", datas);
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project openolat by klemens.
the class ValidationStepForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (validModel.getRowCount() == 0) {
// do not continue wizard without valid data
return;
}
BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
List<BulkAssessmentRow> rows = new ArrayList<>(validModel.getRowCount() + invalidModel.getRowCount());
for (int i = validModel.getRowCount(); i-- > 0; ) {
rows.add(validModel.getObject(i).getRow());
}
for (int i = invalidModel.getRowCount(); i-- > 0; ) {
rows.add(invalidModel.getObject(i).getRow());
}
datas.setRows(rows);
addToRunContext("datas", datas);
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project openolat by klemens.
the class BulkAssessmentOverviewController method doNewBulkAssessment.
private void doNewBulkAssessment(UserRequest ureq) {
removeAsListenerAndDispose(bulkAssessmentCtrl);
List<AssessableCourseNode> nodes = new ArrayList<>();
ICourse course = CourseFactory.loadCourse(courseEntry);
collectBulkAssessableCourseNode(course.getRunStructure().getRootNode(), nodes);
Step start;
if (nodes.size() > 1) {
start = new BulkAssessment_1_SelectCourseNodeStep(ureq, courseEntry);
} else if (nodes.size() == 1) {
start = new BulkAssessment_2_DatasStep(ureq, nodes.get(0));
} else {
showWarning("bulk.action.no.coursenodes");
return;
}
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
Date scheduledDate = (Date) runContext.get("scheduledDate");
AssessableCourseNode courseNode = (AssessableCourseNode) runContext.get("courseNode");
BulkAssessmentDatas datas = (BulkAssessmentDatas) runContext.get("datas");
Feedback feedback = doBulkAssessment(courseNode, scheduledDate, datas);
runContext.put("feedback", feedback);
return StepsMainRunController.DONE_MODIFIED;
}
};
bulkAssessmentCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("bulk.wizard.title"), "o_sel_bulk_assessment_wizard");
listenTo(bulkAssessmentCtrl);
getWindowControl().pushAsModalDialog(bulkAssessmentCtrl.getInitialComponent());
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project openolat by klemens.
the class BulkAssessmentOverviewController method doEditBulkAssessment.
private void doEditBulkAssessment(UserRequest ureq, TaskData data) {
removeAsListenerAndDispose(bulkAssessmentCtrl);
if (editedTask != null) {
// only for security purpose
taskManager.returnTaskAfterEdition(editedTask, null);
}
AssessableCourseNode courseNode = data.getCourseNode();
final Task editableTask = taskManager.pickTaskForEdition(data.getTask());
editedTask = editableTask;
if (editableTask == null) {
showWarning("task.edited");
} else {
BulkAssessmentTask runnable = taskManager.getPersistedRunnableTask(editableTask, BulkAssessmentTask.class);
BulkAssessmentDatas datas = runnable.getDatas();
Step start = new BulkAssessment_2_DatasStep(ureq, courseNode, datas, editableTask);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
Task task = (Task) runContext.get("task");
Date scheduledDate = (Date) runContext.get("scheduledDate");
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) runContext.get("courseNode");
BulkAssessmentDatas bulkDatas = (BulkAssessmentDatas) runContext.get("datas");
Feedback feedback = doUpdateBulkAssessment(task, assessableCourseNode, scheduledDate, bulkDatas);
runContext.put("feedback", feedback);
editedTask = null;
return StepsMainRunController.DONE_MODIFIED;
}
};
StepRunnerCallback cancel = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
taskManager.returnTaskAfterEdition(editableTask, null);
editedTask = null;
return Step.NOSTEP;
}
};
bulkAssessmentCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, cancel, translate("bulk.wizard.title"), "o_sel_bulk_assessment_wizard");
listenTo(bulkAssessmentCtrl);
getWindowControl().pushAsModalDialog(bulkAssessmentCtrl.getInitialComponent());
}
}
Aggregations