Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
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
parenta8fdf565c7594baa2c0faa23f5d5c38fda380a0e (diff)
lib/style.php: print_listing() now suitable for lists of groups, too
-rw-r--r--groups.php2
-rw-r--r--lib/style.php123
-rw-r--r--packages/index.php4
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 " </tr>\n";
print " </thead>\n";
print " <tbody>\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 " <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";
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) {
<p><?php print count($exact_matches); ?> exact match<?php if (count($exact_matches) != 1) print "es"; ?> found.</p>
</div>
<?php
- print_listing($exact_matches, false, $pkglist_sorts);
+ print_listing($exact_matches, false, 'package');
?>
</div>
<?php
@@ -318,7 +318,7 @@ if (count($exact_matches) > 0) {
header_and_footer();
- print_listing($fuzzy_matches, true, $pkglist_sorts);
+ print_listing($fuzzy_matches, true, 'package');
header_and_footer();