issue: reply option to mark announced publication
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 28 Sep 2021 15:50:31 +0000 (17:50 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 28 Sep 2021 16:40:46 +0000 (18:40 +0200)
Can be unchecked to decrease message visibility.

database.inc.php
upload.inc.php
widget/comments.sql
widget/reply.php

index b2244b9b0d52db65c180051ec2c24d89edcb27d1..9b65ce6926defaf54b1080ab99db43fc71b9778e 100644 (file)
@@ -29,6 +29,9 @@ class DB
                        $params = array_merge($params, $val);
                        return $sql;
                }
+               elseif (is_bool($val)) {
+                       return $val ? 'TRUE' : 'FALSE';
+               }
 
                $params[] = $val;
                return '?';
index d87fa2d8f4e3bbcb9d14de3debe11ef970eebe6f..ff4ecd3755aaa7ba695b098ebf78b48187bd9261 100644 (file)
@@ -84,6 +84,9 @@ function createcomment($input, &$Issue = NULL)
                $reply['raw'] = $body;
                $reply['message'] = messagehtml($body);
        }
+       if (isset($input['announce'])) {
+               $reply['announced'] = !!$input['announce'];
+       }
        if ($_FILES and !empty($_FILES['image'])) {
                $target = 'data/upload';
                if (!file_exists($target)) {
index b805a2a33a6fdd89082ddebf6889560b4cffbd34..fc261f82ae0c41f7ffd0416610876e5dfdd40cc0 100644 (file)
@@ -14,6 +14,7 @@ CREATE TABLE comments (
        page       text,
        raw        text,
        message    text,
+       announced  boolean     NOT NULL DEFAULT TRUE,
        created    timestamptz DEFAULT now(),
        author     text,
        id         serial      NOT NULL PRIMARY KEY
index b740c2a5276722aa8bba0f6482a263af65a7b272..010b1de4dcb90e9e1c0179a7e9da608797917b0e 100644 (file)
@@ -88,6 +88,21 @@ if ($User->login) {
                );
                print "</p>\n";
        }
+       {
+               print '<p>';
+               printf(
+                       '<input type="hidden" name="%s" value="" />'
+                       . "Geplaatste berichten zijn hier direct zichtbaar voor bewoners.\n"
+                       . '<input type="checkbox" id="%1$s" name="%1$s" value="%s"%s%s />'
+                       . '<label for="%1$s"> %s</label>'."\n",
+                       'announce',
+                       '1',
+                       ($_POST['announce'] ?? TRUE) ? ' checked' : '',
+                       ' onclick="this.nextSibling.hidden = !this.checked"',
+                       "De eerste regel wordt ook weergegeven op het scherm in de hal."
+               );
+               print "</p>\n";
+       }
        if (isset($Issue)) {
                printf(
                        '<p><label for="%s">%s:</label> '