Add Previous and Next links for search results.

Move things around at the bottom of the search results page.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Loui Chang 2009-01-23 15:02:49 -05:00
parent 1e9147a352
commit 03edceff50

View file

@ -1,15 +1,8 @@
<form action='packages.php?<?php print $_SERVER['QUERY_STRING'] ?>' method='post'> <form action='packages.php?<?php print $_SERVER['QUERY_STRING'] ?>' method='post'>
<center> <div class="pgbox">
<div class="pgboxtitle" align='right'>
<table cellspacing='3' class='boxSoft'>
<tr>
<td class='boxSoftTitle' align='right'>
<span class='f3'><?php print __("Package Listing") ?></span> <span class='f3'><?php print __("Package Listing") ?></span>
</td> </div>
</tr>
<tr>
<td class='boxSoft'>
<table width='100%' cellspacing='0' cellpadding='2'>
<?php if (!$result) { ?> <?php if (!$result) { ?>
<div class='pgboxbody'><?php print __("Error retrieving package list.") ?></div> <div class='pgboxbody'><?php print __("Error retrieving package list.") ?></div>
@ -17,6 +10,7 @@
<div class='pgboxbody'><?php print __("No packages matched your search criteria.") ?></div> <div class='pgboxbody'><?php print __("No packages matched your search criteria.") ?></div>
<?php } else { ?> <?php } else { ?>
<table width='100%' cellspacing='0' cellpadding='2'>
<tr> <tr>
<?php if ($SID): ?> <?php if ($SID): ?>
<th style='border-bottom: #666 1px solid; vertical-align: bottom'>&nbsp;</th> <th style='border-bottom: #666 1px solid; vertical-align: bottom'>&nbsp;</th>
@ -83,43 +77,42 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
</tr> </tr>
<?php } ?> <?php } ?>
</table> </table>
</td>
</tr>
</table>
<?php if ($SID): ?>
<div style='text-align: right; padding: 5px 5% 5px 0'>
<select name='action'>
<option><?php print __("Actions") ?></option>
<option value='do_Flag'><?php print __("Flag Out-of-date") ?></option>
<option value='do_UnFlag'><?php print __("Unflag Out-of-date") ?></option>
<option value='do_Adopt'><?php print __("Adopt Packages") ?></option>
<option value='do_Disown'><?php print __("Disown Packages") ?></option>
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
<option value='do_Delete'><?php print __("Delete Packages") ?></option>
<?php endif; ?>
<option value='do_Notify'><?php print __("Notify") ?></option>
<option value='do_UnNotify'><?php print __("UnNotify") ?></option>
</select>
<input type='submit' class='button' style='width: 80px' value='<?php print __("Go") ?>' />
</div> </div>
<?php endif; ?>
<table width='90%' cellspacing='0' cellpadding='2'>
<div class="pgbox">
<table width='100%'>
<tr> <tr>
<td> <td align='left'>
<table border='0' cellpadding='0' cellspacing='0' width='100%'> <div>
<tr> <span class='f3'><?php echo __('Legend') ?>
<td colspan='2' align='center'> <span class="outofdate"><?php print __('Out of Date') ?></span>
<span class='f3'> </span>
<?php echo __('Legend') ?> </div>
<span class="outofdate"><?php print __('Out of Date') ?></span> <?php if ($SID): ?>
</span></td> <div>
<tr><td align='center' colspan='0'><span class='f4'><span class='blue'> <select name='action'>
<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?> <option><?php print __("Actions") ?></option>
</span></span></td></tr> <option value='do_Flag'><?php print __("Flag Out-of-date") ?></option>
</tr> <option value='do_UnFlag'><?php print __("Unflag Out-of-date") ?></option>
<option value='do_Adopt'><?php print __("Adopt Packages") ?></option>
<option value='do_Disown'><?php print __("Disown Packages") ?></option>
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
<option value='do_Delete'><?php print __("Delete Packages") ?></option>
<?php endif; ?>
<option value='do_Notify'><?php print __("Notify") ?></option>
<option value='do_UnNotify'><?php print __("UnNotify") ?></option>
</select>
<input type='submit' class='button' style='width: 80px' value='<?php print __("Go") ?>' />
</div>
<?php endif; ?>
</td>
<td align='right'><span class='f4'><span class='blue'>
<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?>
</span></span>
<br />
<?php <?php
if ($_GET['PP'] > 0) { if ($_GET['PP'] > 0) {
$pages = ceil($total / $_GET['PP']); $pages = ceil($total / $_GET['PP']);
@ -128,8 +121,6 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
if ($pages > 1) { if ($pages > 1) {
?> ?>
<tr>
<td align='center' width='100%'>
<?php <?php
if ($_GET['O'] > 0) { if ($_GET['O'] > 0) {
$currentpage = ceil(($_GET['O'] + 1) / $_GET['PP']); $currentpage = ceil(($_GET['O'] + 1) / $_GET['PP']);
@ -156,7 +147,23 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
<?php else : print "[$i] "; <?php else : print "[$i] ";
endif; endif;
} }
?> ?>
<?php
if ($_GET['O'] > 0):
$O = $_GET['O'] - $_GET['PP'];
if ($_GET['O'] < $_GET['PP']) {
$O = 0;
}
?>
<a href="packages.php?<?php print mkurl("O=$O") ?>"><?php echo __('Previous') ?></a>
<?php endif; ?>
<?php if ($total - $_GET['PP'] - $_GET['O'] > 0): ?>
<a href='packages.php?<?php print mkurl('O=' . ($_GET['O'] + $_GET['PP'])) ?>'><?php echo __('Next') ?></a>
<?php endif; ?>
</td> </td>
</tr> </tr>
@ -164,11 +171,7 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
} }
} }
?> ?>
</table>
</table> </div>
</td>
</tr>
</table>
</center>
</form> </form>