{% extends "admin/base_site.html" %}
{% load i18n adminmedia %}

{% block breadcrumbs %}
{% include "admin/filer/breadcrumbs.html" %}
{% endblock %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}

{% block content %}
{% if perms_lacking %}
    <p>{% blocktrans %}Your account doesn't have permissions to rename all of the selected files.{% endblocktrans %}</p>
{% else %}
{% if not to_rename %}
    <p>{% blocktrans %}There are no files available to rename.{% endblocktrans %}</p>
{% else %}
    <p>{% blocktrans %}The following files will be renamed (they will stay in their folders and keep original filename, only displayed filename will be changed):{% endblocktrans %}</p>
    <ul>{{ to_rename|unordered_list }}</ul>
    <form action="" method="post">{% csrf_token %}
    <div>
    {% for f in files_queryset %}
    <input type="hidden" name="{{ action_checkbox_name }}" value="file-{{ f.pk }}" />
    {% endfor %}
    {% for f in folders_queryset %}
    <input type="hidden" name="{{ action_checkbox_name }}" value="folder-{{ f.pk }}" />
    {% endfor %}
    <input type="hidden" name="action" value="rename_files" />
    <input type="hidden" name="post" value="yes" />
    {{ rename_form.as_p_with_help }}
    <div class="help">
    <p>Rename format is in <a href="http://docs.python.org/library/stdtypes.html#string-formatting-operations">Python % operator format</a> using dictionary of possible values:</p>
    <dl>
    <dt>original_filename</dt>
    <dt>original_basename</dt>
    <dd>Original filename without possible file extension.</dd>
    <dt>original_extension</dt>
    <dt>current_filename</dt>
    <dt>current_basename</dt>
    <dd>Current filename without possible file extension.</dd>
    <dt>current_extension</dt>
    <dt>current_folder</dt>
    <dd>Name of the folder the file is currently in.</dd>
    <dt>counter</dt>
    <dd>Renaming sequence counter in the current folder (1-based).</dd>
    <dt>global_counter</dt>
    <dd>Renaming squence counter for all files currently renaming (1-based).</dd>
    </dl>
    <p>Examples:</p>
    <ul>
    <li><code>Prefix %(current_filename)s</code></li>
    <li><code>Image %(counter)03d</code></li>
    </ul>
    </div>
    <p><input type="submit" value="{% trans "Rename" %}" /></p>
    </div>
    </form>
{% endif %}
{% endif %}
{% endblock %}
