#from kojiweb import util

#include "includes/header.chtml"

  <h4>Build Targets</h4>
  <table class="data-list">
    <tr>
      <td class="paginate" colspan="2">
        #if $len($targetPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'buildtargets?start=' + this.value * $targetRange + '$util.passthrough($self, 'order')';">
            #for $pageNum in $targetPages
            <option value="$pageNum"#if $pageNum == $targetCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $targetStart > 0
        <a href="buildtargets?start=#echo $targetStart - $targetRange #$util.passthrough($self, 'order')">&lt;&lt;&lt;</a>
        #end if
        #if $totalTargets != 0
        <strong>Targets #echo $targetStart + 1 # through #echo $targetStart + $targetCount # of $totalTargets</strong>
        #end if
        #if $targetStart + $targetCount < $totalTargets
        <a href="buildtargets?start=#echo $targetStart + $targetRange#$util.passthrough($self, 'order')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
    <tr class="list-header">
      <th><a href="buildtargets?order=$util.toggleOrder($self, 'id')">ID</a> $util.sortImage($self, 'id')</th>
      <th><a href="buildtargets?order=$util.toggleOrder($self, 'name')">Name</a> $util.sortImage($self, 'name')</th>
    </tr>
    #if $len($targets) > 0
    #for $target in $targets
    <tr class="$util.rowToggle($self)">
      <td>$target.id</td>
      <td><a href="buildtargetinfo?targetID=$target.id">$target.name</a></td>
    </tr>
    #end for
    #else
    <tr class="row-odd">
      <td colspan="2">No build targets</td>
    </tr>
    #end if
    <tr>
      <td class="paginate" colspan="2">
        #if $len($targetPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'buildtargets?start=' + this.value * $targetRange + '$util.passthrough($self, 'order')';">
            #for $pageNum in $targetPages
            <option value="$pageNum"#if $pageNum == $targetCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $targetStart > 0
        <a href="buildtargets?start=#echo $targetStart - $targetRange #$util.passthrough($self, 'order')">&lt;&lt;&lt;</a>
        #end if
        #if $totalTargets != 0
        <strong>Targets #echo $targetStart + 1 # through #echo $targetStart + $targetCount # of $totalTargets</strong>
        #end if
        #if $targetStart + $targetCount < $totalTargets
        <a href="buildtargets?start=#echo $targetStart + $targetRange#$util.passthrough($self, 'order')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
  </table>
  
  #if 'admin' in $perms
  <br/>
  <a href="buildtargetcreate$util.authToken($self, first=True)">Create new Build Target</a>
  #end if

#include "includes/footer.chtml"
