mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Added vote button to detail page (bug#2638)
X's only show up if user can delete comment
This commit is contained in:
parent
90eadf0252
commit
ed17d0f69e
2 changed files with 34 additions and 8 deletions
|
@ -372,7 +372,11 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
print "</p>\n";
|
print "</p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_REQUEST["ID"])) {
|
||||||
|
pkgdetails_link($_REQUEST["ID"]);
|
||||||
|
} else {
|
||||||
pkgsearch_results_link();
|
pkgsearch_results_link();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +429,11 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
print "</p>\n";
|
print "</p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_REQUEST["ID"])) {
|
||||||
|
pkgdetails_link($_REQUEST["ID"]);
|
||||||
|
} else {
|
||||||
pkgsearch_results_link();
|
pkgsearch_results_link();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,10 +444,11 @@ if (isset($_REQUEST["do_Flag"])) {
|
||||||
print __("Error trying to retrieve package details.")."<br />\n";
|
print __("Error trying to retrieve package details.")."<br />\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
package_details($_REQUEST["ID"]);
|
package_details($_REQUEST["ID"], $_COOKIE["AURSID"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br />\n";
|
print "<br />\n";
|
||||||
|
# FIXME: If someone hits the detail page's vote button, this link dies
|
||||||
pkgsearch_results_link();
|
pkgsearch_results_link();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ function pkgvotes_from_sid($sid="") {
|
||||||
|
|
||||||
# display package details
|
# display package details
|
||||||
#
|
#
|
||||||
function package_details($id=0) {
|
function package_details($id=0, $SID="") {
|
||||||
global $_REQUEST;
|
global $_REQUEST;
|
||||||
global $pkgsearch_vars;
|
global $pkgsearch_vars;
|
||||||
$q = "SELECT Packages.*,Location,Category ";
|
$q = "SELECT Packages.*,Location,Category ";
|
||||||
|
@ -392,10 +392,12 @@ function package_details($id=0) {
|
||||||
print " <td valign='top' style='padding-right: 10' colspan='2'>";
|
print " <td valign='top' style='padding-right: 10' colspan='2'>";
|
||||||
print "<table class='boxSoft' width='100%'>";
|
print "<table class='boxSoft' width='100%'>";
|
||||||
print "<tr><td class='boxSoftTitle'><span class='f3'>";
|
print "<tr><td class='boxSoftTitle'><span class='f3'>";
|
||||||
|
if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) {
|
||||||
$durl = "<a href='/pkgedit.php?del_Comment=1";
|
$durl = "<a href='/pkgedit.php?del_Comment=1";
|
||||||
$durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"];
|
$durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"];
|
||||||
$durl.= "'><img src='/images/x.png' border='0'";
|
$durl.= "'><img src='/images/x.png' border='0'";
|
||||||
$durl.= " alt=\"".__("Delete comment")."\"></a>";
|
$durl.= " alt=\"".__("Delete comment")."\"></a>";
|
||||||
|
}
|
||||||
print $durl . " ";
|
print $durl . " ";
|
||||||
print __("Comment by: %h%s%h on %h%s%h",
|
print __("Comment by: %h%s%h on %h%s%h",
|
||||||
array("<b>",$carr["UserName"],"</b>",
|
array("<b>",$carr["UserName"],"</b>",
|
||||||
|
@ -423,6 +425,21 @@ function package_details($id=0) {
|
||||||
print __("Add Comment")."\">";
|
print __("Add Comment")."\">";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
print " </td>";
|
print " </td>";
|
||||||
|
if ($SID) {
|
||||||
|
print "<td><form action='/packages.php' method='post'>\n";
|
||||||
|
print "<input type='hidden' name='IDs[".$row["ID"]."]' value='1'>\n";
|
||||||
|
print "<input type='hidden' name='ID' value='".$row["ID"]."'>\n";
|
||||||
|
$q = "SELECT * FROM PackageVotes WHERE UsersID = ".uid_from_sid($SID);
|
||||||
|
$q.= " AND PackageID = ".$row["ID"];
|
||||||
|
if (!mysql_num_rows(db_query($q, $dbh))) {
|
||||||
|
print "<input type='submit' class='button' name='do_Vote'";
|
||||||
|
print " value='".__("Vote")."'>";
|
||||||
|
} else {
|
||||||
|
print "<input type='submit' class='button' name='do_UnVote'";
|
||||||
|
print " value='".__("Un-Vote")."'>";
|
||||||
|
}
|
||||||
|
print "</form></td>\n";
|
||||||
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue