[aur-dev] [PATCH 3/5] pkg_details.php: Sync metadata layout with archweb

Lukas Fleischer archlinux at cryptocrack.de
Fri Nov 4 09:42:55 EDT 2011


Synchronize the way we display dependencies, required by packages and
sources with archweb.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 web/html/css/arch.css        |    3 -
 web/html/css/containers.css  |   39 ++++++++++++++
 web/template/pkg_details.php |  120 ++++++++++++++++++-----------------------
 3 files changed, 92 insertions(+), 70 deletions(-)

diff --git a/web/html/css/arch.css b/web/html/css/arch.css
index 1e588f1..23b8aa7 100644
--- a/web/html/css/arch.css
+++ b/web/html/css/arch.css
@@ -132,9 +132,6 @@ body {
   background-color: #f6f3dd;
   border: 1px solid #d9d6c2;
 }
-div.listing {
-  padding-right: 10px;
-}
 .error {
   color: #dd0000;
   font-size: small;
diff --git a/web/html/css/containers.css b/web/html/css/containers.css
index 9f845b0..70ffd5c 100644
--- a/web/html/css/containers.css
+++ b/web/html/css/containers.css
@@ -194,3 +194,42 @@ input[type=image] {
 #pkginfo td {
   padding: 0.25em 0 0.25em 1.5em;
 }
+
+/* Package metadata */
+#pkgdetails #metadata {
+  clear: both;
+}
+
+#metadata h3 {
+  background: #555;
+  color: #fff;
+  font-size: 1em;
+  margin: 0.5em 0;
+  padding: 0.2em 0.35em;
+}
+
+#metadata ul {
+  list-style: none;
+  margin: 0;
+  padding: 0;
+}
+
+#metadata li {
+  padding-left: 0.5em;
+}
+
+#metadata #pkgdeps {
+  float: left;
+  width: 48%;
+  margin-right: 2%;
+}
+
+#metadata #pkgreqs {
+  float: left;
+  width: 50%;
+}
+
+#metadata #pkgsrcs {
+  clear: left;
+  padding-top: 1em;
+}
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index f5ed32a..e117e2a 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -61,7 +61,12 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("r", intval($row["Modi
 $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("r", intval($row["SubmittedTS"]));
 $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row["OutOfDateTS"]));
 
+# Save package dependencies, "required by" and sources
+$deps = package_dependencies($row["ID"]);
+$required_by = package_required($row["Name"]);
+$sources = package_sources($row["ID"]);
 ?>
+
 <div class="pgbox">
 	<div class="pgboxtitle"><span class="f3"><?php echo __("Package Details") . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></span></div>
 	<div class="pgboxbody">
@@ -116,76 +121,57 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
 		}
 ?>
 	</p>
-<?php
-
-	$deps = package_dependencies($row["ID"]);
-	$requiredby = package_required($row["Name"]);
-
-	if (count($deps) > 0 || count($requiredby) > 0) {
-		echo '<p>';
-	}
-
-	if (count($deps) > 0) {
-		echo "<span class='boxSoftTitle'><span class='f3'>". __("Dependencies")."</span></span>";
 
-		while (list($k, $darr) = each($deps)) {
-			# darr: (DepName, DepCondition, PackageID), where ID is NULL if it didn't exist
-			if (!is_null($darr[2])) {
-				echo " <a href='packages.php?ID=".$darr[2]."'>".$darr[0].$darr[1]."</a>";
-			} else {
-				echo " <a href='http://www.archlinux.org/packages/?q=".urlencode($darr[0])."'>".$darr[0].$darr[1]."</a>";
+	<div id="metadata">
+		<div id="pkgdeps" class="listing">
+			<h3><?php echo __("Dependencies") . ' (' . count($deps) . ')' ?></h3>
+			<ul>
+			<?php while (list($k, $darr) = each($deps)): ?>
+				<li>
+					<?php if (!is_null($darr[2])): ?>
+						<a href="packages.php?ID=<?php echo $darr[2] ?>"><?php echo $darr[0].$darr[1] ?></a>
+					<?php else: ?>
+						<a href="http://www.archlinux.org/packages/?q=<?php echo urlencode($darr[0]) ?>"><?php echo $darr[0].$darr[1] ?></a>
+					<?php endif; ?>
+				</li>
+			<?php endwhile; ?>
+			</ul>
+		</div>
+
+		<div id="pkgreqs" class="listing">
+			<h3><?php echo __("Required by") . ' (' . count($required_by) . ')' ?></h3>
+			<ul>
+			<?php while (list($k, $darr) = each($required_by)): ?>
+				<li><a href="packages.php?ID=<?php echo $darr[1] ?>"><?php echo $darr[0] ?></a></li>
+			<?php endwhile; ?>
+			</ul>
+		</div>
+
+		<div id="pkgsrcs" class="listing">
+			<h3><?php echo __("Sources") ?></h3>
+			<ul>
+			<?php
+			while (list($k, $src) = each($sources)) {
+				$src = explode('::', $src);
+				$parsed_url = parse_url($src[0]);
+
+				echo '<li>';
+				if (isset($parsed_url['scheme']) || isset($src[1])) {
+					# It is an external source
+					echo "<a href=\"" . htmlspecialchars((isset($src[1]) ? $src[1] : $src[0]), ENT_QUOTES) . "\">" . htmlspecialchars($src[0]) . "</a><br />\n";
+				}
+				else {
+					$src = $src[0];
+					# It is presumably an internal source
+					echo "<span class='f8'>" . htmlspecialchars($src) . "</span>";
+					echo "<br />\n";
+				}
+				echo '</li>';
 			}
-		}
-
-		if (count($requiredby) > 0) {
-			echo '<br />';
-		}
-	}
-
-	if (count($requiredby) > 0) {
-		echo "<span class='boxSoftTitle'><span class='f3'>". __("Required by")."</span></span>";
-
-		while (list($k, $darr) = each($requiredby)) {
-			# darr: (PackageName, PackageID)
-			echo " <a href='packages.php?ID=".$darr[1]."'>".$darr[0]."</a>";
-		}
-	}
-
-	if (count($deps) > 0 || count($requiredby) > 0) {
-		echo '</p>';
-	}
-
-
-	# $sources[0] = 'src';
-	$sources = package_sources($row["ID"]);
-
-	if (count($sources) > 0) {
-
-?>
-	<div class='boxSoftTitle'><span class='f3'><?php echo __('Sources') ?></span></div>
-	<div>
-<?php
-		while (list($k, $src) = each($sources)) {
-			$src = explode('::', $src);
-			$parsed_url = parse_url($src[0]);
-
-			if (isset($parsed_url['scheme']) || isset($src[1])) {
-				# It is an external source
-				echo "<a href=\"" . htmlspecialchars((isset($src[1]) ? $src[1] : $src[0]), ENT_QUOTES) . "\">" . htmlspecialchars($src[0]) . "</a><br />\n";
-			}
-			else {
-				$src = $src[0];
-				# It is presumably an internal source
-				echo "<span class='f8'>" . htmlspecialchars($src) . "</span>";
-				echo "<br />\n";
-			}
-		}
-?>
+			?>
+			</ul>
+		</div>
 	</div>
-<?php
-	}
-
-?>
 
 	</div>
 </div>
-- 
1.7.7.2



More information about the aur-dev mailing list