g6.2
This commit is contained in:
1 parent
f5704e87df
commit
96594641dc
11 files changed
+143
-109
No files matched your search
+1
-8
@@ -349,14 +349,7 @@ function form1(string) {
|
||||
|
||||
|
||||
async function getUserData(couchDB) {
|
||||
let username = getURLArgsMap()["user"];
|
||||
if (!username) {
|
||||
if (debug && typeof (debug_username) == "string") {
|
||||
username = debug_username;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
let username = localStorage.getItem("user");
|
||||
const res = await couchDB.get("users");
|
||||
if (!res) return null;
|
||||
const data = res[username];
|
||||
|
||||
+8
-2
@@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" href="./lib/basic.css" />
|
||||
<script src="./auth.js"></script>
|
||||
<script src="./lib/basic.js"></script>
|
||||
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
@@ -98,6 +99,7 @@
|
||||
autocomplete="username"
|
||||
autocapitalize="off"
|
||||
autocorrect="off"
|
||||
onkeypress='if (event.key == "Enter") login()'
|
||||
required
|
||||
autofocus
|
||||
/>
|
||||
@@ -108,6 +110,7 @@
|
||||
id="password"
|
||||
name="password"
|
||||
autocomplete="current-password"
|
||||
onkeypress='if (event.key == "Enter") login()'
|
||||
required
|
||||
/>
|
||||
|
||||
@@ -141,11 +144,14 @@ async function login() {
|
||||
if (user.password != password) {
|
||||
return alert("Incorrect password!");
|
||||
}
|
||||
|
||||
localStorage.setItem("user", username);
|
||||
|
||||
if (user.role === "student") {
|
||||
location.href = "./student/uebersicht.html?user=" + username;
|
||||
location.href = "./student/uebersicht.html";
|
||||
return;
|
||||
} else {
|
||||
location.href = "./prof/uebersicht.html?user=" + username;
|
||||
location.href = "./prof/uebersicht.html";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ button.navigation:hover {
|
||||
<div class="header_bar_1">
|
||||
<div>
|
||||
<div>
|
||||
<button onclick="location.href = './uebersicht.html?user=' + userData.name;" class="navigation">Meine Kurse</button>
|
||||
<button onclick="location.href = './uebersicht.html';" class="navigation">Meine Kurse</button>
|
||||
</div>
|
||||
</div>
|
||||
<div><b>Auswertungen</b></div>
|
||||
|
||||
@@ -17,7 +17,7 @@ setUserData(couchDB);
|
||||
</head>
|
||||
<body>
|
||||
<div class="header_bar_1">
|
||||
<button class="back" onclick="location.href = './uebersicht.html?user=' + userData.name;">
|
||||
<button class="back" onclick="location.href = './uebersicht.html';">
|
||||
Übersicht
|
||||
</button>
|
||||
<div>
|
||||
|
||||
@@ -20,7 +20,7 @@ setUserData(couchDB);
|
||||
Meine Kurse
|
||||
</div>
|
||||
<div>
|
||||
<button class="auswertung" onclick='location.href = "./auswertung.html?user=" + userData.name'>
|
||||
<button class="auswertung" onclick='location.href = "./auswertung.html";'>
|
||||
Auswertungen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<body>
|
||||
<div class="header_bar_1">
|
||||
<div>
|
||||
<button onclick="location.href = './uebersicht.html?user=' + userData.name;" class="back">Meine
|
||||
<button onclick="location.href = './uebersicht.html" class="back">Meine
|
||||
Kurse</button>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -208,7 +208,7 @@ async function startSurvey() {
|
||||
users[userData.name].courses.push(code);
|
||||
}
|
||||
await couchDB.set("users", users);
|
||||
location.href = "./umfrage.html?user=" + userData.name + ",course=" + code;
|
||||
location.href = "./umfrage.html?course=" + code;
|
||||
} else {
|
||||
alert("Umfrage nicht gefunden!");
|
||||
}
|
||||
@@ -229,7 +229,7 @@ async function setCourseView() {
|
||||
card.addEventListener("click", (e) => {
|
||||
if (e.target.closest("button")) return;
|
||||
location.href =
|
||||
"./kursAnzeige.html?user=" + userData.name + ",course=" + courseId;
|
||||
"./kursAnzeige.html?course=" + courseId;
|
||||
});
|
||||
|
||||
const surveyUrl = (card.innerHTML = `
|
||||
@@ -240,7 +240,7 @@ async function setCourseView() {
|
||||
</div>
|
||||
|
||||
${isExpired ? '': `
|
||||
<button class="action start" onclick='location.href = "./umfrage.html?user=${userData.name},course=${courseId.trim()}";'>
|
||||
<button class="action start" onclick='location.href = "./umfrage.html?course=${courseId.trim()}";'>
|
||||
Umfrage Starten
|
||||
</button>`
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ async function updateCourseAnswer(answer) {
|
||||
return kurs;
|
||||
}
|
||||
function close_page() {
|
||||
location.href = "./uebersicht.html?user=" + userData.name;
|
||||
location.href = "./uebersicht.html";
|
||||
}
|
||||
|
||||
function createNavBar(pos) {
|
||||
@@ -287,7 +287,7 @@ async function onFinishEva() {
|
||||
}
|
||||
}
|
||||
async function onEndEvent() {
|
||||
location.href = "./uebersicht.html?user=" + userData.name;
|
||||
location.href = "./uebersicht.html";
|
||||
}
|
||||
|
||||
(async () => {
|
||||
|
||||
Reference in new issue
Block a user