Browse Source

mustard: notifs: Aggiunto bottone per leggere le notifiche.

* web/mustard/notifs.php: Aggiunto bottone che chiama la funzione JS
  markread per marcare come letta la notifica.
paul 4 years ago
parent
commit
970c8d64c1
1 changed files with 11 additions and 1 deletions
  1. 11 1
      web/mustard/notifs.php

+ 11 - 1
web/mustard/notifs.php

@@ -304,6 +304,8 @@ if ($account['Level'] != 'guest') {
     </div>
 </nav>
 
+<?php echo($notifs['div']); ?>
+
 <div id="fullscreen">
     <div id="middlerow">
         <div id="notifs-list">
@@ -314,8 +316,16 @@ if ($account['Level'] != 'guest') {
                     2 => "sev-warning",
                     3 => "sev-error"
                 );
+                $seen_class = array(
+                    0 => "unseen",
+                    1 => "seen"
+                );
                 foreach ($notifs['notifs'] as $n) {
-                    echo("<div id=\"notif-" . $n["ID"] . "\" class=\"" . $sev_classes[$n["Severity"]] . "\">" . $n["Notification"] . "</div>\n");
+                    echo("<div id=\"notif-" . $n["ID"] .
+                        "\" class=\"" . $sev_classes[$n["Severity"]] . " " . $seen_class[$n["Seen"]] . "\">" .
+                        $n["Notification"] .
+                        "<button type='button' onclick='markread(this.parentElement)'>&#x2715</button>" .
+                        "</div>\n");
                 }
             } ?>
         </div>