<form action="index.cgi?show=prop" method="post" id="form">
<input type="hidden" name="show" value="prop" />
<input type="hidden" id="do" name="do" value="" />

<table class="files">
    <colgroup>
        <col width="1%" />
        <col/>
        <col width="5%" />
        <col width="10%" />
        <col width="5%" />
        <col width="5%" />
    </colgroup>
    <thead>
        <tr>
            <th>
                <input type="checkbox" class="all"
                       id="all_files" name="all_files"
                    [% IF data.all_files == 'true' %]checked="checked"[% END %]
                    title="[% gettext('Select/Unselect all') %]"
                 />
            </th>
            <th>
                [% gettext('Path')          %]
            </th>
            <th>[% gettext('Size')          %]</th>
            <th>[% gettext('Done')          %]</th>
            <th>[% gettext('Chunks')        %]</th>
            <th>[% gettext('Priority')      %]</th>
        </tr>
    </thead>

    <tbody>
    [% FOR node = data.tree %]
        [%
            SET class = [];
            IF node.type != 'folder';
                IF node.findex % 2; class.push('odd');
                ELSE;              class.push('even'); END;
            END;
            IF node.parent;
                class.push('child-of-node-' _ node.parent);
            END;
            # Reque for folder selection
            class.push('level' _ node.level);
        %]

        [% IF node.type == 'folder' %]
            [%
                class.push('folder');
            %]
            <tr id="node-[% node.index %]" class="[% class.join(' ') %]">
                <td class="select">
                    <input
                        [% IF data.folder.${node.dindex} %]
                            checked="checked"
                        [% END %]
                        type="checkbox" class="folder" name="folder[]"
                        value="[% node.dindex %]"/>
                    <input type="hidden" value="[% node.dindex %]"
                        [% IF data.expanded.${node.dindex} %]
                            name="expanded[]"
                        [% END %]/>
                </td>
                <td class="path">
                    <div class="mime">&nbsp;</div>
                    [% node.name %]
                </td>
                <td class="size">[% node.data.size_bytes.as_human_size %]</td>
                <td class="percent">
                    [% node.data.percent %]
                    <div class="indicator">
                        <div class="percent"
                            style="width: [% node.data.percent %];"/>
                    </div>
                </td>
                <td class="chunks">[% node.data.size_chunks %]</td>
                <td/>
            </tr>

        [% ELSE %]
            [% class.push('file'); %]
            <tr id="node-[% node.index %]" class="[% class.join(' ') %]">
                <td class="select">
                    <input
                        [% IF data.index.${node.findex} %]
                            checked="checked"
                        [% END %]
                        type="checkbox" name="index[]"
                        value="[% node.findex %]"/>
                </td>
                <td class="path">
                    <div class="mime">
                        [% IF node.data.mime %]
                            <img
                                alt="[% node.data.mime.type | lower %]"
                                title="[% node.data.mime.type %]"
                                src="[% config.url.skin.mime _ '/' _
                                        node.data.mime.mediaType _ '.png' | lower %]"
                            />
                        [% END %]
                    </div>
                    [% IF node.dlink %]
                        <a target="_blank" href="[% node.dlink %]">
                    [% END %]
                    [% node.name %]
                    [% IF node.dlink %]
                        </a>
                    [% END %]
                </td>
                <td class="size">[% node.data.size_bytes.as_human_size %]</td>
                <td class="percent">
                    [% node.data.percent %]
                    <div class="indicator">
                        <div class="percent"
                            style="width: [% node.data.percent %];"/>
                    </div>
                </td>
                <td class="chunks">[% node.data.size_chunks %]</td>
                <td class="priority">[% gettext(node.data.priority_str) %]</td>
            </tr>
        [% END %]
    [% END %]
    </tbody>
</table>

</form>
