issue: assignment text field for admins
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 7 Nov 2019 04:04:59 +0000 (05:04 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 9 Nov 2019 06:08:13 +0000 (07:08 +0100)
issue/index.php
widget/comments.sql
widget/reply.php

index 835f1f0ec14bec32682cee4f72dc2adaae865baf..ff99064574b88658893271e011dd49f0f97e09e1 100644 (file)
@@ -19,6 +19,11 @@ if ($id) {
                $Issue->author ? " door <strong>{$Issue->author}</strong>" : '',
                showdate(preg_split('/\D/', $Issue->created))
        );
+       if ($Issue->assign) {
+               printf('<p><em>%s</em> aan <strong>%s</strong></p>'."\n",
+                       'Toegewezen', htmlspecialchars($Issue->assign)
+               );
+       }
        if ($Issue->closed) {
                printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
                        'Opgelost', '',
index 924c136e3a385d9d489d62f3cd92e155dedad69b..8a0655826101a8147c5e3e26984008285fe60a1f 100644 (file)
@@ -7,6 +7,7 @@ CREATE TABLE issues (
        closed     timestamptz          DEFAULT now(),
        updated    timestamptz NOT NULL DEFAULT now(),
        author     text,
+       assign     text,
        id         serial      NOT NULL PRIMARY KEY
 );
 
index 4c7a3045d80ae11c7bf7bd6375214330e09b7ef1..1071976e42ddf87632359237aab3c67d3b4fc586 100644 (file)
@@ -19,6 +19,10 @@ if ($_POST) {
 
                if (isset($Issue)) {
                        $row = ['updated' => ['now()']];
+                       foreach (['assign'] as $col) {
+                               if (!isset($_POST[$col])) continue;
+                               $row[$col] = $_POST[$col] ?: NULL;
+                       }
                        $Db->set('issues', $row, ['id = ?', $Issue->id]);
                }
                $_POST['reply'] = NULL;
@@ -45,6 +49,17 @@ while ($row = $query->fetch()) {
 if ($User) {
        print '<li>';
        print '<form method="post" action="">';
+       if (isset($Issue) and $User->admin("edit $Page")) {
+               print '<p>';
+               printf(
+                       '<label for="%s">%s:</label> '
+                       . '<input id="%1$s" name="%1$s" value="%s" />'."\n",
+                       'assign',
+                       'Toegewezen aan',
+                       htmlspecialchars($Issue->assign ?? '')
+               );
+               print "</p>\n";
+       }
        printf('<textarea id="%s" name="%1$s" cols=60 rows=3 placeholder="%s">%s</textarea>'."\n",
                'reply',
                "Bericht van {$User->login}",