use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class QTI21DeliveryOptionsController method applyDeliveryOptions.
private void applyDeliveryOptions(QTI21DeliveryOptions options) {
String maxAttemptsValue = "";
int maxAttempts = options.getMaxAttempts();
if (maxAttempts > 0) {
limitAttemptsEl.select(onKeys[0], true);
maxAttemptsValue = Integer.toString(maxAttempts);
} else {
limitAttemptsEl.uncheckAll();
}
maxAttemptsEl.setValue(maxAttemptsValue);
maxAttemptsEl.setVisible(maxAttempts > 0);
applyMultipleSelection(blockAfterSuccessEl, options.isBlockAfterSuccess());
applyMultipleSelection(allowAnonymEl, options.isAllowAnonym());
applyMultipleSelection(hideLmsEl, options.isHideLms());
applyMultipleSelection(showTitlesEl, options.isShowTitles());
applyMultipleSelection(showMenuEl, options.isShowMenu());
applyMultipleSelection(personalNotesEl, options.isPersonalNotes());
applyMultipleSelection(displayQuestionProgressEl, options.isDisplayQuestionProgress());
applyMultipleSelection(displayScoreProgressEl, options.isDisplayScoreProgress());
applyMultipleSelection(displayMaxScoreItemEl, options.isDisplayMaxScoreItem());
applyMultipleSelection(enableSuspendEl, options.isEnableSuspend());
applyMultipleSelection(enableCancelEl, options.isEnableCancel());
applyMultipleSelection(showFeedbacksEl, !options.isHideFeedbacks());
if (options.isShowAssessmentResultsOnFinish()) {
showResultsOnFinishEl.select(onKeys[0], true);
}
QTI21AssessmentResultsOptions resultsOptions = options.getAssessmentResultsOptions();
if (!resultsOptions.none()) {
assessmentResultsOnFinishEl.uncheckAll();
if (resultsOptions.isMetadata()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[0], true);
}
if (resultsOptions.isSectionSummary()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[1], true);
}
if (resultsOptions.isQuestionSummary()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[2], true);
}
if (resultsOptions.isUserSolutions()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[3], true);
}
if (resultsOptions.isCorrectSolutions()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[4], true);
}
} else {
assessmentResultsOnFinishEl.uncheckAll();
}
assessmentResultsOnFinishEl.setVisible(showResultsOnFinishEl.isAtLeastSelected(1));
boolean digitalSignature = options.isDigitalSignature();
applyMultipleSelection(digitalSignatureEl, digitalSignature);
boolean digitalSignatureSendMail = options.isDigitalSignatureMail();
applyMultipleSelection(digitalSignatureMailEl, digitalSignatureSendMail);
digitalSignatureMailEl.setVisible(qtiModule.isDigitalSignatureEnabled() && digitalSignatureEl.isAtLeastSelected(1));
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentTestHandler method createResource.
@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
ImsQTI21Resource ores = new ImsQTI21Resource();
OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(ores);
RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
dbInstance.commit();
File repositoryDir = new File(FileResourceManager.getInstance().getFileResourceRoot(re.getOlatResource()), FileResourceManager.ZIPDIR);
if (!repositoryDir.exists()) {
repositoryDir.mkdirs();
}
if (createObject instanceof QItemList) {
QItemList itemToImport = (QItemList) createObject;
qpoolServiceProvider.exportToEditorPackage(repositoryDir, itemToImport.getItems(), locale);
} else if (createObject instanceof QTIEditorPackage) {
QTIEditorPackage testToConvert = (QTIEditorPackage) createObject;
QTI21DeliveryOptions options = qtiService.getDeliveryOptions(re);
qpoolServiceProvider.convertFromEditorPackage(testToConvert, repositoryDir, locale, options);
qtiService.setDeliveryOptions(re, options);
} else if (createObject instanceof OLATResource) {
// convert a Onyx test in QTI 2.1
OLATResource onyxResource = (OLATResource) createObject;
RepositoryEntry onyxRe = CoreSpringFactory.getImpl(RepositoryService.class).loadByResourceKey(onyxResource.getKey());
if (OnyxModule.isOnyxTest((OLATResource) createObject)) {
copyOnyxResources(onyxResource, repositoryDir);
} else {
QTI21DeliveryOptions options = qtiService.getDeliveryOptions(re);
QTIEditorPackage testToConvert = TestFileResource.getQTIEditorPackageReader(onyxResource);
qpoolServiceProvider.convertFromEditorPackage(testToConvert, repositoryDir, locale, options);
qtiService.setDeliveryOptions(re, options);
}
copyMetadata(onyxRe, re, repositoryDir);
} else {
createMinimalAssessmentTest(displayname, repositoryDir, locale);
}
return re;
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project openolat by klemens.
the class QTI21AssessmentTestHandler method createResource.
@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
ImsQTI21Resource ores = new ImsQTI21Resource();
OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(ores);
RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
dbInstance.commit();
File repositoryDir = new File(FileResourceManager.getInstance().getFileResourceRoot(re.getOlatResource()), FileResourceManager.ZIPDIR);
if (!repositoryDir.exists()) {
repositoryDir.mkdirs();
}
if (createObject instanceof QItemList) {
QItemList itemToImport = (QItemList) createObject;
qpoolServiceProvider.exportToEditorPackage(repositoryDir, itemToImport.getItems(), locale);
} else if (createObject instanceof QTIEditorPackage) {
QTIEditorPackage testToConvert = (QTIEditorPackage) createObject;
QTI21DeliveryOptions options = qtiService.getDeliveryOptions(re);
qpoolServiceProvider.convertFromEditorPackage(testToConvert, repositoryDir, locale, options);
qtiService.setDeliveryOptions(re, options);
} else if (createObject instanceof OLATResource) {
// convert a Onyx test in QTI 2.1
OLATResource onyxResource = (OLATResource) createObject;
RepositoryEntry onyxRe = CoreSpringFactory.getImpl(RepositoryService.class).loadByResourceKey(onyxResource.getKey());
if (OnyxModule.isOnyxTest((OLATResource) createObject)) {
copyOnyxResources(onyxResource, repositoryDir);
} else {
QTI21DeliveryOptions options = qtiService.getDeliveryOptions(re);
QTIEditorPackage testToConvert = TestFileResource.getQTIEditorPackageReader(onyxResource);
qpoolServiceProvider.convertFromEditorPackage(testToConvert, repositoryDir, locale, options);
qtiService.setDeliveryOptions(re, options);
}
copyMetadata(onyxRe, re, repositoryDir);
} else {
createMinimalAssessmentTest(displayname, repositoryDir, locale);
}
return re;
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project openolat by klemens.
the class QTI21ServiceImpl method getDeliveryOptions.
@Override
public QTI21DeliveryOptions getDeliveryOptions(RepositoryEntry testEntry) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(testEntry.getOlatResource());
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
QTI21DeliveryOptions config;
if (configXml.exists()) {
config = (QTI21DeliveryOptions) configXstream.fromXML(configXml);
} else {
// set default config
config = QTI21DeliveryOptions.defaultSettings();
setDeliveryOptions(testEntry, config);
}
return config;
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project openolat by klemens.
the class QTI21DeliveryOptionsController method applyDeliveryOptions.
private void applyDeliveryOptions(QTI21DeliveryOptions options) {
String maxAttemptsValue = "";
int maxAttempts = options.getMaxAttempts();
if (maxAttempts > 0) {
limitAttemptsEl.select(onKeys[0], true);
maxAttemptsValue = Integer.toString(maxAttempts);
} else {
limitAttemptsEl.uncheckAll();
}
maxAttemptsEl.setValue(maxAttemptsValue);
maxAttemptsEl.setVisible(maxAttempts > 0);
applyMultipleSelection(blockAfterSuccessEl, options.isBlockAfterSuccess());
applyMultipleSelection(allowAnonymEl, options.isAllowAnonym());
applyMultipleSelection(hideLmsEl, options.isHideLms());
applyMultipleSelection(showTitlesEl, options.isShowTitles());
applyMultipleSelection(showMenuEl, options.isShowMenu());
applyMultipleSelection(personalNotesEl, options.isPersonalNotes());
applyMultipleSelection(displayQuestionProgressEl, options.isDisplayQuestionProgress());
applyMultipleSelection(displayScoreProgressEl, options.isDisplayScoreProgress());
applyMultipleSelection(displayMaxScoreItemEl, options.isDisplayMaxScoreItem());
applyMultipleSelection(enableSuspendEl, options.isEnableSuspend());
applyMultipleSelection(enableCancelEl, options.isEnableCancel());
applyMultipleSelection(showFeedbacksEl, !options.isHideFeedbacks());
if (options.isShowAssessmentResultsOnFinish()) {
showResultsOnFinishEl.select(onKeys[0], true);
}
QTI21AssessmentResultsOptions resultsOptions = options.getAssessmentResultsOptions();
if (!resultsOptions.none()) {
assessmentResultsOnFinishEl.uncheckAll();
if (resultsOptions.isMetadata()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[0], true);
}
if (resultsOptions.isSectionSummary()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[1], true);
}
if (resultsOptions.isQuestionSummary()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[2], true);
}
if (resultsOptions.isUserSolutions()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[3], true);
}
if (resultsOptions.isCorrectSolutions()) {
assessmentResultsOnFinishEl.select(resultsOptionsKeys[4], true);
}
} else {
assessmentResultsOnFinishEl.uncheckAll();
}
assessmentResultsOnFinishEl.setVisible(showResultsOnFinishEl.isAtLeastSelected(1));
boolean digitalSignature = options.isDigitalSignature();
applyMultipleSelection(digitalSignatureEl, digitalSignature);
boolean digitalSignatureSendMail = options.isDigitalSignatureMail();
applyMultipleSelection(digitalSignatureMailEl, digitalSignatureSendMail);
digitalSignatureMailEl.setVisible(qtiModule.isDigitalSignatureEnabled() && digitalSignatureEl.isAtLeastSelected(1));
}
Aggregations