<!--#set global $topmenu="history"#-->
<!--#set global $statpath=".."#-->
<!--#set global $helpsubject="GUI+History"#-->
<!--#include $webdir + "/inc_top.tmpl"#-->

<span class="SubMenu">
  <a href="./purge?session=$session" onclick="return confirm('$T('purgeHistConf').replace("'","`") ');">$T('purgeHist')</a> |
  <a href="./purge_failed?session=$session" onclick="return confirm('$T('purgeHistFailedConf').replace("'","`") ');">$T('purgeHistFailed')</a> |
  <a href="./purge_failed?session=$session&del_files=1" onclick="return confirm('$T('purgeFailed-Files').replace("'","`") ');">$T('purgeFailed-Files')</a> |
  <!--#if $isverbose#-->
    <a href="./tog_verbose?session=$session">$T('hideDetails')</a> |
  <!--#else#-->
    <a href="./tog_verbose?session=$session">$T('showDetails')</a> |
  <!--#end if#-->
  <!--#if $failed_only#-->
    <a href="./tog_failed_only?session=$session">$T('showAllHis')</a>
  <!--#else#-->
    <a href="./tog_failed_only?session=$session">$T('showFailedHis')</a>
  <!--#end if#-->

</span>

<br>
<p>
<strong>$T('sizeHist'): $total_size&nbsp;&nbsp;|&nbsp;&nbsp;$T('today'): $day_size&nbsp;&nbsp;|&nbsp;&nbsp;
$T('thisWeek'): $week_size&nbsp;&nbsp;|&nbsp;&nbsp;$T('thisMonth'): $month_size
</strong>
</p>

<% import datetime %>
<% from sabnzbd.misc import time_format %>
<!--#if $lines#-->
<table id="historyTable">
  <tr><th></th><th>$T('completed')</th><th>$T('name')</th><th>$T('size')</th><th>$T('status')</th><th></th></tr>
  <!--#set $odd = False#-->
  <!--#for $line in $lines #-->
<%
compl = datetime.datetime.fromtimestamp(float(line['completed'])).strftime(time_format('%Y-%m-%d %H:%M:%S'))
%>
  <!--#set $odd = not $odd#-->
  <tr class="<!--#if $odd then "odd" else "even"#-->">
  <td><a class="verbosity_link" href="./tog_verbose?session=$session&jobs=$line.nzo_id">
  <!--#if $line.show_details then '-' else '+'#-->
  </a></td>
  <td>$compl</td>
  <td>$line.name<!--#if $line.action_line#--> - $line.action_line<!--#else if $line.fail_message#--> - <span class="fail_message">$line.fail_message</span><!--#end if#--></td>
  <td>$line.size</td><td>$Tx('post-'+$line.status)</td>
  <td>
    <!--#if not $line.loaded#-->
      <!--#if $line.retry#-->
        <input type="submit" onclick="if(confirm('$T('confirm').replace("'","`") ')){ if (confirm('$T('delFiles').replace("'","`") ')) window.location='delete?job=$line.nzo_id&del_files=1&session=$session'; else window.location='delete?job=$line.nzo_id&del_files=0&session=$session'; return false;}" value="$T('button-del')">
      <!--#else#-->
        <form action="delete" method="get">
        <input type="hidden" value="$line.nzo_id" name="job">
        <input type="hidden" name="session" value="$session">
        <input type="submit" value="$T('button-del')"></form>
          <!--#end if#-->
    <!--#end if#-->
    <br/>
    <!--#if $line.retry#-->
      <form action="retry_pp" method="post" enctype="multipart/form-data">
      <input type="file" name="nzbfile">
      <input type="hidden" value="$line.nzo_id" name="job">
      <input type="hidden" name="session" value="$session">
      <input type="submit" value="$T('button-retry')"></form>
    <!--#end if#-->
  </td>
  </tr>
  <!--#if $line.show_details#-->
    <!--#set $oddLine = not False#-->
    <tr class="<!--#if $oddLine then "oddLine" else "evenLine"#-->"><td></td><td></td>
    <td colspan="3"><dl>
    <!--#for $stage in $line.stage_log#-->
      <!--#set $oddLine = not $oddLine#-->
      <dt><b>$Tx('stage-'+$stage.name.title.lower())</b></dt>
      <!--#for $action in $stage.actions#-->
        <dd>$action</dd>
          <!--#end for#-->
        <br />
    <!--#end for#-->
    <!--#if $line.category#-->
      <dt><b>$T('category')</b></dt>
      <dd>$line.category</dd>
      <br />
    <!--#end if#-->
    <!--#if $line.storage#-->
      <dt><b>$T('msg-path')</b></dt>
      <dd>$line.storage</dd>
      <br />
    <!--#end if#-->
      </dl>
      </td>
      <td></td>
    </tr>
  <!--#end if#-->
<!--#end for#-->
</table>
<!--#end if#-->

<!--#include $webdir + "/inc_bottom.tmpl"#-->
