From 479671b569256aa92c4ca85bd0f1c76528cb9677 Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Thu, 30 Jan 2025 12:22:53 +0200 Subject: [PATCH] Test: Fix Ordering Horizontal Question in LM See: https://mantis.ilias.de/view.php?id=43879 --- .../templates/default/tpl.question_export.html | 11 +++++++---- .../resources/js/dist/question_handling.js | 13 ++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/components/ILIAS/COPage/templates/default/tpl.question_export.html b/components/ILIAS/COPage/templates/default/tpl.question_export.html index 7ee09f1cf421..42fc2c5ee5ca 100755 --- a/components/ILIAS/COPage/templates/default/tpl.question_export.html +++ b/components/ILIAS/COPage/templates/default/tpl.question_export.html @@ -137,7 +137,7 @@ if (typeof MathJax != "undefined") { MathJax.Hub.Queue(["Typeset", MathJax.Hub, "container{VAL_ID}"]); } - il.test.orderinghorizontal.init(document.querySelector('#container{VAL_ID}')); + il.test.orderingvertical.init(document.querySelector('#container{VAL_ID}')); } @@ -339,7 +339,10 @@
qtitle
@@ -351,8 +354,8 @@ { ilias.questions.shuffle(questions[{VAL_ID}]); jQuery('div#container{VAL_ID}').autoRender(questions[{VAL_ID}]); - jQuery("#order{VAL_ID}").sortable({containment: '#container{VAL_ID}'}); - jQuery("#order{VAL_ID}").css('font-size', questions[{VAL_ID}].textsize+'%'); + document.querySelector("#order{VAL_ID}").style.fontSize = questions[{VAL_ID}].textsize+'%'; + il.test.orderinghorizontal.init(document.querySelector('#order{VAL_ID}')); } diff --git a/components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js b/components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js index 7b70639021d6..63ff367b0e7f 100755 --- a/components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js +++ b/components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js @@ -343,14 +343,14 @@ ilias.questions.handleOrderingImages = function(a_id) { ilias.questions.assOrderingHorizontal = function(a_id) { - var result = jQuery('#order'+a_id).sortable('toArray'); + var result = document.querySelectorAll(`#order${a_id} > .answers`); answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; for (var i=0;i { item.draggable = false; item.id = i + 1; - item.firstElementChild.firstElementChild.innerHtml = answers_sorted[i].answertext; + let content_item = item.firstElementChild + if (content_item.firstElementChild !== null) { + content_item = content_item.firstElementChild; + } + content_item.innerHtml = answers_sorted[i].answertext; } ); ilias.questions.handleOrderingImages(a_id);