Commit 2416ffea authored by canyonknight's avatar canyonknight Committed by Lukas Fleischer
Browse files

pkg_search_results.php: Overhaul to match archweb



* Change search results table to use CSS from archweb with better alternating
line contrast
* Change table results header to match archweb
* General clean-up of XHTML

Signed-off-by: default avatarcanyonknight <canyonknight@gmail.com>
Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent 99ffcfc9
......@@ -582,8 +582,8 @@ function pkg_search_page($SID="", $dbh=NULL) {
$templ_pages = array();
if ($current > 1) {
$templ_pages[__('First')] = 0;
$templ_pages[__('Previous')] = ($current - 2) * $per_page;
$templ_pages['&laquo; ' . __('First')] = 0;
$templ_pages['&lsaquo; ' . __('Previous')] = ($current - 2) * $per_page;
}
if ($current - 5 > 1)
......@@ -597,8 +597,8 @@ function pkg_search_page($SID="", $dbh=NULL) {
$templ_pages["... "] = false;
if ($current < $pages) {
$templ_pages[__('Next')] = $current * $per_page;
$templ_pages[__('Last')] = ($pages - 1) * $per_page;
$templ_pages[__('Next') . ' &rsaquo;'] = $current * $per_page;
$templ_pages[__('Last') . ' &raquo;'] = ($pages - 1) * $per_page;
}
include('pkg_search_form.php');
......
<?php if (!$result) { ?>
<div class='pgboxbody'><?php print __("Error retrieving package list.") ?></div>
<?php } elseif ($total == 0) { ?>
<div class='pgboxbody'><?php print __("No packages matched your search criteria.") ?></div>
<?php } else { ?>
<form action='packages.php?<?php echo htmlentities($_SERVER['QUERY_STRING']) ?>' method='post'>
<div class="pgbox">
<h2><?php print __("Package Listing") ?></h2>
<table class='results'>
<tr>
<?php if ($SID): ?>
<th class='header'>&nbsp;</th>
<?php endif; ?>
<th class='header'><span class='f2'>
<a href='?<?php print mkurl('SB=c&SO=' . $SO_next) ?>'><?php print __("Category") ?></a>
</span></th>
<th class='header'><span class='f2'>
<a href='?<?php print mkurl('SB=n&SO=' . $SO_next) ?>'><?php print __("Name") ?></a>
</span></th>
<th class='header'><span class='f2'>
<a href='?<?php print mkurl('SB=v&SO=' . $SO_next) ?>'><?php print __("Votes") ?></a>
</span></th>
<?php if ($SID): ?>
<th class='header'><span class='f2'>
<a href='?<?php print mkurl('SB=w&SO=' . $SO_next) ?>'><?php print __("Voted") ?></a>
</span></th>
<th class='header'><span class='f2'>
<a href='?<?php print mkurl('SB=o&SO=' . $SO_next) ?>'><?php print __("Notify") ?></a>
</span></th>
<?php endif; ?>
<th class='header'><span class='f2'><?php print __("Description") ?></span></th>
<th class='header'><span class='f2'>
<a href='?<?php print mkurl('SB=m&SO=' . $SO_next) ?>'><?php print __("Maintainer") ?></a>
</span></th>
</tr>
<?php
if (isset($_COOKIE['AURSID'])) {
$atype = account_from_sid($_COOKIE['AURSID']);
} else {
$atype = "";
}
for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
(($i % 2) == 0) ? $c = "data1" : $c = "data2";
if ($row["OutOfDateTS"] !== NULL): $c = "outofdate"; endif;
?>
<tr>
<?php if ($SID): ?>
<td class='<?php print $c ?>'><input type='checkbox' name='IDs[<?php print $row["ID"] ?>]' value='1' /></td>
<?php endif; ?>
<td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print htmlspecialchars($row["Category"]) ?></span></span></td>
<td class='<?php print $c ?>'><span class='f4'><a href='packages.php?ID=<?php print $row["ID"] ?>'><span class='black'><?php print htmlspecialchars($row["Name"]) ?> <?php print htmlspecialchars($row["Version"]) ?></span></a></span></td>
<td class='<?php print $c ?>' style="text-align: right"><span class='f5'><span class='blue'><?php print $row["NumVotes"] ?></span></span></td>
<?php if ($SID): ?>
<td class='<?php print $c ?>'><span class='f5'><span class='blue'>
<?php if (isset($row["Voted"])): ?>
<?php print __("Yes") ?></span></span></td>
<?php else: ?>
</span></span></td>
<?php endif; ?>
<td class='<?php print $c ?>'><span class='f5'><span class='blue'>
<?php if (isset($row["Notify"])): ?>
<?php print __("Yes") ?></span></span></td>
<?php else: ?>
</span></span></td>
<?php endif; ?>
<?php endif; ?>
<td class='<?php print $c ?>'><span class='f4'><span class='blue'>
<?php print htmlspecialchars($row['Description'], ENT_QUOTES); ?></span></span></td>
<td class='<?php print $c ?>'><span class='f5'><span class='blue'>
<?php if (isset($row["Maintainer"])): ?>
<a href='packages.php?K=<?php print htmlspecialchars($row['Maintainer'], ENT_QUOTES) ?>&amp;SeB=m'><?php print htmlspecialchars($row['Maintainer']) ?></a>
<?php else: ?>
<span style='color: blue; font-style: italic;'><?php print __("orphan") ?></span>
<?php endif; ?>
</span></span></td>
</tr>
<?php } ?>
</table>
</div> <!-- .pgbox ??! -->
if (!$result): ?>
<div class="box"><p><?php echo __("Error retrieving package list.") ?></p></div>
<?php elseif ($total == 0): ?>
<div class="box"><p><?php echo __("No packages matched your search criteria.") ?></p></div>
<?php else: ?>
<div id="pkglist-results" class="box">
<div id="pkglist-stats-top">
<p><?php echo __('%s Packages found. Showing %s - %s', $total, $first, $last) ?></p>
<p class="pkglist-nav">
<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
<?php if ($pagestart === false): ?>
<span class="page"><?php echo $pagenr ?></span>
<?php elseif ($pagestart + 1 == $first): ?>
<span class="page"><?php echo $pagenr ?></span>
<?php else: ?>
<a class="page" href="packages.php?<?php echo mkurl('O=' . $pagestart) ?>"><?php echo $pagenr ?></a>
<?php endif; ?>
<?php endforeach; ?>
</p>
</div>
<form id="pkglist-results-form" method="post" action="packages.php?<?php echo htmlentities($_SERVER['QUERY_STRING']) ?>">
<table class="results">
<thead>
<tr>
<?php if ($SID): ?>
<th>&nbsp;</th>
<?php endif; ?>
<th><a href="?<?php echo mkurl('SB=c&SO=' . $SO_next) ?>"><?php echo __("Category") ?></a></th>
<th><a href="?<?php echo mkurl('SB=n&SO=' . $SO_next) ?>"><?php echo __("Name") ?></a></th>
<th><a href="?<?php echo mkurl('SB=v&SO=' . $SO_next) ?>"><?php echo __("Votes") ?></a></th>
<?php if ($SID): ?>
<th><a href="?<?php echo mkurl('SB=w&SO=' . $SO_next) ?>"><?php echo __("Voted") ?></a></th>
<th><a href="?<?php echo mkurl('SB=o&SO=' . $SO_next) ?>"><?php echo __("Notify") ?></a></th>
<?php endif; ?>
<th><?php echo __("Description") ?></th>
<th><a href="?<?php echo mkurl('SB=m&SO=' . $SO_next) ?>"><?php echo __("Maintainer") ?></a></th>
</tr>
</thead>
<tbody>
<?php for ($i = 0; $row = mysql_fetch_assoc($result); $i++): ?>
<tr class="<?php echo ($i % 2 == 0) ? 'odd' : 'even' ?>">
<?php if ($SID): ?>
<td><input type="checkbox" name="IDs[<?php echo $row["ID"] ?>]" value="1" /></td>
<?php endif; ?>
<td><?php echo htmlspecialchars($row["Category"]) ?></td>
<td><a href="packages.php?ID=<?php echo $row["ID"] ?>"><?php echo htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]) ?></a></td>
<td><?php echo $row["NumVotes"] ?></td>
<?php if ($SID): ?>
<td>
<?php if (isset($row["Voted"])): ?>
<?php echo __("Yes") ?>
<?php endif; ?>
</td>
<td>
<?php if (isset($row["Notify"])): ?>
<?php echo __("Yes") ?>
<?php endif; ?>
</td>
<?php endif; ?>
<td><?php echo htmlspecialchars($row['Description'], ENT_QUOTES); ?></td>
<td>
<?php if (isset($row["Maintainer"])): ?>
<a href="packages.php?K=<?php echo htmlspecialchars($row['Maintainer'], ENT_QUOTES) ?>&amp;SeB=m"><?php echo htmlspecialchars($row['Maintainer']) ?></a>
<?php else: ?>
<span><?php echo __("orphan") ?></span>
<?php endif; ?>
</td>
</tr>
<?php endfor; ?>
</tbody>
</table>
<div id="pkglist-stats-bottom">
<p><?php echo __('%s Packages found. Showing %s - %s', $total, $first, $last) ?></p>
<p class="pkglist-nav">
<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
<?php if ($pagestart === false): ?>
<span class="page"><?php echo $pagenr ?></span>
<?php elseif ($pagestart + 1 == $first): ?>
<span class="page"><?php echo $pagenr ?></span>
<?php else: ?>
<a class="page" href="packages.php?<?php echo mkurl('O=' . $pagestart) ?>"><?php echo $pagenr ?></a>
<?php endif; ?>
<?php endforeach; ?>
</p>
</div>
<div class="pgbox pkg_search_results_footer">
<div class="legend_and_actions">
<div class="legend">
<span class='f3'><?php echo __('Legend') ?></span>
<span class="outofdate"><?php print __('Out of Date') ?></span>
</div>
<?php if ($SID): ?>
<div>
<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>
<?php if ($SID): ?>
<p>
<select name="action">
<option><?php echo __("Actions") ?></option>
<option value="do_Flag"><?php echo __("Flag Out-of-date") ?></option>
<option value="do_UnFlag"><?php echo __("Unflag Out-of-date") ?></option>
<option value="do_Adopt"><?php echo __("Adopt Packages") ?></option>
<option value="do_Disown"><?php echo __("Disown Packages") ?></option>
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
<label for='merge_Into'><?php print __("Merge into") ?></label>
<input type='text' id='merge_Into' name='merge_Into' />
<input type='checkbox' name='confirm_Delete' value='1' /> <?php print __("Confirm") ?>
<option value="do_Delete"><?php echo __("Delete Packages") ?></option>
<?php endif; ?>
<input type='submit' class='button' style='width: 80px' value='<?php print __("Go") ?>' />
</div>
<?php endif; # if ($SID) ?>
</div> <!-- .legend_and_actions -->
<div class="page_links">
<div class="f4 blue">
<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?>
</div>
<div class="page_nav">
<?php foreach($templ_pages as $pagenr => $pagestart) { ?>
<?php if ($pagestart === false) { ?>
<?php echo $pagenr ?>
<?php } else if ($pagestart + 1 == $first) { ?>
<span class="page_sel"><?php echo $pagenr ?></span>
<?php } else { ?>
<a class="page_num" href="packages.php?<?php print mkurl('O=' . ( $pagestart)) ?>"><?php echo $pagenr ?></a>
<?php } ?>
<?php } ?>
</div>
</div> <!-- .page_links -->
</div> <!-- .pgbox .pkg_search_results_footer -->
</form>
<?php } # search was successful and returned multiple results ?>
<option value="do_Notify"><?php echo __("Notify") ?></option>
<option value="do_UnNotify"><?php echo __("UnNotify") ?></option>
</select>
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
<label for="merge_Into"><?php echo __("Merge into") ?></label>
<input type="text" id="merge_Into" name="merge_Into" />
<input type="checkbox" name="confirm_Delete" value="1" /> <?php echo __("Confirm") ?>
<?php endif; ?>
<input type="submit" class="button" style="width: 80px" value="<?php echo __("Go") ?>" />
</p>
<?php endif; # if ($SID) ?>
</form>
</div>
<?php endif; # search was successful and returned multiple results ?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment