#from kojiweb import util

#include "includes/header.chtml"

  <h4>Tags</h4>
  <table class="data-list">
    <tr>
      <td class="paginate" colspan="2">
        #if $len($tagPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'tags?start=' + this.value * $tagRange + '$util.passthrough($self, 'userID', 'tagID', 'order', 'childID')';">
            #for $pageNum in $tagPages
            <option value="$pageNum"#if $pageNum == $tagCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $tagStart > 0
        <a href="tags?start=#echo $tagStart - $tagRange #$util.passthrough($self, 'userID', 'tagID', 'order', 'childID')">&lt;&lt;&lt;</a>
        #end if
        #if $totalTags != 0
        <strong>Tags #echo $tagStart + 1 # through #echo $tagStart + $tagCount # of $totalTags</strong>
        #end if
        #if $tagStart + $tagCount < $totalTags
        <a href="tags?start=#echo $tagStart + $tagRange#$util.passthrough($self, 'userID', 'tagID', 'order', 'childID')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
    <tr class="list-header">
      <th><a href="tags?order=$util.toggleOrder($self, 'id')">ID</a> $util.sortImage($self, 'id')</th>
      <th><a href="tags?order=$util.toggleOrder($self, 'name')">Name</a> $util.sortImage($self, 'name')</th>
    </tr>
    #if $len($tags) > 0
      #for $tag in $tags
        <tr class="$util.rowToggle($self)">
          <td>$tag.id</td>
          <td><a href="taginfo?tagID=$tag.id$util.passthrough($self, 'childID')">$tag.name</a></td>
        </tr>
      #end for
    #else
      <tr class="row-odd">
        <td colspan="2">No tags</td>
      </tr>
    #end if
    <tr>
      <td class="paginate" colspan="2">
        #if $len($tagPages) > 1
        <form class="pageJump" action="">
          Page:
          <select onchange="javascript: window.location = 'tags?start=' + this.value * $tagRange + '$util.passthrough($self, 'userID', 'tagID', 'order', 'childID')';">
            #for $pageNum in $tagPages
            <option value="$pageNum"#if $pageNum == $tagCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
            #end for
          </select>
        </form>
        #end if
        #if $tagStart > 0
        <a href="tags?start=#echo $tagStart - $tagRange #$util.passthrough($self, 'userID', 'tagID', 'order', 'childID')">&lt;&lt;&lt;</a>
        #end if
        #if $totalTags != 0
        <strong>Tags #echo $tagStart + 1 # through #echo $tagStart + $tagCount # of $totalTags</strong>
        #end if
        #if $tagStart + $tagCount < $totalTags
        <a href="tags?start=#echo $tagStart + $tagRange#$util.passthrough($self, 'userID', 'tagID', 'order', 'childID')">&gt;&gt;&gt;</a>
        #end if
      </td>
    </tr>
  </table>

  #if 'admin' in $perms
  <br/>
  <a href="tagcreate$util.authToken($self, first=True)">Create new Tag</a>
  #end if

#include "includes/footer.chtml"
