From ed17d0f69e3f8f88ed8f23ad12543022636fd87a Mon Sep 17 00:00:00 2001 From: simo Date: Fri, 6 May 2005 03:58:26 +0000 Subject: Added vote button to detail page (bug#2638) X's only show up if user can delete comment --- web/html/packages.php | 15 ++++++++++++--- web/lib/pkgfuncs.inc | 27 ++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 8 deletions(-) (limited to 'web') diff --git a/web/html/packages.php b/web/html/packages.php index 210f135..604ba72 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -372,7 +372,11 @@ if (isset($_REQUEST["do_Flag"])) { print "

\n"; } - pkgsearch_results_link(); + if (isset($_REQUEST["ID"])) { + pkgdetails_link($_REQUEST["ID"]); + } else { + pkgsearch_results_link(); + } } @@ -425,7 +429,11 @@ if (isset($_REQUEST["do_Flag"])) { print "

\n"; } - pkgsearch_results_link(); + if (isset($_REQUEST["ID"])) { + pkgdetails_link($_REQUEST["ID"]); + } else { + pkgsearch_results_link(); + } } @@ -436,10 +444,11 @@ if (isset($_REQUEST["do_Flag"])) { print __("Error trying to retrieve package details.")."
\n"; } else { - package_details($_REQUEST["ID"]); + package_details($_REQUEST["ID"], $_COOKIE["AURSID"]); } print "
\n"; + # FIXME: If someone hits the detail page's vote button, this link dies pkgsearch_results_link(); diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index dd168da..b0e570f 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -246,7 +246,7 @@ function pkgvotes_from_sid($sid="") { # display package details # -function package_details($id=0) { +function package_details($id=0, $SID="") { global $_REQUEST; global $pkgsearch_vars; $q = "SELECT Packages.*,Location,Category "; @@ -392,10 +392,12 @@ function package_details($id=0) { print " "; print ""; print ""; + if ($SID) { + print "\n"; + } print "\n"; print "
"; - $durl = ""; + if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) { + $durl = ""; + } print $durl . "  "; print __("Comment by: %h%s%h on %h%s%h", array("",$carr["UserName"],"", @@ -423,6 +425,21 @@ function package_details($id=0) { print __("Add Comment")."\">"; print "\n"; print "
\n"; + print "\n"; + print "\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 ""; + } else { + print ""; + } + print "
\n"; -- cgit v1.2.3-70-g09d2