Skip to content
Snippets Groups Projects
Commit df2012ab authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 9.3 to OpenOLAT default branch with f8cb8f3419b95b42dda3e5148703bab771de8d17

parents e914cfa6 87e1ee4c
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ package de.bps.olat.modules.cl; ...@@ -21,6 +21,7 @@ package de.bps.olat.modules.cl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.olat.core.commons.persistence.DBFactory; import org.olat.core.commons.persistence.DBFactory;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
...@@ -53,10 +54,10 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -53,10 +54,10 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
// GUI // GUI
private FormLayoutContainer titleContainer, buttonContainer; private FormLayoutContainer titleContainer, buttonContainer;
private DialogBoxController yesNoController; private DialogBoxController yesNoController;
private ArrayList<TextElement> titleInputList; private List<TextElement> titleInputList;
private ArrayList<TextElement> descriptionInputList; private List<TextElement> descriptionInputList;
private ArrayList<SingleSelection> modeInputList; private List<SingleSelection> modeInputList;
private ArrayList<FormLink> delButtonList; private List<FormLink> delButtonList;
private String submitKey; private String submitKey;
private FormLink addButton; private FormLink addButton;
private CheckpointComparator checkpointComparator = ChecklistUIFactory.comparatorTitleAsc; private CheckpointComparator checkpointComparator = ChecklistUIFactory.comparatorTitleAsc;
...@@ -64,6 +65,7 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -64,6 +65,7 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
// data // data
private long counter = 0; private long counter = 0;
private Checklist checklist; private Checklist checklist;
private List<Checkpoint> checkpointsInVc;
// helpers // helpers
private boolean deletedOK = true; private boolean deletedOK = true;
...@@ -82,10 +84,11 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -82,10 +84,11 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
} }
int size = checklist.getCheckpoints().size(); int size = checklist.getCheckpoints().size();
titleInputList = new ArrayList<TextElement>(size); checkpointsInVc = new ArrayList<>(size);
descriptionInputList = new ArrayList<TextElement>(size); titleInputList = new ArrayList<>(size);
modeInputList = new ArrayList<SingleSelection>(size); descriptionInputList = new ArrayList<>(size);
delButtonList = new ArrayList<FormLink>(size); modeInputList = new ArrayList<>(size);
delButtonList = new ArrayList<>(size);
initForm(ureq); initForm(ureq);
} }
...@@ -124,6 +127,9 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -124,6 +127,9 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
} }
checklist = checklistManager.updateChecklist(checklist); checklist = checklistManager.updateChecklist(checklist);
DBFactory.getInstance().commit(); DBFactory.getInstance().commit();
checkpointsInVc.clear();
checkpointsInVc.addAll(checklist.getCheckpointsSorted(checkpointComparator));
titleContainer.contextPut("checkpoints", checkpointsInVc);
// Inform all listeners about the changes // Inform all listeners about the changes
fireEvent(ureq, Event.CHANGED_EVENT); fireEvent(ureq, Event.CHANGED_EVENT);
} }
...@@ -173,6 +179,7 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -173,6 +179,7 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source.getComponent() instanceof Link) { if (source.getComponent() instanceof Link) {
if (addButton.equals(source)) { if (addButton.equals(source)) {
int index = checklist.getCheckpoints().size();
// add a new form link // add a new form link
Checkpoint newCheckpoint = new Checkpoint(); Checkpoint newCheckpoint = new Checkpoint();
newCheckpoint.setChecklist(checklist); newCheckpoint.setChecklist(checklist);
...@@ -180,9 +187,10 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -180,9 +187,10 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
newCheckpoint.setTitle(""); newCheckpoint.setTitle("");
newCheckpoint.setDescription(""); newCheckpoint.setDescription("");
newCheckpoint.setMode(CheckpointMode.MODE_EDITABLE); newCheckpoint.setMode(CheckpointMode.MODE_EDITABLE);
int index = checklist.getCheckpoints().size();
checklist.addCheckpoint(index, newCheckpoint); checklist.addCheckpoint(index, newCheckpoint);
addNewFormCheckpoint(index, newCheckpoint); addNewFormCheckpoint(index, newCheckpoint);
checkpointsInVc.add(newCheckpoint);
flc.setDirty(true);
} else if (delButtonList.contains(source)) { } else if (delButtonList.contains(source)) {
// special case: only one line existent // special case: only one line existent
if (checklist.getCheckpoints().size() == 1) { if (checklist.getCheckpoints().size() == 1) {
...@@ -215,9 +223,10 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -215,9 +223,10 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
titleContainer = FormLayoutContainer.createCustomFormLayout("titleLayout", getTranslator(), velocity_root + "/edit.html"); titleContainer = FormLayoutContainer.createCustomFormLayout("titleLayout", getTranslator(), velocity_root + "/edit.html");
fic.add(titleContainer); fic.add(titleContainer);
// create gui elements for all checkpoints // create gui elements for all checkpoints
if(checklist.getCheckpoints().size() == 0) { int numOfCheckpoints = checklist.getCheckpoints().size();
if(numOfCheckpoints == 0) {
Checkpoint newCheckpoint = new Checkpoint(); Checkpoint newCheckpoint = new Checkpoint();
newCheckpoint.setChecklist(this.checklist); newCheckpoint.setChecklist(checklist);
newCheckpoint.setLastModified(new Date()); newCheckpoint.setLastModified(new Date());
newCheckpoint.setTitle(""); newCheckpoint.setTitle("");
newCheckpoint.setDescription(""); newCheckpoint.setDescription("");
...@@ -225,7 +234,7 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -225,7 +234,7 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
checklist.addCheckpoint(0, newCheckpoint); checklist.addCheckpoint(0, newCheckpoint);
addNewFormCheckpoint(0, newCheckpoint); addNewFormCheckpoint(0, newCheckpoint);
} else { } else {
for (int i = 0; i < checklist.getCheckpoints().size(); i++) { for (int i = 0; i<numOfCheckpoints; i++) {
Checkpoint checkpoint = checklist.getCheckpointsSorted(checkpointComparator).get(i); Checkpoint checkpoint = checklist.getCheckpointsSorted(checkpointComparator).get(i);
addNewFormCheckpoint(i, checkpoint); addNewFormCheckpoint(i, checkpoint);
} }
...@@ -233,8 +242,9 @@ public class ChecklistEditCheckpointsController extends FormBasicController { ...@@ -233,8 +242,9 @@ public class ChecklistEditCheckpointsController extends FormBasicController {
addButton = new FormLinkImpl("add" + counter, "add" + counter, "cl.table.add", Link.BUTTON_SMALL); addButton = new FormLinkImpl("add" + counter, "add" + counter, "cl.table.add", Link.BUTTON_SMALL);
addButton.setUserObject(checklist.getCheckpointsSorted(checkpointComparator).get(checklist.getCheckpoints().size() - 1)); addButton.setUserObject(checklist.getCheckpointsSorted(checkpointComparator).get(checklist.getCheckpoints().size() - 1));
titleContainer.add(addButton); titleContainer.add(addButton);
titleContainer.contextPut("checkpoints", checklist.getCheckpointsSorted(checkpointComparator)); checkpointsInVc.addAll(checklist.getCheckpointsSorted(checkpointComparator));
titleContainer.contextPut("checkpoints", checkpointsInVc);
titleContainer.contextPut("titleInputList", titleInputList); titleContainer.contextPut("titleInputList", titleInputList);
titleContainer.contextPut("descriptionInputList", descriptionInputList); titleContainer.contextPut("descriptionInputList", descriptionInputList);
titleContainer.contextPut("modeInputList", modeInputList); titleContainer.contextPut("modeInputList", modeInputList);
......
...@@ -641,6 +641,7 @@ public class IQEditController extends ActivateableTabbableDefaultController impl ...@@ -641,6 +641,7 @@ public class IQEditController extends ActivateableTabbableDefaultController impl
private void checkEssay(RepositoryEntry re) { private void checkEssay(RepositoryEntry re) {
if(OnyxModule.isOnyxTest(re.getOlatResource())) return; if(OnyxModule.isOnyxTest(re.getOlatResource())) return;
if(courseNode instanceof IQSURVCourseNode || courseNode instanceof IQSELFCourseNode) return;
TestFileResource fr = new TestFileResource(); TestFileResource fr = new TestFileResource();
fr.overrideResourceableId(re.getOlatResource().getResourceableId()); fr.overrideResourceableId(re.getOlatResource().getResourceableId());
......
...@@ -121,13 +121,15 @@ public class EssayItemController extends DefaultController implements Controller ...@@ -121,13 +121,15 @@ public class EssayItemController extends DefaultController implements Controller
try { try {
String score = ureq.getParameter("single_score"); String score = ureq.getParameter("single_score");
float sc = Float.parseFloat(score); float sc = Float.parseFloat(score);
if(sc <= 0.0001f) { if(sc <= 0.0001f && !qtiPackage.getQTIDocument().isSurvey()) {
getWindowControl().setWarning(trnsltr.translate("editor.info.mc.zero.points")); getWindowControl().setWarning(trnsltr.translate("editor.info.mc.zero.points"));
} }
essayQuestion.setMinValue(0.0f); essayQuestion.setMinValue(0.0f);
essayQuestion.setMaxValue(sc); essayQuestion.setMaxValue(sc);
} catch(Exception e) { } catch(Exception e) {
getWindowControl().setWarning(trnsltr.translate("editor.info.mc.zero.points")); if(!qtiPackage.getQTIDocument().isSurvey()) {
getWindowControl().setWarning(trnsltr.translate("editor.info.mc.zero.points"));
}
} }
if (restrictedEdit) { if (restrictedEdit) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment