Source

iredadmin-ose / templates / default / ldap / admin / list.html

Full commit
{% extends "layout.html" %}

{% from "macros/general.html" import
        set_account_status_img,
        highlight_username_in_mail,
        set_admin_type_img,
        show_pages,
        with context
        %}
{% from "macros/msgHandlers.html" import adminMsgHandler with context %}

{% block title %}{{ _('Domain Admins') }}{% endblock %}
{% block navlinks_active_admins %}class="active"{% endblock %}

{% block main %}
{# Show system message #}
{{ adminMsgHandler(msg) }}

{# List admins #}

{% if admins is not string %}
    <div class="content-box">
        <div class="box-body">
            <div class="box-header clear">
                {# -- Tabs -- #}
                <ul class="tabs clear">
                    <li><a href="#list_table">{{ _('All admins') }}</a></li>
                    {% if session.get('domainGlobalAdmin') is sameas true %}
                        <li><a href="{{ctx.homepath}}/create/admin"><img src="{{ctx.homepath}}/static/{{skin}}/images/ico_add_12.png" class="vcenter" />&nbsp;{{ _('Add admin') }}</a></li>
                    {% endif %}
                </ul>

                <h2>{{ _('All mail administrators.') }}
                    {% if total is defined and admins|length > 0 %}
                        ({{ (cur_page-1) * session['pageSizeLimit'] + 1 }}-{{ (cur_page-1) * session['pageSizeLimit'] + admins|length}}/{{ total }})
                    {% endif %}
                </h2>
            </div>

        <form id="list_table" method="post" action="{{ctx.homepath}}/admins">
            <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>{{ _('Global Admin') }}</th>
                        <th>{{ _('Created') }}</th>
                    </tr>
                </thead>

                <tbody>
                    {% for admin in admins %}
                        {% set entry = admin[1] %}

                        {% set mail = entry.get('mail')[0] |e %}
                        {% set cn = entry.get('cn', [''])[0].decode('utf-8') |e %}
                        {% set accountStatus = entry.get('accountStatus', ['disabled'])[0] |lower |e %}
                        {% set domainGlobalAdmin = entry.get('domainGlobalAdmin', ['no'])[0] |e %}
                        {% set timestamp = entry.get('createTimestamp', ['--------------'])[0] |e %}

                        <tr class="{{ accountStatus }}">
                            <td><input type="checkbox" class="checkbox " name="mail" value="{{mail}}" {% if mail == session.get('username') %}disabled{% endif %}/></td>
                            <td>
                                <a href="{{ctx.homepath}}/profile/admin/general/{{mail}}"><img src="{{ctx.homepath}}/static/{{skin}}/images/action_edit.png" title="{{ _('Edit account profile') }}" class="fr-space"/></a>
                                {{ set_account_status_img(accountStatus) }}
                                {{ cn |cutString }}
                            </td>
                            <td>{{ highlight_username_in_mail(mail) }}</td>
                            <td>{{ set_admin_type_img(domainGlobalAdmin) }}</td>
                            <td>{{ timestamp |setDatetimeFormat(hour=False) }}</td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>

            <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 + '/admins',
                    total=total,
                    cur_page=cur_page)
                    %}

                {{ pages }}
            </div>
        </form>
    </div>{# -- box body -- #}
</div>{# -- content box -- #}
{% endif %}

{% endblock main %}

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