Search form layout overhaul

* Always show advanced search criteria.

* Rearrange filter criteria (list filters first, list sorting and
  pagination options behind).

* HTML cleanup.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: canyonknight <canyonknight@gmail.com>
This commit is contained in:
Lukas Fleischer 2012-05-23 13:46:14 -04:00
parent 0d05a26a5a
commit 941f310068

View file

@ -1,126 +1,128 @@
<?php include_once('pkgfuncs.inc.php') ?> <?php
include_once('pkgfuncs.inc.php');
<div class='pgbox'> $searchby = array(
<form action='packages.php' method='get'> 'nd' => __('Name, Description'),
'n' => __('Name Only'),
'x' => __('Exact name'),
'm' => __('Maintainer'),
's' => __('Submitter')
);
$outdated_flags = array(
'' => __('All'),
'on' => __('Flagged'),
'off' => __('Not Flagged')
);
$sortby = array(
'n' => __('Name'),
'c' => __('Category'),
'v' => __('Votes'),
'w' => __('Voted'),
'o' => __('Notify'),
'm' => __('Maintainer'),
'a' => __('Age')
);
$orderby = array(
'a' => __('Ascending'),
'd' => __('Descending')
);
$pages = array(50, 100, 250);
?>
<div id="pkglist-search" class="box filter-criteria">
<h2><?php print __("Search Criteria"); ?></h2> <h2><?php print __("Search Criteria"); ?></h2>
<div>
<input type='hidden' name='O' value='0' />
<input type='text' name='K' size='30' value="<?php if (isset($_REQUEST["K"])) { print stripslashes(trim(htmlspecialchars($_REQUEST["K"], ENT_QUOTES))); } ?>" maxlength='35' />
<input type='submit' style='min-width:80px' class='button' name='do_Search' value='<?php print __("Go"); ?>' />
<?php if (!empty($_GET['detail'])): ?>
<input type='submit' style='min-width:80px' class='button' name='do_Orphans' value='<?php print __("Orphans"); ?>' />
<?php endif; ?>
<a href="?<?php print mkurl('detail=' . ((!empty($_GET['detail'])) ? 0 : 1) ) ?>"><?php print __("Advanced"); ?></a>
</div>
<?php if (!empty($_GET['detail'])): ?> <form action='packages.php' method='get'>
<div id="advanced-search" class="blue"> <p><input type='hidden' name='O' value='0' /></p>
<input type="hidden" name="detail" value="1" />
<ul> <fieldset>
<li> <legend><?php echo __('Enter search criteria') ?></legend>
<label><?php print __("Category"); ?></label> <div>
<select name='C'> <label for="id_category"><?php print __("Category"); ?></label>
<option value='0'><?php print __("Any"); ?></option> <select name='C' id="id_category">
<?php <option value='0'><?php print __("Any"); ?></option>
foreach (pkgCategories() as $id => $cat): <?php foreach (pkgCategories() as $id => $cat): ?>
if (isset($_REQUEST['C']) && $_REQUEST['C'] == $id): <?php if (isset($_REQUEST['C']) && $_REQUEST['C'] == $id): ?>
?> <option value="<?php print $id ?>" selected="selected"><?php print $cat; ?></option>
<option value="<?php print $id ?>" selected="selected"><?php print $cat; ?></option> <?php else: ?>
<?php else: ?> <option value="<?php print $id ?>"><?php print $cat; ?></option>
<option value="<?php print $id ?>"><?php print $cat; ?></option> <?php endif; ?>
<?php <?php endforeach; ?>
endif; </select>
endforeach; </div>
?> <div>
</select> <label for="id_method"><?php print __("Search by"); ?></label>
</li> <select name='SeB'>
<li> <?php foreach ($searchby as $k => $v): ?>
<label><?php print __("Search by"); ?></label> <?php if (isset($_REQUEST['SeB']) && $_REQUEST['SeB'] == $k): ?>
<select name='SeB'> <option value="<?php print $k; ?>" selected="selected"><?php print $v; ?></option>
<?php <?php else: ?>
$searchby = array('nd' => __('Name, Description'), 'n' => __('Name Only'), 'x' => __('Exact name'), 'm' => __('Maintainer'), 's' => __('Submitter')); <option value="<?php print $k; ?>"><?php print $v; ?></option>
foreach ($searchby as $k => $v): <?php endif; ?>
if (isset($_REQUEST['SeB']) && $_REQUEST['SeB'] == $k): <?php endforeach; ?>
?> </select>
<option value="<?php print $k; ?>" selected="selected"><?php print $v; ?></option> </div>
<?php else: ?> <div>
<option value="<?php print $k; ?>"><?php print $v; ?></option> <label for="id_q"><?php print __("Keywords"); ?></label>
<?php <input type='text' name='K' size='30' value="<?php if (isset($_REQUEST["K"])) { print stripslashes(trim(htmlspecialchars($_REQUEST["K"], ENT_QUOTES))); } ?>" maxlength='35' />
endif; </div>
endforeach; <div>
?> <label for="id_out_of_date"><?php echo __('Out of Date'); ?></label>
</select> <select name='outdated'>
</li> <?php foreach ($outdated_flags as $k => $v): ?>
<li> <?php if (isset($_REQUEST['outdated']) && $_REQUEST['outdated'] == $k): ?>
<label><?php print __("Sort by"); ?></label> <option value='<?php print $k; ?>' selected="selected"><?php print $v; ?></option>
<select name='SB'> <?php else: ?>
<?php <option value='<?php print $k; ?>'><?php print $v; ?></option>
$sortby = array('n' => __('Name'), 'c' => __('Category'), 'v' => __('Votes'), 'w' => __('Voted'), 'o' => __('Notify'), 'm' => __('Maintainer'), 'a' => __('Age')); <?php endif; ?>
foreach ($sortby as $k => $v): <?php endforeach; ?>
if (isset($_REQUEST['SB']) && $_REQUEST['SB'] == $k): </select>
?> </div>
<option value='<?php print $k; ?>' selected="selected"><?php print $v; ?></option> <div>
<?php else: ?> <label for="id_sort_by"><?php print __("Sort by"); ?></label>
<option value='<?php print $k; ?>'><?php print $v; ?></option> <select name='SB'>
<?php <?php foreach ($sortby as $k => $v): ?>
endif; <?php if (isset($_REQUEST['SB']) && $_REQUEST['SB'] == $k): ?>
endforeach; <option value='<?php print $k; ?>' selected="selected"><?php print $v; ?></option>
?> <?php else: ?>
</select> <option value='<?php print $k; ?>'><?php print $v; ?></option>
</li> <?php endif; ?>
<li> <?php endforeach; ?>
<label><?php print __("Sort order"); ?></label> </select>
<select name='SO'> </div>
<?php <div>
$orderby = array('a' => __('Ascending'), 'd' => __('Descending')); <label for="id_order_by"><?php print __("Sort order"); ?></label>
foreach ($orderby as $k => $v): <select name='SO'>
if (isset($_REQUEST['SO']) && $_REQUEST['SO'] == $k): <?php foreach ($orderby as $k => $v): ?>
?> <?php if (isset($_REQUEST['SO']) && $_REQUEST['SO'] == $k): ?>
<option value='<?php print $k; ?>' selected="selected"><?php print $v; ?></option> <option value='<?php print $k; ?>' selected="selected"><?php print $v; ?></option>
<?php else: ?> <?php else: ?>
<option value='<?php print $k; ?>'><?php print $v; ?></option> <option value='<?php print $k; ?>'><?php print $v; ?></option>
<?php <?php endif; ?>
endif; <?php endforeach; ?>
endforeach; </select>
?> </div>
</select> <div>
</li> <label for="id_per_page"><?php print __("Per page"); ?></label>
<li> <select name='PP'>
<label><?php print __("Per page"); ?></label> <?php foreach ($pages as $i): ?>
<select name='PP'> <?php if (isset($_REQUEST['PP']) && $_REQUEST['PP'] == $i): ?>
<?php <option value="<?php print $i; ?>" selected="selected"><?php print $i; ?></option>
$pages = array(50, 100, 250); <?php else: ?>
foreach ($pages as $i): <option value="<?php print $i; ?>"><?php print $i; ?></option>
if (isset($_REQUEST['PP']) && $_REQUEST['PP'] == $i): <?php endif; ?>
?> <?php endforeach; ?>
<option value="<?php print $i; ?>" selected="selected"><?php print $i; ?></option> </select>
<?php else: ?> </div>
<option value="<?php print $i; ?>"><?php print $i; ?></option> <div>
<?php <label>&nbsp;</label>
endif; <input type='submit' class='button' name='do_Search' value='<?php print __("Go"); ?>' />
endforeach; <input type='submit' class='button' name='do_Orphans' value='<?php print __("Orphans"); ?>' />
?> </div>
</select> </fieldset>
</li>
<li>
<label><?php echo __('Out of Date'); ?></label>
<select name='outdated'>
<?php
$outdated_flags = array('' => __('All'), 'on' => __('Flagged'), 'off' => __('Not Flagged'));
foreach ($outdated_flags as $k => $v):
if (isset($_REQUEST['outdated']) && $_REQUEST['outdated'] == $k):
?>
<option value='<?php print $k; ?>' selected="selected"><?php print $v; ?></option>
<?php else: ?>
<option value='<?php print $k; ?>'><?php print $v; ?></option>
<?php
endif;
endforeach;
?>
</select>
</li>
</ul>
</div>
<?php endif; ?>
</form> </form>
</div> </div>