Search in sources :

Example 36 with AssessmentItemEvent

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

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 37 with AssessmentItemEvent

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

the class FIBScoreController 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);
    itemBuilder.setMinScore(new Double(0d));
    if (assessmentModeEl.isOneSelected() && assessmentModeEl.isSelected(1)) {
        itemBuilder.setScoreEvaluationMode(ScoreEvaluation.perAnswer);
        for (FIBEntryWrapper wrapper : wrappers) {
            String pointsStr = wrapper.getPointsEl().getValue();
            Double points = new Double(pointsStr);
            wrapper.getEntry().setScore(points);
        }
    } else {
        itemBuilder.setScoreEvaluationMode(ScoreEvaluation.allCorrectAnswers);
    }
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), null));
}
Also used : AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 38 with AssessmentItemEvent

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

the class HottextEditorController method formOK.

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

Example 39 with AssessmentItemEvent

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

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 40 with AssessmentItemEvent

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

the class DrawingEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (readOnly)
        return;
    // title
    itemBuilder.setTitle(titleEl.getValue());
    File objectImg = null;
    if (backgroundImage != null) {
        objectImg = backgroundImage;
    } else if (initialBackgroundImage != null) {
        objectImg = initialBackgroundImage;
    }
    if (objectImg != null) {
        String filename = objectImg.getName();
        String mimeType = WebappHelper.getMimeType(filename);
        Size size = imageService.getSize(new LocalFileImpl(objectImg), null);
        int height = -1;
        int width = -1;
        if (size != null) {
            height = size.getHeight();
            width = size.getWidth();
        }
        itemBuilder.setBackground(filename, mimeType, height, width);
    }
    // question
    String questionText = textEl.getRawValue();
    itemBuilder.setQuestion(questionText);
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.drawing));
}
Also used : Size(org.olat.core.commons.services.image.Size) LocalFileImpl(org.olat.core.util.vfs.LocalFileImpl) File(java.io.File) 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