#from kojiweb import util
#import urllib

#include "includes/header.chtml"

  <h4>Search Results for $typeLabel matching "$terms"</h4>

  <table class="data-list">
    <tr>
      <td class="paginate" colspan="2">
        #if $len($resultPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'search?start=' + this.value * $resultRange + '$util.passthrough($self, 'order', 'terms', 'type', 'match')';">
            #for $pageNum in $resultPages
            <option value="$pageNum"#if $pageNum == $resultCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $resultStart > 0
        <a href="search?start=#echo $resultStart - $resultRange #$util.passthrough($self, 'order', 'terms', 'type', 'match')">&lt;&lt;&lt;</a>
        #end if
        #if $totalResults != 0
        <strong>Results #echo $resultStart + 1 # through #echo $resultStart + $resultCount # of $totalResults</strong>
        #end if
        #if $resultStart + $resultCount < $totalResults
        <a href="search?start=#echo $resultStart + $resultRange#$util.passthrough($self, 'order', 'terms', 'type', 'match')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
    <tr class="list-header">
      <th><a href="search?order=$util.toggleOrder($self, 'id')$util.passthrough($self, 'terms', 'type', 'match')">ID</a> $util.sortImage($self, 'id')</th>
      <th><a href="search?order=$util.toggleOrder($self, 'name')$util.passthrough($self, 'terms', 'type', 'match')">Name</a> $util.sortImage($self, 'name')</th>
    </tr>
    #if $len($results) > 0
    #for $result in $results
    <tr class="$util.rowToggle($self)">
      <td>$result.id</td>
      #set $quoted = $result.copy()
      #silent $quoted['name'] = $urllib.quote($quoted['name'])
      <td><a href="${infoURL % $quoted}">$result.name</a></td>
    </tr>
    #end for
    #else
    <tr class="row-odd">
      <td colspan="2">No search results</td>
    </tr>
    #end if
    <tr>
      <td class="paginate" colspan="2">
        #if $len($resultPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'search?start=' + this.value * $resultRange + '$util.passthrough($self, 'order', 'terms', 'type', 'match')';">
            #for $pageNum in $resultPages
            <option value="$pageNum"#if $pageNum == $resultCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $resultStart > 0
        <a href="search?start=#echo $resultStart - $resultRange #$util.passthrough($self, 'order', 'terms', 'type', 'match')">&lt;&lt;&lt;</a>
        #end if
        #if $totalResults != 0
        <strong>Results #echo $resultStart + 1 # through #echo $resultStart + $resultCount # of $totalResults</strong>
        #end if
        #if $resultStart + $resultCount < $totalResults
        <a href="search?start=#echo $resultStart + $resultRange#$util.passthrough($self, 'order', 'terms', 'type', 'match')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
  </table>

#include "includes/footer.chtml"
