From d4b07f2b334dada626e4743951cdd6adab87f62e Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sat, 12 Jan 2008 18:18:43 +0900 Subject: Tweaks of various page layouts and handling of data This is a patch that fixes a lot of little things: * We no longer have pkgsearch or pkgdetails link functions and all references to them are gone, that's what a back button is for and if we really need it we can come up with something better * No longer have do_Details variable, this means links on the package search are simply ?ID=foo * On the pkgdetails pages when there are either no deps, deps by, sources or comments for a package the list for each will display "None" instead of nothing at all (ruining the layout) * Fixed a bug where if a package had no sources or no deps pkgsubmit.php would submit an empty one * Translation of the word "Search'" has been changed to "Search" Most of these relate to each other. Signed-off-by: Callan Barrett --- web/html/packages.php | 30 +-- web/html/pkgedit.php | 11 +- web/html/pkgsubmit.php | 28 ++- web/lang/ca/acctfuncs_po.inc | 2 +- web/lang/de/acctfuncs_po.inc | 2 +- web/lang/en/acctfuncs_po.inc | 2 +- web/lang/es/acctfuncs_po.inc | 2 +- web/lang/fr/acctfuncs_po.inc | 2 +- web/lang/it/acctfuncs_po.inc | 2 +- web/lang/pl/acctfuncs_po.inc | 2 +- web/lang/pt/acctfuncs_po.inc | 2 +- web/lang/ru/acctfuncs_po.inc | 2 +- web/lib/pkgfuncs.inc | 343 ++++++++++++++++------------------ web/template/header.php | 2 +- web/template/search_accounts_form.php | 2 +- 15 files changed, 189 insertions(+), 245 deletions(-) diff --git a/web/html/packages.php b/web/html/packages.php index 9deff6a..bc398ee 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -92,9 +92,6 @@ if (isset($_REQUEST["do_Flag"])) { print __("You did not select any packages to flag."); print "

\n"; } - - pkgsearch_results_link(); - } } elseif (isset($_REQUEST["do_UnFlag"])) { @@ -131,7 +128,6 @@ if (isset($_REQUEST["do_Flag"])) { print "

\n"; } - pkgsearch_results_link(); } @@ -187,7 +183,6 @@ if (isset($_REQUEST["do_Flag"])) { print "

\n"; } - pkgsearch_results_link(); } @@ -295,7 +290,6 @@ if (isset($_REQUEST["do_Flag"])) { print __("You did not select any packages to delete."); print "

\n"; } # end if (!empty($ids)) - pkgsearch_results_link(); } # end if (!atype) } elseif (isset($_REQUEST["do_Adopt"])) { @@ -353,9 +347,6 @@ if (isset($_REQUEST["do_Flag"])) { print __("You did not select any packages to adopt."); print "

\n"; } - - pkgsearch_results_link(); - } @@ -414,13 +405,6 @@ if (isset($_REQUEST["do_Flag"])) { print __("You did not select any packages to vote for."); print "

\n"; } - - if (isset($_REQUEST["ID"])) { - pkgdetails_link($_REQUEST["ID"]); - } else { - pkgsearch_results_link(); - } - } @@ -471,28 +455,19 @@ if (isset($_REQUEST["do_Flag"])) { print __("You did not select any packages to un-vote for."); print "

\n"; } - - if (isset($_REQUEST["ID"])) { - pkgdetails_link($_REQUEST["ID"]); - } else { - pkgsearch_results_link(); - } - } -} elseif (isset($_REQUEST["do_Details"])) { +} elseif (isset($_REQUEST["ID"])) { - if (!isset($_REQUEST["ID"]) || !intval($_REQUEST["ID"])) { + if (!intval($_REQUEST["ID"])) { print __("Error trying to retrieve package details.")."
\n"; } else { package_details($_REQUEST["ID"], $_COOKIE["AURSID"]); } - print "
\n"; # FIXME: If someone hits the detail page's vote button, this link dies - pkgsearch_results_link(); } elseif (isset($_REQUEST["do_Notify"])) { # I realize that the implementation here seems a bit convoluted, but we want to @@ -532,7 +507,6 @@ if (isset($_REQUEST["do_Flag"])) { print '

'; } } - pkgdetails_link($pid); } else { print '

'; print __("Couldn't add to notification list."); diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php index 6d8314f..9eb2fe2 100644 --- a/web/html/pkgedit.php +++ b/web/html/pkgedit.php @@ -58,7 +58,6 @@ if ($_REQUEST["del_Comment"]) { } else { print __("Missing comment ID.")."
\n"; } - pkgdetails_link($_REQUEST["ID"]); html_footer(AUR_VERSION); exit(); } @@ -76,8 +75,7 @@ if ($_REQUEST["add_Comment"]) { $q.= "'".mysql_real_escape_string($_REQUEST["comment"])."', "; $q.= "UNIX_TIMESTAMP())"; db_query($q, $dbh); - print __("Comment has been added.")."
 
\n"; - pkgdetails_link($_REQUEST["ID"]); + print __("Comment has been added."); # Send email notifications # @@ -144,8 +142,6 @@ if ($_REQUEST["change_Category"]) { } else { print __("Invalid category ID.")."
\n"; } - pkgdetails_link($_REQUEST["ID"]); - } else { # Prompt visitor for new category_id # @@ -179,10 +175,7 @@ if ($_REQUEST["change_Category"]) { print __("You've found a bug if you see this....")."
\n"; -html_footer(AUR_VERSION); # Use the $Id$ keyword - # NOTE: when checking in a new file, use - # 'svn propset svn:keywords "Id" filename.php' - # to tell svn to expand the "Id" keyword. +html_footer(AUR_VERSION); # vim: ts=2 sw=2 noet ft=php ?> diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index e349591..638654b 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -421,11 +421,15 @@ if ($_COOKIE["AURSID"]) { db_query($q, $dbh); } - $sources = explode(" ", $new_pkgbuild['source']); - while (list($k, $v) = each($sources)) { - $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; - $q .= $pdata["ID"].", '".mysql_real_escape_string($v)."')"; - db_query($q, $dbh); + # Insert sources, if they don't exist don't inser them + # + if ($new_pkgbuild['source'] != "") { + $sources = explode(" ", $new_pkgbuild['source']); + while (list($k, $v) = each($sources)) { + $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; + $q .= $pdata["ID"].", '".mysql_real_escape_string($v)."')"; + db_query($q, $dbh); + } } } else { # this is a brand new package @@ -483,11 +487,15 @@ if ($_COOKIE["AURSID"]) { db_query($q, $dbh); } - $sources = explode(" ", $new_pkgbuild['source']); - while (list($k, $v) = each($sources)) { - $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; - $q .= $packageID.", '".mysql_real_escape_string($v)."')"; - db_query($q, $dbh); + # insert sources + # + if ($new_pkgbuild['source'] != "") { + $sources = explode(" ", $new_pkgbuild['source']); + while (list($k, $v) = each($sources)) { + $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; + $q .= $packageID.", '".mysql_real_escape_string($v)."')"; + db_query($q, $dbh); + } } } } diff --git a/web/lang/ca/acctfuncs_po.inc b/web/lang/ca/acctfuncs_po.inc index 6770506..59dee9c 100644 --- a/web/lang/ca/acctfuncs_po.inc +++ b/web/lang/ca/acctfuncs_po.inc @@ -7,7 +7,7 @@ global $_t; $_t["ca"]["Missing a required field."] = "Manca un camp requerit."; -$_t["ca"]["Search'"] = "Cerca'"; +$_t["ca"]["Search"] = "Cerca'"; $_t["ca"]["The account, %h%s%h, has been successfully created."] = "El compte, %h%s%h, s'ha creat satisfactòriament."; diff --git a/web/lang/de/acctfuncs_po.inc b/web/lang/de/acctfuncs_po.inc index e73fb74..248f669 100644 --- a/web/lang/de/acctfuncs_po.inc +++ b/web/lang/de/acctfuncs_po.inc @@ -7,7 +7,7 @@ global $_t; $_t["de"]["Missing a required field."] = "Ein benötigtes Feld fehlt."; -$_t["de"]["Search'"] = "Suche'"; +$_t["de"]["Search"] = "Suche'"; $_t["de"]["The account, %h%s%h, has been successfully created."] = "Das Konto %h%s%h wurde erfolgreich angelegt."; diff --git a/web/lang/en/acctfuncs_po.inc b/web/lang/en/acctfuncs_po.inc index 3c054c1..c19bfdb 100644 --- a/web/lang/en/acctfuncs_po.inc +++ b/web/lang/en/acctfuncs_po.inc @@ -13,7 +13,7 @@ global $_t; $_t["en"]["Missing a required field."] = "Missing a required field."; -$_t["en"]["Search'"] = "Search'"; +$_t["en"]["Search"] = "Search"; $_t["en"]["The account, %h%s%h, has been successfully created."] = "The account, %h%s%h, has been successfully created."; diff --git a/web/lang/es/acctfuncs_po.inc b/web/lang/es/acctfuncs_po.inc index 706740a..9f8f96e 100644 --- a/web/lang/es/acctfuncs_po.inc +++ b/web/lang/es/acctfuncs_po.inc @@ -7,7 +7,7 @@ global $_t; $_t["es"]["Missing a required field."] = "Falta un campo obligatorio."; -$_t["es"]["Search'"] = "Buscar'"; +$_t["es"]["Search"] = "Buscar'"; $_t["es"]["The account, %h%s%h, has been successfully created."] = "La cuenta, %h%s%h, se creó correctamente."; diff --git a/web/lang/fr/acctfuncs_po.inc b/web/lang/fr/acctfuncs_po.inc index 0c10757..61e4ffb 100644 --- a/web/lang/fr/acctfuncs_po.inc +++ b/web/lang/fr/acctfuncs_po.inc @@ -7,7 +7,7 @@ global $_t; $_t["fr"]["Missing a required field."] = "Il manque un champ requis."; -$_t["fr"]["Search'"] = "Rechercher'"; +$_t["fr"]["Search"] = "Rechercher'"; $_t["fr"]["The account, %h%s%h, has been successfully created."] = "Le compte, %h%s%h, a été créé avec succès."; diff --git a/web/lang/it/acctfuncs_po.inc b/web/lang/it/acctfuncs_po.inc index e08d342..e5b9316 100644 --- a/web/lang/it/acctfuncs_po.inc +++ b/web/lang/it/acctfuncs_po.inc @@ -7,7 +7,7 @@ global $_t; $_t["it"]["Missing a required field."] = "Manca un campo obbligatorio."; -$_t["it"]["Search'"] = "Cerca'"; +$_t["it"]["Search"] = "Cerca'"; $_t["it"]["The account, %h%s%h, has been successfully created."] = "L'account %h%s%h è stato creato con successo."; diff --git a/web/lang/pl/acctfuncs_po.inc b/web/lang/pl/acctfuncs_po.inc index 4b94e9d..b9d6459 100644 --- a/web/lang/pl/acctfuncs_po.inc +++ b/web/lang/pl/acctfuncs_po.inc @@ -27,7 +27,7 @@ $_t["pl"]["Re-type password"] = "Hasło (ponownie)"; $_t["pl"]["Language is not currently supported."] = "Język nie jest obecnie obsługiwany."; $_t["pl"]["Missing User ID"] = "Brakuje ID użytkownika"; $_t["pl"]["Developer"] = "Developer"; -$_t["pl"]["Search'"] = "Szukaj'"; +$_t["pl"]["Search"] = "Szukaj'"; $_t["pl"]["Status"] = "Status"; $_t["pl"]["No results matched your search criteria."] = "Wyszukiwanie nie przyniosło rezultatu."; $_t["pl"]["Never"] = "Nigdy"; diff --git a/web/lang/pt/acctfuncs_po.inc b/web/lang/pt/acctfuncs_po.inc index c7d158a..5a9a813 100644 --- a/web/lang/pt/acctfuncs_po.inc +++ b/web/lang/pt/acctfuncs_po.inc @@ -13,7 +13,7 @@ global $_t; $_t["pt"]["Missing a required field."] = "Um campo requerido não foi informado."; -$_t["pt"]["Search'"] = "Pesquisa'"; +$_t["pt"]["Search"] = "Pesquisa'"; $_t["pt"]["The account, %h%s%h, has been successfully created."] = "A conta, %h%s%h, foi criada com sucesso."; diff --git a/web/lang/ru/acctfuncs_po.inc b/web/lang/ru/acctfuncs_po.inc index 8e02a90..cc4cae3 100644 --- a/web/lang/ru/acctfuncs_po.inc +++ b/web/lang/ru/acctfuncs_po.inc @@ -7,7 +7,7 @@ global $_t; $_t["ru"]["Missing a required field."] = "Отсутствует обязательное значение."; -$_t["ru"]["Search'"] = "Поиск'"; +$_t["ru"]["Search"] = "Поиск'"; $_t["ru"]["The account, %h%s%h, has been successfully created."] = "Учетная запись %h%s%h успешно создана."; diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index f560ef9..46bc522 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -6,42 +6,6 @@ include_once("config.inc"); # $pkgsearch_vars = array("O", "L", "C", "K", "SB", "SO", "PP", "do_MyPackages", "do_Orphans", "SeB"); - -# print out the 'return to package details' link -# -function pkgdetails_link($id=0) { - $url_data = ""; - print __("Go back to %hpackage details view%h.", - array($url_data, "")); - print "\n
\n"; - return; -} - - -# print out the 'return to search results' link -# -function pkgsearch_results_link() { - global $_REQUEST; - global $pkgsearch_vars; - - $url_data = ""; - print "

"; - print __("Go back to %hsearch results%h.", - array($url_data, "")); - print "
"; - print "\n
\n"; - - return; -} - # Make sure this visitor can delete the requested package comment # They can delete if they were the comment submitter, or if they are a TU/Dev # @@ -387,21 +351,25 @@ function package_details($id=0, $SID="") { echo __("Dependencies")."\n"; echo " "; $deps = package_dependencies($row["ID"]); # $deps[0] = array('id','name', 'dummy'); - while (list($k, $darr) = each($deps)) { - $url = "".$darr[1].$darr[3]."
\n"; + else echo "".$darr[1].$darr[3]."
\n"; } - reset($pkgsearch_vars); - - // $darr[3] is the DepCondition - - if ($darr[2] == 0) echo $url."'>".$darr[1].$darr[3]."
\n"; - else echo "".$darr[1].$darr[3]."
\n"; } echo "\n"; echo ""; @@ -413,58 +381,66 @@ function package_details($id=0, $SID="") { echo __("Required by")."\n"; echo ""; $deps = package_required($row["ID"]); - while (list($k, $darr) = each($deps)) { - $url = "".$darr[1].$darr[3]."
\n"; + else print "".$darr[1].$darr[3]."
\n"; } - reset($pkgsearch_vars); - - // $darr[3] is the DepCondition - - if ($darr[2] == 0) print $url."'>".$darr[1].$darr[3]."
\n"; - else print "".$darr[1].$darr[3]."
\n"; } - echo "\n"; - echo " \n"; - echo " \n"; + echo "\n"; + echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; - echo "
"; echo __("Sources")."
"; $sources = package_sources($row["ID"]); # $sources[0] = 'src'; - while (list($k, $src) = each($sources)) { - $parsed_url = parse_url($src); - if ($parsed_url['scheme']) - { - //It is an external source - echo "".$src."
\n"; - } - else - { - //It is presumably an internal source - if ($row["LocationID"] == 2) { - echo "".$src."
\n"; - } elseif ($row["LocationID"] == 3) { - echo ""; - echo $src."
\n"; + if (count($sources) == 0) { + print "None\n"; + } else { + while (list($k, $src) = each($sources)) { + $parsed_url = parse_url($src); + if ($parsed_url['scheme']) + { + //It is an external source + echo "".$src."
\n"; + } + else + { + //It is presumably an internal source + if ($row["LocationID"] == 2) { + echo "".$src."
\n"; + } elseif ($row["LocationID"] == 3) { + echo ""; + echo $src."
\n"; + } } } } echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " \n"; - echo " \n"; - echo "\n\n"; - echo "
\n\n"; + echo " \n"; + echo "\n\n"; + echo "
\n\n"; # Actions Bar @@ -534,19 +510,20 @@ function package_details($id=0, $SID="") { # Comments # - echo "
\n"; - echo "
".__("Comments")."
\n"; - echo "
\n"; + echo "
\n"; + echo "
".__("Comments")."
\n"; + echo "
\n"; echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + if (isset($_COOKIE['AURSID'])) { + echo ""; + //echo "
\n"; + } $comments = package_comments($row["ID"]); if (!empty($comments)) { while (list($indx, $carr) = each($comments)) { @@ -554,8 +531,8 @@ function package_details($id=0, $SID="") { echo " \n"; echo " \n"; echo " \n"; } + } else { + print "\n"; } - echo "
\n"; - echo "
\n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; - echo " \n"; + echo "\n"; + echo " \n"; echo "
"; + echo "
"; if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) { $durl = ""; + echo "
"; echo "\n"; echo nl2br(htmlspecialchars($carr["Comments"])); - echo "
\n"; echo "
None
\n"; - echo "
\n"; - echo "
\n"; - + echo "
\n"; + echo "
\n"; } } return; @@ -942,61 +919,77 @@ function pkg_search_page($SID="") { $q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC "; break; } + $qnext = $q."LIMIT ".($O+$PP).", ".$PP; //next page's worth $q.= "LIMIT ".$O.", ".$PP; - print "\n"; + if ($SID) { + # The 'Actions' table + # + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "
\n"; + print " ".__("Actions")."\n"; + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print "
"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
\n"; + print "
\n"; + print "
\n"; + print "
\n"; + } + + // Why? + // print "\n"; + $result = db_query($q, $dbh); + + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print "
\n"; + print " ".__("Package Listing")."\n"; + print "
\n"; + print "\n"; + if (!$result) { + print "
"; print __("Error retrieving package list."); - + print "
"; } elseif (!mysql_num_rows($result)) { + print "
"; print __("No packages matched your search criteria."); - + print "
"; } else { - - if ($SID) { - # The 'Actions' table - # - print "
\n"; - print "
\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " ".__("Actions")."\n"; - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print "
"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "
\n"; - print "
\n"; - print "\n"; - print "
\n"; - } - # print out package search results # @@ -1006,17 +999,6 @@ function pkg_search_page($SID="") { } else { $SO_next="d"; } - - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " ".__("Package Listing")."\n"; - print "
\n"; - print "\n"; print "\n"; if ($SID) { print " \n"; print " \n"; print " \n"; - - print "
"; if ($row["OutOfDate"]) { $c = "outofdate"; } + print " "; print ""; # if ($i == 0) { # $all_ids = $row["ID"]; @@ -1085,20 +1067,8 @@ function pkg_search_page($SID="") { print $cats[$row["CategoryID"]].""; $url = ""; $url.=""; $url.=$row["Name"]; @@ -1210,13 +1180,12 @@ function pkg_search_page($SID="") { } print "
\n"; - print "
\n"; - print "
\n"; } + print "
\n"; + print " \n"; + print "\n"; + print "\n"; + print "
\n"; print "\n"; return; diff --git a/web/template/header.php b/web/template/header.php index 440cb24..8e02211 100644 --- a/web/template/header.php +++ b/web/template/header.php @@ -43,7 +43,7 @@ if (isset($_COOKIE["AURSID"])) { .__("My Packages")."\n"; } ?> -
  • +
  • diff --git a/web/template/search_accounts_form.php b/web/template/search_accounts_form.php index 6e7d552..d5665e9 100644 --- a/web/template/search_accounts_form.php +++ b/web/template/search_accounts_form.php @@ -58,7 +58,7 @@    
    "> + value=""> "> -- cgit v1.2.3-54-g00ecf