Search in sources :

Example 6 with AssessmentItemEvent

use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.

the class FeedbacksEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (restrictedEdit || readOnly)
        return;
    hintForm.commit();
    hintForm.setVisible(!hintForm.isEmpty());
    correctSolutionForm.commit();
    correctSolutionForm.setVisible(!correctSolutionForm.isEmpty());
    correctForm.commit();
    correctForm.setVisible(!correctForm.isEmpty());
    incorrectForm.commit();
    incorrectForm.setVisible(!incorrectForm.isEmpty());
    answeredForm.commit();
    answeredForm.setVisible(!answeredForm.isEmpty());
    emptyForm.commit();
    emptyForm.setVisible(!emptyForm.isEmpty());
    List<RuledFeedbackForm> validAdditionalForms = new ArrayList<>();
    List<ModalFeedbackBuilder> additionalBuilders = new ArrayList<>();
    for (RuledFeedbackForm additionalForm : additionalForms) {
        ModalFeedbackBuilder additionalBuilder = additionalForm.commit();
        if (additionalBuilder != null) {
            additionalBuilders.add(additionalBuilder);
            validAdditionalForms.add(additionalForm);
        }
    }
    itemBuilder.setAdditionalFeedbackBuilders(additionalBuilders);
    additionalForms.clear();
    additionalForms.addAll(validAdditionalForms);
    updateAddButtons();
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem()));
}
Also used : ModalFeedbackBuilder(org.olat.ims.qti21.model.xml.ModalFeedbackBuilder) ArrayList(java.util.ArrayList) AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 7 with AssessmentItemEvent

use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.

the class ChoiceScoreController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (restrictedEdit || readOnly)
        return;
    super.formOK(ureq);
    String maxScoreValue = maxScoreEl.getValue();
    Double maxScore = Double.parseDouble(maxScoreValue);
    itemBuilder.setMaxScore(maxScore);
    String minScoreValue = minScoreEl.getValue();
    Double minScore = Double.parseDouble(minScoreValue);
    itemBuilder.setMinScore(minScore);
    if (maxChoicesEl != null && maxChoicesEl.isOneSelected()) {
        int maxChoices = Integer.parseInt(maxChoicesEl.getSelectedKey());
        itemBuilder.setMaxChoices(maxChoices);
    }
    if (minChoicesEl != null && minChoicesEl.isOneSelected()) {
        int minChoices = Integer.parseInt(minChoicesEl.getSelectedKey());
        itemBuilder.setMinChoices(minChoices);
    }
    if (assessmentModeEl.isOneSelected() && assessmentModeEl.isSelected(1)) {
        itemBuilder.setScoreEvaluationMode(ScoreEvaluation.perAnswer);
        itemBuilder.clearMapping();
        for (ChoiceWrapper wrapper : wrappers) {
            String pointsStr = wrapper.getPointsEl().getValue();
            Double points = new Double(pointsStr);
            itemBuilder.setMapping(wrapper.getChoice().getIdentifier(), points);
        }
    } else {
        itemBuilder.setScoreEvaluationMode(ScoreEvaluation.allCorrectAnswers);
        itemBuilder.clearMapping();
    }
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), null));
}
Also used : AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 8 with AssessmentItemEvent

use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.

the class MatchScoreController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (restrictedEdit || readOnly)
        return;
    super.formOK(ureq);
    String maxScoreValue = maxScoreEl.getValue();
    Double maxScore = Double.parseDouble(maxScoreValue);
    itemBuilder.setMaxScore(maxScore);
    String minScoreValue = minScoreEl.getValue();
    Double minScore = Double.parseDouble(minScoreValue);
    itemBuilder.setMinScore(minScore);
    if (assessmentModeEl.isOneSelected() && assessmentModeEl.isSelected(1)) {
        itemBuilder.setScoreEvaluationMode(ScoreEvaluation.perAnswer);
        itemBuilder.clearMapping();
        for (Map.Entry<DirectedPairValue, MatchScoreWrapper> entry : scoreWrappers.entrySet()) {
            DirectedPairValue directedPair = entry.getKey();
            MatchScoreWrapper scoreWrapper = entry.getValue();
            String val = scoreWrapper.getScoreEl().getValue();
            double score = Double.parseDouble(val);
            itemBuilder.addScore(directedPair, score);
        }
    } else {
        itemBuilder.setScoreEvaluationMode(ScoreEvaluation.allCorrectAnswers);
        itemBuilder.clearMapping();
    }
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), null));
}
Also used : DirectedPairValue(uk.ac.ed.ph.jqtiplus.value.DirectedPairValue) HashMap(java.util.HashMap) Map(java.util.Map) AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 9 with AssessmentItemEvent

use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.

the class FIBEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (readOnly)
        return;
    // title
    itemBuilder.setTitle(titleEl.getValue());
    // set the question with the text entries
    String questionText = textEl.getRawValue();
    extractSolution(questionText);
    itemBuilder.setQuestion(questionText);
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.fib));
    itemBuilder.extractQuestions();
    itemBuilder.extractEntriesSettingsFromResponseDeclaration();
    String question = itemBuilder.getQuestion();
    textEl.setValue(question);
}
Also used : AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 10 with AssessmentItemEvent

use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.

the class QTI21EditorController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == editorCtrl) {
        if (event instanceof AssessmentItemEvent) {
            AssessmentItemEvent aie = (AssessmentItemEvent) event;
            AssessmentItem assessmentItem = aie.getAssessmentItem();
            qtiService.persistAssessmentObject(resourceFile, assessmentItem);
            updateQuestionItem(ureq, assessmentItem);
        }
    }
}
Also used : ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Aggregations

AssessmentItemEvent (org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)42 ArrayList (java.util.ArrayList)9 SimpleAssociableChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice)6 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)6 File (java.io.File)4 Size (org.olat.core.commons.services.image.Size)4 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)4 AssessmentItemFactory.createSimpleAssociableChoice (org.olat.ims.qti21.model.xml.AssessmentItemFactory.createSimpleAssociableChoice)4 DetachFromPoolEvent (org.olat.ims.qti21.ui.editor.events.DetachFromPoolEvent)4 SimpleChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice)4 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 HotspotLayouts (org.olat.ims.qti21.QTI21Constants.HotspotLayouts)2 ModalFeedbackBuilder (org.olat.ims.qti21.model.xml.ModalFeedbackBuilder)2 AssessmentItemsPackage (org.olat.ims.qti21.questionimport.AssessmentItemsPackage)2 AssessmentSectionEvent (org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)2 AssessmentTestEvent (org.olat.ims.qti21.ui.editor.events.AssessmentTestEvent)2