diff --git a/cis/testtool/externeueberwachung.js b/cis/testtool/externeueberwachung.js index 65143290d..71951779f 100644 --- a/cis/testtool/externeueberwachung.js +++ b/cis/testtool/externeueberwachung.js @@ -1,34 +1,15 @@ (function () { - /* - - const params = new URLSearchParams(location.search); - let expectedOrigin = params.get("examus-client-origin"); - - if (!expectedOrigin) - { - window.top.location.href = 'resetconnection.php'; - return; + function sendMessage() { + let frame = window.frames['content']; + if (frame) + frame.postMessage({ type: "proctoringReady" }); } - */ - let proctoringOK = false; - window.addEventListener("message", function (e) { - /*if (e.origin !== expectedOrigin) { - return; - }*/ - - const data = e.data || {}; - - if (data.proctoringIsActive) + window.addEventListener("message", function (e) + { + if (e.data.indexOf("proctoringReady_") === 0) { - proctoringOK = true; + sendMessage(); } }); - - setTimeout(function () { - if (!proctoringOK) - { - top.location.href='resetconnection.php'; - } - }, 1000); -})(); \ No newline at end of file +})(); diff --git a/cis/testtool/frage.css b/cis/testtool/frage.css new file mode 100644 index 000000000..04024ae53 --- /dev/null +++ b/cis/testtool/frage.css @@ -0,0 +1,30 @@ +.proctoring-blocker +{ + position: fixed; + inset: 0; + z-index: 99999; + backdrop-filter: blur(6px); + pointer-events: all; + user-select: none; +} + +.proctoring-blocker.hidden +{ + display: none !important; +} + +.proctoring-text +{ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + color: #fff; + font-size: 16px; + font-family: sans-serif; +} + +.proctoring-blur-fallback +{ + filter: blur(6px); +} diff --git a/cis/testtool/frage.php b/cis/testtool/frage.php index 4267d6a13..bf2ee24c5 100644 --- a/cis/testtool/frage.php +++ b/cis/testtool/frage.php @@ -183,7 +183,9 @@ if(!isset($_SESSION['pruefling_id'])) die($p->t('testtool/bitteZuerstAnmelden')); if (!empty($_SESSION['externe_ueberwachung']) && isset($_SESSION['externe_ueberwachung_verified'])): ?> - + + + Loading...'; + document.body.appendChild(blocker); + } + document.documentElement.classList.add("proctoring-blur-fallback"); + } + + function block() { + showBlocker(); + blocker.classList.remove("hidden"); + } + + function unblock() { + document.documentElement.classList.remove("proctoring-blur-fallback"); + if (!blocker) return; + blocker.classList.add("hidden"); + } + + const blockTimer = setTimeout(function () { + if (!ok) + block(); + }, 1500); + + window.addEventListener("message", function (e) { + const data = e.data || {}; + + if (data.type === "proctoringReady") + { + ok = true; + clearTimeout(blockTimer); + unblock(); + } + }); + + setTimeout(function () { + if (!ok) { + top.location.href = "resetconnection.php"; + } + }, 3000); +})(); + + diff --git a/cis/testtool/index.php b/cis/testtool/index.php index 9aa6c3f84..6f2cfac26 100644 --- a/cis/testtool/index.php +++ b/cis/testtool/index.php @@ -22,6 +22,7 @@ if ((isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung +