{% extends '@CoreUpdater/layout.twig' %}
{% set helpMessage %}
    {{ 'CoreUpdater_HelpMessageContent'|translate('<a target="_blank" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/">','</a>','</li><li>')|raw }}
{% endset %}

{% block content %}
{% if coreError %}
    <br/>
    <br/>
    <div class="error">
        <img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate }}
        {% for message in errorMessages %}
            <pre>{{ message }}</pre>
            <br/>
        {% endfor %}
    </div>
    <br/>
    <p>{{ 'CoreUpdater_HelpMessageIntroductionWhenError'|translate }}
    <ul>
        <li>{{ helpMessage }}</li>
    </ul>
    </p>
    <p>{{ 'CoreUpdater_ErrorDIYHelp'|translate }}
    <ul>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_1'|translate }}</li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_2'|translate }}</li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_3'|translate }} <a href='https://piwik.org/faq/how-to-update/#faq_179' target='_blank'>(see FAQ)</a></li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_4'|translate }}</li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_5'|translate }}</li>
    </ul>
    </p>
{% else %}
    {% if warningMessages|length > 0 %}
        <div class="warning">
            <p><img src="plugins/Zeitgeist/images/warning_medium.png"/> {{ 'CoreUpdater_WarningMessages'|translate }}</p>
            {% for message in warningMessages %}
                <pre>{{ message }}</pre>
                <br/>
            {% endfor %}
        </div>
    {% endif %}

    {% if errorMessages|length > 0 %}
        <div class="warning">
            <p><img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_ErrorDuringPluginsUpdates'|translate }}</p>
            {% for message in errorMessages %}
                <pre>{{ message }}</pre>
                <br/>
            {% endfor %}

            {% if deactivatedPlugins is defined and deactivatedPlugins|length > 0 %}
                {% set listOfDeactivatedPlugins=deactivatedPlugins|join(', ') %}
                <p style="color:red;">
                    <img src="plugins/Zeitgeist/images/error_medium.png"/>
                    {{ 'CoreUpdater_WeAutomaticallyDeactivatedTheFollowingPlugins'|translate(listOfDeactivatedPlugins) }}
                </p>
            {% endif %}
        </div>
    {% endif %}

    {% if errorMessages|length > 0 or warningMessages|length > 0 %}
        <br/>
        <p>{{ 'CoreUpdater_HelpMessageIntroductionWhenWarning'|translate }}
        <ul>
            <li>{{ helpMessage }}</li>
        </ul>
        </p>
    {% else %}
        <p class="success">{{ 'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate }}</p>
        <div id="donate-form-container">
            {% include "@CoreHome/_donate.twig" %}
        </div>
    {% endif %}
    <form action="index.php">
        <input type="submit" class="submit" value="{{ 'General_ContinueToPiwik'|translate }}"/>
    </form>
{% endif %}
{% endblock %}
