summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/html/css/aur.css30
-rw-r--r--web/html/pkgbase.php8
-rw-r--r--web/lib/pkgbasefuncs.inc.php26
-rw-r--r--web/lib/routing.inc.php6
-rw-r--r--web/template/pkgreq_results.php18
5 files changed, 71 insertions, 17 deletions
diff --git a/web/html/css/aur.css b/web/html/css/aur.css
index 78fd4ce8..cbebb306 100644
--- a/web/html/css/aur.css
+++ b/web/html/css/aur.css
@@ -24,20 +24,6 @@
padding: 0;
}
-#actionlist .text-button {
- color: #07b;
- background: none;
- border: none;
- padding: 0;
- cursor: pointer;
- font-size: 100%;
-}
-
-#actionlist .text-button:hover {
- text-decoration: underline;
- color: #666;
-}
-
.arch-bio-entry ul {
list-style: none;
padding: 0;
@@ -61,3 +47,19 @@
#pkg-updates td.pkg-date {
text-align:right;
}
+
+.text-button {
+ background: transparent;
+ border: none !important;
+ margin: 0 !important;
+ padding: 0 !important;
+ font: normal 100% sans-serif;
+ text-decoration: none;
+ color: #07b;
+ cursor: pointer;
+}
+
+.text-button:hover {
+ text-decoration: underline;
+ color: #666;
+}
diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php
index dd099774..9047f5b8 100644
--- a/web/html/pkgbase.php
+++ b/web/html/pkgbase.php
@@ -96,6 +96,8 @@ if (check_token()) {
list($ret, $output) = pkgbase_change_category($base_id, $atype);
} elseif (current_action("do_FileRequest")) {
list($ret, $output) = pkgbase_file_request($ids, $_POST['type'], $_POST['comments']);
+ } elseif (current_action("do_CloseRequest")) {
+ list($ret, $output) = pkgbase_close_request($_POST['reqid']);
}
if (isset($_REQUEST['comment'])) {
@@ -105,7 +107,11 @@ if (check_token()) {
}
if ($ret) {
- if (isset($base_id)) {
+ if (current_action("do_CloseRequest")) {
+ /* Redirect back to package request page on success. */
+ header('Location: ' . get_pkgreq_route());
+ exit();
+ } if (isset($base_id)) {
/* Redirect back to package base page on success. */
header('Location: ' . get_pkgbase_uri($pkgbase_name));
exit();
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 505bb511..a039f836 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -975,10 +975,12 @@ function pkgbase_request_list() {
$q.= "PackageRequests.PackageBaseID AS BaseID, ";
$q.= "PackageRequests.PackageBaseName AS Name, ";
$q.= "RequestTypes.Name AS Type, PackageRequests.Comments, ";
- $q.= "Users.Username AS User, PackageRequests.RequestTS ";
+ $q.= "Users.Username AS User, PackageRequests.RequestTS, ";
+ $q.= "PackageRequests.Status ";
$q.= "FROM PackageRequests INNER JOIN RequestTypes ON ";
$q.= "RequestTypes.ID = PackageRequests.ReqTypeID ";
- $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID";
+ $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID ";
+ $q.= "ORDER BY Status ASC, RequestTS DESC";
return $dbh->query($q)->fetchAll();
}
@@ -1070,3 +1072,23 @@ function pkgbase_file_request($ids, $type, $comments) {
return array(true, __("Added request successfully."));
}
+
+/**
+ * Close a deletion/orphan request
+ *
+ * @param int $id The package request to close
+ *
+ * @return void
+ */
+function pkgbase_close_request($id) {
+ $dbh = DB::connect();
+
+ if (!check_user_privileges()) {
+ return array(false, __("Only TUs and developers can close requests."));
+ }
+
+ $q = "UPDATE PackageRequests SET Status = 1 WHERE ID = " . intval($id);
+ $dbh->exec($q);
+
+ return array(true, __("Request closed successfully."));
+}
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php
index 5836a137..2fa3e1f7 100644
--- a/web/lib/routing.inc.php
+++ b/web/lib/routing.inc.php
@@ -21,6 +21,7 @@ $ROUTES = array(
$PKG_PATH = '/packages';
$PKGBASE_PATH = '/pkgbase';
+$PKGREQ_PATH = '/requests';
$USER_PATH = '/account';
function get_route($path) {
@@ -55,6 +56,11 @@ function get_pkgbase_route() {
return $PKGBASE_PATH;
}
+function get_pkgreq_route() {
+ global $PKGREQ_PATH;
+ return $PKGREQ_PATH;
+}
+
function get_pkg_uri($pkgname) {
global $USE_VIRTUAL_URLS;
global $PKG_PATH;
diff --git a/web/template/pkgreq_results.php b/web/template/pkgreq_results.php
index 7cbdcc4b..33195c71 100644
--- a/web/template/pkgreq_results.php
+++ b/web/template/pkgreq_results.php
@@ -24,6 +24,7 @@
<th><?= __("Comments") ?></th>
<th><?= __("Filed by") ?></th>
<th><?= __("Date") ?></th>
+ <th><?= __("Status") ?></th>
</tr>
</thead>
<tbody>
@@ -41,6 +42,23 @@
<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><?= gmdate("Y-m-d H:i", intval($row['RequestTS'])) ?></td>
+ <?php if ($row['Status'] == 0): ?>
+ <td>
+ <form action="<?= get_uri('/pkgbase/'); ?>" method="post">
+ <fieldset>
+ <input type="hidden" name="IDs[<?= $row['BaseID'] ?>]" value="1" />
+ <input type="hidden" name="ID" value="<?= $row['BaseID'] ?>" />
+ <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
+ <input type="hidden" name="reqid" value="<?= $row['ID'] ?>" />
+ <div>
+ <input type="submit" class="button text-button" name="do_CloseRequest" value="<?= __("Close") ?>" />
+ </div>
+ </fieldset>
+ </form>
+ </td>
+ <?php else: ?>
+ <td><?= __("Closed") ?></td>
+ <?php endif; ?>
</tr>
<?php endwhile; ?>