{% extends 'orga/base.html' %}
{% load compress %}
{% load copyable %}
{% load i18n %}
{% load static %}

{% block scripts %}
{% compress js %}
<script defer src="{% static "common/js/copy.js" %}"></script>
{% endcompress %}
{% endblock %}

{% block content %}

<h1>{% trans "Administrator information" %}</h1>

{% if settings.DEBUG %}
<div class="alert alert-danger"><span></span><span>
    {% blocktrans trimmed %}
    You are running pretalx in development mode. Please <strong>STOP</strong>
    and set the DEBUG variable to False if this page is in any way reachable
    from the internet.
    {% endblocktrans %}
    </span>
</div>
{% endif %}

<h2>{% trans "Settings" %}</h2>

<div class="alert alert-info">
    {% if settings.CONFIG_FILES %}
    {% trans "Settings have been loaded from:" %} {{ settings.CONFIG_FILES|join:', ' }}
    {% else %}
    {% trans "No settings files were found, all settings are either set to their default value or have been read from environment variables." %}
    {% endif %}
</div>
<ul>
    <li>{% trans "Database" %}
        <ul>
            <li>{% trans "Driver" %}: <code>{{ settings.DATABASES.default.ENGINE|copyable }}</code></li>
            <li>{% trans "Name" %}: <code>{{ settings.DATABASES.default.NAME|copyable }}</code></li>
        </ul>
    </li>
    <li>{% trans "Files" %}
        <ul>
            <li>{% trans "Log" %}: <code>{{ settings.LOG_DIR|copyable }}</code></li>
            <li>{% trans "Static files" %}: <code>{{ settings.STATIC_ROOT|copyable }}</code></li>
            <li>{% trans "Media files" %}: <code>{{ settings.MEDIA_ROOT|copyable }}</code></li>
        </ul>
    </li>
    <li>{% trans "Mails" %}
        <ul>
            <li>{% trans "Host" %}: <code>{{ settings.EMAIL_HOST|copyable }}</code></li>
            <li>{% trans "Port" %}: <code>{{ settings.EMAIL_PORT|copyable }}</code></li>
            <li>{% trans "User" %}: <code>{{ settings.EMAIL_USER|copyable }}</code></li>
            <li>{% trans "Password" %}: {% if settings.EMAIL_PASSWORD %}{% trans "An email password has been set." %}{% else %}{% trans "No email password has been set." %}{% endif %}</li>
        </ul>
    </li>
</ul>
<h2>{% trans "System" %}</h2>
<ul>
    <li>{% trans "Executable" %}: <code>{{ executable|copyable }}</code></li>
    <li>{% trans "Plugins" %}: {% if settings.PLUGINS %}<ul>{% for plugin in settings.PLUGINS %}<li>{{ plugin|copyable }}</li>{% endfor %}{% else %}–{% endif %}</ul></li>
    <li>{% if settings.ADMINS %}{% trans "On errors, emails will be sent to:" %}
            {% for admin in settings.ADMINS %}
            <code>{{ admin.0|copyable }}</code>{% if not forloop.last %},{% endif %}
            {% endfor %}
        {% else %}{% trans "On errors, no emails will be sent." %}{% endif %}
    </li>
</ul>

<h3>redis</h3>
{% if not settings.HAS_REDIS %}
    {% trans "No redis server has been configured." %}
{% else %}
    {% trans "Redis is used as cache backend:" %} <code>{{ settings.CACHES.redis.LOCATION|copyable }}</code>
{% endif %}

<h3>Celery</h3>
{% if not settings.HAS_CELERY %}
    {% trans "No celery workers have been configured." %}
{% else %}
    <ul>
        <li>{% trans "Broker" %}: <code>{{ settings.CELERY_BROKER_URL|copyable }}</code></li>
        <li>{% trans "Backend" %}: <code>{{ settings.CELERY_RESULT_BACKEND|copyable }}</code></li>
        <li>{% trans "Current queue length" %}: <strong>{{ queue_length }}</strong></li>
    </ul>
{% endif %}

<h2>{% trans "Links" %}</h2>
<ul>
    <li><a target="_blank" rel="noopener" href="https://pretalx.com">{% trans "pretalx website" %}</a></li>
    <li><a target="_blank" rel="noopener" href="https://docs.pretalx.org">{% trans "pretalx documentation" %}</a>
        <ul>
            <li><a target="_blank" rel="noopener" href="https://docs.pretalx.org/en/latest/administrator/configure.html">{% trans "Configuration reference" %}</a></li>
            <li><a target="_blank" rel="noopener" href="https://docs.pretalx.org/en/latest/administrator/installation.html">{% trans "Installation guide" %}</a></li>
            <li><a target="_blank" rel="noopener" href="https://docs.pretalx.org/en/latest/administrator/maintenance.html">{% trans "Upgrade/maintenance guide" %}</a></li>
        </ul>
    </li>
    <li><a target="_blank" rel="noopener" href="https://docs.pretalx.org/en/latest/changelog.html">{% trans "Release notes" %}</a></li>
    <li><a target="_blank" rel="noopener" href="https://pretalx.com/p/news">{% trans "pretalx blog (release announcements, features)" %}</a></li>
</ul>
{% endblock %}
