Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-19 10:08:06 +0100
committerErich Eckner <git@eckner.net>2019-02-19 10:08:06 +0100
commit1891c18d82c7714e02db96d0da44dbf09e93777d (patch)
treeffb7d752947af84877faac16a41e41be67eefb20 /lib
parenta8fdf565c7594baa2c0faa23f5d5c38fda380a0e (diff)
lib/style.php: print_listing() now suitable for lists of groups, too
Diffstat (limited to 'lib')
-rw-r--r--lib/style.php123
1 files changed, 87 insertions, 36 deletions
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 " <table class=\"results\">\n";
print " <thead>\n";
@@ -226,32 +264,43 @@ function print_listing($list, $print_order_links, $columns) {
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 "&nbsp;";
- print "\n";
- print " </td>\n";
- print " <td>\n";
- print " ";
- if (isset($row["build_date"]))
- print $row["build_date"];
- else
- print "&nbsp;";
- print "\n";
- print " </td>\n";
+ if ($list_content_type == 'package') {
+ 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 "&nbsp;";
+ print "\n";
+ print " </td>\n";
+ print " <td>\n";
+ print " ";
+ if (isset($row["build_date"]))
+ print $row["build_date"];
+ else
+ print "&nbsp;";
+ print "\n";
+ print " </td>\n";
+ }
+ if ($list_content_type == 'group') {
+ print " <td>\n";
+ print " <a href=\"/groups/" . $row["arch"] . "/" . $row["name"] . "/\"";
+ print " title=\"Group details for " . $row["name"] . "\">" . $row["name"] . "</a>\n";
+ print " </td>\n";
+ print " <td>\n";
+ print " " . $row["count"] . "\n";
+ print " </td>";
+ }
print " <td>\n";
print " ";
if (isset($row["move_date"]))
@@ -260,14 +309,16 @@ function print_listing($list, $print_order_links, $columns) {
print "&nbsp;";
print "\n";
print " </td>\n";
- print " <td>\n";
- print " ";
- if ($row["is_to_be_deleted"])
- print "to be deleted";
- else
- print "&nbsp;";
- print "\n";
- print " </td>\n";
+ if ($list_content_type == 'package') {
+ print " <td>\n";
+ print " ";
+ if ($row["is_to_be_deleted"])
+ print "to be deleted";
+ else
+ print "&nbsp;";
+ print "\n";
+ print " </td>\n";
+ }
print " </tr>\n";
if ($oddity == "odd" )
$oddity = "even";