$def with (torrent_list, all_torrents)
$:render.header(_('Torrent list'))

<div class="panel" id="toolbar">

    <a class='toolbar_btn' href="#"
    onclick='toolbar_get("/torrent/add/",0)'
    title='$_("Add")'><img class='toolbar_btn'
    src='/static/images/tango/list-add.png'></a>

    <a class='toolbar_btn' href="#"
    onclick='toolbar_get("/torrent/delete/",2)'><img class='toolbar_btn'
        src='/static/images/tango/list-remove.png'
        title='$_("Remove")'></a>

    <a class='toolbar_btn' href="#"
    onclick='toolbar_post("/torrent/stop/",2)'
    title='$_("Pause")'><img class='toolbar_btn'
    src='/static/images/tango/pause.png'
    ></a>

    <a class='toolbar_btn' href="#"
    onclick='toolbar_post("/torrent/start/",2)'
    title='$_("Start")'><img class='toolbar_btn'
    src='/static/images/tango/start.png'></a>

    <a class='toolbar_btn' href="#"
    onclick='toolbar_post("/torrent/queue/up/",2)'
    title='$_("Up")'><img class='toolbar_btn'
    src='/static/images/tango/queue-up.png'></a>


    <a class='toolbar_btn' href="#"
    onclick='toolbar_post("/torrent/queue/down/",2)'
    title='$_("Down")'><img class='toolbar_btn'
    src='/static/images/tango/queue-down.png'></a>


    <a class='toolbar_btn' href="#"
    onclick='toolbar_get("/torrent/info/",1)'
    title='$_("Details")'><img class='toolbar_btn'
    src='/static/images/tango/details.png'></a>

    $:category_tabs(all_torrents)

</div>


<div id="tableContainer" class="tableContainer">
<table class="torrent_list" border=0 cellspacing=0 cellpadding=2  id="torrent_list">
<thead class="fixedHeader">
<tr>
        $:(sort_head('calc_state_str', 'S'))
        $:(sort_head('queue_pos', '#'))
        $:(sort_head('name', _('Name')))
        $:(sort_head('total_size', _('Size')))
        $:(sort_head('progress', _('Progress')))
        $if (not get('category')):
            $:(sort_head('category', _('Tracker')))
        $:(sort_head('num_seeds', _('Seeders')))
        $:(sort_head('num_peers', _('Peers')))
        $:(sort_head('download_rate', _('Download')))
        $:(sort_head('upload_rate', _('Upload')))
        $:(sort_head('eta', _('Eta')))
        $:(sort_head('distributed_copies', _('Avail')))
        $:(sort_head('ratio', _('Ratio')))
    </tr>
</thead>
<tbody class="scrollContent">
$altrow(True)
$#4-space indentation is mandatory for for-loops in templetor!
$for torrent in torrent_list:
    <tr class="$altrow()" onclick="on_click_row(event, '$torrent.id')" id="torrent_$torrent.id">
    <td>
       <form action="/torrent/$torrent.action/$torrent.id" method="POST"
            class="pause_resume">
            <input type="image"
            src="/static/images/$(torrent.calc_state_str)16.png"
            name="pauseresume" value="submit" />
        </form>
       </td>
    <td>$torrent.queue_pos</td>
    <td style="width:100px; overflow:hidden;white-space: nowrap">
        $(crop(torrent.name, 40))</td>
    <td>$fsize(torrent.total_size)</td>
    <td class="progress_bar">
        <div class="progress_bar_outer">
            <div class="progress_bar" style="width:$(torrent.progress)%">
            $torrent.message $int(torrent.progress) %
            </div>
        </div>
    </td>
    $if (not get('category')):
        <td>$torrent.category</td>
    <td>$torrent.num_seeds ($torrent.total_seeds)</td>
    <td>$torrent.num_peers ($torrent.total_peers)</td>
    <td>
    $if (torrent.download_rate):
        $fspeed(torrent.download_rate)
    $else:
        &nbsp;
    </td>
    <td>
    $if (torrent.upload_rate):
        $fspeed(torrent.upload_rate)
    $else:
        &nbsp;
    </td>
    <td>$torrent.eta</td>
    <td>$("%.3f" % torrent.distributed_copies)</td>
    <td>$("%.3f" % torrent.ratio)</td\>
    </tr>
</tbody>
</table>
</div>


$:part_stats()

<div class="panel" id="info_panel_div">
    <iframe
    style="border-style:hidden;width:740px;height:200px;"
    id="torrent_info">
    </iframe>
</div>

<br />



<script language='javascript'>
    /*on_click_action = open_details;*/
    on_click_action = on_click_row_js;
    reselect_rows();
    var id = state.selected_rows[0];
    if (id) {
        open_inner_details(id);
    }
</script>

<form id='toolbar_form' method="POST" action="changed by javascript">

</form>


$:render.footer()

