{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load i18n adminmedia fb_tags fb_csrf %}

<!-- STYLESHEETS -->
{% block extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
    <link rel="stylesheet" type="text/css" href="{{ settings_var.URL_FILEBROWSER_MEDIA }}css/filebrowser.css" />
{% endblock %}

<!-- JAVASCRIPTS -->
{% block extrahead %}
    {{ block.super }}
    <script type="text/javascript" src="../../jsi18n/"></script>
    <script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
    <script type="text/javascript" src="{% admin_media_prefix %}js/admin/CollapsedFieldsets.js"></script>
{% endblock %}

<!-- COLTYPE/BODYCLASS -->
{% block bodyclass %}change-form filebrowser{% if query.pop %} popup{% endif %}{% endblock %}
{% block content-class %}content-flexible{% endblock %}

<!-- BREADCRUMBS -->
{% block breadcrumbs %}{% include "filebrowser/include/breadcrumbs.html" %}{% endblock %}

<!-- CONTENT -->
{% block content %}
<div id="content-main">
    <form enctype="multipart/form-data" action="?action=upload&{{ query.urlencode }}" method="post" name="FileForm">
    {% fb_csrf_token %}
    {{ formset.management_form }}
    <div>
        {% if form.errors %}{{ form.errors }}{% endif %}
        <fieldset class="module aligned">
          {% for form in formset.forms %}
          <div class="form-row">
            {% if form.file.errors %}{{ form.file.errors }}{% endif %}
            <label>{{ form.file.label }} {{ forloop.counter }}</label>
            {{ form.file }}
        </div>
        {% endfor %}
        </fieldset>
        <fieldset class="module aligned collapse closed">
            <h2>{% trans "Help" %}</h2>
            <div class="form-row">
                {% for extension in settings_var.EXTENSIONS.items %}
                    {% ifnotequal extension.0 'Folder' %}
                        <div class="column span-4"><label class="required">{% if forloop.first %}{% trans "Allowed" %}:{% else %}&nbsp;{% endif %}</label></div>
                        <div class="column span-12 last"><p>{{ extension.0|safe }} ({{ extension.1|join:", "|safe }})</p></div><br clear="all" />
                    {% endifnotequal %}
                {% endfor %}
            </div>
            <div class="form-row">
                <div class="column span-4"><label class="required">{% trans "Max. Filesize" %}:</label></div>
                <div class="column span-12 last"><p>{{ settings_var.MAX_UPLOAD_SIZE|filesizeformat }}</p></div><br clear="all" />
            </div>
            {% if settings_var.CONVERT_FILENAME %}
                <div class="form-row">
                    <div class="column span-16 last"><p>
                        {% trans "The Name will be converted to lowercase. Spaces will be replaced with underscores." %}
                    </p></div><br clear="all" />
                </div>
            {% endif %}
        </fieldset>

        <div class="submit-row">
            <input type="submit" value="{% trans 'Upload' %}" class="default" />
        </div>

    </form>
</div>
{% endblock %}
