[aur-dev] [PATCH 1/5] pkg_details.php: Use a table for package details

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


Given that we only show a bunch of labels and associated details, using
a table seems reasonable here.

The CSS snippet was extracted from archweb's style sheet.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 web/html/css/containers.css  |    8 +++++
 web/template/pkg_details.php |   71 +++++++++++++++++++++++++----------------
 2 files changed, 51 insertions(+), 28 deletions(-)

diff --git a/web/html/css/containers.css b/web/html/css/containers.css
index 237950f..9f845b0 100644
--- a/web/html/css/containers.css
+++ b/web/html/css/containers.css
@@ -186,3 +186,11 @@ input[type=image] {
   background: none;
 }
 
+/* Package details */
+#pkginfo {
+  width: auto;
+}
+
+#pkginfo td {
+  padding: 0.25em 0 0.25em 1.5em;
+}
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index 880a675..c8e703c 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -8,9 +8,8 @@ if ($uid == $row["MaintainerUID"] or
 
 	$catarr = pkgCategories();
 	$edit_cat = "<form method='post' action='packages.php?ID=".$pkgid."'>\n";
-	$edit_cat.= "<p>";
+	$edit_cat.= "<div>";
 	$edit_cat.= "<input type='hidden' name='action' value='do_ChangeCategory' />";
-	$edit_cat.= "<span class='f3'>" . __("Category") . ":</span> ";
 	$edit_cat.= "<select name='category_id'>\n";
 	foreach ($catarr as $cid => $catname) {
 		$edit_cat.= "<option value='$cid'";
@@ -20,12 +19,12 @@ if ($uid == $row["MaintainerUID"] or
 		$edit_cat.=">".$catname."</option>";
 	}
 	$edit_cat.= "</select> <input type='submit' value='" . __("Change category") . "' />";
-	$edit_cat.= "</p>";
+	$edit_cat.= "</div>";
 	$edit_cat.= "</form>";
 
 }
 else {
-	$edit_cat = "<span class='f3'>" . __("Category") . ": " . $row['Category'] . "</span>";
+	$edit_cat = $row['Category'];
 }
 
 if ($row["SubmitterUID"]) {
@@ -48,7 +47,7 @@ if ($row["MaintainerUID"]) {
 	$maintainer = "None";
 }
 
-$votes = __('Votes') . ': ' . $row['NumVotes'];
+$votes = $row['NumVotes'];
 if ($atype == "Developer" or $atype == "Trusted User") {
 	$votes = "<a href=\"voters.php?ID=$pkgid\">$votes</a>";
 }
@@ -64,31 +63,47 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
 
 ?>
 <div class="pgbox">
-	<div class="pgboxtitle"><span class="f3"><?php echo __("Package Details") ?></span></div>
+	<div class="pgboxtitle"><span class="f3"><?php echo __("Package Details") . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></span></div>
 	<div class="pgboxbody">
 
-	<p>
-	<span class='f2'><?php echo htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></span><br />
-	<span class='f3'><a href="<?php echo htmlspecialchars($row['URL'], ENT_QUOTES) . '">' . $row['URL'] ?></a></span><br />
-	<span class='f3'><?php echo htmlspecialchars($row['Description'], ENT_QUOTES); ?></span>
-	</p>
-
-	<?php echo $edit_cat ?>
-
-	<p>
-	<span class='f3'><?php echo __('Submitter') .': ' . $submitter ?></span><br />
-	<span class='f3'><?php echo __('Maintainer') .': ' . $maintainer ?></span><br />
-	<span class='f3'><?php echo $votes ?></span>
-	</p>
-
-	<p><span class='f3'><?php echo __('License') . ': ' . htmlspecialchars($license) ?></span></p>
-
-	<p>
-	<span class='f3'>
-	<?php echo __('Last Updated') . ': ' . $updated_time ?><br />
-	<?php echo __('First Submitted') . ': '. $submitted_time ?>
-	</span>
-	</p>
+	<table id="pkginfo">
+		<tr>
+			<th><?php echo __('Category') . ':' ?></th>
+			<td><?php echo $edit_cat ?></td>
+		</tr>
+		<tr>
+			<th><?php echo __('Description') . ':' ?></th>
+			<td><?php echo htmlspecialchars($row['Description']) ?></td>
+		</tr>
+		<tr>
+			<th><?php echo __('Upstream URL') . ':' ?></th>
+			<td><a href="<?php echo htmlspecialchars($row['URL'], ENT_QUOTES) ?>"><?php echo htmlspecialchars($row['URL']) ?></a></td>
+		</tr>
+		<tr>
+			<th><?php echo __('License') . ':' ?></th>
+			<td><?php echo htmlspecialchars($license) ?></a></td>
+		</tr>
+		<tr>
+			<th><?php echo __('Submitter') . ':' ?></th>
+			<td><?php echo $submitter ?></td>
+		</tr>
+		<tr>
+			<th><?php echo __('Maintainer') . ':' ?></th>
+			<td><?php echo $maintainer ?></td>
+		</tr>
+		<tr>
+			<th><?php echo __('Votes') . ':' ?></th>
+			<td><?php echo $votes ?></td>
+		</tr>
+		<tr>
+			<th><?php echo __('Last Updated') . ':' ?></th>
+			<td><?php echo $updated_time ?></td>
+		</tr>
+		<tr>
+			<th><?php echo __('First Submitted') . ':' ?></th>
+			<td><?php echo $submitted_time ?></td>
+		</tr>
+	</table>
 
 	<p><span class='f3'>
 <?php
-- 
1.7.7.2



More information about the aur-dev mailing list