Search in sources :

Example 1 with AssessmentSectionEvent

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

the class AssessmentTestComposerController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (event instanceof AssessmentTestEvent) {
        AssessmentTestEvent ate = (AssessmentTestEvent) event;
        if (ate == AssessmentTestEvent.ASSESSMENT_TEST_CHANGED_EVENT) {
            doSaveAssessmentTest(ureq, null);
        }
    } else if (event instanceof AssessmentTestPartEvent) {
        AssessmentTestPartEvent atpe = (AssessmentTestPartEvent) event;
        if (atpe == AssessmentTestPartEvent.ASSESSMENT_TEST_PART_CHANGED_EVENT) {
            doSaveAssessmentTest(ureq, null);
        }
    } else if (event instanceof AssessmentSectionEvent) {
        AssessmentSectionEvent ase = (AssessmentSectionEvent) event;
        if (AssessmentSectionEvent.ASSESSMENT_SECTION_CHANGED.equals(ase.getCommand())) {
            doSaveAssessmentTest(ureq, null);
            doUpdate(ase.getSection().getIdentifier(), ase.getSection().getTitle());
            doSaveManifest();
        }
    } else if (event instanceof AssessmentItemEvent) {
        AssessmentItemEvent aie = (AssessmentItemEvent) event;
        if (AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED.equals(aie.getCommand())) {
            assessmentChanged(ureq);
            doSaveAssessmentTest(ureq, null);
            doUpdate(aie.getAssessmentItemRef().getIdentifier(), aie.getAssessmentItem().getTitle());
            doSaveManifest();
        } else if (AssessmentItemEvent.ASSESSMENT_ITEM_METADATA_CHANGED.equals(aie.getCommand())) {
            doSaveManifest();
        } else if (AssessmentItemEvent.ASSESSMENT_ITEM_NEED_RELOAD.equals(aie.getCommand())) {
            doReloadItem(ureq);
        }
    } else if (event instanceof DetachFromPoolEvent) {
        DetachFromPoolEvent dfpe = (DetachFromPoolEvent) event;
        doDetachItemFromPool(ureq, dfpe.getItemRef());
    } else if (selectQItemCtrl == source) {
        cmc.deactivate();
        cleanUp();
        if (event instanceof QItemViewEvent) {
            QItemViewEvent e = (QItemViewEvent) event;
            List<QuestionItemView> items = e.getItemList();
            doInsert(ureq, items);
        }
    } else if (importTableWizard == source) {
        AssessmentItemsPackage importPackage = (AssessmentItemsPackage) importTableWizard.getRunContext().get("importPackage");
        getWindowControl().pop();
        cleanUp();
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            doInsert(ureq, importPackage);
        }
    } else if (confirmDeleteCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            // yes, delete
            doDelete(ureq, (TreeNode) confirmDeleteCtrl.getUserObject());
        }
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : AssessmentTestEvent(org.olat.ims.qti21.ui.editor.events.AssessmentTestEvent) DetachFromPoolEvent(org.olat.ims.qti21.ui.editor.events.DetachFromPoolEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) AssessmentItemsPackage(org.olat.ims.qti21.questionimport.AssessmentItemsPackage) ArrayList(java.util.ArrayList) List(java.util.List) QItemViewEvent(org.olat.modules.qpool.ui.events.QItemViewEvent) AssessmentSectionEvent(org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent) AssessmentTestPartEvent(org.olat.ims.qti21.ui.editor.events.AssessmentTestPartEvent) AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 2 with AssessmentSectionEvent

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

the class AssessmentSectionExpertOptionsEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    super.formOK(ureq);
    // visible
    boolean visible = visibleEl.isOneSelected() && visibleEl.isSelected(0);
    section.setVisible(visible);
    fireEvent(ureq, new AssessmentSectionEvent(AssessmentSectionEvent.ASSESSMENT_SECTION_CHANGED, section));
}
Also used : AssessmentSectionEvent(org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)

Example 3 with AssessmentSectionEvent

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

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));
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) Selection(uk.ac.ed.ph.jqtiplus.node.test.Selection) ArrayList(java.util.ArrayList) Ordering(uk.ac.ed.ph.jqtiplus.node.test.Ordering) RubricBlock(uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock) AssessmentSectionEvent(org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)

Example 4 with AssessmentSectionEvent

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

the class AssessmentSectionExpertOptionsEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    super.formOK(ureq);
    // visible
    boolean visible = visibleEl.isOneSelected() && visibleEl.isSelected(0);
    section.setVisible(visible);
    fireEvent(ureq, new AssessmentSectionEvent(AssessmentSectionEvent.ASSESSMENT_SECTION_CHANGED, section));
}
Also used : AssessmentSectionEvent(org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)

Example 5 with AssessmentSectionEvent

use of org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent 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));
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) Selection(uk.ac.ed.ph.jqtiplus.node.test.Selection) ArrayList(java.util.ArrayList) Ordering(uk.ac.ed.ph.jqtiplus.node.test.Ordering) RubricBlock(uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock) AssessmentSectionEvent(org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)

Aggregations

AssessmentSectionEvent (org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)6 ArrayList (java.util.ArrayList)4 List (java.util.List)2 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 AssessmentItemsPackage (org.olat.ims.qti21.questionimport.AssessmentItemsPackage)2 AssessmentItemEvent (org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)2 AssessmentTestEvent (org.olat.ims.qti21.ui.editor.events.AssessmentTestEvent)2 AssessmentTestPartEvent (org.olat.ims.qti21.ui.editor.events.AssessmentTestPartEvent)2 DetachFromPoolEvent (org.olat.ims.qti21.ui.editor.events.DetachFromPoolEvent)2 QItemViewEvent (org.olat.modules.qpool.ui.events.QItemViewEvent)2 RubricBlock (uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock)2 Ordering (uk.ac.ed.ph.jqtiplus.node.test.Ordering)2 Selection (uk.ac.ed.ph.jqtiplus.node.test.Selection)2