use of org.olat.ims.qti21.model.xml.ScoreBuilder in project openolat by klemens.
the class HotspotChoiceScoreController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
super.initForm(formLayout, listener, ureq);
setFormContextHelp("Test editor QTI 2.1 in detail#details_testeditor_score");
ScoreBuilder minScore = itemBuilder.getMinScoreBuilder();
String minValue = minScore == null ? "" : (minScore.getScore() == null ? "" : minScore.getScore().toString());
minScoreEl = uifactory.addTextElement("min.score", "min.score", 8, minValue, formLayout);
minScoreEl.setElementCssClass("o_sel_assessment_item_min_score");
minScoreEl.setEnabled(!restrictedEdit && !readOnly);
ScoreBuilder maxScore = itemBuilder.getMaxScoreBuilder();
String maxValue = maxScore == null ? "" : (maxScore.getScore() == null ? "" : maxScore.getScore().toString());
maxScoreEl = uifactory.addTextElement("max.score", "max.score", 8, maxValue, formLayout);
maxScoreEl.setElementCssClass("o_sel_assessment_item_max_score");
maxScoreEl.setEnabled(!restrictedEdit && !readOnly);
String[] modeValues = new String[] { translate("form.score.assessment.all.correct"), translate("form.score.assessment.per.answer") };
assessmentModeEl = uifactory.addRadiosHorizontal("assessment.mode", "form.score.assessment.mode", formLayout, modeKeys, modeValues);
assessmentModeEl.addActionListener(FormEvent.ONCHANGE);
assessmentModeEl.setEnabled(!restrictedEdit && !readOnly);
if (itemBuilder.getScoreEvaluationMode() == ScoreEvaluation.perAnswer) {
assessmentModeEl.select(ScoreEvaluation.perAnswer.name(), true);
} else {
assessmentModeEl.select(ScoreEvaluation.allCorrectAnswers.name(), true);
}
String scorePage = velocity_root + "/hotspot_choices_score.html";
scoreCont = FormLayoutContainer.createCustomFormLayout("scores", getTranslator(), scorePage);
formLayout.add(scoreCont);
scoreCont.setLabel(null, null);
for (HotspotChoice choice : itemBuilder.getHotspotChoices()) {
HotspotChoiceWrapper wrapper = createHotspotChoiceWrapper(choice);
wrappers.add(wrapper);
}
scoreCont.contextPut("choices", wrappers);
scoreCont.contextPut("mapperUri", backgroundMapperUri);
scoreCont.setVisible(assessmentModeEl.isSelected(1));
updateBackground();
// Submit Button
FormLayoutContainer buttonsContainer = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsContainer.setRootForm(mainForm);
buttonsContainer.setVisible(!readOnly);
formLayout.add(buttonsContainer);
uifactory.addFormSubmitButton("submit", buttonsContainer);
}
use of org.olat.ims.qti21.model.xml.ScoreBuilder in project openolat by klemens.
the class MinimalScoreController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormContextHelp(contextHelpUrl);
super.initForm(formLayout, listener, ureq);
minScoreEl = uifactory.addTextElement("min.score", "min.score", 8, "0.0", formLayout);
minScoreEl.setElementCssClass("o_sel_assessment_item_min_score");
minScoreEl.setEnabled(false);
ScoreBuilder maxScore = itemBuilder.getMaxScoreBuilder();
String maxValue = maxScore == null ? "" : (maxScore.getScore() == null ? "" : maxScore.getScore().toString());
maxScoreEl = uifactory.addTextElement("max.score", "max.score", 8, maxValue, formLayout);
maxScoreEl.setElementCssClass("o_sel_assessment_item_max_score");
maxScoreEl.setEnabled(!restrictedEdit && !readOnly);
// Submit Button
FormLayoutContainer buttonsContainer = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsContainer.setRootForm(mainForm);
buttonsContainer.setVisible(!readOnly);
formLayout.add(buttonsContainer);
uifactory.addFormSubmitButton("submit", buttonsContainer);
}
Aggregations