use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class DialogCourseNode method updateModuleConfigDefaults.
/**
* Update the module configuration to have all mandatory configuration flags
* set to usefull default values
*
* @param isNewNode true: an initial configuration is set; false: upgrading
* from previous node configuration version, set default to maintain
* previous behaviour
*/
public void updateModuleConfigDefaults(boolean isNewNode) {
ModuleConfiguration config = getModuleConfiguration();
if (isNewNode) {
// use defaults for new course building blocks
// REVIEW:pb version should go to 2 now and the handling for 1er should be to remove
config.setConfigurationVersion(1);
config.set(DialogConfigForm.DIALOG_CONFIG_INTEGRATION, DialogConfigForm.CONFIG_INTEGRATION_VALUE_INLINE);
}
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class EdubaseCourseNode method updateModuleConfigDefaults.
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
ModuleConfiguration config = getModuleConfiguration();
if (isNewNode) {
config.setBooleanEntry(CONFIG_DESCRIPTION_ENABLED, Boolean.TRUE.booleanValue());
}
config.setConfigurationVersion(CURRENT_VERSION);
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTACourseNode method archiveNodeData.
@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
final GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class);
final ModuleConfiguration config = getModuleConfiguration();
String prefix;
if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
prefix = "grouptask_";
} else {
prefix = "ita_";
}
String dirName = prefix + StringHelper.transformDisplayNameToFileSystemName(getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
TaskList taskList = gtaManager.getTaskList(course.getCourseEnvironment().getCourseGroupManager().getCourseEntry(), this);
// save assessment datas
List<Identity> users = null;
if (config.getBooleanSafe(GTASK_GRADING)) {
users = ScoreAccountingHelper.loadUsers(course.getCourseEnvironment(), options);
String courseTitle = course.getCourseTitle();
String fileName = ExportUtil.createFileNameWithTimeStamp(courseTitle, "xlsx");
List<AssessableCourseNode> nodes = Collections.<AssessableCourseNode>singletonList(this);
try (OutputStream out = new ShieldOutputStream(exportStream)) {
exportStream.putNextEntry(new ZipEntry(dirName + "/" + fileName));
ScoreAccountingHelper.createCourseResultsOverviewXMLTable(users, nodes, course, locale, out);
exportStream.closeEntry();
} catch (Exception e) {
log.error("", e);
}
}
// copy tasks
if (taskList != null) {
if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
List<BusinessGroup> selectedGroups;
if (options != null && options.getGroup() != null) {
selectedGroups = Collections.singletonList(options.getGroup());
} else {
selectedGroups = gtaManager.getBusinessGroups(this);
}
for (BusinessGroup businessGroup : selectedGroups) {
archiveNodeData(course, businessGroup, taskList, dirName, exportStream);
}
} else {
if (users == null) {
users = ScoreAccountingHelper.loadUsers(course.getCourseEnvironment(), options);
}
Set<Identity> uniqueUsers = new HashSet<>(users);
for (Identity user : uniqueUsers) {
archiveNodeData(course, user, taskList, dirName, exportStream);
}
}
}
// copy solutions
if (config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION)) {
VFSContainer solutions = gtaManager.getSolutionsContainer(course.getCourseEnvironment(), this);
if (solutions.exists()) {
String solutionDirName = dirName + "/solutions";
for (VFSItem solution : solutions.getItems(new SystemItemFilter())) {
ZipUtil.addToZip(solution, solutionDirName, exportStream);
}
}
}
return true;
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTACourseNode method archiveNodeData.
private void archiveNodeData(ICourse course, Identity assessedIdentity, TaskList taskList, String dirName, ZipOutputStream exportStream) {
ModuleConfiguration config = getModuleConfiguration();
GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class);
String name = assessedIdentity.getUser().getLastName() + "_" + assessedIdentity.getUser().getFirstName() + "_" + assessedIdentity.getName();
// for beautiful ordering
int flow = 0;
String userDirName = dirName + "/" + StringHelper.transformDisplayNameToFileSystemName(name);
Task task = gtaManager.getTask(assessedIdentity, taskList);
if (task != null && task.getTaskName() != null && config.getBooleanSafe(GTASK_ASSIGNMENT)) {
File taskDirectory = gtaManager.getTasksDirectory(course.getCourseEnvironment(), this);
File taskFile = new File(taskDirectory, task.getTaskName());
if (taskFile.exists()) {
String path = userDirName + "/" + (++flow) + "_task/" + taskFile.getName();
ZipUtil.addFileToZip(path, taskFile, exportStream);
}
}
if (config.getBooleanSafe(GTASK_SUBMIT)) {
File submitDirectory = gtaManager.getSubmitDirectory(course.getCourseEnvironment(), this, assessedIdentity);
String submissionDirName = userDirName + "/" + (++flow) + "_submissions";
ZipUtil.addDirectoryToZip(submitDirectory.toPath(), submissionDirName, exportStream);
}
if (config.getBooleanSafe(GTACourseNode.GTASK_REVIEW_AND_CORRECTION)) {
File correctionsDir = gtaManager.getCorrectionDirectory(course.getCourseEnvironment(), this, assessedIdentity);
String correctionDirName = userDirName + "/" + (++flow) + "_corrections";
ZipUtil.addDirectoryToZip(correctionsDir.toPath(), correctionDirName, exportStream);
}
if (task != null && config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD)) {
int numOfIteration = task.getRevisionLoop();
for (int i = 1; i <= numOfIteration; i++) {
File revisionDirectory = gtaManager.getRevisedDocumentsDirectory(course.getCourseEnvironment(), this, i, assessedIdentity);
String revisionDirName = userDirName + "/" + (++flow) + "_revisions_" + i;
ZipUtil.addDirectoryToZip(revisionDirectory.toPath(), revisionDirName, exportStream);
File correctionDirectory = gtaManager.getRevisedDocumentsCorrectionsDirectory(course.getCourseEnvironment(), this, i, assessedIdentity);
String correctionDirName = userDirName + "/" + (++flow) + "_corrections_" + i;
ZipUtil.addDirectoryToZip(correctionDirectory.toPath(), correctionDirName, exportStream);
}
}
// assessment documents
if (config.getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_INDIVIDUAL_ASSESSMENT_DOCS, false)) {
List<File> assessmentDocuments = course.getCourseEnvironment().getAssessmentManager().getIndividualAssessmentDocuments(this, assessedIdentity);
if (assessmentDocuments != null && !assessmentDocuments.isEmpty()) {
String assessmentDir = userDirName + "/" + (++flow) + "_assessment/";
for (File document : assessmentDocuments) {
String path = assessmentDir + document.getName();
ZipUtil.addFileToZip(path, document, exportStream);
}
}
}
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTACourseNode method updateModuleConfigDefaults.
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
if (isNewNode) {
// setup default configuration
ModuleConfiguration config = getModuleConfiguration();
// group task
if (getType().equals(TYPE_INDIVIDUAL)) {
config.setStringValue(GTASK_TYPE, GTAType.individual.name());
} else {
config.setStringValue(GTASK_TYPE, GTAType.group.name());
}
// manual choice
config.setStringValue(GTASK_ASSIGNEMENT_TYPE, GTASK_ASSIGNEMENT_TYPE_MANUAL);
// all steps
config.setBooleanEntry(GTASK_ASSIGNMENT, true);
config.setBooleanEntry(GTASK_SUBMIT, true);
config.setBooleanEntry(GTASK_REVIEW_AND_CORRECTION, true);
config.setBooleanEntry(GTASK_REVISION_PERIOD, true);
config.setBooleanEntry(GTASK_SAMPLE_SOLUTION, true);
config.setBooleanEntry(GTASK_GRADING, true);
// editors
config.setBooleanEntry(GTACourseNode.GTASK_EXTERNAL_EDITOR, true);
config.setBooleanEntry(GTACourseNode.GTASK_EMBBEDED_EDITOR, true);
// reuse tasks
config.setStringValue(GTACourseNode.GTASK_SAMPLING, GTACourseNode.GTASK_SAMPLING_REUSE);
// configure grading
config.set(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, Boolean.FALSE);
config.set(MSCourseNode.CONFIG_KEY_SCORE_MIN, new Float(0));
config.set(MSCourseNode.CONFIG_KEY_SCORE_MAX, new Float(0));
config.set(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD, Boolean.TRUE);
config.set(MSCourseNode.CONFIG_KEY_HAS_COMMENT_FIELD, Boolean.TRUE);
}
}
Aggregations