iredadmin-ose / templates / default / ldap / user_profile.html

{# profile_type, mail, user_profile, [msg], #}
{% extends "layout.html" %}

{% from "macros.html" import
        display_quota,
        display_cn,
        display_employeeid,
        display_phone,
        display_account_status,
        display_password_policy,
        display_reset_password,
        %}

{% block js_tablesorter %}{% endblock %}
{% block jquery_snippet_sorter %}{% endblock jquery_snippet_sorter %}

{% block title %}{{ _('Edit user profile') }}{% endblock %}

{# User profile. #}

{# Show profile categories #}
{% block id_welcome %}
<span><a href="{{ctx.homepath}}/profile/user/general/{{mail}}" {% if profile_type == 'general' %}class="active"{%endif%}>{{ _('General') }}</a>&nbsp;</span>
<span><a href="{{ctx.homepath}}/profile/user/password/{{mail}}" {% if profile_type == 'password' %}class="active"{%endif%}>{{ _('Reset Password') }}</a>&nbsp;</span>
{% endblock id_welcome %}

{% block id_visit_links %}
<span><a href="{{ctx.homepath}}/users/{{mail.split('@', 1)[1]}}">{{ _('Back to user list') }}</a></span>
{% endblock id_visit_links %}

{% block main %}
{# message #}
{% if msg is defined and msg is not sameas none %}
    <div class="ct-box info-box">
        {% if msg == 'SUCCESS' %}
        <div class="success">
            {{ _('User created. Would you like to <a href="%s/create/user/%s">add one more</a>?' |format(ctx.homepath, mail.split('@', 1)[1] )) }}
        </div>
        {% elif msg == 'UPDATED_SUCCESS' %}
        <div class="success">
            {{ _('Profile updated success.') }}
        </div>
        {% elif msg == 'UPDATED_FAILED' %}
        <div class="error">
            {{ _('Profile updated failed.') }}
        </div>
        {% else %}
            {# Password #}
            {% if profile_type == 'password' %}
            <div class="error">
                {% if msg == 'PW_MISMATCH' %}
                    {{ _('New passwords are not match.') }}
                {% elif msg == 'PW_EMPTY' %}
                    {{ _('Password is empty.') }}
                {% elif msg == 'PW_LESS_THAN_MIN_LENGTH' %}
                    {{ _('New password must contain at least %s characters.') |format(min_passwd_length) }}
                {% elif msg == 'PW_GREATER_THAN_MAX_LENGTH' %}
                    {{ _('New password must NOT contain more than %s characters.') |format(max_passwd_length) }}
                {% else %}
                {# Catch-all #}
                <div class="error">
                    {{ msg }}
                </div>
                {% endif %}
            </div>
            {% endif %}
        {% endif %}
    </div>
{% endif %}

{% set user = user_profile[0] %}
{% set entries = user[1] %}
{% set cn = entries.get('cn', [''])[0].decode('utf-8') %}
{% set mail = entries.get('mail')[0] %}
{% set username, domain = mail.split('@', 1) %}
{% set employeeNumber = entries.get('employeeNumber', [''])[0].decode('utf-8') %}
{% set jpegPhoto = entries.get('jpegPhoto', [''])[0] %}
{% set createTimestamp = entries.get('createTimestamp', ['--------------'])[0] %}

{% if profile_type == 'general' %}
    {% set telephoneNumber = entries.get('telephoneNumber', []) %}
    {% set accountStatus = entries.get('accountStatus', ['disabled'])[0] %}
    {% set mailQuota = entries.get('mailQuota', [0])[0] %}
{% endif %}

<form class="frm-form" method="post" action="{{ctx.homepath}}/profile/user/{{profile_type}}/{{mail}}">
<div class="main-frm">
    <div class="profile ct-group data-group vcard">
        <div class="ct-set data-set set1">
            <div class="ct-box data-box">
                <ul class="user-ident ct-legend">
                    <li class="useravatar">{% if jpegPhoto |length != 0 %}<img src="{{ctx.homepath}}/img/{{jpegPhoto.encode('base64')}}" width="120" alt="" />{%else%}{{ _('No avatar available.') }}{%endif%}</li>
                </ul>
                <ul class="data-list">
                    <li class="username fn nickname"><span>{{ _('Display Name') }}{{_(':')}} <strong>{% if cn != 'None'  %}{{cn}}{% endif %}</strong></span></li>
                    <li><span>{{ _('Mail Address') }}{{_(':')}} <strong>{{mail}}</strong></span></li>
                    <li><span>{{ _('Employee ID') }}{{_(':')}} <strong>{{employeeNumber}}</strong></span></li>
                    <li><span>{{ _('Created Date') }}{{_(':')}} <strong>{{createTimestamp[:4]}}-{{createTimestamp[4:6]}}-{{createTimestamp[6:8]}} {{createTimestamp[8:10]}}:{{createTimestamp[10:12]}}:{{createTimestamp[12:14]}}</strong></span></li>
                </ul>
            </div>
        </div>
    </div>

    {% if profile_type == 'general' %}
        {{ display_account_status(accountStatus) }}
        {{ display_cn(cn, firstitem='no') }}
        {{ display_employeeid(employeeNumber) }}
        {{ display_quota(value=mailQuota, firstitem='no' ) }}
        {{ display_phone(value=telephoneNumber) }}
    {% endif %}

    {% if profile_type == 'password' %}
        {{ display_password_policy(
            min_passwd_length=min_passwd_length,
            max_passwd_length=max_passwd_length)
            }}

        {{ display_reset_password(show_confirmpw='yes') }}
    {% endif %}

</table>

    <div class="frm-buttons">
        <span class="submit">
            <input type="submit" value="{{ _('Save changes') }}" />
        </span>
    </div>

</div>
</form>
{% endblock main %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.