{% extends "base.html" %}


{% block main %}
<img id="logo" src="/style/logo.svg" alt="FoLiA Linguistic Annotation Tool" />

<div id="uploadform" class="dialog">
    <h3>Upload</h3>
    <p>
    Here you can upload a new FoLiA XML document to the editor.
    </p>
    <form action="/upload/" enctype="multipart/form-data" method="post">
        {% csrf_token %}
        <label>Select file:</label> <input type="file" name="file" />
        <label>Namespace:</label> <input type="text" name="namespace" value="{{ username }}" />
        <div class="buttoncontainer">
            <input id="uploadbutton" class="button" type="submit" value="Upload" onclick="$('#wait').show()" />
            <button id="cancelupload" class="button">Cancel</button>
        </div>
    </form>
</div>

<div class="dialog">
    <h3>My Documents</h3>
    {% if error %}
    <div class="error">{{ error }}</div>
    {% endif %}
    {% if configuration.allowupload %}
    <div class="uploadcontainer">
        <button id="showuploadbutton" class="button">Upload</button>
    </div>
    {% endif %}
    <ul id="doclist">
    {% for namespace, docsinnamespace in docs %}
        <li><strong>{{ namespace }}</strong>
        <ul>
        {% for doc, size, timestamp  in docsinnamespace %}
        <li><a href="/{{ defaultmode }}/{{ namespace }}/{{ doc }}/" onclick="$('#wait').show()">{{ doc }}</a> <span>{{size}}MB &nbsp;&nbsp; <em>{{ timestamp }}</em></span> <span>[<a href="/download/{{ namespace }}/{{ doc }}.folia.xml">Download</a>]</span></li>
        {% endfor %}
        </ul></li>
    {% endfor %}
    </ul>
</div>

{% endblock %}

