#from kojiweb import util

#include "includes/header.chtml"

  <h4>Tasks by Host#if $hostArch then ' (%s)' % $hostArch else ''#</h4>
  <table class="data-list">
    <tr>
      <td class="archlist" colspan="3">
        <strong>Host arch:</strong> #for $arch in $hostArchList
        #if $arch == $hostArch
        <strong>$arch</strong> |
        #else
        <a href="tasksbyhost?hostArch=$arch$util.passthrough($self, 'order')">$arch</a> |
        #end if
        #end for
        #if $hostArch
        <a href="tasksbyhost?${util.passthrough($self, 'order')[1:]}">all</a>
        #else
        <strong>all</strong>
        #end if
      </td>
    </tr>
    <tr>
      <td class="paginate" colspan="3">
        #if $len($hostPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'tasksbyhost?start=' + this.value * $hostRange + '$util.passthrough($self, 'order', 'hostArch')';">
            #for $pageNum in $hostPages
            <option value="$pageNum"#if $pageNum == $hostCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $hostStart > 0
        <a href="tasksbyhost?start=#echo $hostStart - $hostRange #$util.passthrough($self, 'order', 'hostArch')">&lt;&lt;&lt;</a>
        #end if
        #if $totalHosts != 0
        <strong>Hosts #echo $hostStart + 1 # through #echo $hostStart + $hostCount # of $totalHosts</strong>
        #end if
        #if $hostStart + $hostCount < $totalHosts
        <a href="tasksbyhost?start=#echo $hostStart + $hostRange#$util.passthrough($self, 'order', 'hostArch')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
    <tr class="list-header">
      <th><a href="tasksbyhost?order=$util.toggleOrder($self, 'name')$util.passthrough($self, 'hostArch')">Name</a> $util.sortImage($self, 'name')</th>
      <th><a href="tasksbyhost?order=$util.toggleOrder($self, 'tasks')$util.passthrough($self, 'hostArch')">Tasks</a> $util.sortImage($self, 'tasks')</th>
      <th>&nbsp;</th>
    </tr>
    #if $len($hosts) > 0
    #for $host in $hosts
    <tr class="$util.rowToggle($self)">
      <td><a href="hostinfo?hostID=$host.id">$host.name</a></td>
      <td width="#echo $graphWidth + 5#"><img src="$util.themePath('images/1px.gif')" width="#echo $increment * $host.tasks#" height="15" class="graphrow" alt="graph row"/></td>
      <td>$host.tasks</td>
    </tr>
    #end for
    #else
    <tr class="row-odd">
      <td colspan="3">No hosts</td>
    </tr>
    #end if
    <tr>
      <td class="paginate" colspan="3">
        #if $len($hostPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'tasksbyhost?start=' + this.value * $hostRange + '$util.passthrough($self, 'order', 'hostArch')';">
            #for $pageNum in $hostPages
            <option value="$pageNum"#if $pageNum == $hostCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $hostStart > 0
        <a href="tasksbyhost?start=#echo $hostStart - $hostRange #$util.passthrough($self, 'order', 'hostArch')">&lt;&lt;&lt;</a>
        #end if
        #if $totalHosts != 0
        <strong>Hosts #echo $hostStart + 1 # through #echo $hostStart + $hostCount # of $totalHosts</strong>
        #end if
        #if $hostStart + $hostCount < $totalHosts
        <a href="tasksbyhost?start=#echo $hostStart + $hostRange#$util.passthrough($self, 'order', 'hostArch')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
  </table>

#include "includes/footer.chtml"
