classic theme priority feature request with implementation

Suggestions and discussion of future versions
Post Reply
ion

classic theme priority feature request with implementation

Post by ion »

Added support for priority change for all files.

Please change tab_files.html template for classic theme:

Code: Select all

$def with (torrent, redirect=None)

<script type="text/javascript">

CheckAll = function(val)
{
  for (i = 0, cnt = document.formFiles.length; i < cnt; i++)
  {
     var el = document.formFiles.elements[i];
     if (el.type == 'radio' && el.value == val)
     {
         el.checked=true;
     }
  }

  return;
}

</script>

<form name="formFiles" method="POST" action="$base/torrent/files/$torrent.id">
$if redirect:
    <input type="hidden" name="redir" value="$base/home">
$else:
    <input type="hidden" name="redir" value="$self_url()">

<table id="tblFiles" width="100%">

$altrow(True)
<tr class="head">
    <th width="100%">$_("File")</th>
    <th width="50px">$_("Size")</th>
    <th width="50px">$_("Progress")</th>
    <th width="16px"><a href="javascript:CheckAll(0);"><img src="$base/static/images/16/process-stop.png" title="$_('Do not download')"></a></th>
    <th width="16px"><a href="javascript:CheckAll(1);"><img src="$base/static/images/16/gtk-yes.png" title="$_('Normal priority')"></a></th>
    <th width="16px"><a href="javascript:CheckAll(2);"><img src="$base/static/images/16/queue-up.png" title="$_('High priority')"></a></th>
    <th width="16px"><a href="javascript:CheckAll(5);"><img src="$base/static/images/16/go-top.png" title="$_('Highest priority')"></a></th>
</tr>
$for i, file in enumerate(torrent.files):
    <tr class="$altrow()"  >
    <td title="$file['path']">
    $(crop_left(file["path"], 60))
    </td>
        <td style="white-space:nowrap">$fsize(file["size"])</td>
        <td align="right">$int(torrent.file_progress[i] * 100)%</td>
    $for prio in [0, 1, 2, 5]:
        <td><input type="radio" id="prio_$i" name="prio_$i" value="$prio" style="margin:0px"
        $if torrent.file_priorities[i] == prio:
            checked
        ></input></td>
    </tr>
</table>
<input type="submit" value="$_('Update')" name="submit_files">
</form>
Post Reply