Changeset 357 for branches/stable


Ignore:
Timestamp:
02/14/07 13:03:31 (18 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Tweak complex search to allow more results on a single page, or all on
one page if *really* wanted.

Location:
branches/stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/search.cgi

    r323 r357  
    4040my %webvar = parse_post();
    4141cleanInput(\%webvar);
     42
     43if (defined($webvar{rpp})) {
     44  ($RESULTS_PER_PAGE) = ($webvar{rpp} =~ /(\d+)/);
     45}
    4246
    4347if (!defined($webvar{stype})) {
     
    185189  } else {
    186190    # Add the limit/offset clauses
    187     $sql .= " order by cidr limit $RESULTS_PER_PAGE offset $offset";
     191    $sql .= " order by cidr";
     192    $sql .= " limit $RESULTS_PER_PAGE offset $offset" if $RESULTS_PER_PAGE != 0;
    188193    # And tell the user.
    189194    print "<div class=heading>Searching...............</div>\n";
     
    420425
    421426  # print the page thing..
    422   if ($rowCount > $RESULTS_PER_PAGE) {
     427  if ($RESULTS_PER_PAGE > 0 && $rowCount > $RESULTS_PER_PAGE) {
    423428    my $pages = ceil($rowCount/$RESULTS_PER_PAGE);
    424429    print qq(<div class="center"> Page: );
  • branches/stable/compsearch.html

    r286 r357  
    66<td colspan=2>Match on:<input type=radio checked name=which value="all">All
    77<input type=radio name=which value="any">Any
    8 <td colspan=2 align=right><input type=submit value="Search Now"></td>
     8<td>Results per page: <select name=rpp>
     9<option value='25'>25</option>
     10<option value='50'>50</option>
     11<option value='100'>100</option>
     12<option value='200'>200</option>
     13<option value='0'>Show all</option>
     14</select>
     15<td align=right><input type=submit value="Search Now"></td>
    916</td>
    1017<tr class="color1">
Note: See TracChangeset for help on using the changeset viewer.