diff --git a/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java b/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java index 4c57f68c40a58beea305d16206e5a69f63f85b73..e84ac06760d149a9ff4701a39b8e95efd375b29c 100644 --- a/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java +++ b/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java @@ -880,6 +880,11 @@ public class AssessmentTestDisplayController extends BasicController implements return;// } + String cmd = ureq.getParameter("tmpResponse"); + if(!qtiWorksCtrl.validateResponseIdentifierCommand(cmd, currentItemKey)) { + return;//this is not the right node in the plan + } + final Date timestamp = ureq.getRequestTimestamp(); final Map<Identifier, ResponseData> responseDataMap = new HashMap<>(); @@ -1824,6 +1829,10 @@ public class AssessmentTestDisplayController extends BasicController implements Interaction interaction = qtiEl.getInteractionOfResponseUniqueIdentifier(uniqueId); return interaction == null ? null : interaction.getResponseIdentifier(); } + + protected boolean validateResponseIdentifierCommand(String cmd, TestPlanNodeKey nodeKey) { + return qtiEl.validateCommand(cmd, nodeKey); + } @Override protected void formOK(UserRequest ureq) { diff --git a/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestComponent.java b/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestComponent.java index 115abc04fdd4c81eb219662b25c6e685ae1ae5c4..04e1a656305ba8d93a7181049d8d1b71b7e070cd 100644 --- a/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestComponent.java +++ b/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestComponent.java @@ -128,6 +128,11 @@ public class AssessmentTestComponent extends AssessmentObjectComponent { responseIdentifiersMap.put(id, interaction); return id; } + + public boolean validateCommand(String cmd, TestPlanNodeKey tpnk) { + String id = "oo" + (tpnk.toString().replace(":", "_")) + "_"; + return cmd.contains(id); + } @Override public Interaction getInteractionOfResponseUniqueIdentifier(String responseUniqueId) { diff --git a/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestFormItem.java b/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestFormItem.java index 73619c0acbc64da7dc477197a1321413bb0a8ed0..45f9b4ff599904432dab70a9da7320b3cc763669 100644 --- a/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestFormItem.java +++ b/src/main/java/org/olat/ims/qti21/ui/components/AssessmentTestFormItem.java @@ -41,6 +41,7 @@ import org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent; import uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction; import uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest; import uk.ac.ed.ph.jqtiplus.running.TestSessionController; +import uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey; /** * @@ -113,6 +114,10 @@ public class AssessmentTestFormItem extends AssessmentObjectFormItem { public Interaction getInteractionOfResponseUniqueIdentifier(String uniqueId) { return component.getInteractionOfResponseUniqueIdentifier(uniqueId); } + + public boolean validateCommand(String cmd, TestPlanNodeKey nodeKey) { + return component.validateCommand(cmd, nodeKey); + } @Override protected Component getFormItemComponent() {