distroquery: improve binary packages pages with table for list of brothers,provides,obsoletes,requires

This commit is contained in:
Silvan Calarco 2024-07-07 14:56:17 +02:00
parent c17f34699b
commit dd3d8f4e6d
2 changed files with 44 additions and 33 deletions

View File

@ -163,7 +163,7 @@ $url_prefix = home_url() . "/rpms/";
<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>
<h5><?php echo $j["description"] ?></h5>
<?php echo nl2br($j["description"]) ?>
<table class="pkgpage" width="100%">
<tr><td width="15%"><?php echo _r("Name") ?>:</td><td><?php echo $j["name"] ?></td></tr>
@ -257,7 +257,7 @@ $url_prefix = home_url() . "/rpms/";
<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>
<h5><?php echo $j["description"] ?></h5>
<?php echo nl2br($j["description"]) ?>
<table class="pkgpage" width="100%">
<tr><td width="15%"><?php echo _r("Name") ?>:</td><td><?php echo $j["name"] ?></td></tr>
@ -271,36 +271,47 @@ $url_prefix = home_url() . "/rpms/";
<tr><td width="15%"><?php echo _r("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%"><?php echo _r("Brothers") ?>:</td><td><?php
foreach ($j["brothers"] as $brother) {
$brother_url = $url_prefix . $repo . "/" . $brother . "/" . $arch;
echo "<a href=\"". $brother_url . "\">". $brother . "</a> ";
} ?>
</td></tr>
<tr><td width="15%"><?php echo _r("Provides") ?>:</td><td><?php
foreach ($j["provides"] as $provide) {
echo $provide["name"];
if ($provide["flags"] != "") echo "[" . $provide["flags"] . $provide["version"] . "]";
echo " ";
} ?>
</td></tr>
<tr><td width="15%"><?php echo _r("Obsoletes") ?>:</td><td><?php
foreach ($j["obsoletes"] as $obsolete) {
echo $obsolete["name"];
if ($obsolete["flags"] != "") echo "[" . $obsolete["flags"] . $obsolete["version"] . "]";
echo " ";
} ?>
</td></tr>
<tr><td width="15%"><?php echo _r("Requires") ?>:</td><td><?php
foreach ($j["requires"] as $require) {
echo $require["name"];
if ($require["flags"] != "") echo "[" . $require["flags"] . $require["version"] . "]";
echo " ";
} ?>
</td></tr>
</table>
<?php
// RPM provides, requires, obsoletes table
echo "<table class=\"pkgpage\" width=\"100%\"><tr><th>" .
_r("Brothers") . "</th><th>" . _r("Provides") . "</th><th>" .
_r("Obsoletes") . "</th><th>" . _r("Requires") . "</th></tr>";
echo "<tr><td>";
foreach ($j["brothers"] as $brother) {
$brother_url = $url_prefix . $repo . "/" . $brother . "/" . $arch;
echo "<a href=\"". $brother_url . "\">". $brother . "</a><br/>";
}
echo "</td><td>";
foreach ($j["provides"] as $provide) {
echo $provide["name"];
if ($provide["flags"] != "") echo " " . $provide["flags"] . $provide["version"];
echo "<br/>";
}
echo "</td><td>";
foreach ($j["obsoletes"] as $obsolete) {
echo $obsolete["name"];
if ($obsolete["flags"] != "") echo " " . $obsolete["flags"] . $obsolete["version"];
echo "<br/>";
}
echo "</td><td>";
foreach ($j["requires"] as $require) {
echo $require["name"];
if ($require["flags"] != "") echo " " . $require["flags"] . $require["version"];
$cnt = 0;
foreach ($require["providers"] as $provider) {
$cnt++;
$provider_url = $url_prefix . $provider["repository"] . "/" . $provider["name"] . "/" . $arch;
echo " <a href=\"" . $provider_url . "\">[" . $cnt . "]</a>";
}
if ($cnt == 0) echo " (" . _r("unresolved") . ")";
echo "<br/>";
}
echo "</td></tr></table>";
}
}
?>

View File

@ -261,7 +261,7 @@ div#ag-terms {
span#distromatic table,
span#distromatic table tr,
span#distromatic table td {
padding:0;
padding:4px;
border:0;
word-break: break-word;
}
@ -331,7 +331,7 @@ table.queryfiletable td {
font-family:courier;
}
table.pkgpage tr:nth-child(even) td { background-color: #F2F2F2; }
table.pkgpage th { padding:0; font-weight: 800; border: 0; text-align: left; vertical-align: top; }
table.pkgpage td { vertical-align: top; }
table.pkgpage tr:nth-child(even) td { padding:2px; background-color: #F2F2F2; }
table.pkgpage th { padding:4px; font-weight: 800; border: 0; text-align: left; vertical-align: top; }
table.pkgpage td { padding:4px; vertical-align: top; }