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:
@@ -18,3 +18,4 @@
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,14 +7,14 @@ document.getElementById("loginForm").addEventListener("submit", async function (
|
||||
formData.append("username", username);
|
||||
formData.append("password", password);
|
||||
|
||||
const response = await fetch("backend/login.php", {
|
||||
const response = await fetch("../php/login.php", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
window.location.href = "admin.php";
|
||||
window.location.href = "../php/admin.php";
|
||||
} else {
|
||||
document.getElementById("errorMsg").innerText = "Login fehlgeschlagen!";
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Admin Dashboard</title>
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<link rel="stylesheet" href="../css/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>Admin Dashboard</h2>
|
||||
<a href="backend/logout.php">Logout</a>
|
||||
<a href="../php/logout.php">Logout</a>
|
||||
<div id="ticket-container">Tickets werden geladen...</div>
|
||||
</div>
|
||||
<script>
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
async function ladeTickets() {
|
||||
try {
|
||||
const response = await fetch('backend/tickets.json');
|
||||
const response = await fetch('../data/tickets.json');
|
||||
if (!response.ok) throw new Error("Fehler beim Laden der Datei");
|
||||
|
||||
const tickets = await response.json();
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="container">
|
||||
<div class="header-with-image">
|
||||
<h2>Admin Login</h2>
|
||||
<img src="img/csg.png" width="100" />
|
||||
<img src="./img/csg.png" width="100" />
|
||||
</div>
|
||||
<form id="loginForm">
|
||||
<label for="username">Benutzername</label>
|
||||
46
pages/ticket_submit.html
Normal file
46
pages/ticket_submit.html
Normal 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>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION["loggedIn"])) {
|
||||
header("Location: login.html");
|
||||
header("Location: ../pages/login.html");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -10,7 +10,7 @@ if (!isset($_SESSION["loggedIn"])) {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Admin Dashboard</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-dashboard">
|
||||
@@ -19,7 +19,7 @@ if (!isset($_SESSION["loggedIn"])) {
|
||||
<img src="img/csg.png" width="100" />
|
||||
</div>
|
||||
|
||||
<a href="backend/logout.php" class="logout-btn">Logout</a>
|
||||
<a href="../php/logout.php" class="logout-btn">Logout</a>
|
||||
|
||||
<div class="dashboard">
|
||||
<!-- Linke Ticket-Übersicht -->
|
||||
@@ -40,7 +40,7 @@ let tickets = [];
|
||||
|
||||
async function ladeTickets() {
|
||||
try {
|
||||
const response = await fetch('backend/tickets.json?ts=' + Date.now(), {cache:"no-store"});
|
||||
const response = await fetch('../data/tickets.json?ts=' + Date.now(), {cache:"no-store"});
|
||||
tickets = await response.json();
|
||||
|
||||
const ul = document.getElementById('tickets-ul');
|
||||
@@ -91,7 +91,7 @@ function showTicketDetails(index) {
|
||||
const newStatus = document.getElementById('status-select').value;
|
||||
ticket.status = newStatus;
|
||||
|
||||
const res = await fetch('backend/update_ticket.php', {
|
||||
const res = await fetch('./update_ticket.php', {
|
||||
method:'POST',
|
||||
headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({index, ticket})
|
||||
@@ -108,7 +108,7 @@ function showTicketDetails(index) {
|
||||
document.getElementById('delete-ticket').addEventListener('click', async () => {
|
||||
if(!confirm("Ticket wirklich löschen?")) return;
|
||||
|
||||
const res = await fetch('backend/delete_ticket.php', {
|
||||
const res = await fetch('./backend/delete_ticket.php', {
|
||||
method:'POST',
|
||||
headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({index})
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
if(!isset($_SESSION['user_id'])){
|
||||
header("Location: login.html");
|
||||
header("Location: ../pages/login.html");
|
||||
exit;
|
||||
}
|
||||
echo "Willkommen im Dashboard, ".$_SESSION['role']."!";
|
||||
@@ -82,7 +82,7 @@ echo "Willkommen im Dashboard, ".$_SESSION['role']."!";
|
||||
<a href="#" data-section="tickets">Tickets</a>
|
||||
<a href="#" data-section="users">Benutzer</a>
|
||||
<a href="#" data-section="settings">Persönliche Einstellungen</a>
|
||||
<a href="backend/logout.php">Logout</a>
|
||||
<a href="./logout.php">Logout</a>
|
||||
</div>
|
||||
|
||||
<div class="content" id="main-content">
|
||||
@@ -90,7 +90,7 @@ echo "Willkommen im Dashboard, ".$_SESSION['role']."!";
|
||||
<div class="welcome-box">
|
||||
<h2>Admin Dashboard</h2>
|
||||
<p>Angemeldet als: <?= htmlspecialchars($_SESSION["username"]) ?></p>
|
||||
<a href="backend/logout.php">Logout</a>
|
||||
<a href="./logout.php">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -114,10 +114,10 @@ echo "Willkommen im Dashboard, ".$_SESSION['role']."!";
|
||||
<h2>Willkommen, ${username}!</h2>
|
||||
<p>Hier siehst du eine Übersicht und kannst über die Buttons neue Bereiche öffnen:</p>
|
||||
<div class="button-panel">
|
||||
<button onclick="window.location.href='users.php'">Benutzer erstellen</button>
|
||||
<button onclick="window.location.href='admin.php'">Tickets verwalten</button>
|
||||
<button onclick="window.location.href='deleted_tickets.php'">Gelöschte Tickets</button>
|
||||
<button onclick="window.location.href='settings.php'">Persönliche Einstellungen</button>
|
||||
<button onclick="window.location.href='./users.php'">Benutzer erstellen</button>
|
||||
<button onclick="window.location.href='./admin.php'">Tickets verwalten</button>
|
||||
<button onclick="window.location.href='./deleted_tickets.php'">Gelöschte Tickets</button>
|
||||
<button onclick="window.location.href='./settings.php'">Persönliche Einstellungen</button>
|
||||
</div>
|
||||
</div>`;
|
||||
break;
|
||||
@@ -13,7 +13,7 @@ if($index === null){
|
||||
exit;
|
||||
}
|
||||
|
||||
$ticketsPath = __DIR__ . '/tickets.json';
|
||||
$ticketsPath = __DIR__ . '../data/tickets.json';
|
||||
$tickets = [];
|
||||
|
||||
if(file_exists($ticketsPath)){
|
||||
@@ -4,7 +4,7 @@ session_start();
|
||||
$username = $_POST['username'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
$usersFile = __DIR__ . "/users.json";
|
||||
$usersFile = __DIR__ . "../data/users.json";
|
||||
if (!file_exists($usersFile)) {
|
||||
die("Benutzerdaten fehlen!");
|
||||
}
|
||||
@@ -24,9 +24,9 @@ if (is_array($users)) {
|
||||
if ($loginOk) {
|
||||
$_SESSION['loggedIn'] = true;
|
||||
$_SESSION['username'] = $username;
|
||||
header("Location: ../admin.php");
|
||||
header("Location: ./admin.php");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: ../login.html?error=1");
|
||||
header("Location: ../pages/login.html?error=1");
|
||||
exit;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
header("Location: ../login.html");
|
||||
header("Location: ../pages/login.html");
|
||||
exit;
|
||||
?>
|
||||
@@ -22,7 +22,7 @@ $newTicket = [
|
||||
'date' => $date
|
||||
];
|
||||
|
||||
$ticketsPath = __DIR__ . '/tickets.json';
|
||||
$ticketsPath = __DIR__ . '../data/tickets.json';
|
||||
$tickets = [];
|
||||
|
||||
if (file_exists($ticketsPath)) {
|
||||
@@ -36,5 +36,5 @@ $tickets[] = $newTicket;
|
||||
file_put_contents($ticketsPath, json_encode($tickets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), LOCK_EX);
|
||||
|
||||
// Redirect zurück ins Dashboard oder zur Hauptseite
|
||||
header('Location: ../ticket_submit.html?success=1');
|
||||
header('Location: ../pages/ticket_submit.html?success=1');
|
||||
exit;
|
||||
@@ -14,7 +14,7 @@ if($index === null || $ticket === null){
|
||||
exit;
|
||||
}
|
||||
|
||||
$ticketsPath = __DIR__ . '/tickets.json';
|
||||
$ticketsPath = __DIR__ . '../data/tickets.json';
|
||||
$tickets = [];
|
||||
|
||||
if(file_exists($ticketsPath)){
|
||||
@@ -4,16 +4,16 @@
|
||||
<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" />
|
||||
<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" />
|
||||
<img src="../img/csg.png" width="100" />
|
||||
</div>
|
||||
|
||||
<form action="backend/save_ticket.php" method="post">
|
||||
<form action="../php/save_ticket.php" method="post">
|
||||
<label for="title">Betreff</label>
|
||||
<input type="text" id="title" name="title" required />
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</select>
|
||||
|
||||
<button type="submit">Ticket absenden</button>
|
||||
<a href="login.html" class="login-btn">Admin Login</a>
|
||||
<a href="./login.html" class="login-btn">Admin Login</a>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user