diff --git a/Dashboard_V2/app.py b/Dashboard_V2/app.py index 03f53fd..338b08a 100644 --- a/Dashboard_V2/app.py +++ b/Dashboard_V2/app.py @@ -546,6 +546,50 @@ def dashboard(): # SUPPORT & SETTINGS ROUTEN (Aus V1) # ------------------------------------------------------------ +@app.route('/delete_notification/', methods=['POST']) +def delete_notification(notif_id): + if 'user_id' not in session: + flash("Bitte melde dich an!", "red") + return redirect(url_for('login')) + + user_id = session['user_id'] + db = get_db() + + # Prüfen, ob die Notification existiert + row = db.execute(""" + SELECT user_id + FROM notifications + WHERE id=? + """, (notif_id,)).fetchone() + + if not row: + flash("Benachrichtigung existiert nicht.", "red") + return redirect(url_for('dashboard')) + + # Wenn user_id = NULL => globale Notification + # Du kannst selbst definieren, ob jeder sie löschen darf oder nur Admin + # Hier: Jeder kann globale Notification löschen, wenn er sie sieht. + # Oder du sagst: Nur Admin kann globale Notis löschen -> if row['user_id'] is None and not is_admin(): ... + if row['user_id'] is None: + # Optional: Nur Admin löschen + if not is_admin(): + flash('Nicht erlaubt', 'red') + return redirect(url_for('dashboard')) + pass + else: + # Wenn es eine user-spezifische Notification ist: user_id muss übereinstimmen + if row['user_id'] != user_id: + flash("Keine Berechtigung, diese Benachrichtigung zu löschen.", "red") + return redirect(url_for('dashboard')) + + # Benachrichtigung löschen + db.execute("DELETE FROM notifications WHERE id=?", (notif_id,)) + db.commit() + + flash("Benachrichtigung gelöscht!", "green") + return redirect(url_for('dashboard')) + + @app.route('/send_support_message', methods=['POST']) def send_support_message(): """ @@ -665,6 +709,7 @@ def add_bookmarks_multi(): if not target_list: flash("Bitte mindestens einen Benutzer auswählen!", "red") return redirect(url_for('admin_panel')) + icon = request.form.get('icon_class') db = get_db() for uid in target_list: diff --git a/Dashboard_V2/templates/admin.html b/Dashboard_V2/templates/admin.html index d2a5306..a0c0efb 100644 --- a/Dashboard_V2/templates/admin.html +++ b/Dashboard_V2/templates/admin.html @@ -1,154 +1,150 @@ - {% extends "base.html" %} {% block title %} Admin-Bereich {% endblock title %} {% block content %} -
-

Admin-Bereich

+
+

Admin-Bereich

{% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %} -
+
{{ message }}
{% endfor %} {% endif %} {% endwith %} - -
+ +
-
-

Neuen Benutzer anlegen

-
-
- - -
-
- - -
-
- - Als Admin markieren -
- +
+

Neuen Benutzer anlegen

+ +
+ + +
+
+ + +
+
+ + Als Admin markieren +
+
-
-

Benutzerverwaltung

- - - - - - - - - - - {% for u in users %} - - - - - - - {% endfor %} - -
IDUsernameAdmin?Aktion
{{ u.id }}{{ u.username }}{{ 'Ja' if u.is_admin else 'Nein' }} - - - Lesezeichen - - -
- -
-
+
+

Benutzerverwaltung

+
+ + + + + + + + + + + {% for u in users %} + + + + + + + {% endfor %} + +
IDUsernameAdmin?Aktion
{{ u.id }}{{ u.username }}{{ 'Ja' if u.is_admin else 'Nein' }} + + Lesezeichen + +
+ +
+
+
-
-

Benachrichtigung erstellen

-
+
+

Benachrichtigung erstellen

+
- - + +
-

Für welche Benutzer?

- +

Für welche Benutzer?

- {% for u in users %} -
-
-
-

Lesezeichen-Verwaltung

-
-

Für welche Benutzer soll das Lesezeichen gelten?

+
+

Lesezeichen-Verwaltung

+ +

Für welche Benutzer soll das Lesezeichen gelten?

{% for u in users %} -
-
- - + +
- - + +
- - + +
- - {% if single_user and bookmarks %} -

Lesezeichen für {{ single_user.username }}:

-
+ class="inline-block bg-blue-500 hover:bg-blue-600 text-white px-6 py-3 rounded shadow transition duration-200 mt-8"> Zurück zum Dashboard
diff --git a/Dashboard_V2/templates/dashboard.html b/Dashboard_V2/templates/dashboard.html index e6f6d2a..ef8b6ba 100644 --- a/Dashboard_V2/templates/dashboard.html +++ b/Dashboard_V2/templates/dashboard.html @@ -24,15 +24,15 @@
-
- + - -
@@ -68,12 +68,21 @@

Benachrichtigungen

{% if notifications %}
    - {% for note in notifications %} -
  • - {{ note.message }}
    - {{ note.created_at }} -
  • - {% endfor %} + {% for note in notifications %} +
  • +
    + {{ note.message }}
    + {{ note.created_at }} +
    +
    + +
    +
  • + {% endfor %}
{% else %}

Keine neuen Benachrichtigungen

diff --git a/clickcandit.db b/clickcandit.db deleted file mode 100644 index ae91edf..0000000 Binary files a/clickcandit.db and /dev/null differ