<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body {% if type == 'file' %}{% if oldfile %}onload="updateParent();"{% else %}onload="setInvalid();"{% endif %}{% else %}onload="updateParent();"{% endif %}>
 <table>
    <thead>
      <tr>
          <th>{{_('name')}}</th>
          <th>{{_('size')}}</th>
          <th>{{_('type')}}</th>
          <th>{{_('last modified')}}</th>
      </tr>
    </thead>
    <tbody id="tbody">
    {% if parentdir %}
        <tr class='tr-clickable' data-href="{% if type == 'folder' %}/pathchooser/{{parentdir|quotepath}}{% else %}/filechooser/{{parentdir|quotepath}}{% endif %}">
          <td title="{{_('Parent Directory')}}"><span class="parentdir">..</span></td>
          <td></td>
          <td colspan="2">&lt;DIR&gt;</td>
        </tr>
    {% endif %}
    {% for file in files %}
            {% if type == 'folder' %} {# browsing for folder #}
                  {% if file.type == 'dir' %}
                    <tr class="tr-clickable" data-href="/pathchooser/{{file.fullpath|quotepath}}" title="{{file.name}}">
                      <td class="name path_directory text-ellipsis">{{file.name}}</td>
                  {% else %}
                    <tr class="tr-nonclickable" title="{{file.fullpath}}">
                      <td class="name path_file text-ellipsis">{{file.name}}</td>
                  {% endif %}
            {% else %} {# browsing for file #}
                  {% if file.type == 'dir' %}
                   <tr class="tr-clickable" data-href="/filechooser/{{file.fullpath|quotepath}}" title="{{file.fullpath}}">
                    <td class="name file_directory text-ellipsis">{{file.name}}</td>
                  {% else %}
                   <tr class="tr-clickable" title="{{file.fullpath}}" onclick="setFile('{{file.fullpath|replace("\\", "\\\\")}}', '{{file.name}}');">
                    <td class="name file_file text-ellipsis">{{file.name}}</td>
                  {% endif %}
            {% endif %}

            <td class="size">{% if file.type == 'file' %}
              {{(file.size|round(precision=0, method='common'))|int}} {{file.unit|replace('Byte', 'B')}}
              {% endif %}</td>
            <td class="type">{% if file.type == 'dir' %}&lt;DIR&gt;{% else %}{{file.ext|default('file', True)}}{% endif %}</td>
            <td class="mtime">{{file.modified|date("%d/%m/%Y %H:%M:%S")}}</td>
        </tr>
    {% endfor %}
    </tbody>
  </table>
  </body>
</html>

{% block head %}
<link rel="stylesheet" type="text/css" href="{{theme_static('css/pathchooser.css')}}" />
{% endblock %}

{% block footer %}
<script type="text/javascript" src="{{theme_template('js/pathchooser.js')}}"></script>
{% endblock %}
