use of org.olat.ims.qti21.QTI21DeliveryOptions in project openolat by klemens.
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 klemens.
the class IQConfigurationController method doPreview.
private void doPreview(UserRequest ureq) {
removeAsListenerAndDispose(previewLayoutCtr);
RepositoryEntry re = getIQReference();
if (re != null) {
Controller previewController;
if (OnyxModule.isOnyxTest(re.getOlatResource())) {
showError("error.onyx");
} else if (ImsQTI21Resource.TYPE_NAME.equals(re.getOlatResource().getResourceableTypeName())) {
// clean up last session
cleanUpQti21PreviewSession();
// need to clean up the assessment test session
QTI21DeliveryOptions deliveryOptions = qti21service.getDeliveryOptions(re);
QTI21OverrideOptions overrideOptions = QTI21OverrideOptions.nothingOverriden();
RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
previewQTI21Ctrl = new AssessmentTestDisplayController(ureq, getWindowControl(), new InMemoryOutcomeListener(), re, courseEntry, courseNode.getIdent(), deliveryOptions, overrideOptions, true, true, true);
listenTo(previewQTI21Ctrl);
stackPanel.pushController(translate("preview"), previewQTI21Ctrl);
} else {
long courseResId = course.getResourceableId().longValue();
previewController = iqManager.createIQDisplayController(moduleConfiguration, new IQPreviewSecurityCallback(), ureq, getWindowControl(), courseResId, courseNode.getIdent(), null);
previewLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), previewController);
stackPanel.pushController(translate("preview"), previewLayoutCtr);
}
}
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project openolat by klemens.
the class IQLayoutConfigurationController method updateEditController.
protected void updateEditController(UserRequest ureq) {
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())) {
QTI21DeliveryOptions deliveryOptions = qti21service.getDeliveryOptions(re);
mod21ConfigForm = new QTI21EditLayoutForm(ureq, getWindowControl(), moduleConfiguration, re, deliveryOptions);
listenTo(mod21ConfigForm);
myContent.put("iqeditform", mod21ConfigForm.getInitialComponent());
} else if (OnyxModule.isOnyxTest(re.getOlatResource())) {
myContent.remove("iqeditform");
} else {
mod12ConfigForm = new IQ12LayoutEditForm(ureq, getWindowControl(), moduleConfiguration);
listenTo(mod12ConfigForm);
myContent.put("iqeditform", mod12ConfigForm.getInitialComponent());
}
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
the class IQLayoutConfigurationController method updateEditController.
protected void updateEditController(UserRequest ureq) {
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())) {
QTI21DeliveryOptions deliveryOptions = qti21service.getDeliveryOptions(re);
mod21ConfigForm = new QTI21EditLayoutForm(ureq, getWindowControl(), moduleConfiguration, re, deliveryOptions);
listenTo(mod21ConfigForm);
myContent.put("iqeditform", mod21ConfigForm.getInitialComponent());
} else if (OnyxModule.isOnyxTest(re.getOlatResource())) {
myContent.remove("iqeditform");
} else {
mod12ConfigForm = new IQ12LayoutEditForm(ureq, getWindowControl(), moduleConfiguration);
listenTo(mod12ConfigForm);
myContent.put("iqeditform", mod12ConfigForm.getInitialComponent());
}
}
use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.
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;
}
Aggregations