From 4b80bc34ffb738ef3cd1a7944e8716d3e8140565 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 28 Jun 2004 19:37:02 +0000 Subject: re-working pkgsearch, NumVotes add to Packages table --- web/html/index.php | 7 ++- web/html/pkgmgmnt.php | 8 ++-- web/html/pkgsearch.php | 116 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 104 insertions(+), 27 deletions(-) (limited to 'web/html') diff --git a/web/html/index.php b/web/html/index.php index 67ff657..64a1c2f 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -25,11 +25,14 @@ if (isset($_REQUEST["user"]) || isset($_REQUEST["pass"])) { $q.= "AND Passwd = '" . mysql_escape_string($_REQUEST["pass"]) . "'"; $result = db_query($q, $dbh); if (!$result) { - $login_error = __("Incorrect password for username, %s.", + $login_error = __("Error looking up username, %s.", array($_REQUEST["user"])); } else { $row = mysql_fetch_row($result); - if ($row[1]) { + if (empty($row)) { + $login_error = __("Incorrect password for username, %s.", + array($_REQUEST["user"])); + } elseif ($row[1]) { $login_error = __("Your account has been suspended."); } } diff --git a/web/html/pkgmgmnt.php b/web/html/pkgmgmnt.php index 5544016..98c8400 100644 --- a/web/html/pkgmgmnt.php +++ b/web/html/pkgmgmnt.php @@ -6,10 +6,12 @@ check_sid(); # see if they're still logged in html_header(); # print out the HTML header -# Any text you print out to the visitor, use the __() function -# for i18n support. See 'testpo.php' for more details. +# vistor has requested package management for a specific package +# +print __("Manage package ID: %s", array($_REQUEST["ID"])) . "
\n"; + +# NOTE: managing an orphaned package will automatically force adoption # -print __("Under construction...")."
\n"; html_footer("\$Id$"); diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php index 9d4521c..64d229b 100644 --- a/web/html/pkgsearch.php +++ b/web/html/pkgsearch.php @@ -6,14 +6,6 @@ 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 -# TODO Maybe pkgsearch, pkgvote can be consolidated? This script can -# provide a search form. In the results, it can contain a checkbox -# for 'flag out of date', 'vote', 'details' link, and a link to 'pkgmgmnt'. -# -# the results page should have columns for, -# pkg name/ver, location, maintainer, description, O-O-D, Vote, details, mgmnt -# - # get login privileges # @@ -25,30 +17,110 @@ if (isset($_COOKIE["AURSID"])) { $atype = ""; } +# grab the list of Package IDs to be operated on +# +isset($_REQUEST["IDs"]) ? $ids = $_REQUEST["IDs"] : $ids = array(); + + +# determine what button the visitor clicked +# +if (isset($_REQUEST["do_Flag"])) { + if (!$atype) { + print __("You must be logged in before you can flag packages."); + print "
\n"; + + } else { + # Flag the packages in $ids array, and unflag any other + # packages listed in $_REQUEST["All_IDs"] + # + 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"], $_REQUEST["L"], $_REQUEST["C"], + $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], + $_REQUEST["PP"]); + } + + +} elseif (isset($_REQUEST["do_Disown"])) { + if ($atype != "User" && $atype != "") { + print __("You do not have access to disown packages."); + print "
\n"; + + } else { + # Disown the packages in $ids array + # + 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"], $_REQUEST["L"], $_REQUEST["C"], + $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], + $_REQUEST["PP"]); + } -if ($atype && $_REQUEST["Action"] == "Something") { - # do something based on what the user specifies - # -} elseif ($atype && $_REQUEST["Action"] == "SomethingElse") { - # do something else based on what the user specifies +} elseif (isset($_REQUEST["do_Adopt"])) { + if ($atype != "User" && $atype != "") { + print __("You do not have access to adopt packages."); + print "
\n"; + + } else { + # Adopt the packages in $ids array + # + 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"], $_REQUEST["L"], $_REQUEST["C"], + $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], + $_REQUEST["PP"]); + } + + +} elseif (isset($_REQUEST["do_Vote"])) { + if (!$atype) { + print __("You must be logged in before you can vote for packages."); + print "
\n"; + + } else { + # vote on the packages in $ids array. 'unvote' for any packages + # listed in the $_REQUEST["All_IDs"] array. + # + print "adopting
\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"], $_REQUEST["L"], $_REQUEST["C"], + $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], + $_REQUEST["PP"]); + } + + +} elseif (isset($_REQUEST["do_Details"])) { + # give a link to 'manage', and another to return to search + # results. # + print "details for package
\n"; + -} elseif ($_REQUEST["Action"] == "SearchPkgs") { - # the visitor has requested search options and/or hit the less/more button +} else { + # do_More/do_Less/do_Search/do_MyPackages - just do a search # pkg_search_page($_COOKIE["AURSID"], $_REQUEST["L"], $_REQUEST["C"], $_REQUEST["K"], $_REQUEST["SB"], $_REQUEST["M"], $_REQUEST["O"], $_REQUEST["PP"]); -} else { - # do the default thing - give the user a search form that they - # can specify: location, category, maintainer, name, 'my pkgs' - # and display a list of packages based on no search options. - # - pkg_search_page($_COOKIE["AURSID"]); } - html_footer("\$Id$"); ?> -- cgit v1.2.3-70-g09d2