use of uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock in project openolat by klemens.
the class AssessmentSectionOptionsEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
section.setTitle(titleEl.getValue());
// rubrics
List<RubricBlock> rubricBlocks = new ArrayList<>();
for (RichTextElement rubricEl : rubricEls) {
String rubric = rubricEl.getRawValue();
if (htmlBuilder.containsSomething(rubric)) {
RubricBlock rubricBlock = (RubricBlock) rubricEl.getUserObject();
if (rubricBlock == null) {
rubricBlock = new RubricBlock(section);
rubricBlock.setViews(Collections.singletonList(View.CANDIDATE));
}
rubricBlock.getBlocks().clear();
htmlBuilder.appendHtml(rubricBlock, rubric);
rubricBlocks.add(rubricBlock);
}
}
section.getRubricBlocks().clear();
section.getRubricBlocks().addAll(rubricBlocks);
// shuffle
boolean shuffle = (shuffleEl.isOneSelected() && shuffleEl.isSelected(0));
if (shuffle) {
if (section.getOrdering() == null) {
section.setOrdering(new Ordering(section));
}
section.getOrdering().setShuffle(shuffle);
} else {
section.setOrdering(null);
}
// number of selected questions
Integer randomSelection = null;
if (StringHelper.containsNonWhitespace(randomSelectedEl.getSelectedKey())) {
randomSelection = new Integer(randomSelectedEl.getSelectedKey());
}
if (randomSelection == null || randomSelection.intValue() < 1) {
section.setSelection(null);
} else {
if (section.getSelection() == null) {
section.setSelection(new Selection(section));
}
section.getSelection().setSelect(randomSelection);
}
fireEvent(ureq, new AssessmentSectionEvent(AssessmentSectionEvent.ASSESSMENT_SECTION_CHANGED, section));
}
Aggregations