use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class IQConfigurationController method updateEditController.
/**
* Update the edit and layout controllers.
*
* @param ureq The user request
* @param replacedTest Set true if the test was replaced by a new one.
*/
protected void updateEditController(UserRequest ureq, boolean replacedTest) {
removeAsListenerAndDispose(mod12ConfigForm);
removeAsListenerAndDispose(mod21ConfigForm);
mod12ConfigForm = null;
mod21ConfigForm = null;
RepositoryEntry re = getIQReference();
if (re == null) {
myContent.remove("iqeditform");
} else if (ImsQTI21Resource.TYPE_NAME.equals(re.getOlatResource().getResourceableTypeName())) {
boolean needManualCorrection = false;
try {
// in case of an unreadable test
needManualCorrection = needManualCorrectionQTI21(re);
} catch (Exception e) {
logError("Test cannot be read: " + re, e);
showError("error.resource.corrupted");
}
if (replacedTest) {
// set some default settings in case the user don't save the next panel
moduleConfiguration.setStringValue(IQEditController.CONFIG_CORRECTION_MODE, needManualCorrection ? "manual" : "auto");
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
QTI21DeliveryOptions deliveryOptions = qti21service.getDeliveryOptions(re);
mod21ConfigForm = new QTI21EditForm(ureq, getWindowControl(), moduleConfiguration, deliveryOptions, needManualCorrection);
mod21ConfigForm.update(re);
listenTo(mod21ConfigForm);
myContent.put("iqeditform", mod21ConfigForm.getInitialComponent());
} else if (OnyxModule.isOnyxTest(re.getOlatResource())) {
myContent.remove("iqeditform");
showError("error.onyx");
} else {
boolean hasEssay = needManualCorrectionQTI12(re);
if (replacedTest) {
// set some default settings in case the user don't save the next panel
moduleConfiguration.setStringValue(IQEditController.CONFIG_CORRECTION_MODE, hasEssay ? "manual" : "auto");
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
mod12ConfigForm = new IQ12EditForm(ureq, getWindowControl(), moduleConfiguration, hasEssay);
mod12ConfigForm.update(re.getOlatResource());
listenTo(mod12ConfigForm);
myContent.put("iqeditform", mod12ConfigForm.getInitialComponent());
}
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class IQIdentityListCourseNodeController method isSuspendEnable.
private boolean isSuspendEnable() {
ModuleConfiguration config = courseNode.getModuleConfiguration();
QTI21DeliveryOptions testOptions = qtiService.getDeliveryOptions(getReferencedRepositoryEntry());
boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
boolean suspendEnabled = false;
if (!configRef) {
suspendEnabled = config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESUSPEND, testOptions.isEnableSuspend());
} else {
suspendEnabled = testOptions.isEnableSuspend();
}
return suspendEnabled;
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentRunController method getDeliveryOptions.
private QTI21DeliveryOptions getDeliveryOptions() {
QTI21DeliveryOptions testOptions = qtiService.getDeliveryOptions(testEntry);
QTI21DeliveryOptions finalOptions = testOptions.clone();
boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
if (!configRef) {
finalOptions.setMaxAttempts(config.getIntegerSafe(IQEditController.CONFIG_KEY_ATTEMPTS, testOptions.getMaxAttempts()));
finalOptions.setBlockAfterSuccess(config.getBooleanSafe(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS, testOptions.isBlockAfterSuccess()));
finalOptions.setHideLms(config.getBooleanSafe(IQEditController.CONFIG_FULLWINDOW, testOptions.isHideLms()));
finalOptions.setShowTitles(config.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTIONTITLE, testOptions.isShowTitles()));
finalOptions.setPersonalNotes(config.getBooleanSafe(IQEditController.CONFIG_KEY_MEMO, testOptions.isPersonalNotes()));
finalOptions.setEnableCancel(config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLECANCEL, testOptions.isEnableCancel()));
finalOptions.setEnableSuspend(config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESUSPEND, testOptions.isEnableSuspend()));
finalOptions.setDisplayQuestionProgress(config.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTIONPROGRESS, testOptions.isDisplayQuestionProgress()));
finalOptions.setDisplayMaxScoreItem(config.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTION_MAX_SCORE, testOptions.isDisplayMaxScoreItem()));
finalOptions.setDisplayScoreProgress(config.getBooleanSafe(IQEditController.CONFIG_KEY_SCOREPROGRESS, testOptions.isDisplayScoreProgress()));
finalOptions.setHideFeedbacks(config.getBooleanSafe(IQEditController.CONFIG_KEY_HIDE_FEEDBACKS, testOptions.isHideFeedbacks()));
finalOptions.setAssessmentResultsOptions(QTI21AssessmentResultsOptions.parseString(config.getStringValue(IQEditController.CONFIG_KEY_SUMMARY, AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT)));
finalOptions.setShowMenu(config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLEMENU, testOptions.isShowMenu()));
finalOptions.setAllowAnonym(config.getBooleanSafe(IQEditController.CONFIG_ALLOW_ANONYM, testOptions.isAllowAnonym()));
finalOptions.setDigitalSignature(config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE, testOptions.isDigitalSignature()));
finalOptions.setDigitalSignatureMail(config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE_SEND_MAIL, testOptions.isDigitalSignatureMail()));
}
Boolean assessmentResultOnFinish = config.getBooleanEntry(IQEditController.CONFIG_KEY_RESULT_ON_FINISH);
if (assessmentResultOnFinish != null) {
finalOptions.setShowAssessmentResultsOnFinish(assessmentResultOnFinish.booleanValue());
}
if (!AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT.equals(config.getStringValue(IQEditController.CONFIG_KEY_SUMMARY))) {
// if this setting is set, override the summary
finalOptions.setAssessmentResultsOptions(QTI21AssessmentResultsOptions.parseString(config.getStringValue(IQEditController.CONFIG_KEY_SUMMARY, AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT)));
}
return finalOptions;
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class IQTESTCourseNode method isGuestAllowedForQTI21.
public boolean isGuestAllowedForQTI21(RepositoryEntry testEntry) {
OLATResource ores = testEntry.getOlatResource();
if (ImsQTI21Resource.TYPE_NAME.equals(ores.getResourceableTypeName())) {
QTI21DeliveryOptions options = CoreSpringFactory.getImpl(QTI21Service.class).getDeliveryOptions(testEntry);
boolean allowAnonym = options != null && options.isAllowAnonym();
allowAnonym = getModuleConfiguration().getBooleanSafe(IQEditController.CONFIG_ALLOW_ANONYM, allowAnonym);
return allowAnonym;
}
return false;
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentDetailsController method getSignatureOptions.
private DigitalSignatureOptions getSignatureOptions(AssessmentTestSession session) {
RepositoryEntry sessionTestEntry = session.getTestEntry();
QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(sessionTestEntry);
boolean digitalSignature = deliveryOptions.isDigitalSignature();
boolean sendMail = deliveryOptions.isDigitalSignatureMail();
if (courseNode != null) {
ModuleConfiguration config = courseNode.getModuleConfiguration();
digitalSignature = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE, deliveryOptions.isDigitalSignature());
sendMail = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE_SEND_MAIL, deliveryOptions.isDigitalSignatureMail());
}
DigitalSignatureOptions options = new DigitalSignatureOptions(digitalSignature, sendMail, entry, testEntry);
if (digitalSignature) {
if (courseNode == null) {
AssessmentEntryOutcomesListener.decorateResourceConfirmation(entry, testEntry, session, options, null, getLocale());
} else {
CourseEnvironment courseEnv = CourseFactory.loadCourse(entry).getCourseEnvironment();
QTI21AssessmentRunController.decorateCourseConfirmation(session, options, courseEnv, courseNode, sessionTestEntry, null, getLocale());
}
}
return options;
}
Aggregations