Source

iredadmin-ose / templates / default / mysql / user / list.html

Full commit
{#
    @users              LDIF of all users
    @cur_domain         Current domain
    @allDomains         All domain info (domainName only)
    @showLoginDate      Show login date or not
    @msg
#}

{% extends "layout.html" %}

{% from "macros/general.html" import
        display_subnav,
        set_account_status_img,
        highlight_username_in_mail,
        display_progress_bar,
        show_pages,
        with context %}

{% from "macros/msgHandlers.html" import userMsgHandler with context %}

{% block title %}{{ _('Mail Users') }}{% endblock %}
{% block navlinks_active_domains %}class="active"{% endblock %}

{% block breadcrumb %}
    {% set crumbs = [
            (ctx.homepath + '/domains', _('All domains'),),
            (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain,),
            (None, _('Users'),),
            ]
            %}
    {{ display_subnav(crumbs) }}
{% endblock %}


{% block main %}

{# Show system message #}
{{ userMsgHandler(msg) }}

{% if users is defined %}
    {% if showLoginDate is sameas true %}
        {% set time_title = _('Last Signed In') %}
        {% set time_var = 'lastLoginDate' %}
    {% else %}
        {% set time_title = _('Created') %}
        {% set time_var = 'createTimestamp' %}
    {% endif %}

    {# List all users. #}
    <div class="content-box">
        <div class="box-body">
            <div class="box-header clear">
                <ul class="tabs clear">
                    <li class="active"><a href="{{ctx.homepath}}/users/{{cur_domain}}">{{ _('Users') }}</a></li>
                    <li><a href="{{ctx.homepath}}/create/user/{{cur_domain}}"><img src="{{ctx.homepath}}/static/{{skin}}/images/ico_add_12.png" /> {{ _('User') }}</a>
                </ul>

                <h2>
                    {{ _('Users under domain: %s') |format(cur_domain) }}
                    {% if total is defined and users|length > 0 %}
                        ({{ (cur_page-1) * session['pageSizeLimit'] + 1 }}-{{ (cur_page-1) * session['pageSizeLimit'] + users|length}}/{{ total }})
                    {% endif %}
                </h2>
            </div>

            <div class="box-wrapper clear">
            <div id="user_list">
    <form id="account_list" method="post" action="{{ctx.homepath}}/users/{{cur_domain}}">
    <table class="style1 tablesorter" cellspacing="0">
        <thead>
        <tr>
            <th class="checkbox"><input type="checkbox" class="checkbox select-all" /></th>
            <th>{{ _('Display Name') }}</th>
            <th>{{ _('Mail Address') }}</th>
            <th>{{ _('User ID') }}</th>
            {#
            <th>{{ _('Job Title') }}</th>
            #}
            <th>{{ _('Quota') }}</th>
            <th>{{ time_title }}</th>
        </tr>
        </thead>

        <tbody>
        {% if users|length > 0 %}
            {% for r in users %}
                <tr>
                    <td class="checkbox"><input type="checkbox" name="username" value="{{r.username}}" /></td>
                    <td class="vcenter">
                        <a href="{{ctx.homepath}}/profile/user/general/{{r.username}}"><img src="{{ctx.homepath}}/static/{{skin}}/images/action_edit.png" title="{{ _('Edit account profile') }}" class="fr-space"/></a>
                        {{ set_account_status_img(r.active) }}
                        {% if r.name %}
                            {{ r.name |cutString |e }}
                        {% else %}
                            {{ r.username.split('@', 1)[0] }}
                        {% endif %}
                    </td>
                    <td class="vcenter">{{ highlight_username_in_mail(r.username) }}</td>
                    <td class="vcenter">{% if r.employeeid %}{{ r.employeeid }}{% endif %}</td>
                    {#
                    <td class="vcenter">{{ jobTitle }}</td>
                    #}

                    {### mail quota #}

                    {% if r.quota == 0 %}
                        <td class="vcenter">{{ r.bytes |filesizeformat(baseMB=True) }} / {{ _('Unlimited') }}</td>
                    {% else %}
                        {% set percent = r.bytes |getPercentage(r.quota * 1024 * 1024) %}
                        <td class="vcenter">
                            <div>
                                <span title="{{ _('Edit quota setting') }}"><a href="{{ctx.homepath}}/profile/user/general/{{r.username}}">{{ percent }}%</a></span>
                                <span class="grey">(<span title="{{ _('Stored') }}">{{ r.messages }} {{_('Emails') }}/{{ r.bytes |filesizeformat }}</span>)/<span title="{{ _('Allocated') }}">{{ r.quota |filesizeformat(baseMB=True) }}</span></span>
                            </div>
                            {{ display_progress_bar(percent, show_zero=true, width='60%', style='thin') }}
                        </td>
                    {% endif %}

                    <td class="vcenter">{{ r.created |setDatetimeFormat(hour=False) }}</td>
                </tr>
            {% endfor %}
        {% else %}
            <tr>
                <td class="checkbox"></td>
                <td colspan="7">{{ _('No user available.') }} <a href="{{ctx.homepath}}/create/user/{{ cur_domain }}">{{ _('Add one') }}</a>?</td>
            </tr>
        {% endif %}
        </tbody>
    </table>

    <input type="hidden" name="cur_page" value="{{cur_page}}" />

    <div class="tab-footer clear f1">
        <div class="fl">
            <select name="action" class="fl-space">
                <option>{{ _('Choose Action') }}</option>
                <option value="enable">{{ _('Enable') }}</option>
                <option value="disable">{{ _('Disable') }}</option>
                <option value="delete">{{ _('Delete') }}</option>
            </select>
            <input type="submit" value="{{ _('Apply') }}" class="button fl-space" />
        </div>

        {% set pages = show_pages(
                  baseurl=ctx.homepath + '/users/' + cur_domain,
                  total=total,
                  cur_page=cur_page)
                  %}

        {{ pages }}
    </div>
</div>{# #user_list #}
    </div>{# .box-wrapper #}
</form>
</div>{# -- End id=user_list -- #}
</div>
{% endif %}
{% endblock main %}

{% block js %}
    {{ load_jquery(['tablesorter'], sortFirstCol=false) }}
{% endblock js %}