From 1891c18d82c7714e02db96d0da44dbf09e93777d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 19 Feb 2019 10:08:06 +0100 Subject: lib/style.php: print_listing() now suitable for lists of groups, too --- groups.php | 2 +- lib/style.php | 123 +++++++++++++++++++++++++++++++++++++---------------- packages/index.php | 4 +- 3 files changed, 90 insertions(+), 39 deletions(-) diff --git a/groups.php b/groups.php index c3bd778..349cc0b 100644 --- a/groups.php +++ b/groups.php @@ -82,6 +82,6 @@ print " \n"; print " \n"; print " \n"; -print_package_listing($packages, true); +print_listing($packages, true, 'package'); print_footer(); diff --git a/lib/style.php b/lib/style.php index a8f3163..6a59462 100644 --- a/lib/style.php +++ b/lib/style.php @@ -77,10 +77,34 @@ function print_footer() { /********************************************************************** * * - * Functions for generating and diplaying listings of packages * + * Functions for generating and diplaying listings of packages and * + * groups * * * **********************************************************************/ +$grouplist_sorts = array( + "arch" => array( + "title" => "architecture", + "label" => "Arch", + "mysql" => "`architectures`.`name`" + ), + "groupname" => array( + "title" => "group name", + "label" => "Group Name", + "mysql" => "`install_targets`.`name`" + ), + "count" => array( + "title" => "package count", + "label" => "Package Count", + "mysql" => "`count`" + ), + "last_moved" => array( + "title" => "last update", + "label" => "Last Updated", + "mysql" => "`last_moved`" + ) +); + $pkglist_sorts = array( "arch" => array( "title" => "architecture", @@ -191,7 +215,21 @@ function query_package_listing($filter, $limit, $float_columns, $count_only, $ex } } -function print_listing($list, $print_order_links, $columns) { +function print_listing($list, $print_order_links, $list_content_type) { + + global $pkglist_sorts; + global $grouplist_sorts; + switch ($list_content_type) { + case 'package': + $columns = $pkglist_sorts; + break; + case 'group': + $columns = $grouplist_sorts; + break; + default: + throw_http_error(500,'Internal Server Error','invalit list type "' . $list_content_type . '"' . "\n"); + die(); + } print " \n"; print " \n"; @@ -226,32 +264,43 @@ function print_listing($list, $print_order_links, $columns) { print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + if ($list_content_type == 'package') { + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + } + if ($list_content_type == 'group') { + print " \n"; + print " "; + } print " \n"; - print " \n"; + if ($list_content_type == 'package') { + print " \n"; + } print " \n"; if ($oddity == "odd" ) $oddity = "even"; diff --git a/packages/index.php b/packages/index.php index fb568da..951dbb1 100644 --- a/packages/index.php +++ b/packages/index.php @@ -306,7 +306,7 @@ if (count($exact_matches) > 0) {

exact match found.

0) { header_and_footer(); - print_listing($fuzzy_matches, true, $pkglist_sorts); + print_listing($fuzzy_matches, true, 'package'); header_and_footer(); -- cgit v1.2.3-54-g00ecf
\n"; print " " . $row["arch"] . "\n"; print " \n"; - print " " . $row["repo"] . "\n"; - print " \n"; - print " " . $row["pkgname"] . "\n"; - print " \n"; - print " " . $row["version"] . "\n"; - print " \n"; - print " "; - if ($row["has_issues"]) - print "has open bug reports"; - else - print " "; - print "\n"; - print " \n"; - print " "; - if (isset($row["build_date"])) - print $row["build_date"]; - else - print " "; - print "\n"; - print " \n"; + print " " . $row["repo"] . "\n"; + print " \n"; + print " " . $row["pkgname"] . "\n"; + print " \n"; + print " " . $row["version"] . "\n"; + print " \n"; + print " "; + if ($row["has_issues"]) + print "has open bug reports"; + else + print " "; + print "\n"; + print " \n"; + print " "; + if (isset($row["build_date"])) + print $row["build_date"]; + else + print " "; + print "\n"; + print " \n"; + print " " . $row["name"] . "\n"; + print " \n"; + print " " . $row["count"] . "\n"; + print " \n"; print " "; if (isset($row["move_date"])) @@ -260,14 +309,16 @@ function print_listing($list, $print_order_links, $columns) { print " "; print "\n"; print " \n"; - print " "; - if ($row["is_to_be_deleted"]) - print "to be deleted"; - else - print " "; - print "\n"; - print " \n"; + print " "; + if ($row["is_to_be_deleted"]) + print "to be deleted"; + else + print " "; + print "\n"; + print "