#import koji
#from kojiweb import util
#from pprint import pformat
#import urllib

#attr _PASSTHROUGH = ['archiveID', 'fileOrder', 'fileStart', 'buildrootOrder', 'buildrootStart']

#include "includes/header.chtml"
  <h4>Information for archive <a href="archiveinfo?archiveID=$archive.id">$archive.filename</a></h4>

  <table>
    <tr>
      <th>ID</th><td>$archive.id</td>
    </tr>
    <tr>
    #if $wininfo
      <th>File Name</th><td>$koji.pathinfo.winfile($archive)</td>
    #else
      <th>File Name</th><td>$archive.filename</td>
    #end if
    </tr>
    #if $archive.metadata_only
    <tr>
      <th>Metadata only</th><td>True (file not imported)</td>
    </tr>
    #end if
    <tr>
      <th>File Type</th><td>$archive_type.description</td>
    </tr>
    <tr>
      <th>Build</th><td><a href="buildinfo?buildID=$build.id">$koji.buildLabel($build)</a></td>
    </tr>
    #if $maveninfo
    <tr>
      <th>Maven groupId</th><td>$archive.group_id</td>
    </tr>
    <tr>
      <th>Maven artifactId</th><td>$archive.artifact_id</td>
    </tr>
    <tr>
      <th>Maven version</th><td>$archive.version</td>
    </tr>
    #end if
    <tr>
      <th>Size</th><td>$archive.size</td>
    </tr>
    <tr>
      <th>Checksum</th><td>$archive.checksum</td>
    </tr>
    #if $wininfo
    <tr>
      <th>Platforms</th><td>$archive.platforms</td>
    </tr>
    <tr>
      <th>Flags</th><td>$archive.flags</td>
    </tr>
    #end if
    #if $builtInRoot
    <tr>
      <th>Buildroot</th><td><a href="buildrootinfo?buildrootID=$builtInRoot.id">$util.brLabel($builtInRoot)</a></td>
    </tr>
    #end if
    #if $archive.get('extra')
    <tr>
      <th>Extra</th><td class="usertext">$util.escapeHTML($pformat($archive.extra))</td>
    </tr>
    #end if
    #if $files
    <tr>
      <th id="filelist">Files</th>
      <td class="container">
        <table class="nested data-list">
          <tr>
            <td class="paginate" colspan="2">
              #if $len($filePages) > 1
              <form class="pageJump">
                Page:
                <select onchange="javascript: window.location = 'archiveinfo?fileStart=' + this.value * $fileRange + '$util.passthrough_except($self, 'fileStart')#filelist';">
                  #for $pageNum in $filePages
                  <option value="$pageNum"#if $pageNum == $fileCurrentPage then ' selected' else ''#>#echo $pageNum + 1#</option>
                  #end for
                </select>
              </form>
              #end if
              #if $fileStart > 0
              <a href="archiveinfo?fileStart=#echo $fileStart - $fileRange#$util.passthrough_except($self, 'fileStart')#filelist">&lt;&lt;&lt;</a>
              #end if
              <strong>#echo $fileStart + 1 # through #echo $fileStart + $fileCount # of $totalFiles</strong>
              #if $fileStart + $fileCount < $totalFiles
              <a href="archiveinfo?fileStart=#echo $fileStart + $fileRange#$util.passthrough_except($self, 'fileStart')#filelist">&gt;&gt;&gt;</a>
              #end if
            </td>
          </tr>
          <tr class="list-header">
            <th><a href="archiveinfo?fileOrder=$util.toggleOrder($self, 'name', 'fileOrder')$util.passthrough_except($self, 'fileOrder', 'fileStart')#filelist">Name</a> $util.sortImage($self, 'name', 'fileOrder')</th>
            <th><a href="archiveinfo?fileOrder=$util.toggleOrder($self, 'size', 'fileOrder')$util.passthrough_except($self, 'fileOrder', 'fileStart')#filelist">Size</a> $util.sortImage($self, 'size', 'fileOrder')</th>
          </tr>
          #for $file in $files
          <tr class="$util.rowToggle($self)">
            <td><a href="fileinfo?archiveID=$archive.id&filename=$urllib.quote($file.name)">$file.name</a></td><td>$file.size</td>
          </tr>
          #end for
        </table>
      </td>
    </tr>
    #end if
    <tr>
      <th id="buildrootlist">Component&nbsp;of</th>
      <td class="container">
        #if $len($buildroots) > 0
        <table class="nested data-list">
          <tr>
            <td class="paginate" colspan="3">
              #if $len($buildrootPages) > 1
              <form class="pageJump" action="">
                Page:
                <select onchange="javascript: window.location = 'archiveinfo?buildrootStart=' + this.value * $buildrootRange + '$util.passthrough_except($self, 'buildrootStart')#buildrootlist';">
                  #for $pageNum in $buildrootPages
                  <option value="$pageNum"#if $pageNum == $buildrootCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
                  #end for
                </select>
              </form>
              #end if
              #if $buildrootStart > 0
              <a href="archiveinfo?buildrootStart=#echo $buildrootStart - $buildrootRange #$util.passthrough_except($self, 'buildrootStart')#buildrootlist">&lt;&lt;&lt;</a>
              #end if
              <strong>#echo $buildrootStart + 1 # through #echo $buildrootStart + $buildrootCount # of $totalBuildroots</strong>
              #if $buildrootStart + $buildrootCount < $totalBuildroots
              <a href="archiveinfo?buildrootStart=#echo $buildrootStart + $buildrootRange#$util.passthrough_except($self, 'buildrootStart')#buildrootlist">&gt;&gt;&gt;</a>
              #end if
            </td>
          </tr>
          <tr class="list-header">
            <th><a href="archiveinfo?buildrootOrder=$util.toggleOrder($self, 'id', 'buildrootOrder')$util.passthrough_except($self, 'buildrootOrder', 'buildrootStart')#buildrootlist">Buildroot</a> $util.sortImage($self, 'id', 'buildrootOrder')</th>
            <th><a href="archiveinfo?buildrootOrder=$util.toggleOrder($self, 'create_event_time', 'buildrootOrder')$util.passthrough_except($self, 'buildrootOrder', 'buildrootStart')#buildrootlist">Created</a> $util.sortImage($self, 'create_event_time', 'buildrootOrder')</th>
            <th><a href="archiveinfo?buildrootOrder=$util.toggleOrder($self, 'state', 'buildrootOrder')$util.passthrough_except($self, 'buildrootOrder', 'buildrootStart')#buildrootlist">State</a> $util.sortImage($self, 'state', 'buildrootOrder')</th>
          </tr>
          #for $buildroot in $buildroots
          <tr class="$util.rowToggle($self)">
            <td><a href="buildrootinfo?buildrootID=$buildroot.id">$util.brLabel($buildroot)</a></td>
            <td>$util.formatTime($buildroot.create_event_time)</td>
            <td>$util.imageTag($util.brStateName($buildroot.state))</td>
          </tr>
          #end for
        </table>
        #else
        No buildroots
        #end if
      </td>
    </tr>
    #if 'rootid' in $archive and $archive.rootid
    <tr>
      <th colspan="2"><a href="rpmlist?imageID=$archive.id&amp;type=image" title="RPMs that where installed to the image">Installed RPMs</a></th>
    </tr>
    #end if
  </table>

#include "includes/footer.chtml"
