diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-07-04 11:21:58 +0200 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-07-04 11:24:24 +0200 |
commit | 87215cef000b2a49b31b14a759050db834b3497b (patch) | |
tree | 84b78384511f86e228b1a232636e8a21332b9dda | |
parent | 743f13e92d0f87e82a2c8de2b9554fd0bebfdee0 (diff) | |
download | aur-87215cef000b2a49b31b14a759050db834b3497b.tar.gz aur-87215cef000b2a49b31b14a759050db834b3497b.tar.xz |
Remember whether a request has been accepted
Store whether a package request is accepted or rejected and display the
reason of each closed request in the request list.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
-rw-r--r-- | web/lib/pkgreqfuncs.inc.php | 16 | ||||
-rw-r--r-- | web/template/pkgreq_results.php | 12 |
2 files changed, 22 insertions, 6 deletions
diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php index 8266c675..53cf328f 100644 --- a/web/lib/pkgreqfuncs.inc.php +++ b/web/lib/pkgreqfuncs.inc.php @@ -30,11 +30,11 @@ function pkgreq_list($offset, $limit) { $q.= "PackageRequests.MergeBaseName AS MergeInto, "; $q.= "RequestTypes.Name AS Type, PackageRequests.Comments, "; $q.= "Users.Username AS User, PackageRequests.RequestTS, "; - $q.= "PackageRequests.Status "; + $q.= "PackageRequests.Status, PackageRequests.Status = 0 AS Open "; $q.= "FROM PackageRequests INNER JOIN RequestTypes ON "; $q.= "RequestTypes.ID = PackageRequests.ReqTypeID "; $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID "; - $q.= "ORDER BY Status ASC, RequestTS DESC "; + $q.= "ORDER BY Open DESC, RequestTS DESC "; $q.= "LIMIT " . $limit . " OFFSET " . $offset; return $dbh->query($q)->fetchAll(); @@ -164,7 +164,14 @@ function pkgreq_close($id, $reason, $comments) { global $AUR_LOCATION; global $AUR_REQUEST_ML; - if ($reason != 'accepted' && $reason != 'rejected') { + switch ($reason) { + case 'accepted': + $status = 2; + break; + case 'rejected': + $status = 3; + break; + default: return array(false, __("Invalid reason.")); } @@ -175,7 +182,8 @@ function pkgreq_close($id, $reason, $comments) { return array(false, __("Only TUs and developers can close requests.")); } - $q = "UPDATE PackageRequests SET Status = 1 WHERE ID = " . intval($id); + $q = "UPDATE PackageRequests SET Status = " . intval($status) . " "; + $q.= "WHERE ID = " . intval($id); $dbh->exec($q); /* diff --git a/web/template/pkgreq_results.php b/web/template/pkgreq_results.php index b5e1177b..261a1f7d 100644 --- a/web/template/pkgreq_results.php +++ b/web/template/pkgreq_results.php @@ -45,8 +45,8 @@ <td> <a href="<?= get_uri('/account/') . htmlspecialchars($row['User'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['User'])) ?>"><?= htmlspecialchars($row['User']) ?></a> </td> - <td<?php if ($row['Status'] == 0 && time() - intval($row['RequestTS']) > $REQUEST_IDLE_TIME): ?> class="flagged"<?php endif; ?>><?= gmdate("Y-m-d H:i", intval($row['RequestTS'])) ?></td> - <?php if ($row['Status'] == 0): ?> + <td<?php if ($row['Open'] && time() - intval($row['RequestTS']) > $REQUEST_IDLE_TIME): ?> class="flagged"<?php endif; ?>><?= gmdate("Y-m-d H:i", intval($row['RequestTS'])) ?></td> + <?php if ($row['Open']): ?> <td> <?php if ($row['BaseID']): ?> <?php if ($row['Type'] == 'deletion'): ?> @@ -66,7 +66,15 @@ <a href="<?= get_pkgreq_route() . '/' . intval($row['ID']) ?>/close/"><?= __('Close') ?></a> </td> <?php else: ?> + <?php if ($row['Status'] == 1): ?> <td><?= __("Closed") ?></td> + <?php elseif ($row['Status'] == 2): ?> + <td><?= __("Accepted") ?></td> + <?php elseif ($row['Status'] == 3): ?> + <td><?= __("Rejected") ?></td> + <?php else: ?> + <td><?= __("unknown") ?></td> + <?php endif; ?> <?php endif; ?> </tr> <?php endwhile; ?> |