Search in sources :

Example 1 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project OpenOLAT by OpenOLAT.

the class QTI21EditForm method initFormReport.

protected void initFormReport(FormItemContainer formLayout) {
    boolean testDateDependent = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_DATE_DEPENDENT_TEST);
    testDateDependentEl = uifactory.addCheckboxesHorizontal("qti_datetest", "qti.form.test.date", formLayout, new String[] { "xx" }, new String[] { null });
    testDateDependentEl.select("xx", testDateDependent);
    testDateDependentEl.setHelpTextKey("qti.form.test.date.help", null);
    testDateDependentEl.addActionListener(FormEvent.ONCLICK);
    Date startTestDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_START_TEST_DATE);
    startTestDateElement = uifactory.addDateChooser("qti_form_start_test_date", "qti.form.date.start", startTestDate, formLayout);
    startTestDateElement.setDateChooserTimeEnabled(true);
    startTestDateElement.setMandatory(true);
    Date endTestDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_END_TEST_DATE);
    endTestDateElement = uifactory.addDateChooser("qti_form_end_test_date", "qti.form.date.end", endTestDate, formLayout);
    endTestDateElement.setDateChooserTimeEnabled(true);
    String[] correctionModeValues = new String[] { translate("correction.auto"), translate("correction.manual") };
    correctionModeEl = uifactory.addRadiosVertical("correction.mode", "correction.mode", formLayout, correctionModeKeys, correctionModeValues);
    correctionModeEl.setHelpText(translate("correction.mode.help"));
    correctionModeEl.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#details_testeditor_test_konf_kurs");
    String mode = modConfig.getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
    boolean selected = false;
    for (String correctionModeKey : correctionModeKeys) {
        if (correctionModeKey.equals(mode)) {
            correctionModeEl.select(correctionModeKey, true);
            selected = true;
        }
    }
    if (!selected) {
        if (needManualCorrection) {
            correctionModeEl.select(correctionModeKeys[1], true);
        } else {
            correctionModeEl.select(correctionModeKeys[0], true);
        }
    }
    // Show score informations on start page
    boolean enableScoreInfos = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    scoreInfo = uifactory.addCheckboxesHorizontal("qti_scoreInfo", "qti.form.scoreinfo", formLayout, new String[] { "xx" }, new String[] { null });
    if (enableScoreInfos) {
        scoreInfo.select("xx", enableScoreInfos);
    }
    scoreInfo.addActionListener(FormEvent.ONCLICK);
    boolean showResultOnHomePage = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    showResultsOnHomePage = uifactory.addCheckboxesHorizontal("qti_enableResultsOnHomePage", "qti.form.results.onhomepage", formLayout, new String[] { "xx" }, new String[] { null });
    if (showResultOnHomePage) {
        showResultsOnHomePage.select("xx", showResultOnHomePage);
    }
    showResultsOnHomePage.setElementCssClass("o_sel_results_on_homepage");
    showResultsOnHomePage.addActionListener(FormEvent.ONCLICK);
    boolean showResultsDateDependent = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_DATE_DEPENDENT_RESULTS);
    showResultsDateDependentButton = uifactory.addCheckboxesHorizontal("qti_showresult", "qti.form.show.results", formLayout, new String[] { "xx" }, new String[] { null });
    showResultsDateDependentButton.select("xx", showResultsDateDependent);
    showResultsDateDependentButton.addActionListener(FormEvent.ONCLICK);
    Date startDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_START_DATE);
    startDateElement = uifactory.addDateChooser("qti_form_start_date", "qti.form.date.start", null, formLayout);
    startDateElement.setDateChooserTimeEnabled(true);
    startDateElement.setDate(startDate);
    startDateElement.setMandatory(true);
    Date endDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_END_DATE);
    endDateElement = uifactory.addDateChooser("qti_form_end_date", "qti.form.date.end", null, formLayout);
    endDateElement.setDateChooserTimeEnabled(true);
    endDateElement.setDate(endDate);
    QTI21AssessmentResultsOptions resultsOptions = deliveryOptions.getAssessmentResultsOptions();
    if (!AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT.equals(modConfig.getStringValue(IQEditController.CONFIG_KEY_SUMMARY))) {
        resultsOptions = QTI21AssessmentResultsOptions.parseString(modConfig.getStringValue(IQEditController.CONFIG_KEY_SUMMARY, AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT));
    }
    showResultsOnFinishEl = uifactory.addCheckboxesHorizontal("resultOnFinish", "qti.form.results.onfinish", formLayout, onKeys, onValues);
    showResultsOnFinishEl.setElementCssClass("o_sel_qti_show_results");
    showResultsOnFinishEl.addActionListener(FormEvent.ONCHANGE);
    showResultsOnFinishEl.setHelpText(translate("qti.form.results.onfinish.help"));
    Boolean showResultOnFinish = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_RESULT_ON_FINISH);
    if (showResultOnFinish == null) {
        // not set -> back the default
        if (!resultsOptions.none()) {
            showResultsOnFinishEl.select(onKeys[0], true);
        }
    } else if (showResultOnFinish.booleanValue()) {
        showResultsOnFinishEl.select(onKeys[0], true);
    }
    String[] resultsOptionsValues = new String[] { translate("qti.form.summary.metadata"), translate("qti.form.summary.sections"), translate("qti.form.summary.questions.metadata"), translate("qti.form.summary.responses"), translate("qti.form.summary.solutions") };
    assessmentResultsOnFinishEl = uifactory.addCheckboxesVertical("typeResultOnFinish", "qti.form.summary", formLayout, resultsOptionsKeys, resultsOptionsValues, 1);
    assessmentResultsOnFinishEl.setElementCssClass("o_sel_qti_show_results_options");
    assessmentResultsOnFinishEl.setHelpText(translate("qti.form.summary.help"));
    assessmentResultsOnFinishEl.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#overview_results");
    uifactory.addFormSubmitButton("submit", formLayout);
    // setup the values
    update();
    updateAssessmentResultsOnFinish(resultsOptions);
}
Also used : Date(java.util.Date) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 2 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project OpenOLAT by OpenOLAT.

the class QTI21DeliveryOptionsController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (limitAttemptsEl.isAtLeastSelected(1)) {
        deliveryOptions.setMaxAttempts(Integer.parseInt(maxAttemptsEl.getValue()));
    } else {
        deliveryOptions.setMaxAttempts(0);
    }
    deliveryOptions.setBlockAfterSuccess(blockAfterSuccessEl.isAtLeastSelected(1));
    deliveryOptions.setShowMenu(showMenuEl.isAtLeastSelected(1));
    deliveryOptions.setShowTitles(showTitlesEl.isAtLeastSelected(1));
    deliveryOptions.setPersonalNotes(personalNotesEl.isAtLeastSelected(1));
    deliveryOptions.setEnableCancel(enableCancelEl.isAtLeastSelected(1));
    deliveryOptions.setEnableSuspend(enableSuspendEl.isAtLeastSelected(1));
    deliveryOptions.setDisplayQuestionProgress(displayQuestionProgressEl.isAtLeastSelected(1));
    deliveryOptions.setDisplayScoreProgress(displayScoreProgressEl.isAtLeastSelected(1));
    deliveryOptions.setDisplayMaxScoreItem(displayMaxScoreItemEl.isAtLeastSelected(1));
    deliveryOptions.setAllowAnonym(allowAnonymEl.isAtLeastSelected(1));
    deliveryOptions.setHideLms(hideLmsEl.isAtLeastSelected(1));
    // reverse logic for compatibility
    deliveryOptions.setHideFeedbacks(!showFeedbacksEl.isAtLeastSelected(1));
    if (showResultsOnFinishEl.isAtLeastSelected(1)) {
        QTI21AssessmentResultsOptions resultsOptions = new QTI21AssessmentResultsOptions(assessmentResultsOnFinishEl.isSelected(0), assessmentResultsOnFinishEl.isSelected(1), assessmentResultsOnFinishEl.isSelected(2), assessmentResultsOnFinishEl.isSelected(3), assessmentResultsOnFinishEl.isSelected(4));
        deliveryOptions.setAssessmentResultsOptions(resultsOptions);
        deliveryOptions.setShowAssessmentResultsOnFinish(true);
    } else {
        deliveryOptions.setAssessmentResultsOptions(QTI21AssessmentResultsOptions.noOptions());
        deliveryOptions.setShowAssessmentResultsOnFinish(false);
    }
    // nullify old stuff
    deliveryOptions.setShowResultsOnFinish(null);
    if (qtiModule.isDigitalSignatureEnabled() && digitalSignatureEl.isAtLeastSelected(1)) {
        deliveryOptions.setDigitalSignature(true);
        deliveryOptions.setDigitalSignatureMail(digitalSignatureMailEl.isAtLeastSelected(1));
    } else {
        deliveryOptions.setDigitalSignature(false);
        deliveryOptions.setDigitalSignatureMail(false);
    }
    qtiService.setDeliveryOptions(testEntry, deliveryOptions);
    changes = true;
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 3 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions 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));
}
Also used : QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 4 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project openolat by klemens.

the class QTI21DeliveryOptionsController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (limitAttemptsEl.isAtLeastSelected(1)) {
        deliveryOptions.setMaxAttempts(Integer.parseInt(maxAttemptsEl.getValue()));
    } else {
        deliveryOptions.setMaxAttempts(0);
    }
    deliveryOptions.setBlockAfterSuccess(blockAfterSuccessEl.isAtLeastSelected(1));
    deliveryOptions.setShowMenu(showMenuEl.isAtLeastSelected(1));
    deliveryOptions.setShowTitles(showTitlesEl.isAtLeastSelected(1));
    deliveryOptions.setPersonalNotes(personalNotesEl.isAtLeastSelected(1));
    deliveryOptions.setEnableCancel(enableCancelEl.isAtLeastSelected(1));
    deliveryOptions.setEnableSuspend(enableSuspendEl.isAtLeastSelected(1));
    deliveryOptions.setDisplayQuestionProgress(displayQuestionProgressEl.isAtLeastSelected(1));
    deliveryOptions.setDisplayScoreProgress(displayScoreProgressEl.isAtLeastSelected(1));
    deliveryOptions.setDisplayMaxScoreItem(displayMaxScoreItemEl.isAtLeastSelected(1));
    deliveryOptions.setAllowAnonym(allowAnonymEl.isAtLeastSelected(1));
    deliveryOptions.setHideLms(hideLmsEl.isAtLeastSelected(1));
    // reverse logic for compatibility
    deliveryOptions.setHideFeedbacks(!showFeedbacksEl.isAtLeastSelected(1));
    if (showResultsOnFinishEl.isAtLeastSelected(1)) {
        QTI21AssessmentResultsOptions resultsOptions = new QTI21AssessmentResultsOptions(assessmentResultsOnFinishEl.isSelected(0), assessmentResultsOnFinishEl.isSelected(1), assessmentResultsOnFinishEl.isSelected(2), assessmentResultsOnFinishEl.isSelected(3), assessmentResultsOnFinishEl.isSelected(4));
        deliveryOptions.setAssessmentResultsOptions(resultsOptions);
        deliveryOptions.setShowAssessmentResultsOnFinish(true);
    } else {
        deliveryOptions.setAssessmentResultsOptions(QTI21AssessmentResultsOptions.noOptions());
        deliveryOptions.setShowAssessmentResultsOnFinish(false);
    }
    // nullify old stuff
    deliveryOptions.setShowResultsOnFinish(null);
    if (qtiModule.isDigitalSignatureEnabled() && digitalSignatureEl.isAtLeastSelected(1)) {
        deliveryOptions.setDigitalSignature(true);
        deliveryOptions.setDigitalSignatureMail(digitalSignatureMailEl.isAtLeastSelected(1));
    } else {
        deliveryOptions.setDigitalSignature(false);
        deliveryOptions.setDigitalSignatureMail(false);
    }
    qtiService.setDeliveryOptions(testEntry, deliveryOptions);
    changes = true;
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 5 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions 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));
}
Also used : QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Aggregations

QTI21AssessmentResultsOptions (org.olat.ims.qti21.QTI21AssessmentResultsOptions)10 File (java.io.File)2 URL (java.net.URL)2 Date (java.util.Date)2 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)2 QTI21Page (org.olat.selenium.page.qti.QTI21Page)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2