diff options
author | Erich Eckner <git@eckner.net> | 2019-02-18 14:28:52 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-02-18 14:28:52 +0100 |
commit | e5c0107d8c0dca4bdbbfa6fa26c2ef4d8997be6a (patch) | |
tree | 7c13cd3137fba0bf19b5e362be5fc24a62f1834a /lib/style.php | |
parent | b3150d206e9b45838162ecdd591bdc6ff351cba6 (diff) | |
download | archweb32-e5c0107d8c0dca4bdbbfa6fa26c2ef4d8997be6a.tar.xz |
lib/style.php,packages/index.php: move displaying part of package listing to a separate function in a separate file
Diffstat (limited to 'lib/style.php')
-rw-r--r-- | lib/style.php | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/style.php b/lib/style.php index 622e764..2fe2992 100644 --- a/lib/style.php +++ b/lib/style.php @@ -74,3 +74,99 @@ function print_footer() { </html> <?php } + +/********************************************************************** + * * + * Functions for generating and diplaying listings of packages * + * * + **********************************************************************/ + +function query_package_listing() { +} + +function print_package_listing($list, $sorts, $print_order_links) { + + print " <table class=\"results\">\n"; + print " <thead>\n"; + print " <tr>\n"; + + foreach ($sorts as $get => $sort) { + print " <th>\n"; + if ($print_order_links) { + print " <a href=\"?"; + print + substr( + str_replace( + "&sort=" . $_GET["sort"] . "&", + "&", + "&" . $_SERVER["QUERY_STRING"] . "&" + ), + 1) . "sort="; + if ($_GET["sort"] == $get) + print "-"; + print $get . "\" title=\"Sort packages by " . $sort["title"] . "\">" . $sort["label"] . "</a>\n"; + } else + print " " . $sort["label"] . "\n"; + print " </th>\n"; + } + + print " </tr>\n"; + print " </thead>\n"; + print " <tbody>\n"; + $oddity = "odd"; + foreach ($list as $row) { + print " <tr class=\"" . $oddity . "\">\n"; + print " <td>\n"; + print " " . $row["arch"] . "\n"; + print " </td>\n"; + print " <td>\n"; + print " " . $row["repo"] . "\n"; + print " </td>\n"; + print " <td>\n"; + print " <a href=\"" . $row["repo"] . "/" . $row["pkgname"] ."/\" "; + print "title=\"View package details for " . $row["pkgname"] . "\">" . $row["pkgname"] . "</a>\n"; + print " </td>\n"; + print " <td>\n"; + print " " . $row["version"] . "\n"; + print " </td>\n"; + print " <td>\n"; + print " "; + if ($row["has_issues"]) + print "has open bug reports"; + else + print " "; + print "\n"; + print " </td>\n"; + print " <td>\n"; + print " "; + if (isset($row["build_date"])) + print $row["build_date"]; + else + print " "; + print "\n"; + print " </td>\n"; + print " <td>\n"; + print " "; + if (isset($row["move_date"])) + print $row["move_date"]; + else + print " "; + print "\n"; + print " </td>\n"; + print " <td>\n"; + print " "; + if ($row["is_to_be_deleted"]) + print "to be deleted"; + else + print " "; + print "\n"; + print " </td>\n"; + print " </tr>\n"; + if ($oddity == "odd" ) + $oddity = "even"; + else + $oddity = "odd"; + } + print " </tbody>\n"; + print " </table>\n"; +} |