{% extends "admin/layout.html" %}
{% block title %}{{ _("Plugin Management") }}{% endblock %}
{% block contents %}
  <h1>{{ _("Plugin Management") }}</h1>
  {%- call form(enctype="multipart/form-data") %}
    {{ form.all_errors() }}
    <p>{% trans %}
      Plugins extend the functionality of the Zine system. Because of
      security and convenience reasons you have to enable plugins by hand.
      Some plugins could conflict with each other so it's up to you to
      decide which plugins you want to enable. In case of doubt have a look
      at the installation instructions of the plugin you've added.
    {% endtrans %}</p>
    <table class="plugins">
      <tr>
        <th class="plugin">{{ _("Plugin") }}</th>
        <th class="version">{{ _("Version") }}</th>
        <th class="description">{{ _("Description") }}</th>
        <th class="active">{{ _("Activate") }}</th>
      </tr>
    {%- for plugin in plugins %}
      <tr class="plugin-{{ 'active' if plugin.active else 'inactive' }}">
        <td class="plugin">{{ plugin.html_display_name }}</td>
        <td class="version">{{ (plugin.version or '?')|e }}</td>
        <td class="description">{{ plugin.description }}
          <span class="author">
          {% trans author=plugin.html_author_info %}
          By {{ author }}
          {% endtrans %}
          {% if plugin.contributors %}
          {% trans contributors=plugin.html_contributors_info %}
            and {{ contributors }}
          {% endtrans %}
          {% endif %}
          </span>
          {%- if plugin.instance_plugin and not plugin.active %}
            [<a href="{{ url_for('admin/remove_plugin', plugin=plugin.name)
              }}">{{ _("Remove plugin") }}</a>]
          {% endif -%}
        </td>
        <td class="active">{{ form.active_plugins[plugin.name]() }}</td>
      </tr>
    {%- endfor %}
    </table>
    <h2>{{ _("Plugin Guard") }}</h2>
    <p>{% trans %}
      Normally the plugin guard is enabled and catches exceptions during
      plugin setup.  In some situations however this is not wanted, for
      example if you want to debug a broken plugin.
    {% endtrans %}
    <dl>{{ form.disable_guard.as_dd() }}</dl>
    <h2>{{ _("Add New Plugin") }}</h2>
    <p>{% trans %}
      If you have a plugin as Zine <tt>.plugin</tt> file you can upload it
      to your Zine instance using the following form. Plugins added this way
      can also be completely removed.
    {% endtrans %}</p>
    <p><input type="file" name="new_plugin"></p>
    <div class="actions">
      <input type="submit" value="{{ _('Apply') }}">
    </div>
  {%- endcall %}
{% endblock %}
