{% extends 'admin.twig' %}

{% block content %}
{% if isSuperUser %}
    <h2 piwik-enriched-headline>{{ 'UsersManager_MenuAnonymousUserSettings'|translate }}</h2>
    {% if anonymousSites|length == 0 %}
        <h3 class='form-description'><strong>{{ 'UsersManager_NoteNoAnonymousUserAccessSettingsWontBeUsed2'|translate }}</strong></h3>
        <br/>
    {% else %}
        <br/>
        {{ ajax.errorDiv('ajaxErrorAnonymousUserSettings') }}
        {{ ajax.loadingDiv('ajaxLoadingAnonymousUserSettings') }}
        <table id='anonymousUserSettingsTable' class="adminTable" style='width:850px;'>
            <tr>
                <td style="width:400px;">{{ 'UsersManager_WhenUsersAreNotLoggedInAndVisitPiwikTheyShouldAccess'|translate }}</td>
                <td>
                    <fieldset>
                        <input id="anonymousDefaultReport-login" type="radio" value="Login"
                               name="anonymousDefaultReport"{% if anonymousDefaultReport==loginModule %} checked="checked"{% endif %} />
                        <label for="anonymousDefaultReport-login">{{ 'UsersManager_TheLoginScreen'|translate }}</label><br/>
                        <input id="anonymousDefaultReport-multisites" {% if anonymousSites is empty %}disabled="disabled" {% endif %}type="radio" value="MultiSites"
                               name="anonymousDefaultReport"{% if anonymousDefaultReport=='MultiSites' %} checked="checked"{% endif %} />
                        <label for="anonymousDefaultReport-multisites">{{ 'General_AllWebsitesDashboard'|translate }}</label><br/>

                        <input id="anonymousDefaultReport-specific" {% if anonymousSites is empty %}disabled="disabled" {% endif %}type="radio" value="1"
                               name="anonymousDefaultReport"{% if anonymousDefaultReport>0 %} checked="checked"{% endif %} />
                        <label for="anonymousDefaultReport-specific">{{ 'General_DashboardForASpecificWebsite'|translate }}</label>
                        {% if anonymousSites is not empty %}
                            <select id="anonymousDefaultReportWebsite">
                                {% for info in anonymousSites %}
                                    <option value="{{ info.idsite }}" {% if anonymousDefaultReport==info.idsite %} selected="selected"{% endif %}>{{ info.name|raw }}</option>
                                {% endfor %}
                            </select>
                        {% endif %}
                    </fieldset>
                </td>
            </tr>
            <tr>
                <td>{{ 'UsersManager_ForAnonymousUsersReportDateToLoadByDefault'|translate }}</td>
                <td>
                    <fieldset>
                        {% for value,description in availableDefaultDates %}
                            <input id="anonymousDefaultDate-{{ loop.index }}" type="radio" {% if anonymousDefaultDate==value %}checked="checked" {% endif %}value="{{ value }}"
                                   name="anonymousDefaultDate"/>
                            <label for="anonymousDefaultDate-{{ loop.index }}">{{ description }}</label>
                            <br/>
                        {% endfor %}
                    </fieldset>
                </td>
            </tr>

        </table>
        <input type="submit" value="{{ 'General_Save'|translate }}" id="anonymousUserSettingsSubmit" class="submit"/>
    {% endif %}
{% endif %}
{% endblock %}