Removed arbitrary files
admin.html not needed so i removed it. Also admin.php now uses the container id to match the rest of the pages
This commit is contained in:
@@ -1,2 +1,11 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"title": "test",
|
||||||
|
"description": "test",
|
||||||
|
"category": "Whiteboard",
|
||||||
|
"room": "139",
|
||||||
|
"name": "peter",
|
||||||
|
"status": "InProgress",
|
||||||
|
"date": "2026-01-22 19:54:13"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<!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, "&")
|
|
||||||
.replace(/</g, "<")
|
|
||||||
.replace(/>/g, ">")
|
|
||||||
.replace(/"/g, """)
|
|
||||||
.replace(/'/g, "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
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>
|
|
||||||
@@ -13,7 +13,7 @@ if (!isset($_SESSION["loggedIn"])) {
|
|||||||
<link rel="stylesheet" href="../css/style.css">
|
<link rel="stylesheet" href="../css/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container-dashboard">
|
<div class="container">
|
||||||
<div class="header-with-image">
|
<div class="header-with-image">
|
||||||
<h2>Admin Dashboard</h2>
|
<h2>Admin Dashboard</h2>
|
||||||
<img src="../img/csg.png" width="100" />
|
<img src="../img/csg.png" width="100" />
|
||||||
|
|||||||
Reference in New Issue
Block a user