[aur-dev] [PATCH 3/4] pkg_search_results.php: Split out package results box

Lukas Fleischer lfleischer at archlinux.org
Fri Feb 3 23:50:31 UTC 2017


Do not print the wrapper div container when calling pkg_search_page().

Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 web/html/packages.php               |   2 +
 web/template/pkg_search_results.php | 174 ++++++++++++++++++------------------
 2 files changed, 88 insertions(+), 88 deletions(-)

diff --git a/web/html/packages.php b/web/html/packages.php
index ec6fc75..113a114 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -98,11 +98,13 @@ if (isset($pkgid)) {
 		$_GET['SB'] = 'p';
 		$_GET['SO'] = 'd';
 	}
+	echo '<div id="pkglist-results" class="box">';
 	if (isset($_COOKIE["AURSID"])) {
 		pkg_search_page($_GET, true, $_COOKIE["AURSID"]);
 	} else {
 		pkg_search_page($_GET, true);
 	}
+	echo '</div>';
 }
 
 html_footer(AURWEB_VERSION);
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index 7b6b00a..d596ec2 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -1,52 +1,51 @@
 <?php
 if (!$result): ?>
-	<div class="box"><p><?= __("Error retrieving package list.") ?></p></div>
+	<p><?= __("Error retrieving package list.") ?></p>
 <?php elseif ($total == 0): ?>
-	<div class="box"><p><?= __("No packages matched your search criteria.") ?></p></div>
+	<p><?= __("No packages matched your search criteria.") ?></p>
 <?php else: ?>
-	<div id="pkglist-results" class="box">
-		<?php if ($show_headers): ?>
-		<div class="pkglist-stats">
-			<p>
-				<?= _n('%d package found.', '%d packages found.', $total) ?>
-				<?= __('Page %d of %d.', $current, $pages) ?>
-			</p>
-			<?php if (count($templ_pages) > 1): ?>
-			<p class="pkglist-nav">
-				<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
-					<?php if ($pagestart === false): ?>
-						<span class="page"><?= $pagenr ?></span>
-					<?php elseif ($pagestart + 1 == $first): ?>
-						<span class="page"><?= $pagenr ?></span>
-					<?php else: ?>
-						<a class="page" href="<?= get_uri('/packages/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
-					<?php endif; ?>
-				<?php endforeach; ?>
-			</p>
-			<?php endif; ?>
-		</div>
+	<?php if ($show_headers): ?>
+	<div class="pkglist-stats">
+		<p>
+			<?= _n('%d package found.', '%d packages found.', $total) ?>
+			<?= __('Page %d of %d.', $current, $pages) ?>
+		</p>
+		<?php if (count($templ_pages) > 1): ?>
+		<p class="pkglist-nav">
+			<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
+				<?php if ($pagestart === false): ?>
+					<span class="page"><?= $pagenr ?></span>
+				<?php elseif ($pagestart + 1 == $first): ?>
+					<span class="page"><?= $pagenr ?></span>
+				<?php else: ?>
+					<a class="page" href="<?= get_uri('/packages/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
+				<?php endif; ?>
+			<?php endforeach; ?>
+		</p>
 		<?php endif; ?>
+	</div>
+	<?php endif; ?>
 
-		<form id="pkglist-results-form" method="post" action="<?= get_uri('/pkgbase/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
-			<table class="results">
-			<thead>
-				<tr>
-					<?php if ($SID && $show_headers): ?>
-					<th> </th>
-					<?php endif; ?>
-					<th><a href="?<?= mkurl('SB=n&SO=' . $SO_next) ?>"><?= __("Name") ?></a></th>
-					<th><?= __("Version") ?></th>
-					<th><a href="?<?= mkurl('SB=v&SO=' . $SO_next) ?>"><?= __("Votes") ?></a></th>
-					<th><a href="?<?= mkurl('SB=p&SO=' . $SO_next) ?>"><?= __("Popularity") ?></a><span title="<?= __('Popularity is calculated as the sum of all votes with each vote being weighted with a factor of %.2f per day since its creation.', 0.98) ?>" class="hover-help"><sup>?</sup></span></th>
-					<?php if ($SID): ?>
-					<th><a href="?<?= mkurl('SB=w&SO=' . $SO_next) ?>"><?= __("Voted") ?></a></th>
-					<th><a href="?<?= mkurl('SB=o&SO=' . $SO_next) ?>"><?= __("Notify") ?></a></th>
-					<?php endif; ?>
-					<th><?= __("Description") ?></th>
-					<th><a href="?<?= mkurl('SB=m&SO=' . $SO_next) ?>"><?= __("Maintainer") ?></a></th>
-				</tr>
-			</thead>
-			<tbody>
+	<form id="pkglist-results-form" method="post" action="<?= get_uri('/pkgbase/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
+		<table class="results">
+		<thead>
+			<tr>
+				<?php if ($SID && $show_headers): ?>
+				<th> </th>
+				<?php endif; ?>
+				<th><a href="?<?= mkurl('SB=n&SO=' . $SO_next) ?>"><?= __("Name") ?></a></th>
+				<th><?= __("Version") ?></th>
+				<th><a href="?<?= mkurl('SB=v&SO=' . $SO_next) ?>"><?= __("Votes") ?></a></th>
+				<th><a href="?<?= mkurl('SB=p&SO=' . $SO_next) ?>"><?= __("Popularity") ?></a><span title="<?= __('Popularity is calculated as the sum of all votes with each vote being weighted with a factor of %.2f per day since its creation.', 0.98) ?>" class="hover-help"><sup>?</sup></span></th>
+				<?php if ($SID): ?>
+				<th><a href="?<?= mkurl('SB=w&SO=' . $SO_next) ?>"><?= __("Voted") ?></a></th>
+				<th><a href="?<?= mkurl('SB=o&SO=' . $SO_next) ?>"><?= __("Notify") ?></a></th>
+				<?php endif; ?>
+				<th><?= __("Description") ?></th>
+				<th><a href="?<?= mkurl('SB=m&SO=' . $SO_next) ?>"><?= __("Maintainer") ?></a></th>
+			</tr>
+		</thead>
+		<tbody>
 
 	<?php while (list($indx, $row) = each($searchresults)): ?>
 		<tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>">
@@ -84,53 +83,52 @@ if (!$result): ?>
 	</tr>
 	<?php endwhile; ?>
 
-			</tbody>
-			</table>
+		</tbody>
+		</table>
 
-			<?php if ($show_headers): ?>
-			<div class="pkglist-stats">
-				<p>
-					<?= _n('%d package found.', '%d packages found.', $total) ?>
-					<?= __('Page %d of %d.', $current, $pages) ?>
-				</p>
-				<?php if (count($templ_pages) > 1): ?>
-				<p class="pkglist-nav">
-					<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
-						<?php if ($pagestart === false): ?>
-							<span class="page"><?= $pagenr ?></span>
-						<?php elseif ($pagestart + 1 == $first): ?>
-							<span class="page"><?= $pagenr ?></span>
-						<?php else: ?>
-							<a class="page" href="<?= get_uri('/packages/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
-						<?php endif; ?>
-					<?php endforeach; ?>
-				</p>
-				<?php endif; ?>
-			</div>
+		<?php if ($show_headers): ?>
+		<div class="pkglist-stats">
+			<p>
+				<?= _n('%d package found.', '%d packages found.', $total) ?>
+				<?= __('Page %d of %d.', $current, $pages) ?>
+			</p>
+			<?php if (count($templ_pages) > 1): ?>
+			<p class="pkglist-nav">
+				<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
+					<?php if ($pagestart === false): ?>
+						<span class="page"><?= $pagenr ?></span>
+					<?php elseif ($pagestart + 1 == $first): ?>
+						<span class="page"><?= $pagenr ?></span>
+					<?php else: ?>
+						<a class="page" href="<?= get_uri('/packages/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
+					<?php endif; ?>
+				<?php endforeach; ?>
+			</p>
+			<?php endif; ?>
+		</div>
 
-			<?php if ($SID): ?>
-				<p>
-					<select name="action">
-						<option><?= __("Actions") ?></option>
-						<option value="do_UnFlag"><?= __("Unflag Out-of-date") ?></option>
-						<option value="do_Adopt"><?= __("Adopt Packages") ?></option>
-						<option value="do_Disown"><?= __("Disown Packages") ?></option>
-						<?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
-						<option value="do_Delete"><?= __("Delete Packages") ?></option>
-						<?php endif; ?>
-						<option value="do_Notify"><?= __("Notify") ?></option>
-						<option value="do_UnNotify"><?= __("UnNotify") ?></option>
-					</select>
+		<?php if ($SID): ?>
+			<p>
+				<select name="action">
+					<option><?= __("Actions") ?></option>
+					<option value="do_UnFlag"><?= __("Unflag Out-of-date") ?></option>
+					<option value="do_Adopt"><?= __("Adopt Packages") ?></option>
+					<option value="do_Disown"><?= __("Disown Packages") ?></option>
 					<?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
-						<label for="merge_Into"><?= __("Merge into") ?></label>
-						<input type="text" id="merge_Into" name="merge_Into" />
+					<option value="do_Delete"><?= __("Delete Packages") ?></option>
 					<?php endif; ?>
-					<label class="confirmation"><input type="checkbox" name="confirm" value="1" /> <?= __("Confirm") ?></label>
-					<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
-					<input type="submit" class="button" style="width: 80px" value="<?= __("Go") ?>" />
-				</p>
-			<?php endif; # if ($SID) ?>
-			<?php endif; ?>
-		</form>
-	</div>
+					<option value="do_Notify"><?= __("Notify") ?></option>
+					<option value="do_UnNotify"><?= __("UnNotify") ?></option>
+				</select>
+				<?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
+					<label for="merge_Into"><?= __("Merge into") ?></label>
+					<input type="text" id="merge_Into" name="merge_Into" />
+				<?php endif; ?>
+				<label class="confirmation"><input type="checkbox" name="confirm" value="1" /> <?= __("Confirm") ?></label>
+				<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
+				<input type="submit" class="button" style="width: 80px" value="<?= __("Go") ?>" />
+			</p>
+		<?php endif; # if ($SID) ?>
+		<?php endif; ?>
+	</form>
 <?php endif; # search was successful and returned multiple results ?>
-- 
2.11.1


More information about the aur-dev mailing list