use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.
the class HotspotChoiceScoreController 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 (HotspotChoiceWrapper 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));
}
use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.
the class KPrimEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (readOnly)
return;
// title
itemBuilder.setTitle(titleEl.getValue());
// question
String questionText = textEl.getRawValue();
itemBuilder.setQuestion(questionText);
// shuffle
if (!restrictedEdit) {
itemBuilder.setShuffle(shuffleEl.isOneSelected() && shuffleEl.isSelected(0));
// alignment
if (alignmentEl.isOneSelected() && alignmentEl.isSelected(1)) {
itemBuilder.addClass(QTI21Constants.CHOICE_ALIGN_RIGHT);
} else {
itemBuilder.removeClass(QTI21Constants.CHOICE_ALIGN_RIGHT);
}
}
// update kprims
for (KprimWrapper choiceWrapper : choiceWrappers) {
SimpleAssociableChoice choice = choiceWrapper.getSimpleChoice();
String answer = choiceWrapper.getAnswer().getRawValue();
itemBuilder.getHtmlHelper().appendHtml(choice, answer);
}
// set associations
if (!restrictedEdit) {
for (KprimWrapper choiceWrapper : choiceWrappers) {
SimpleAssociableChoice choice = choiceWrapper.getSimpleChoice();
Identifier choiceIdentifier = choice.getIdentifier();
String association = ureq.getHttpReq().getParameter(choiceIdentifier.toString());
if ("correct".equals(association)) {
itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.CORRECT_IDENTIFIER);
} else if ("wrong".equals(association)) {
itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.WRONG_IDENTIFIER);
}
}
}
fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.kprim));
}
use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.
the class SingleChoiceEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (readOnly)
return;
// title
itemBuilder.setTitle(titleEl.getValue());
// question
String questionText = textEl.getRawValue();
itemBuilder.setQuestion(questionText);
Identifier correctAnswerIdentifier = null;
if (!restrictedEdit) {
// correct response
String correctAnswer = ureq.getParameter("correct");
correctAnswerIdentifier = Identifier.parseString(correctAnswer);
itemBuilder.setCorrectAnswer(correctAnswerIdentifier);
// shuffle
itemBuilder.setShuffle(shuffleEl.isOneSelected() && shuffleEl.isSelected(0));
// orientation
itemBuilder.setOrientation(Orientation.valueOf(orientationEl.getSelectedKey()));
// alignment
if (alignmentEl.isOneSelected() && alignmentEl.isSelected(1)) {
itemBuilder.addClass(QTI21Constants.CHOICE_ALIGN_RIGHT);
} else {
itemBuilder.removeClass(QTI21Constants.CHOICE_ALIGN_RIGHT);
}
}
// replace simple choices
List<SimpleChoice> choiceList = new ArrayList<>();
for (SimpleChoiceWrapper choiceWrapper : choiceWrappers) {
SimpleChoice choice = choiceWrapper.getSimpleChoice();
// text
String answer = choiceWrapper.getAnswer().getRawValue();
itemBuilder.getHtmlHelper().appendHtml(choice, answer);
choiceList.add(choice);
}
itemBuilder.setSimpleChoices(choiceList);
fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.sc));
}
use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.
the class UploadEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (readOnly)
return;
// title
itemBuilder.setTitle(titleEl.getValue());
// question
String questionText = textEl.getRawValue();
itemBuilder.setQuestion(questionText);
fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.upload));
}
use of org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent in project OpenOLAT by OpenOLAT.
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));
}
Aggregations