<!--#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>
      <!--#if $rating_enable#--><th>Rating</th><!--#end if#-->
      <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>
  <!--#if $rating_enable#-->
    <!--#if $line.has_rating#-->
      <td><div class="rating_overall">$T('video')&nbsp;$line.rating_avg_video $T('audio')&nbsp;$line.rating_avg_audio</div>
      <form method="GET" action="./show_edit_rating">
        <input type="hidden" name="job" value="$line.nzo_id">
        <input type="hidden" name="session" value="$session">
        <input type="submit" value="$T('report')">
      </form></td>
    <!--#else#-->
      <td></td>
    <!--#end if#-->
  <!--#end if#-->
  <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.edit_rating#-->
    <!--#set $oddLine = not False#-->
    <tr class="<!--#if $oddLine then "oddLine" else "evenLine"#-->"><td></td><td></td>
    <td colspan="3">
      <form action="action_edit_rating" method="post" enctype="multipart/form-data">
      <input type="hidden" value="$line.nzo_id" name="job">
      <input type="hidden" value="$session" name="session" >
      <div class="rating_item">$T('video')&nbsp;
        <select name="video">
        <!--#if not $line.rating_user_video#--><option>-</option><!--#end if#-->
        <!--#for $val in $range(1, 11)#--><option <!--#if $line.rating_user_video==$val#-->selected<!--#end if#--> >$val</option><!--#end for#-->
        </select>
      </div>
      <div class="rating_item">$T('audio')&nbsp;
        <select name="audio">
        <!--#if not $line.rating_user_audio#--><option>-</option><!--#end if#-->
        <!--#for $val in $range(1, 11)#--><option <!--#if $line.rating_user_audio==$val#-->selected<!--#end if#--> >$val</option><!--#end for#-->
        </select>
      </div>      
      <div class="rating_item">
        <input type="radio" name="rating_flag" value="spam">&nbsp;$T('spam')
        <input type="radio" name="rating_flag" value="encrypted">&nbsp;$T('encrypted') 
        <input type="radio" name="rating_flag" value="expired">&nbsp;$T('expired') 
        <input type="text" name="expired_host" style="margin-left:10px" value="<$T('host')>"> 
      </div>
      <div class="rating_item">
        <input type="submit" name="send" value="$T('send')">
        <input type="submit" name="cancel" value="$T('cancel')">
      </div>
      </form>
    </td>
    <td></td>
    <td></td>
    </tr>
  <!--#end if#-->
  <!--#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>
      <!--#if $rating_enable#--><td></td><!--#end if#-->
    </tr>
  <!--#end if#-->
<!--#end for#-->
</table>
<!--#end if#-->

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