distroquery.php: improvements in rest client results data and navigation
This commit is contained in:
parent
c2985c53f7
commit
8c206bae0d
104
distroquery.php
104
distroquery.php
@ -22,11 +22,11 @@ $url_prefix = home_url() . "/distroquery-api/";
|
||||
?>
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div id="content-full" class="grid col-940">
|
||||
<div id="content-full" class="grid col-940"><span id="distromatic">
|
||||
|
||||
<?php
|
||||
echo "[<a href=\"" . $url_prefix . "\">repositories</a>]";
|
||||
|
||||
// Navigation bar
|
||||
echo "<a href=\"" . home_url() . "\">Home</a>";
|
||||
|
||||
$repo=get_query_var('repo');
|
||||
$package=get_query_var('package');
|
||||
@ -36,9 +36,11 @@ $url_prefix = home_url() . "/distroquery-api/";
|
||||
//
|
||||
// Repositories
|
||||
//
|
||||
echo "<h3>Available repositories:</h3>";
|
||||
echo " > Repositories";
|
||||
|
||||
echo "<h1>Available repositories:</h1>";
|
||||
$request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/repositories');
|
||||
$j = json_decode($request["body"],true);
|
||||
$j = json_decode($request["body"], true);
|
||||
foreach ($j as $repository) {
|
||||
$repository_url = $url_prefix . $repository["tag"];
|
||||
echo "<a href=\"" . $repository_url . "\">". $repository["tag"] . "</a>: " . $repository["description"] . "</br>";
|
||||
@ -48,20 +50,93 @@ $url_prefix = home_url() . "/distroquery-api/";
|
||||
//
|
||||
// Repository
|
||||
//
|
||||
echo "<h3>List of packages:</h3>";
|
||||
$request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/repository/' . $repo);
|
||||
$j = json_decode($request["body"],true);
|
||||
echo " > <a href=\"" . $url_prefix . "\">Repositories</a>";
|
||||
|
||||
} else if ($package != "") {
|
||||
$request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/repository/' . $repo);
|
||||
$j = json_decode($request["body"], true);
|
||||
|
||||
if ($j["error"] != "") {
|
||||
echo "<h3>ERROR: " . $j["error"] . "</h3>";
|
||||
} else {
|
||||
|
||||
echo " > " . $repo;
|
||||
echo "<h1>List of packages:</h1>";
|
||||
|
||||
foreach ($j as $package) {
|
||||
$package_url = $url_prefix . $repo . "/" . $package["name"];
|
||||
echo "<a href=\"" . $package_url . "\">". $package["name"] . "</a>: " . $package["summary"] . "</br>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if ($arch == "") {
|
||||
//
|
||||
// Source package
|
||||
//
|
||||
echo " > <a href=\"" . $url_prefix . "\">Repositories</a>";
|
||||
|
||||
$request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/package/'. $repo . "/" . $package);
|
||||
$j = json_decode($request["body"], true);
|
||||
|
||||
if ($j["error"] != "") {
|
||||
echo "<h3>ERROR: " . $j["error"] . "</h3>";
|
||||
} else {
|
||||
echo " > <a href=\"" . $url_prefix . "/" . $repo . "\">$repo</a> > " . $package;
|
||||
|
||||
?>
|
||||
|
||||
<h1><img src="https://www.google.com/s2/favicons?domain=<?php echo $j["url"] ?>" width="24" height="24">
|
||||
<?php echo $j["name"] ?>: <?php echo $j["summary"] ?></h1>
|
||||
|
||||
<table class="pkgpage" width="100%">
|
||||
<tr><td width="15%">Name:</td><td><?php echo $j["name"] ?></td></tr>
|
||||
<tr><td width="15%">Release:</td><td>
|
||||
<?php if ($j["epoch"] != "0") echo $j["epoch"].":";
|
||||
echo $j["version"]."-".$j["release"] ?></td></tr>
|
||||
<tr><td width="15%">Group:</td><td><?php echo $j["group"] ?></td></tr>
|
||||
<tr><td width="15%">Maintainer:</td><td><?php echo $j["maintainer"] ?></td></tr>
|
||||
<tr><td width="15%">Description:</td><td><?php echo $j["description"] ?></td></tr>
|
||||
<tr><td width="15%">License:</td><td><?php echo $j["license"] ?></td></tr>
|
||||
<tr><td width="15%">Size:</td><td><?php echo $j["size"] ?></td></tr>
|
||||
<tr><td width="15%">URL:</td><td><a href="<?php echo $j["url"] ?>" target=_blank><?php echo $j["url"] ?></a></td></tr>
|
||||
<tr><td width="15%">Download:</td><td><a href="<?php echo $j["download_url"] ?>" target=_blank><?php echo basename($j["download_url"]) ?></a></td></tr>
|
||||
<tr><td width="15%">Sources:</td><td><a href="<?php echo $j["source_url"] ?>" target=_blank><?php echo $j["source_url"] ?></a></td></tr>
|
||||
<tr><td width="15%">Build time:</td><td><?php echo iso8601_to_datetime($j["buildtime"]) ?></td></tr>
|
||||
<tr><td width="15%">Built RPMS:</td><td><?php
|
||||
foreach ($j["children"] as $child) {
|
||||
$child_url = $url_prefix . $repo . "/" . $child["name"] . "/" . $child["arch"];
|
||||
echo "<a href=\"" . $child_url . "\">" . $child["name"] . "(" . $child["arch"] . ")</a> ";
|
||||
} ?>
|
||||
</td></tr>
|
||||
<tr><td width="15%">Build requirements:</td><td><?php
|
||||
foreach ($j["buildrequires"] as $buildrequire) {
|
||||
echo $buildrequire["name"];
|
||||
if ($buildrequire["flags"] != "") echo "[" . $buildrequire["flags"] . $buildrequire["version"] . "]";
|
||||
echo " ";
|
||||
} ?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
} else if ($arch != "") {
|
||||
//
|
||||
// Package
|
||||
//
|
||||
echo " > <a href=\"" . $url_prefix . "\">Repositories</a>";
|
||||
|
||||
$request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/package/'. $repo . "/" . $package . "/" . $arch);
|
||||
$j = json_decode($request["body"],true);
|
||||
if ($j["error"] != "") {
|
||||
echo "<h3>ERROR: " . $j["error"] . "</h3>";
|
||||
} else {
|
||||
echo " > <a href=\"" . $url_prefix . "/" . $repo . "\">$repo</a> > " . $package . " (" . $arch . ")";
|
||||
|
||||
?>
|
||||
|
||||
<h2><img src="https://www.google.com/s2/favicons?domain=<?php echo $j["source"]["url"] ?>" width="24" height="24">
|
||||
<?php echo $j["name"] ?>: <?php echo $j["summary"] ?></h2>
|
||||
<h1><img src="https://www.google.com/s2/favicons?domain=<?php echo $j["source"]["url"] ?>" width="24" height="24">
|
||||
<?php echo $j["name"] ?>: <?php echo $j["summary"] ?></h1>
|
||||
|
||||
<table class="pkgpage" width="100%">
|
||||
<tr><td width="15%">Name:</td><td><?php echo $j["name"] ?></td></tr>
|
||||
@ -74,6 +149,9 @@ $url_prefix = home_url() . "/distroquery-api/";
|
||||
<tr><td width="15%">Size:</td><td><?php echo $j["size"] ?></td></tr>
|
||||
<tr><td width="15%">URL:</td><td><a href="<?php echo $j["source"]["url"] ?>" target=_blank><?php echo $j["source"]["url"] ?></a></td></tr>
|
||||
<tr><td width="15%">Download:</td><td><a href="<?php echo $j["download_url"] ?>" target=_blank><?php echo basename($j["download_url"]) ?></a></td></tr>
|
||||
<tr><td width="15%">Source RPM:</td><td><?php
|
||||
$sourcerpm_url = $url_prefix . $repo . "/" . $j["source"]["name"];
|
||||
echo "<a href=\"". $sourcerpm_url . "\">". $j["source"]["name"] . "</a> "; ?>
|
||||
<tr><td width="15%">Sources:</td><td><a href="<?php echo $j["source"]["source_url"] ?>" target=_blank><?php echo $j["source"]["source_url"] ?></a></td></tr>
|
||||
<tr><td width="15%">Brothers:</td><td><?php
|
||||
foreach ($j["brothers"] as $brother) {
|
||||
@ -88,13 +166,13 @@ $url_prefix = home_url() . "/distroquery-api/";
|
||||
echo " ";
|
||||
} ?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</div><!-- end of #content-full -->
|
||||
</span></div><!-- end of #content-full -->
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
Loading…
Reference in New Issue
Block a user