
<h3>$T('menu-queue')</h3>
<div class="centerLinks">
<a onclick="if(confirm('$T('purgeQueueConf')')){lr('queue/purge','limit=$limit&start=$start', -1,-1, this.parentNode.parentNode.id);}">$T('smpl-purgeQueue')</a> |
<a onclick="setCookie('queue_details','<!--#if $queue_details =='1' then "0" else "1"#-->',30);lr('queue','limit=$limit&start=$start', -1,-1, this.parentNode.parentNode.id);"><!--#if $queue_details == '1' then $T('smpl-hideEdit') else $T('smpl-showEdit')#--></a> |
<a onclick="lr('queue/tog_verbose','limit=$limit&start=$start', -1,-1, this.parentNode.parentNode.id);"><!--#if $isverbose then $T('link-hideFiles') else $T('link-showFiles')#--></a> |
$T('onQueueFinish'):
<select onfocus="pauseQueueDeferer(this.parentNode.parentNode.id)" onblur="javascript:lr('queue/','limit=$limit&start=$start', 1,-1, this.parentNode.parentNode.id);" onChange="javascript:changequeuedetails('queue/change_queue_complete_action?action='+this.options[this.selectedIndex].value, 'limit=$limit&start=$start')">
<option value=""></option>
  <optgroup label="$T('eoq-actions')">
    <!--#if $power_options#-->
    <option value="shutdown_pc" <!--#if $finishaction == 'shutdown_pc' then 'selected' else ''#-->>Shutdown PC</option>
    <option value="standby_pc" <!--#if $finishaction == 'standby_pc' then 'selected' else ''#-->>Standby PC</option>
    <option value="hibernate_pc" <!--#if $finishaction == 'hibernate_pc' then 'selected' else ''#-->>Hibernate PC</option>
    <!--#end if#-->
    <option value="shutdown_program" <!--#if $finishaction == 'shutdown_program' then 'selected' else ''#-->>Shutdown SABnzbd</option>
  </optgroup>
<!--#if $script_list#-->
  <optgroup label="$T('eoq-scripts')">
  <!--#for $sc in $script_list#-->
    <!--#if $sc != 'None'#-->
    <option value="script_$sc" <!--#if $finishaction == 'script_'+$sc then 'selected' else ''#-->>$sc</option>
    <!--#end if#-->
  <!--#end for#-->
  </optgroup>
<!--#end if#-->
</select>

</div>

<!--#if float($mb)>0 #-->
<!--#set $perc = round( (1-(float($mbleft) / float($mb))) * 100, 2)#-->
<!--#if $varExists('slots')#-->
<center><strong>$perc%</strong> - <span id="left">$mbleft</span>/<span id="total">$mb</span> MB -
$T('smpl-timeleft'): <strong>$timeleft</strong> $T('eta'): <strong>$eta</strong>
  <!--#end if#--><br /> </center>
  <!--#end if#-->
  <table id="queueTable" class="datagrid">

  <thead>
  <tr>
    <th class="expandColumn center"></th>
    <th class="orderColumn center"></th>
    <th>$T('name') <a class="columnLinks" onclick="javascript:lr('queue/sort_by_name','limit=$limit&start=$start&dir=asc', -1,-1, this.parentNode.parentNode.id);"><img src="static/images/up.gif" /></a><a class="columnLinks" onclick="javascript:lr('queue/sort_by_name','limit=$limit&start=$start&dir=desc', -1,-1, this.parentNode.parentNode.id);"><img src="static/images/down.gif" /></a></th>
    <!--#if $queue_details == '1'#-->
      <th class="center">$T('smpl-edit')</th>
    <!--#end if#-->
    <th class="center">$T('smpl-progress')</th>
    <th class="timeleftColumn center">$T('smpl-timeleft')</th>
    <th class="ageColumn center">$T('smpl-age') <a class="columnLinks" onclick="javascript:lr('queue/sort_by_avg_age','limit=$limit&start=$start&dir=asc', -1,-1, this.parentNode.parentNode.id);"><img src="static/images/up.gif" /></a><a class="columnLinks" onclick="javascript:lr('queue/sort_by_avg_age','limit=$limit&start=$start&dir=desc', -1,-1, this.parentNode.parentNode.id);"><img src="static/images/down.gif" /></a></th>
    <th class="sizeColumn center">$T('smpl-size') <a class="columnLinks" onclick="javascript:lr('queue/sort_by_size','limit=$limit&start=$start&dir=asc', -1,-1, this.parentNode.parentNode.id);"><img src="static/images/up.gif" /></a><a class="columnLinks" onclick="javascript:lr('queue/sort_by_size','limit=$limit&start=$start&dir=desc', -1,-1, this.parentNode.parentNode.id);"><img src="static/images/down.gif" /></a></th>
    <th class="actionsColumn center"></th>
  </tr>
  </thead>
  <!--#if $varExists('slots')#-->
    <!--#set $odd = False#-->
    <!--#for $slot in $slots#-->
      <!--#set $odd = not $odd#-->
      <tbody id="$slot.nzo_id">
        <tr class="$slot.priority">
          <td class="expand">
            <a class="expander" onclick="javascript:toggle_verbosity('$slot.nzo_id', 'limit=$limit&start=$start')"><span id="name_$slot.nzo_id"><!--#if $slot.verbosity then '-' else '+'#--></span></a>
          </td>
          <td>
            <select onfocus="pauseQueueDeferer(this.parentNode.parentNode.id)" onblur="javascript:lr('queue/','limit=$limit&start=$start', 1,-1, this.parentNode.parentNode.id);" onchange="javascript:changequeuedetails('queue/'+this.options[this.selectedIndex].value, 'limit=$limit&start=$start')">
            <!--#for $i in xrange($noofslots)#-->
              <!--#set $index = $slot.index#-->
              <option value="switch?uid1=$slot.nzo_id&uid2=$i" <!--#if $i == $index then "selected" else ""#-->>$i</option>
            <!--#end for#-->
            </select>
          </td>
          <td>
            <span class="filename"><a href="#/nzb/$slot.nzo_id/" onclick="javascript:lr('nzb/$slot.nzo_id/');">$slot.filename</a></span>
          </td>
          <!--#if $queue_details == '1'#-->
          <td>
            <select onfocus="pauseQueueDeferer(this.parentNode.parentNode.id)" onblur="javascript:lr('queue/','limit=$limit&start=$start', 1,-1, this.parentNode.parentNode.id);"onchange="javascript:changequeuedetails('queue/change_opts?nzo_id='+this.options[this.selectedIndex].value, 'limit=$limit&start=$start')">
              <optgroup label="$T('pp')">
                <option value="$slot.nzo_id&pp=0" <!--#if $slot.unpackopts == "0" then "selected" else ""#-->>$T('pp-none')</option>
                <option value="$slot.nzo_id&pp=1" <!--#if $slot.unpackopts == "1" then "selected" else ""#-->>$T('pp-r')</option>
                <option value="$slot.nzo_id&pp=2" <!--#if $slot.unpackopts == "2" then "selected" else ""#-->>$T('pp-u')</option>
                <option value="$slot.nzo_id&pp=3" <!--#if $slot.unpackopts == "3" then "selected" else ""#-->>$T('pp-d')</option>
              </optgroup>
            </select>


  <!--#if $slot.priority#-->
  <select onfocus="pauseQueueDeferer(this.parentNode.parentNode.id)" onblur="javascript:lr('queue/','limit=$limit&start=$start', 1,-1, this.parentNode.parentNode.id);" onchange="javascript:changequeuedetails('queue/set_priority?nzo_id=$slot.nzo_id&priority='+this.options[this.selectedIndex].value, 'limit=$limit&start=$start');">
    <optgroup label="$T('priority')">
      <option value="2" <!--#if $slot.priority == "Force" then "selected" else ""#-->>$T('pr-force')</option>
      <option value="1" <!--#if $slot.priority == "High" then "selected" else ""#-->>$T('pr-high')</option>
      <option value="0" <!--#if $slot.priority == "Normal" then "selected" else ""#-->>$T('pr-normal')</option>
      <option value="-1" <!--#if $slot.priority == "Low" then "selected" else ""#-->>$T('pr-low')</option>
      <option value="-4" <!--#if $slot.priority == "Stop" then "selected" else ""#-->>$T('pr-stop')</option>
    </optgroup>
  </select>
  <!--#end if#-->
<!--#if $script_list#-->
  <select onfocus="pauseQueueDeferer(this.parentNode.parentNode.id)" onblur="javascript:lr('queue/','limit=$limit&start=$start', 1,-1, this.parentNode.parentNode.id);" onchange="javascript:changequeuedetails('queue/change_script?nzo_id=$slot.nzo_id&script='+this.options[this.selectedIndex].value, 'limit=$limit&start=$start');">
  <optgroup label="$T('script')">
  <!--#for $sc in $script_list#-->
    <option value="$sc" <!--#if $slot.script.lower() == $sc.lower() then "selected" else ""#-->>$Tspec($sc)</option>
  <!--#end for#-->
  </optgroup>
  </select>
<!--#end if#-->

  <!--#if $cat_list#-->
  <select onfocus="pauseQueueDeferer(this.parentNode.parentNode.id)" onblur="javascript:lr('queue/','limit=$limit&start=$start', 1,-1, this.parentNode.parentNode.id);" onchange="javascript:changequeuedetails('queue/change_cat?nzo_id=$slot.nzo_id&cat='+this.options[this.selectedIndex].value, 'limit=$limit&start=$start');">
    <optgroup label="$T('category')">
    <!--#for $ct in $cat_list#-->
      <option value="$ct" <!--#if $slot.cat.lower() == $ct.lower() then "selected" else ""#-->>$Tspec($ct)</option>
    <!--#end for#-->
    </optgroup>
    </select>
  <!--#end if#-->
</td>
<!--#end if#-->
<td title="$slot.mbleft/${slot.mb}MB">
  <!--#if float($slot.mb)>0 #-->
  <!--#set $perc = round( (1-(float($slot.mbleft) / float($slot.mb))) * 100, 2)#-->
  <div class="progressBar"><div id="progress_$slot.nzo_id" style="width: $perc%;   position: relative;   background-color: #9bf;   height: 6px;"><!-- --></div></div>
  <!--#end if#-->
</td>
<td class="center" title="$slot.eta">$slot.timeleft</td>
<td class="center">$slot.avg_age</td>
<td class="center">$slot.size</td>
<td class="right_align">
  <!--#if $slot.status == 'Paused'#-->
    <a title="$T('link-resume')" onclick="resumequeueitem('$slot.nzo_id', '$start', '$limit');"><img class="resumeicon" src="static/images/control_play.png" /></a>
  <!--#else#-->
    <a title="$T('link-pause')" onclick="pausequeueitem('$slot.nzo_id', '$start', '$limit');"><img class="pauseicon" src="static/images/control_pause.png" /></a>
  <!--#end if#-->
  <a title="$T('button-del')" onclick="deletequeueitem('$slot.nzo_id');"><img class="delicon" src="static/images/messagebox_critical.png" /></a>
</td>
</tr>
<!--#set $oddLine = False#-->
<!--#for $line in $slot.finished#-->
  <!--#set $oddLine = not $oddLine#-->
  <tr class="finished <!--#if $oddLine then "oddLine" else "evenLine"#--> finished"><td></td><td>Finished</td><td>$line.filename</td><!--#if $queue_details == '1'#--><td></td><!--#end if#--><td class="pre">$line.mbleft/$line.mb MB<td></td><td class="center">$line.age</td><td class="center">$line.size</td><td></td></tr>
<!--#end for#-->
<!--#set $oddLine = False#-->
<!--#for $line in $slot.active#-->
  <!--#set $oddLine = not $oddLine#-->
  <tr id="$line.nzf_id" class="active <!--#if $oddLine then "oddLine" else "evenLine"#--> active"><td></td><td>Active</td><td>$line.filename</td><!--#if $queue_details == '1'#--><td></td><!--#end if#--><td class="pre">$line.mbleft/$line.mb MB</td><td></td><td class="center">$line.age</td><td class="center">$line.size</td><td class="right_align"><a onclick="deletenzf('$slot.nzo_id','$line.nzf_id')"><img class="delicon" src="static/images/messagebox_critical.png" /></a></td></tr>
<!--#end for#-->
<!--#set $oddLine = False#-->
<!--#for $line in $slot.queued#-->
  <!--#set $oddLine = not $oddLine#-->
  <tr class="waiting <!--#if $oddLine then "oddLine" else "evenLine"#--> waiting"><td></td><td>Waiting</td><td>$line.filename (set: $line.set)</td><!--#if $queue_details == '1'#--><td></td><!--#end if#--><td class="pre">$line.mbleft/$line.mb MB<td></td><td class="center">$line.age</td><td class="center">$line.size</td><td></td></tr>
<!--#end for#-->
</tbody>
<!--#end for#-->
<!--#end if#-->
</table>
<!--#if int($cache_max)#-->
<!--#set $bufmsg=$T('ft-buffer@2')%($cache_art, $cache_size)#-->
<center>$bufmsg<br></center>
<!--#end if#-->
<br />
<!--#set $start = int($start)#-->
<!--#if $finish == 0 and $noofslots == 0#-->
$T('smpl-noresult')
<!--#elif $finish == 1#-->
$T('smpl-oneresult')
<!--#else#-->

  <!--#if $finish > 0#-->
    <!--#set $x = $start+1#-->
  <!--#else#-->
    <!--#set $x = $noofslots#-->
  <!--#end if#-->

  <!--#if $finish == 0#-->
    <!--#set $y = $noofslots#-->
  <!--#elif $finish > $noofslots#-->
    <!--#set $y = $start+1#-->
  <!--#else#-->
    <!--#set $y = $finish#-->
  <!--#end if#-->

  <!--#set $numres = $T('smpl-numresults@3') % ($x, $y, $noofslots)#-->
  $numres
<!--#end if#-->
<br />
<div class="centerLinks">
  <!--#if $limit and $noofslots#-->
    <!--#set $total = $noofslots#-->
    <!--#while ($total % $limit)#-->
      <!--#set $total = $total+1#-->
    <!--#end while#-->
    <!--#set $pages = ($total / $limit)#-->
    <!--#set $newfinish = $finish#-->
    <!--#while ($newfinish % $limit)#-->
      <!--#set $newfinish = $newfinish+1#-->
    <!--#end while#-->
    <!--#set $currentpage = int($newfinish / $limit)#-->
    <!--#set $offset = 0#-->
    <!--#if $currentpage == 1#-->
      <span class="unselected">&laquo;$T('smpl-first')</span>
      <span class="unselected">&lsaquo;$T('smpl-previous')</span>
    <!--#else#-->
      <a class="unselected" onclick="javascript:lr('queue', 'limit=$limit&start=0', 1,-1,this.parentNode.parentNode.id);">&laquo;$T('smpl-first')</a>
      <a class="unselected" onclick="javascript:lr('queue', 'limit=$limit&start=<!--#echo $start-$limit#-->', 1,-1,this.parentNode.parentNode.id);">&lsaquo;$T('smpl-previous')</a>
    <!--#end if#-->
    <!--#for $i in $range($pages)#-->
      <!--#set $i = $i+1#-->
      <!--#if  $currentpage == $i#-->
        <span class="selected">$i</span>
      <!--#elif $i >= 0 and $i > $currentpage-3 and $i < $currentpage+6#-->
        <a class="unselected" onclick="javascript:lr('queue', 'limit=$limit&start=$offset', 1,-1,this.parentNode.parentNode.id);"><!--#echo $i#--></a>
      <!--#end if#-->
      <!--#set $offset = $offset + $limit#-->
    <!--#end for#-->
    <!--#if $currentpage == $pages#-->
      <span class="unselected">$T('smpl-next')&rsaquo;</span>
      <span class="unselected">$T('smpl-last')&raquo;</span>
    <!--#else#-->
      <a class="unselected" onclick="javascript:lr('queue', 'limit=$limit&start=<!--#echo $start+$limit#-->',1,-1,this.parentNode.parentNode.id);">$T('smpl-next')&rsaquo;</a>
      <a class="unselected" onclick="javascript:lr('queue', 'limit=$limit&start=<!--#echo (($pages-1)*$limit)#-->', 1,-1,this.parentNode.parentNode.id);">$T('smpl-last')<!--#if $pages > 1#-->($pages)<!--#end if#-->&raquo;</a>
    <!--#end if#-->
  <!--#end if#-->
</div>


