Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/groups.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-18 22:19:17 +0100
committerErich Eckner <git@eckner.net>2019-02-18 22:19:17 +0100
commit2653ca5ae8e9836339aac14e8c891b7b9b26367f (patch)
tree6591697f678a4d8b0909a8a7500cc99f86250b0c /groups.php
parentd03b6d89fa151b0f486938565f53f8c1f751db6a (diff)
groups.php: can show details of _one_ group
Diffstat (limited to 'groups.php')
-rw-r--r--groups.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/groups.php b/groups.php
new file mode 100644
index 0000000..c3bd778
--- /dev/null
+++ b/groups.php
@@ -0,0 +1,87 @@
+<?php
+
+require_once "init.php";
+
+require_once BASE . "/lib/style.php";
+require_once BASE . "/lib/mysql.php";
+
+$uri_parts = explode('/', $_SERVER['REQUEST_URI']);
+
+if ($uri_parts[0] != '' || $uri_parts[1] != 'groups')
+ throw_http_error(422, 'Unprocessable Entity');
+
+$options = '';
+
+$last = array_pop($uri_parts);
+if (substr($last, 0, 1) == '?') {
+ $options = $last;
+ $last = array_pop($uri_parts);
+}
+if ($last != '')
+ array_push($uri_parts, $last);
+
+array_splice(
+ $uri_parts,
+ 0, 2
+);
+
+$arch_filter = '1';
+if (count($uri_parts) != 0) {
+ $repo_arch = $uri_parts[0];
+ $arch_filter = '`r_a`.`name`=from_base64("' . base64_encode($repo_arch) . '")';
+ array_splice(
+ $uri_parts,
+ 0, 1
+ );
+}
+
+if (count($uri_parts) == 0) {
+ // TODO: display overwiev
+ print 'Good so far, but the rest is yet to be implemented.';
+
+ die();
+ print_header('Package Groups');
+}
+
+if (count($uri_parts) != 1)
+ throw_http_error(422, 'Unprocessable Entity');
+
+$group = $uri_parts[0];
+$group_filter = '`install_targets`.`name`=from_base64("' . base64_encode($group) . '")';
+
+$packages = query_package_listing(
+ mysql_join_binary_packages_install_target_providers() .
+ mysql_join_install_target_providers_install_targets() .
+ ' WHERE ' . $arch_filter .
+ ' AND ' . $group_filter,
+ '',
+ array(),
+ false,
+ true
+);
+
+if (count($packages) == 0)
+ throw_http_error(404, 'Not Found');
+
+print_header('Group Details');
+
+print " <div class=\"box\">\n";
+print " <h2>\n";
+print " Group Details - " . $group . " (" . $repo_arch . ")\n";
+print " </h2>\n";
+print " <p>" . count($packages) . " packages found.</p>\n";
+print " <table class=\"results\">\n";
+print " <thead>\n";
+print " <tr>\n";
+foreach ($sorts as $sort) {
+ print " <th>\n";
+ print " " . $sort['label'] . "\n";
+ print " </th>\n";
+}
+print " </tr>\n";
+print " </thead>\n";
+print " <tbody>\n";
+
+print_package_listing($packages, true);
+
+print_footer();