Refactored file system

Changed the file system to a more ordered state and updated links in
files accordingly. Also the reffering to files is now uniform
This commit is contained in:
sraffauf
2026-01-21 17:58:15 +01:00
parent a3b261e9ae
commit 77fd4e836b
15 changed files with 99 additions and 52 deletions

64
pages/admin.html Normal file
View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<title>Admin Dashboard</title>
<link rel="stylesheet" href="../css/style.css" />
</head>
<body>
<div class="container">
<h2>Admin Dashboard</h2>
<a href="../php/logout.php">Logout</a>
<div id="ticket-container">Tickets werden geladen...</div>
</div>
<script>
// einfache Escaping-Funktion gegen XSS
//test
function escapeHtml(str) {
return String(str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
async function ladeTickets() {
try {
const response = await fetch('../data/tickets.json');
if (!response.ok) throw new Error("Fehler beim Laden der Datei");
const tickets = await response.json();
const container = document.getElementById('ticket-container');
container.innerHTML = '';
if (!Array.isArray(tickets) || tickets.length === 0) {
container.innerHTML = '<p>Aktuell keine Tickets vorhanden.</p>';
return;
}
tickets.forEach(ticket => {
const div = document.createElement('div');
div.className = 'ticket';
const date = ticket.created_at || ticket.date || '';
const room = ticket.room || ticket.raum || '';
div.innerHTML = `
<h3>${escapeHtml(ticket.title || '')}</h3>
<p><strong>Kategorie:</strong> ${escapeHtml(ticket.category || '')}</p>
${room ? `<p><strong>Raum:</strong> ${escapeHtml(room)}</p>` : ""}
<p>${escapeHtml(ticket.description || '')}</p>
<p><em>${escapeHtml(date)}</em></p>
`;
container.appendChild(div);
});
} catch (error) {
document.getElementById('ticket-container').innerHTML = 'Fehler beim Laden der Tickets: ' + error.message;
console.error(error);
}
}
ladeTickets();
</script>
</body>
</html>

26
pages/login.html Normal file
View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login</title>
<link rel="stylesheet" href="./css/style.css" />
</head>
<body>
<div class="container">
<div class="header-with-image">
<h2>Admin Login</h2>
<img src="./img/csg.png" width="100" />
</div>
<form id="loginForm">
<label for="username">Benutzername</label>
<input type="text" id="username" name="username" required />
<label for="password">Passwort</label>
<input type="password" id="password" name="password" required />
<button type="submit">Einloggen</button>
</form>
<p id="errorMsg" style="color: red;"></p>
</div>
<script src="./js/login.js"></script>
</body>
</html>

46
pages/ticket_submit.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Schul-IT Ticketsystem</title>
<link rel="stylesheet" href="../css/style.css" />
</head>
<body>
<div class="container">
<div class="header-with-image">
<h2>CSG IT Ticket System</h2>
<img src="../img/csg.png" width="100" />
</div>
<form action="../php/save_ticket.php" method="post">
<label for="title">Betreff</label>
<input type="text" id="title" name="title" required />
<label for="description">Problem-Beschreibung</label>
<textarea id="description" name="description" rows="5" required></textarea>
<label for="room">Raum</label>
<input type="number" id="room" name="room" required />
<label for="name">Name, Vorname</label>
<input type="text" id="name" name="name" required>
<label for="category">Kategorie</label>
<select id="category" name="category">
<option value="Whiteboard">Whiteboard</option>
<option value="Internet">Internet</option>
<option value="Schülerportal">Schülerportal</option>
<option value="Ipad(Koffer)">Ipad(Koffer)</option>
<option value="Apple TV">Apple TV</option>
<option value="DocuCam">Docu Kamera</option>
<option value="Sonstiges">Sonstiges</option>
</select>
<button type="submit">Ticket absenden</button>
<a href="./login.html" class="login-btn">Admin Login</a>
</form>
</div>
</body>
</html>