use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class TACourseNode method updateModuleConfigDefaults.
/**
* Init config parameter with default values for a new course node.
*/
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
ModuleConfiguration config = getModuleConfiguration();
if (isNewNode) {
// use defaults for new course building blocks
// task defaults
config.set(CONF_TASK_ENABLED, Boolean.TRUE);
config.set(CONF_TASK_TYPE, TaskController.TYPE_MANUAL);
config.set(CONF_TASK_TEXT, "");
config.set(CONF_TASK_SAMPLING_WITH_REPLACEMENT, Boolean.TRUE);
// dropbox defaults
config.set(CONF_DROPBOX_ENABLED, Boolean.TRUE);
config.set(CONF_RETURNBOX_ENABLED, Boolean.TRUE);
config.set(CONF_DROPBOX_ENABLEMAIL, Boolean.FALSE);
config.set(CONF_DROPBOX_CONFIRMATION, "");
// scoring defaults
config.set(CONF_SCORING_ENABLED, Boolean.TRUE);
// New config parameter version 2
config.setBooleanEntry(CONF_TASK_PREVIEW, false);
// solution defaults
config.set(CONF_SOLUTION_ENABLED, Boolean.TRUE);
MSCourseNode.initDefaultConfig(config);
config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
} else {
int version = config.getConfigurationVersion();
if (version < CURRENT_CONFIG_VERSION) {
// Loaded config is older than current config version => migrate
if (version == 1) {
// migrate V1 => V2
config.setBooleanEntry(CONF_TASK_PREVIEW, false);
// solution defaults
config.set(CONF_SOLUTION_ENABLED, Boolean.FALSE);
MSCourseNode.initDefaultConfig(config);
version = 2;
}
config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
}
}
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class TACourseNode method hasScoreConfigured.
/**
* @see org.olat.course.nodes.AssessableCourseNode#hasScoreConfigured()
*/
@Override
public boolean hasScoreConfigured() {
Boolean hasScoring = (Boolean) getModuleConfiguration().get(CONF_SCORING_ENABLED);
if (hasScoring) {
ModuleConfiguration config = getModuleConfiguration();
Boolean score = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
if (score != null) {
return score.booleanValue();
}
}
return false;
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class TACourseNode method getMaxScoreConfiguration.
/**
* @see org.olat.course.nodes.AssessableCourseNode#getMaxScoreConfiguration()
*/
@Override
public Float getMaxScoreConfiguration() {
if (!hasScoreConfigured()) {
throw new OLATRuntimeException(TACourseNode.class, "getMaxScore not defined when hasScore set to false", null);
}
ModuleConfiguration config = getModuleConfiguration();
Float max = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
return max;
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class BasicLTICourseNode method isGuestAllowed.
public boolean isGuestAllowed() {
ModuleConfiguration config = getModuleConfiguration();
boolean assessable = config.getBooleanSafe(BasicLTICourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false);
boolean sendName = config.getBooleanSafe(LTIConfigForm.CONFIG_KEY_SENDNAME, false);
boolean sendEmail = config.getBooleanSafe(LTIConfigForm.CONFIG_KEY_SENDEMAIL, false);
boolean customValues = StringHelper.containsNonWhitespace(config.getStringValue(LTIConfigForm.CONFIG_KEY_CUSTOM));
return !assessable && !sendName && !sendEmail && !customValues;
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class BasicLTICourseNode method hasPassedConfigured.
@Override
public boolean hasPassedConfigured() {
ModuleConfiguration config = getModuleConfiguration();
Boolean passed = config.getBooleanEntry(CONFIG_KEY_HAS_PASSED_FIELD);
return (passed == null) ? false : passed.booleanValue();
}
Aggregations