mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Move package actions to package bases
Package actions now operate on package bases instead of packages. Move all actions to the correct locations. This also fixes some issues with comment notifications. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
c1c77836a8
commit
f461344211
11 changed files with 175 additions and 171 deletions
|
@ -1,6 +1,6 @@
|
|||
<div id="generic-form" class="box">
|
||||
<h2><?= __("Add Comment"); ?></h2>
|
||||
<form action="<?= get_pkg_uri($row['Name']) ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($pkgbase_name) ?>" method="post">
|
||||
<fieldset>
|
||||
<?php
|
||||
if (isset($_REQUEST['comment']) && check_token()) {
|
||||
|
@ -8,7 +8,7 @@ if (isset($_REQUEST['comment']) && check_token()) {
|
|||
}
|
||||
?>
|
||||
<div>
|
||||
<input type="hidden" name="ID" value="<?= intval($row['ID']) ?>" />
|
||||
<input type="hidden" name="ID" value="<?= intval($base_id) ?>" />
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
</div>
|
||||
<p>
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
$uid = uid_from_sid($SID);
|
||||
$base_id = pkgbase_from_pkgid($row['ID']);
|
||||
$count = package_comments_count($base_id);
|
||||
$pkgname = $row['Name'];
|
||||
?>
|
||||
<div id="news">
|
||||
<h3>
|
||||
<a href="<?= htmlentities(get_pkg_uri($pkgname), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments' , $count) ?>"><?= __('Latest Comments') ?></a>
|
||||
<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments' , $count) ?>"><?= __('Latest Comments') ?></a>
|
||||
<span class="arrow"></span>
|
||||
</h3>
|
||||
|
||||
|
@ -16,7 +15,7 @@ $pkgname = $row['Name'];
|
|||
endif; ?>
|
||||
<h4>
|
||||
<?php if (canDeleteCommentArray($row, $atype, $uid)): ?>
|
||||
<form method="post" action="<?= htmlspecialchars(get_pkg_uri($pkgname), ENT_QUOTES); ?>">
|
||||
<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
|
||||
<fieldset style="display:inline;">
|
||||
<input type="hidden" name="action" value="do_DeleteComment" />
|
||||
<input type="hidden" name="comment_id" value="<?= $row['ID'] ?>" />
|
||||
|
@ -49,7 +48,7 @@ $pkgname = $row['Name'];
|
|||
<?php if ($count > 10 && !isset($_GET['comments'])): ?>
|
||||
<div id="news">
|
||||
<h3>
|
||||
<a href="<?= htmlentities(get_pkg_uri($pkgname), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
|
||||
<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
|
||||
</h3>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -20,7 +20,7 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($r
|
|||
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
|
||||
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
|
||||
|
||||
$urlpath = URL_DIR . substr($row['Name'], 0, 2) . "/" . $row['Name'];
|
||||
$urlpath = URL_DIR . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
|
||||
|
||||
$deps = package_dependencies($row["ID"]);
|
||||
$requiredby = package_required($row["Name"]);
|
||||
|
@ -35,12 +35,12 @@ $sources = package_sources($row["ID"]);
|
|||
<h4><?= __('Package Actions') ?></h4>
|
||||
<ul class="small">
|
||||
<li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
|
||||
<li><a href="<?= $urlpath . '/' . $row['Name'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
|
||||
<li><a href="<?= $urlpath . '/' . $row['BaseName'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
|
||||
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
|
||||
<?php if ($USE_VIRTUAL_URLS && $uid): ?>
|
||||
<?php if ($row["OutOfDateTS"] === NULL): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'flag/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'flag/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
|
||||
</form>
|
||||
|
@ -48,7 +48,7 @@ $sources = package_sources($row["ID"]);
|
|||
<?php elseif (($row["OutOfDateTS"] !== NULL) &&
|
||||
($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'unflag/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unflag/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
|
||||
</form>
|
||||
|
@ -56,14 +56,14 @@ $sources = package_sources($row["ID"]);
|
|||
<?php endif; ?>
|
||||
<?php if (user_voted($uid, $row['ID'])): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'unvote/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unvote/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
|
||||
</form>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'vote/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'vote/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
|
||||
</form>
|
||||
|
@ -71,28 +71,28 @@ $sources = package_sources($row["ID"]);
|
|||
<?php endif; ?>
|
||||
<?php if (user_notify($uid, $row['ID'])): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'unnotify/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unnotify/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
|
||||
</form>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'notify/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'notify/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
|
||||
</form>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
|
||||
<li><a href="<?= get_pkg_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
|
||||
<li><a href="<?= get_pkg_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
|
||||
<li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
|
||||
<li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($uid && $row["MaintainerUID"] === NULL): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'adopt/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'adopt/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
|
||||
</form>
|
||||
|
@ -100,7 +100,7 @@ $sources = package_sources($row["ID"]);
|
|||
<?php elseif ($uid && $uid == $row["MaintainerUID"] ||
|
||||
$atype == "Trusted User" || $atype == "Developer"): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($row['Name']) . 'disown/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'disown/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
|
||||
</form>
|
||||
|
@ -130,7 +130,7 @@ if ($SID && ($uid == $row["MaintainerUID"] ||
|
|||
($atype == "Developer" || $atype == "Trusted User"))):
|
||||
?>
|
||||
<td>
|
||||
<form method="post" action="<?= htmlspecialchars(get_pkg_uri($row['Name']), ENT_QUOTES); ?>">
|
||||
<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['BaseName']), ENT_QUOTES); ?>">
|
||||
<div>
|
||||
<input type="hidden" name="action" value="do_ChangeCategory" />
|
||||
<?php if ($SID): ?>
|
||||
|
@ -196,9 +196,9 @@ if ($row["MaintainerUID"]):
|
|||
<th><?= __('Votes') . ': ' ?></th>
|
||||
<?php if ($atype == "Developer" || $atype == "Trusted User"): ?>
|
||||
<?php if ($USE_VIRTUAL_URLS): ?>
|
||||
<td><a href="<?= get_pkg_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
|
||||
<td><a href="<?= get_pkgbase_uri($row['BaseName']); ?>voters/"><?= $votes ?></a></td>
|
||||
<?php else: ?>
|
||||
<td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['Name'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
|
||||
<td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['BaseName'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<td><?= $votes ?></td>
|
||||
|
|
|
@ -28,7 +28,7 @@ if (!$result): ?>
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<form id="pkglist-results-form" method="post" action="<?= get_uri('/packages/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
|
||||
<form id="pkglist-results-form" method="post" action="<?= get_uri('/pkgbase/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
|
||||
<table class="results">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -52,7 +52,7 @@ if (!$result): ?>
|
|||
<?php while (list($indx, $row) = each($searchresults)): ?>
|
||||
<tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>">
|
||||
<?php if ($SID): ?>
|
||||
<td><input type="checkbox" name="IDs[<?= $row["ID"] ?>]" value="1" /></td>
|
||||
<td><input type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td>
|
||||
<?php endif; ?>
|
||||
<td><?= htmlspecialchars($row["Category"]) ?></td>
|
||||
<td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
|
||||
|
|
|
@ -30,12 +30,12 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<h4><?= __('Package Actions') ?></h4>
|
||||
<ul class="small">
|
||||
<li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
|
||||
<li><a href="<?= $urlpath . '/' . $pkgs[0] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
|
||||
<li><a href="<?= $urlpath . '/' . $row['Name'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
|
||||
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
|
||||
<?php if ($USE_VIRTUAL_URLS && $uid): ?>
|
||||
<?php if ($row["OutOfDateTS"] === NULL): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'flag/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'flag/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
|
||||
</form>
|
||||
|
@ -43,7 +43,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<?php elseif (($row["OutOfDateTS"] !== NULL) &&
|
||||
($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'unflag/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'unflag/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
|
||||
</form>
|
||||
|
@ -51,14 +51,14 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<?php endif; ?>
|
||||
<?php if (user_voted($uid, $row['ID'])): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'unvote/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
|
||||
</form>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'vote/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'vote/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
|
||||
</form>
|
||||
|
@ -66,28 +66,28 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<?php endif; ?>
|
||||
<?php if (user_notify($uid, $row['ID'])): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'unnotify/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
|
||||
</form>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'notify/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'notify/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
|
||||
</form>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
|
||||
<li><a href="<?= get_pkg_uri($pkgs[0]) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
|
||||
<li><a href="<?= get_pkg_uri($pkgs[0]) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
|
||||
<li><a href="<?= get_pkgbase_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
|
||||
<li><a href="<?= get_pkgbase_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($uid && $row["MaintainerUID"] === NULL): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'adopt/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'adopt/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
|
||||
</form>
|
||||
|
@ -95,7 +95,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<?php elseif ($uid && $uid == $row["MaintainerUID"] ||
|
||||
$atype == "Trusted User" || $atype == "Developer"): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkg_uri($pkgs[0]) . 'disown/'; ?>" method="post">
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'disown/'; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
|
||||
</form>
|
||||
|
@ -113,7 +113,7 @@ if ($SID && ($uid == $row["MaintainerUID"] ||
|
|||
($atype == "Developer" || $atype == "Trusted User"))):
|
||||
?>
|
||||
<td>
|
||||
<form method="post" action="<?= htmlspecialchars(get_pkg_uri($row['Name']), ENT_QUOTES); ?>">
|
||||
<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
|
||||
<div>
|
||||
<input type="hidden" name="action" value="do_ChangeCategory" />
|
||||
<?php if ($SID): ?>
|
||||
|
@ -175,7 +175,7 @@ if ($row["MaintainerUID"]):
|
|||
<th><?= __('Votes') . ': ' ?></th>
|
||||
<?php if ($atype == "Developer" || $atype == "Trusted User"): ?>
|
||||
<?php if ($USE_VIRTUAL_URLS): ?>
|
||||
<td><a href="<?= get_pkg_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
|
||||
<td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
|
||||
<?php else: ?>
|
||||
<td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['Name'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue