issue: admin option to close or reopen
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 7 Nov 2019 04:23:30 +0000 (05:23 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 9 Nov 2019 06:08:13 +0000 (07:08 +0100)
widget/reply.php

index 1071976e42ddf87632359237aab3c67d3b4fc586..328a58fbe1a23f2cb8ba09d1b06f3a5480acd691 100644 (file)
@@ -23,6 +23,12 @@ if ($_POST) {
                                if (!isset($_POST[$col])) continue;
                                $row[$col] = $_POST[$col] ?: NULL;
                        }
+                       if (isset($_POST['status'])) {
+                               $reset = !empty($_POST['status']);
+                               if (isset($Issue->closed) !== $reset) {
+                                       $row['closed'] = $reset ? ['now()'] : NULL;
+                               }
+                       }
                        $Db->set('issues', $row, ['id = ?', $Issue->id]);
                }
                $_POST['reply'] = NULL;
@@ -58,6 +64,15 @@ if ($User) {
                        'Toegewezen aan',
                        htmlspecialchars($Issue->assign ?? '')
                );
+               printf(
+                       '<input type="hidden" name="%s" value="" />' .
+                       '<input type="checkbox" id="%1$s" name="%1$s" value="%s"%s />'
+                       . '<label for="%1$s"> %s</label>'."\n",
+                       'status',
+                       'resolved',
+                       isset($Issue->closed) ? ' checked' : '',
+                       'Gesloten'
+               );
                print "</p>\n";
        }
        printf('<textarea id="%s" name="%1$s" cols=60 rows=3 placeholder="%s">%s</textarea>'."\n",