<html>
<head>
    <script type="text/javascript" src="{{theme_template('js/pathchooser.js')}}"></script>
    <link rel="stylesheet" type="text/css" href="{{url_for('static', filename='css/pathchooser.css')}}"/>
</head>
<body{% if type == 'file' %}{% if not oldfile %} onload="setInvalid();"{% endif %}{% endif %}>
<center>
    <div id="paths">
    <form method="get" action="?" onSubmit="chosen();" onReset="exit();">
        <input type="text" name="p" value="{{ oldfile|default(cwd, True) }}" size="60" onfocus="setValid();">
        <input type="submit" value="Ok" name="send">
    </form>

    <span class="path_abs_rel">{{_("Path")}}: <a href="{{url_for('app.pathchooser' if type == 'folder' else 'app.filechooser')}}?path={{cwd|abspath|quote_plus}}"{% if absolute %} style="text-decoration: underline;"{% endif %}>{{_("absolute")}}</a> | <a href="{{url_for('app.pathchooser' if type == 'folder' else 'app.filechooser')}}?path={{cwd|relpath|quote_plus}}"{% if not absolute %} style="text-decoration: underline;"{% endif %}>{{_("relative")}}</a></span>

    </div>
    <table border="0" cellspacing="0" cellpadding="3">
        <tr>
            <th>{{_("name")}}</th>
            <th>{{_("size")}}</th>
            <th>{{_("type")}}</th>
            <th>{{_("last modified")}}</th>
        </tr>
    {% if parentdir %}
        <tr>
            <td colspan="4">
                <a href="{{url_for('app.pathchooser' if type == 'folder' else 'app.filechooser')}}?path={{parentdir|quote_plus}}"><span class="parentdir">{{_("parent directory")}}</span></a>
            </td>
        </tr>
    {% endif %}
{% for file in files %}
        <tr>
            {% if type == 'folder' %}
                <td class="name">{% if file.type == 'dir' %}<a href="{{ url_for('app.pathchooser') }}?path={{ file.fullpath|quote_plus }}" title="{{ file.fullpath }}"><span class="path_directory">{{ file.name|truncate(25) }}</span></a>{% else %}<span class="path_file" title="{{ file.fullpath }}">{{ file.name|truncate(25) }}{% endif %}</span></td>
            {% else %}
                <td class="name">{% if file.type == 'dir' %}<a href="{{ url_for('app.filechooser') }}?path={{ file.fullpath|quote_plus }}" title="{{ file.fullpath }}"><span class="file_directory">{{ file.name|truncate(25) }}</span></a>{% else %}<a href="#" onclick="setFile('{{ file.fullpath }}');" title="{{ file.fullpath }}"><span class="file_file">{{ file.name|truncate(25) }}{% endif %}</span></a></td>
            {% endif %}
            <td class="size">{{ file.size|float|filesizeformat }}</td>
            <td class="type">{% if file.type == 'dir' %}directory{% else %}{{ file.ext|default("file") }}{% endif %}</td>
            <td class="mtime">{{ file.modified|date("%Y/%m/%d %H:%M:%S") }}</td>
        <tr>
<!--        <tr>
            <td colspan="4">{{_("no content")}}</td>
        </tr> -->
{% endfor %}
    </table>
    </center>
</body>
</html>