From edabcc0bebc12755280d2f309b694e3c3969c5e0 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 30 Jun 2004 12:41:38 +0000 Subject: slow going - work has been insane --- web/html/images/pad.gif | Bin 0 -> 43 bytes web/html/pkgsearch.php | 65 ++++++++++++++++++++---------------- web/lib/pkgfuncs.inc | 87 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 115 insertions(+), 37 deletions(-) create mode 100644 web/html/images/pad.gif (limited to 'web') diff --git a/web/html/images/pad.gif b/web/html/images/pad.gif new file mode 100644 index 0000000..7761b86 Binary files /dev/null and b/web/html/images/pad.gif differ diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php index 9ab00ca..3d78c33 100644 --- a/web/html/pkgsearch.php +++ b/web/html/pkgsearch.php @@ -5,7 +5,24 @@ include("search_po.inc"); # use some form of this for i18n support set_lang(); # this sets up the visitor's language check_sid(); # see if they're still logged in html_header(); # print out the HTML header + +# define variables used during pkgsearch +# +$pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP"); + +function pkgsearch_results_link() { + global $pkgsearch_vars; + + print "Go back to search results.
\n"; + return; +} + # get login privileges # @@ -35,18 +52,14 @@ if (isset($_REQUEST["do_Flag"])) { # print "flagging
\n"; - # After flagging, show the search page again (or maybe print out - # a message and give the user a link to resume where they were - # in the search - # - pkg_search_page($_COOKIE["AURSID"]); + pkgsearch_results_link(); } } elseif (isset($_REQUEST["do_Disown"])) { - if ($atype == "User" || $atype == "") { - print __("You do not have access to disown packages."); + if (!$atype) { + print __("You must be logged in before you can disown packages."); print "
\n"; } else { @@ -54,18 +67,14 @@ if (isset($_REQUEST["do_Flag"])) { # print "disowning
\n"; - # After disowning, show the search page again (or maybe print out - # a message and give the user a link to resume where they were - # in the search - # - pkg_search_page($_COOKIE["AURSID"]); + pkgsearch_results_link(); } } elseif (isset($_REQUEST["do_Adopt"])) { - if ($atype == "User" || $atype == "") { - print __("You do not have access to adopt packages."); + if (!$atype) { + print __("You must be logged in before you can adopt packages."); print "
\n"; } else { @@ -73,11 +82,7 @@ if (isset($_REQUEST["do_Flag"])) { # print "adopting
\n"; - # After adopting, show the search page again (or maybe print out - # a message and give the user a link to resume where they were - # in the search - # - pkg_search_page($_COOKIE["AURSID"]); + pkgsearch_results_link(); } @@ -93,20 +98,24 @@ if (isset($_REQUEST["do_Flag"])) { # print "voting
\n"; - # After voting, show the search page again (or maybe print out - # a message and give the user a link to resume where they were - # in the search - # - pkg_search_page($_COOKIE["AURSID"]); + pkgsearch_results_link(); } } elseif (isset($_REQUEST["do_Details"])) { - # give a link to 'manage', and another to return to search - # results. - # - print "details for package
\n"; + + if (!isset($_REQUEST["ID"]) || !intval($_REQUEST["ID"])) { + print __("Error trying to retrieve package details.")."
\n"; + + } else { + + } + + print "
\n"; + pkgsearch_results_link(); + print "\n"; + print "
\n"; } else { diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 2b6dd2b..8894d3c 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -33,10 +33,56 @@ function pkgLocations() { return $locs; } +# display package details +# +function package_details($id=0) { + $q = "SELECT * FROM Packages WHERE ID = ".intval($_REQUEST["ID"]); + $dbh = db_connect(); + $results = db_query($q, $dbh); + if (!$results) { + print __("Error retrieving package details.")."
\n"; + + } else { + $row = mysql_fetch_assoc($results); + if (empty($row)) { + print __("Package details could not be found.")."
\n"; + + } else { + + # print out package details + # + print "
\n"; + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + + print "
"; + print "Package Details
\n"; + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + + print "
NAME
\n"; + print "
\n"; + print "
\n"; + } + } + return; +} + + # display the search form in a boxSoft style # function pkg_search_page($SID="") { global $_REQUEST; + global $pkgsearch_vars; # SID: session id cookie $locs = pkgLocations(); @@ -215,12 +261,17 @@ function pkg_search_page($SID="") { } } if (isset($_REQUEST["do_MyPackages"]) && $SID) { + # list packages that the user is a AUR Maintainer of, or if it the + # vistior is a registered user, if they are the Maintainer. + # if ($myuid) { if (!$has_where) { - $q.= "WHERE MaintainerUID = ".$myuid." "; + $q.= "WHERE (AURMaintainerUID = ".$myuid." OR "; + $q.= "MaintainerUID = " . $myuid.") "; $has_where = 1; } else { - $q.= "AND MaintainerUID = ".$myuid." "; + $q.= "AND (AURMaintainerUID = ".$myuid." OR "; + $q.= "MaintainerUID = " . $myuid.") "; } } } @@ -241,6 +292,9 @@ function pkg_search_page($SID="") { } $q.= "LIMIT ".$O.", ".$PP; print $q."
\n"; + print "
\n";
+	print_r($_REQUEST);
+	print "
\n"; $result = db_query($q, $dbh); if (!$result) { @@ -345,8 +399,18 @@ function pkg_search_page($SID="") { print " "; print $cats[$row["CategoryID"]]."\n"; print " "; - $details_url = "".$row["Name"]; + $details_url = "".$row["Name"]; $details_url.= "-".$row["Version"].""; print $details_url."\n"; print " "; @@ -355,16 +419,21 @@ function pkg_search_page($SID="") { print $row["Description"]."\n"; print " "; $not_managed = 0; - if (isset($devs[$row["MaintainerUID"]])) { - print $devs[$row["MaintainerUID"]]["Username"]; - } elseif (isset($tus[$row["MaintainerUID"]])) { - print $tus[$row["MaintainerUID"]]["Username"]; + if (isset($devs[$row["AURMaintainerUID"]])) { + print $devs[$row["AURMaintainerUID"]]["Username"]; + } elseif (isset($tus[$row["AURMaintainerUID"]])) { + print $tus[$row["AURMaintainerUID"]]["Username"]; } else { print "None"; $not_managed = 1; } print "\n"; - if ($myuid == $row["MaintainerUID"] || $not_managed) { + if ($myuid == $row["AURMaintainerUID"] || $not_managed || + ($myuid == $row["MaintainerUID"] && $not_managed)) { + # Only allow TUs/Devs to manage packages, or if it is a regular + # user and the package has not been adopted by a TU/Dev, then the + # regular user (most likely the submitter) can manage it. + # $manage_url = "Manage"; print " "; -- cgit v1.2.3-54-g00ecf