mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 07:22:17 +00:00
proctoring check ueberarbeitet
This commit is contained in:
@@ -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);
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -183,7 +183,9 @@ if(!isset($_SESSION['pruefling_id']))
|
||||
die($p->t('testtool/bitteZuerstAnmelden'));
|
||||
|
||||
if (!empty($_SESSION['externe_ueberwachung']) && isset($_SESSION['externe_ueberwachung_verified'])): ?>
|
||||
<script type="text/javascript" src="externeueberwachung.js"></script>
|
||||
<link href="frage.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="frage_externe_ueberwachung.js"></script>
|
||||
<div id="proctoringBlocker" class="proctoring-blocker hidden"></div>
|
||||
<?php endif;
|
||||
|
||||
$pruefling = new pruefling();
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
(function () {
|
||||
let ok = false;
|
||||
let blocker;
|
||||
|
||||
function showBlocker() {
|
||||
blocker = document.getElementById("proctoringBlocker");
|
||||
|
||||
if (!blocker)
|
||||
{
|
||||
blocker = document.createElement("div");
|
||||
blocker.id = "proctoringBlocker";
|
||||
blocker.className = "proctoring-blocker";
|
||||
blocker.innerHTML = '<div class="proctoring-text">Loading...</div>';
|
||||
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);
|
||||
})();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ if ((isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung
|
||||
<link href="../../skin/style.css.php" rel="stylesheet" type="text/css">
|
||||
<?php
|
||||
if (!empty($_SESSION['externe_ueberwachung'])) : ?>
|
||||
<script type="text/javascript" src="externeueberwachung.js"></script>
|
||||
<script>
|
||||
function loadInContent(url)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user