{% extends 'user.twig' %}

{% set title %}{{ 'UsersManager_PersonalSettings'|translate }}{% endset %}

{% block content %}

<h2 piwik-enriched-headline>{{ title }}</h2>

<div class="ui-confirm" id="confirmPasswordChange">
    <h2>{{ 'UsersManager_ChangePasswordConfirm'|translate }}</h2>
    <input role="yes" type="button" value="{{ 'General_Yes'|translate }}"/>
    <input role="no" type="button" value="{{ 'General_No'|translate }}"/>
</div>

<form id="userSettingsTable">

    <div class="form-group">
        <label for="username">{{ 'General_Username'|translate }}</label>
        <div class="form-help">{{ 'UsersManager_YourUsernameCannotBeChanged'|translate }}</div>
        <input value="{{ userLogin }}" id="username" disabled="disabled"/>
    </div>

    <div class="form-group">
        <label for="alias">{{ 'UsersManager_Alias'|translate }}</label>
        <input value="{{ userAlias }}" id="alias" />
    </div>

    <div class="form-group">
        <label for="email">{{ 'UsersManager_Email'|translate }}</label>
        <input value="{{ userEmail }}" id="email"/>
    </div>

    <div class="form-group">
        <label for="language">{{ 'General_Language'|translate }}</label>
        <div class="form-help">
            <a href="?module=Proxy&amp;action=redirect&amp;url=http://piwik.org/translations/" target="_blank">
                {{ 'LanguagesManager_AboutPiwikTranslations'|translate }}</a>
        </div>
        <select name="language" id="language">
            {% for language in languages %}
                <option value="{{ language.code }}" {% if language.code == currentLanguageCode %}selected="selected"{% endif %}
                        title="{{ language.name }} ({{ language.english_name }})">{{ language.name }}</option>
            {% endfor %}
        </select>
    </div>

    <div class="form-group">
        <label for="timeformat">{{ 'General_TimeFormat'|translate }}</label>
        <select name="timeformat" id="timeformat">
            <option value="1" {% if currentTimeformat == 1 %}selected="selected"{% endif %} title="{{ 'General_12HourClock'|translate }}">{{ 'General_12HourClock'|translate }}</option>
            <option value="0" {% if currentTimeformat == 0 %}selected="selected"{% endif %} title="{{ 'General_24HourClock'|translate }}">{{ 'General_24HourClock'|translate }}</option>
        </select>
    </div>

    <div class="form-group">
        <label>{{ 'UsersManager_ReportToLoadByDefault'|translate }}</label>
        <label class="radio">
            <input id="defaultReportRadioAll" type="radio" value="MultiSites"
                   name="defaultReport"{% if defaultReport=='MultiSites' %} checked="checked"{% endif %} />
            {{ 'General_AllWebsitesDashboard'|translate }}
        </label>
        <label class="radio">
            <input id="defaultReportSpecific" type="radio" value="1"
                   name="defaultReport"{% if defaultReport != 'MultiSites' %} checked="checked"{% endif %} />
            {{ 'General_DashboardForASpecificWebsite'|translate }}
        </label>
        <div piwik-siteselector
             show-selected-site="true"
             class="sites_autocomplete"
             siteid="{{ defaultReportIdSite }}"
             sitename="{{ defaultReportSiteName }}"
             switch-site-on-select="false"
             show-all-sites-item="false"
             showselectedsite="true"
             id="defaultReportSiteSelector"
             ></div>
    </div>

    <div class="form-group">
        <label>{{ 'UsersManager_ReportDateToLoadByDefault'|translate }}</label>
        {% for value,description in availableDefaultDates %}
            <label class="radio">
                <input id="defaultDate-{{ loop.index }}" type="radio"{% if defaultDate==value %} checked="checked"{% endif %} value="{{ value }}" name="defaultDate"/>
                {{ description }}
            </label>
        {% endfor %}
    </div>

    {% if isValidHost is defined and isValidHost %}
        <div class="form-group">
            <label for="password">{{ 'General_ChangePassword'|translate }}</label>
            <div class="form-help">
                {{ 'UsersManager_IfYouWouldLikeToChangeThePasswordTypeANewOne'|translate }}
            </div>
            <input value="" autocomplete="off" id="password" type="password"/>
        </div>
        <div class="form-group">
            <div class="form-help">
                {{ 'UsersManager_TypeYourPasswordAgain'|translate }}
            </div>
            <input value="" autocomplete="off" id="passwordBis" type="password"/>
        </div>
    {% endif %}

    {% if isValidHost is not defined or not isValidHost %}
        <div class="alert alert-danger">
            {{ 'UsersManager_InjectedHostCannotChangePwd'|translate(invalidHost) }}
            {% if not isSuperUser %}{{ 'UsersManager_EmailYourAdministrator'|translate(invalidHostMailLinkStart,'</a>')|raw }}{% endif %}
        </div>
    {% endif %}

    {% import 'ajaxMacros.twig' as ajax %}
    {{ ajax.errorDiv('ajaxErrorUserSettings') }}
    {{ ajax.loadingDiv('ajaxLoadingUserSettings') }}

    <button type="button" id="userSettingsSubmit">{{ 'General_Save'|translate }}</button>

</form>

<h2 id="excludeCookie">{{ 'UsersManager_ExcludeVisitsViaCookie'|translate }}</h2>
<p>
    {% if ignoreCookieSet %}
       {{ 'UsersManager_YourVisitsAreIgnoredOnDomain'|translate("<strong>", piwikHost, "</strong>")|raw }}
    {% else %}
       {{ 'UsersManager_YourVisitsAreNotIgnored'|translate("<strong>","</strong>")|raw }}
    {% endif %}
</p>
<span style="margin-left:20px;">
<a href='{{ linkTo({'ignoreSalt':ignoreSalt, 'action':'setIgnoreCookie'}) }}#excludeCookie'>&rsaquo; {% if ignoreCookieSet %}{{ 'UsersManager_ClickHereToDeleteTheCookie'|translate }}
    {% else %}{{'UsersManager_ClickHereToSetTheCookieOnDomain'|translate(piwikHost) }}{% endif %}
    <br/>
</a></span>

{% endblock %}
