#from kojiweb import util

#include "includes/header.chtml"

  <h4>Users#if $prefix then ' starting with "%s"' % $prefix else ''#</h4>
  <table class="data-list">
    <tr>
      <td class="charlist" colspan="5">
        #for $char in $chars
        #if $prefix == $char
        <strong>$char</strong>
        #else
        <a href="users?prefix=$char$util.passthrough($self, 'order')">$char</a>
        #end if
        | 
        #end for
        #if $prefix
        <a href="users?${util.passthrough($self, 'order')[1:]}">all</a>
        #else
        <strong>all</strong>
        #end if
      </td>
    </tr>
    <tr>
      <td class="paginate" colspan="5">
        #if $len($userPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'users?start=' + this.value * $userRange + '$util.passthrough($self, 'order', 'prefix')';">
            #for $pageNum in $userPages
            <option value="$pageNum"#if $pageNum == $userCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $userStart > 0
        <a href="users?start=#echo $userStart - $userRange #$util.passthrough($self, 'order', 'prefix')">&lt;&lt;&lt;</a>
        #end if
        #if $totalUsers != 0
        <strong>Users #echo $userStart + 1 # through #echo $userStart + $userCount # of $totalUsers</strong>
        #end if
        #if $userStart + $userCount < $totalUsers
        <a href="users?start=#echo $userStart + $userRange#$util.passthrough($self, 'order', 'prefix')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
    <tr class="list-header">
      <th><a href="users?order=$util.toggleOrder($self, 'id')$util.passthrough($self, 'prefix')">ID</a> $util.sortImage($self, 'id')</th>
      <th><a href="users?order=$util.toggleOrder($self, 'name')$util.passthrough($self, 'prefix')">Name</a> $util.sortImage($self, 'name')</th>
      <th>Packages</th>
      <th>Builds</th>
      <th>Tasks</th>
    </tr>
    #if $len($users) > 0
      #for $user in $users
        <tr class="$util.rowToggle($self)">
          <td>$user.id</td>
          <td><a href="userinfo?userID=$user.name">$user.name</a></td>
          <td><a href="packages?userID=$user.name">view</a></td>
          <td><a href="builds?userID=$user.name">view</a></td>
          <td><a href="tasks?owner=$user.name">view</a></td>
        </tr>
      #end for
    #else
      <tr class="row-odd">
        <td colspan="5">No users</td>
      </tr>
    #end if
    <tr>
      <td class="paginate" colspan="5">
        #if $len($userPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'users?start=' + this.value * $userRange + '$util.passthrough($self, 'order', 'prefix')';">
            #for $pageNum in $userPages
            <option value="$pageNum"#if $pageNum == $userCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $userStart > 0
        <a href="users?start=#echo $userStart - $userRange #$util.passthrough($self, 'order', 'prefix')">&lt;&lt;&lt;</a>
        #end if
        #if $totalUsers != 0
        <strong>Users #echo $userStart + 1 # through #echo $userStart + $userCount # of $totalUsers</strong>
        #end if
        #if $userStart + $userCount < $totalUsers
        <a href="users?start=#echo $userStart + $userRange#$util.passthrough($self, 'order', 'prefix')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
  </table>

#include "includes/footer.chtml"
