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 --- lib/style.php | 123 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 87 insertions(+), 36 deletions(-) (limited to 'lib') 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"; -- cgit v1.2.3-70-g09d2
\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 "