Source

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

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

{% from "macros.html" import
        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>
{% if session.get('domainGlobalAdmin') == 'yes' %}
    <span><a href="{{ctx.homepath}}/profile/user/advanced/{{mail}}" {%if profile_type == 'advanced'%}class="active"{%endif%}>Advanced settings</a>&nbsp;</span>
{% endif %}
{% endblock id_welcome %}

{% block main %}
{# message #}
{% if msg is defined and msg is not sameas none %}
<div class="ct-box info-box">
    <p class="warn">
    {% if msg == 'CREATE_SUCCESS' %}
    {{ _('User created. Would you like to <a href="%s/create/user">add one more</a>?' |format(ctx.homepath)) }}
    {% endif %}
    </p>
    </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] %}
{% elif profile_type == 'advanced' %}
    {% set mailMessageStore = entries.get('mailMessageStore', [domain + '/' + username + '/'])[0] %}
    {% set homeDirectory = entries.get('homeDirectory', ['/var/vmail/vmail01'])[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="mail" value="{{username}}" size="25" />@{{domain}}</span>
            </div>

            <div class="sf-box text">
                <label><span>{{ _('Mail quota (in MB)') }}</span></label>
                <span class="fld-input"><input type="text" name="mailQuota" value="" size="15" /> {{_('Current quota:') }} {% if mailQuota == '0' %}{{ _('Unlimited') }}{%else%}{{mailQuota |filesizeformat}}{%endif%}</span>
            </div>
        </div>
    </fieldset>

    <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">
                    {% for phone in telephoneNumber %}
                        <input type="text" name="telephoneNumber_{{loop.index}}" value="{{phone}}" size="25" /><br />
                    {% endfor %}
                </span>
            </div>
        </div>
    </fieldset>

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

    {% if profile_type == 'password' %}
    {{ display_reset_password(show_confirmpw='yes') }}
    {% endif %}

    {% if session.get('domainGlobalAdmin') == 'yes' %}
    {% if profile_type == 'advanced' %}
    <tr>
        <th>{{ _("Mailbox directory") }}</th>
        <td>
            <input type="text" name="homeDirectory" title="{{ _("Storage base directory (user's home directory)") }}" value="{{homeDirectory}}" />/<input type="text" name="mailMessageStore" title="{{ _('Mailbox path. Format: domain.ltd/username/') }}" value="{{mailMessageStore}}" />Maildir/
        </td>
    </tr>
    {% endif %}
    {% endif %}

</table>

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

</div>
</form>
{% endblock main %}