Search in sources :

Example 1 with QTI21DeliveryOptions

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());
    }
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 2 with QTI21DeliveryOptions

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;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions)

Example 3 with QTI21DeliveryOptions

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;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 4 with QTI21DeliveryOptions

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;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) QTI21Service(org.olat.ims.qti21.QTI21Service) OLATResource(org.olat.resource.OLATResource)

Example 5 with QTI21DeliveryOptions

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;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) DigitalSignatureOptions(org.olat.ims.qti21.model.DigitalSignatureOptions) RepositoryEntry(org.olat.repository.RepositoryEntry)

Aggregations

QTI21DeliveryOptions (org.olat.ims.qti21.QTI21DeliveryOptions)22 RepositoryEntry (org.olat.repository.RepositoryEntry)14 File (java.io.File)6 ModuleConfiguration (org.olat.modules.ModuleConfiguration)6 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)4 QTI21Service (org.olat.ims.qti21.QTI21Service)4 DigitalSignatureOptions (org.olat.ims.qti21.model.DigitalSignatureOptions)4 OLATResource (org.olat.resource.OLATResource)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 NodeEditController (org.olat.course.editor.NodeEditController)2 FileResourceManager (org.olat.fileresource.FileResourceManager)2 ImsQTI21Resource (org.olat.fileresource.types.ImsQTI21Resource)2 QTIEditorPackage (org.olat.ims.qti.editor.QTIEditorPackage)2 Assessment (org.olat.ims.qti.editor.beecom.objects.Assessment)2