Source

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

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

{% from "macros.html" import
        display_quota,
        display_account_status,
        display_reset_password,
        %}

{% 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 main %}
{# message #}
{% if msg is defined and msg is not sameas none %}
    <div class="ct-box info-box">
        {% if msg == 'CREATE_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' %}
                    {{ _('Two 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] %}
{% 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>{{ _('Name:') }} <strong>{{cn}}</strong></span></li>
                    <li><span>{{ _('Mail:') }} <strong>{{mail}}</strong></span></li>
                    <li><span>{{ _('Employee ID:') }} <strong>{{employeeNumber}}</strong></span></li>
                    <li><span>{{ _('Created:') }} <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' %}
    <fieldset class="frm-group group1">
        <legend class="group-legend"><strong>{{ _('Name') }}</strong></legend>
        <div class="sf-set set1">
            <div class="sf-box text">
                <label><span>{{ _('Username') }}</span></label>
                <span class="fld-input"><input type="text" name="cn" value="{{cn}}" size="25" /></span>
            </div>
            {#
            <div class="sf-box text">
                <label><span>{{ _('Mail address') }}</span>{% if session.get('domainGlobalAdmin') == 'yes' %}<small>{{ _("Warning: Change mail address won't cause mailbox location changed.") }}</small>{%endif%}</label>
                <span class="fld-input"><input type="text" name="username" value="{{username}}" size="25" />@{{domain}}</span>
            </div>
            #}
        </div>
    </fieldset>

    {{ display_quota(value=mailQuota, firstitem='no' ) }}

    <fieldset class="frm-group">
        <legend class="group-legend"><strong>{{ _('Telephone Number') }}</strong></legend>
        <div class="sf-set">
            <div class="sf-box text">
                <label><span>{{ _('Telephone Number') }}</span></label>
                <span class="fld-input">
                    {% if telephoneNumber != [] %}
                        {% for phone in telephoneNumber %}
                        <input type="text" name="telephoneNumber" value="{{phone}}" size="25" /><br />
                        {% endfor %}
                    {% else %}
                        <input type="text" name="telephoneNumber" value="" size="25" /><br />
                    {% endif %}
                </span>
            </div>
        </div>
    </fieldset>

    {{ display_account_status(accountStatus) }}
    {% endif %}

    {% if profile_type == 'password' %}
    {{ display_reset_password(
            show_confirmpw='yes',
            min_passwd_length=min_passwd_length,
            max_passwd_length=max_passwd_length)
            }}
    {% 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.