|
|
|
|
@@ -1,148 +1,178 @@
|
|
|
|
|
<!-- templates/admin.html -->
|
|
|
|
|
<!-- Standalone admin.html without base.html, now with flexible layout, multi-user bookmark creation, and the ability for the own user to manage bookmarks -->
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="de">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
|
<title>Admin-Bereich</title>
|
|
|
|
|
<style>
|
|
|
|
|
body {
|
|
|
|
|
background-color: black !important;
|
|
|
|
|
color: white !important;
|
|
|
|
|
font-family: Arial, sans-serif !important;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
.container {
|
|
|
|
|
max-width: 800px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background-color: #222 !important;
|
|
|
|
|
border-radius: 10px !important;
|
|
|
|
|
}
|
|
|
|
|
.title {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 24px !important;
|
|
|
|
|
}
|
|
|
|
|
.form-group {
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
}
|
|
|
|
|
input, select, button {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
padding: 8px !important;
|
|
|
|
|
border-radius: 5px !important;
|
|
|
|
|
margin-top: 5px !important;
|
|
|
|
|
}
|
|
|
|
|
button {
|
|
|
|
|
background-color: green !important;
|
|
|
|
|
color: white !important;
|
|
|
|
|
border: none !important;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
button:hover {
|
|
|
|
|
background-color: darkgreen !important;
|
|
|
|
|
}
|
|
|
|
|
table {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
border-collapse: collapse !important;
|
|
|
|
|
margin-top: 10px !important;
|
|
|
|
|
}
|
|
|
|
|
th, td {
|
|
|
|
|
padding: 10px !important;
|
|
|
|
|
border-bottom: 1px solid gray !important;
|
|
|
|
|
text-align: left !important;
|
|
|
|
|
}
|
|
|
|
|
th {
|
|
|
|
|
background-color: #333 !important;
|
|
|
|
|
}
|
|
|
|
|
.danger-button {
|
|
|
|
|
background-color: red !important;
|
|
|
|
|
}
|
|
|
|
|
.danger-button:hover {
|
|
|
|
|
background-color: darkred !important;
|
|
|
|
|
}
|
|
|
|
|
.link-button {
|
|
|
|
|
display: block !important;
|
|
|
|
|
background-color: blue !important;
|
|
|
|
|
color: white !important;
|
|
|
|
|
text-align: center !important;
|
|
|
|
|
padding: 10px !important;
|
|
|
|
|
border-radius: 5px !important;
|
|
|
|
|
margin-top: 20px !important;
|
|
|
|
|
text-decoration: none !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="container">
|
|
|
|
|
<h1 class="title">Admin-Bereich</h1>
|
|
|
|
|
|
|
|
|
|
<body style="margin:0 !important; padding:0 !important; background-color:black !important; color:white !important; font-family:Arial,sans-serif !important;">
|
|
|
|
|
<div style="max-width:1200px !important; width:100% !important; margin:auto !important; padding:20px !important;">
|
|
|
|
|
<h1 style="text-align:center !important; font-size:24px !important; margin-bottom:20px !important;">Admin-Bereich</h1>
|
|
|
|
|
|
|
|
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
|
|
|
{% if messages %}
|
|
|
|
|
{% for category, message in messages %}
|
|
|
|
|
<div style="background-color: {{category}} !important; color: white !important; padding: 10px !important; border-radius: 5px !important; margin-bottom: 10px !important;">
|
|
|
|
|
{{ message }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if messages %}
|
|
|
|
|
{% for category, message in messages %}
|
|
|
|
|
<div style="background-color:{{category}} !important; color:white !important; padding:10px !important; border-radius:5px !important; margin-bottom:10px !important;">
|
|
|
|
|
{{ message }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endwith %}
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h2>Neuen Benutzer anlegen</h2>
|
|
|
|
|
<form method="POST" action="{{ url_for('admin_panel') }}">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>Benutzername:</label>
|
|
|
|
|
<input type="text" name="new_username" required>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>Passwort:</label>
|
|
|
|
|
<input type="password" name="new_password" required>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="new_is_admin"> Als Admin markieren
|
|
|
|
|
|
|
|
|
|
<!-- Main grid container for flexibility -->
|
|
|
|
|
<div style="display:flex !important; flex-wrap:wrap !important; gap:20px !important; justify-content:center !important; align-items:start !important;">
|
|
|
|
|
|
|
|
|
|
<!-- Neuen Benutzer anlegen -->
|
|
|
|
|
<div style="flex:1 1 400px !important; min-width:300px !important; max-width:500px !important; background-color:#222 !important; border-radius:10px !important; padding:15px !important;">
|
|
|
|
|
<h2 style="font-size:18px !important; margin-bottom:10px !important;">Neuen Benutzer anlegen</h2>
|
|
|
|
|
<form method="POST" action="{{ url_for('admin_panel') }}">
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">Benutzername:</label>
|
|
|
|
|
<input type="text" name="new_username" required
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important;" />
|
|
|
|
|
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">Passwort:</label>
|
|
|
|
|
<input type="password" name="new_password" required
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important;" />
|
|
|
|
|
|
|
|
|
|
<label style="display:inline-flex !important; align-items:center !important; margin-bottom:10px !important;">
|
|
|
|
|
<input type="checkbox" name="new_is_admin" style="margin-right:5px !important;" /> Als Admin markieren
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
<button type="submit">Erstellen</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h2>Benutzerverwaltung</h2>
|
|
|
|
|
<table>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>ID</th>
|
|
|
|
|
<th>Username</th>
|
|
|
|
|
<th>Admin?</th>
|
|
|
|
|
<th>Aktion</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{% for u in users %}
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{ u.id }}</td>
|
|
|
|
|
<td>{{ u.username }}</td>
|
|
|
|
|
<td>{{ 'Ja' if u.is_admin else 'Nein' }}</td>
|
|
|
|
|
<td>
|
|
|
|
|
{% if u.id != session.user_id %}
|
|
|
|
|
<form method="POST" action="{{ url_for('delete_user', user_id=u.id) }}" onsubmit="return confirm('Benutzer wirklich löschen?')">
|
|
|
|
|
<button class="danger-button">Löschen</button>
|
|
|
|
|
</form>
|
|
|
|
|
{% else %}
|
|
|
|
|
<span style="color: gray !important;">[Eigener Account]</span>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<button type="submit"
|
|
|
|
|
style="background-color:green !important; color:white !important; padding:10px !important; border-radius:5px !important; width:100% !important; border:none !important; cursor:pointer !important; margin-top:10px !important;">
|
|
|
|
|
Erstellen
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Benutzerverwaltung -->
|
|
|
|
|
<div style="flex:1 1 400px !important; min-width:300px !important; max-width:500px !important; background-color:#222 !important; border-radius:10px !important; padding:15px !important;">
|
|
|
|
|
<h2 style="font-size:18px !important; margin-bottom:10px !important;">Benutzerverwaltung</h2>
|
|
|
|
|
<table style="width:100% !important; border-collapse:collapse !important;">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr style="border-bottom:1px solid gray !important;">
|
|
|
|
|
<th style="padding:10px !important; text-align:left !important;">ID</th>
|
|
|
|
|
<th style="padding:10px !important; text-align:left !important;">Username</th>
|
|
|
|
|
<th style="padding:10px !important; text-align:left !important;">Admin?</th>
|
|
|
|
|
<th style="padding:10px !important; text-align:left !important;">Aktion</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{% for u in users %}
|
|
|
|
|
<tr style="border-bottom:1px solid #444 !important;">
|
|
|
|
|
<td style="padding:10px !important;">{{ u.id }}</td>
|
|
|
|
|
<td style="padding:10px !important;">{{ u.username }}</td>
|
|
|
|
|
<td style="padding:10px !important;">{{ 'Ja' if u.is_admin else 'Nein' }}</td>
|
|
|
|
|
<td style="padding:10px !important;">
|
|
|
|
|
<!-- Link zum Lesezeichen-Management (auch für eigenen Account) -->
|
|
|
|
|
<a href="{{ url_for('manage_bookmarks', user_id=u.id) }}"
|
|
|
|
|
style="background-color:blue !important; color:white !important; padding:5px 10px !important; border-radius:5px !important; text-decoration:none !important; margin-right:10px !important;">
|
|
|
|
|
Lesezeichen
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<form method="POST" action="{{ url_for('delete_user', user_id=u.id) }}"
|
|
|
|
|
style="display:inline;"
|
|
|
|
|
onsubmit="return confirm('Benutzer wirklich löschen?')">
|
|
|
|
|
<button style="background-color:red !important; color:white !important; padding:5px 10px !important; border-radius:5px !important; border:none !important; cursor:pointer !important;">
|
|
|
|
|
Löschen
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Benachrichtigung erstellen -->
|
|
|
|
|
<div style="flex:1 1 400px !important; min-width:300px !important; max-width:500px !important; background-color:#222 !important; border-radius:10px !important; padding:15px !important;">
|
|
|
|
|
<h2 style="font-size:18px !important; margin-bottom:10px !important;">Benachrichtigung erstellen</h2>
|
|
|
|
|
<form method="POST" action="{{ url_for('add_notification') }}">
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">Nachricht:</label>
|
|
|
|
|
<textarea name="message" rows="2" required
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important; border:none !important;"></textarea>
|
|
|
|
|
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">Für Benutzer:</label>
|
|
|
|
|
<select name="user_id"
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important;">
|
|
|
|
|
<option value="all">Alle</option>
|
|
|
|
|
{% for u in users %}
|
|
|
|
|
<option value="{{ u.id }}">{{ u.username }}</option>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<button type="submit"
|
|
|
|
|
style="background-color:purple !important; color:white !important; padding:10px !important; border-radius:5px !important; width:100% !important; border:none !important; cursor:pointer !important;">
|
|
|
|
|
Senden
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Lesezeichen-Verwaltung -->
|
|
|
|
|
<div style="flex:1 1 400px !important; min-width:300px !important; max-width:500px !important; background-color:#222 !important; border-radius:10px !important; padding:15px !important;">
|
|
|
|
|
<h2 style="font-size:18px !important; margin-bottom:10px !important;">Lesezeichen-Verwaltung</h2>
|
|
|
|
|
|
|
|
|
|
<!-- Formular: selektierbare Benutzer (Checkboxen) und Lesezeichen-Infos -->
|
|
|
|
|
<form method="POST" style="margin-bottom:20px !important;">
|
|
|
|
|
<p style="margin-bottom:10px !important;">Für welche Benutzer soll dieses Lesezeichen gelten?</p>
|
|
|
|
|
<div style="display:flex !important; flex-wrap:wrap !important; gap:10px !important; margin-bottom:10px !important;">
|
|
|
|
|
{% for u in users %}
|
|
|
|
|
<label style="display:inline-flex !important; align-items:center !important; background-color:#333 !important; padding:5px 10px !important; border-radius:5px !important;">
|
|
|
|
|
<input type="checkbox" name="target_users" value="{{ u.id }}" style="margin-right:5px !important;" />
|
|
|
|
|
{{ u.username }}
|
|
|
|
|
</label>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">Titel:</label>
|
|
|
|
|
<input type="text" name="title" required
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important;" />
|
|
|
|
|
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">URL:</label>
|
|
|
|
|
<input type="text" name="url" required
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important;" />
|
|
|
|
|
|
|
|
|
|
<label style="display:block !important; margin-bottom:5px !important;">Icon (FontAwesome CSS-Klasse):</label>
|
|
|
|
|
<input type="text" name="icon_class" placeholder="z.B. fas fa-user"
|
|
|
|
|
style="width:100% !important; padding:8px !important; border-radius:5px !important; margin-bottom:10px !important;" />
|
|
|
|
|
|
|
|
|
|
<button type="submit"
|
|
|
|
|
style="background-color:green !important; color:white !important; padding:10px !important; border-radius:5px !important; width:100% !important; border:none !important; cursor:pointer !important;">
|
|
|
|
|
Hinzufügen
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<!-- Liste der Lesezeichen, wenn single_user und bookmarks verfügbar sind -->
|
|
|
|
|
{% if single_user and bookmarks %}
|
|
|
|
|
<p style="margin-bottom:10px !important;">Lesezeichen für {{ single_user.username }}:</p>
|
|
|
|
|
<ul style="list-style-type:none !important; padding:0 !important;">
|
|
|
|
|
{% for bm in bookmarks %}
|
|
|
|
|
<li style="background-color:#333 !important; border-radius:5px !important; margin-bottom:10px !important; display:flex !important; justify-content:space-between !important; align-items:center !important; padding:10px !important;">
|
|
|
|
|
<div>
|
|
|
|
|
<i class="{{ bm.icon_class }}" style="margin-right:8px !important;"></i>
|
|
|
|
|
<a href="{{ bm.url }}" target="_blank"
|
|
|
|
|
style="color:#4AB3F4 !important; text-decoration:none !important;">{{ bm.title }}</a>
|
|
|
|
|
</div>
|
|
|
|
|
<form method="POST" action="{{ url_for('delete_bookmark', bookmark_id=bm.id, user_id=single_user.id) }}" onsubmit="return confirm('Lesezeichen wirklich löschen?')">
|
|
|
|
|
<button style="background-color:red !important; color:white !important; padding:5px 10px !important; border-radius:5px !important; border:none !important; cursor:pointer !important;">
|
|
|
|
|
<i class="fas fa-trash-alt"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</li>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<a href="{{ url_for('dashboard') }}" class="link-button">Zurück zum Dashboard</a>
|
|
|
|
|
</ul>
|
|
|
|
|
{% else %}
|
|
|
|
|
<p style="color:#888 !important;">Wähle oben in der Benutzerverwaltung „Lesezeichen“ für den gewünschten Nutzer, um bestehende Einträge zu sehen.</p>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div> <!-- Ende Grid -->
|
|
|
|
|
|
|
|
|
|
<a href="{{ url_for('dashboard') }}"
|
|
|
|
|
style="display:inline-block !important; background-color:blue !important; color:white !important; text-align:center !important; padding:10px !important; border-radius:5px !important; margin-top:20px !important; text-decoration:none !important;">
|
|
|
|
|
Zurück zum Dashboard
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
</html>
|