From e1ae3fec09730b8601c05b066a73ed988c1f9370 Mon Sep 17 00:00:00 2001 From: christianbeeznest <84335353+christianbeeznest@users.noreply.github.com> Date: Mon, 15 Jan 2024 01:01:03 -0500 Subject: [PATCH] Exercise: Update audio question with translatable help link and modal - refs BT#21319 --- assets/js/legacy/exercise.js | 14 ++++++++++++++ public/main/inc/ajax/exercise.ajax.php | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/assets/js/legacy/exercise.js b/assets/js/legacy/exercise.js index 357a7c792a..440796d0f9 100644 --- a/assets/js/legacy/exercise.js +++ b/assets/js/legacy/exercise.js @@ -9,3 +9,17 @@ import '../../../public/main/inc/lib/javascript/epiclock/renderers/minute/epiclo import './annotation' import '../../../public/main/inc/lib/javascript/hotspot/js/hotspot.js'; import '../../../public/main/inc/lib/javascript/d3/jquery.xcolor.js'; + +document.addEventListener("DOMContentLoaded", function() { + var links = document.querySelectorAll('a[href*="web"]'); + links.forEach(function(link) { + link.classList.add("ajax"); + var href = link.getAttribute("href"); + var pathSegments = href.split("/"); + if (pathSegments.length >= 3) { + var contentIdentifier = pathSegments[2]; + link.setAttribute("href", "/main/inc/ajax/exercise.ajax.php?a=" + contentIdentifier); + link.setAttribute("data-title", link.textContent.trim()); + } + }); +}); diff --git a/public/main/inc/ajax/exercise.ajax.php b/public/main/inc/ajax/exercise.ajax.php index 3ed7e6929a..dc8869d009 100644 --- a/public/main/inc/ajax/exercise.ajax.php +++ b/public/main/inc/ajax/exercise.ajax.php @@ -1065,6 +1065,17 @@ switch ($action) { } echo 0; break; + case 'enregistrement-audio': + $content = get_lang('While recording, you can pause whenever you want. If you are not satisfied, register again. This will overwrite the previous version. Satisfied ? To send the recording to your teacher, click on “Stop recording” then select “End exercise”. The teacher will be able to listen to your recording and give you feedback! All your transmitted recordings can be viewed on the exercise home page.'); + + $html = ' +
' . htmlspecialchars($content) . '
+