Source

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

Full commit
{#
#---------------------------------------------------------------------
# This file is part of iRedAdmin-OSE, which is official web-based admin
# panel (Open Source Edition) for iRedMail.
#
# iRedMail is an open source mail server solution for Red Hat(R)
# Enterprise Linux, CentOS, Debian and Ubuntu.
#
# iRedAdmin-OSE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iRedAdmin-OSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iRedAdmin-OSE.  If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------
#}

{% extends "layout.html" %}

{% from "macros.html" import set_account_status_img with context %}
{% from "msgHandlers.html" import adminMsgHandler with context %}

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

{% block id_welcome %}
<span>{{ _('All mail administrators.') }} {{ _('Total: %s.') |format(admins |length) }}</span>
{% endblock id_welcome %}

{% block id_visit_links %}
<span><a href="{{ctx.homepath}}/create/admin">{{ _('Create new mail admin') }}</a></span>
{% endblock id_visit_links %}

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

{# List admins #}

{#{% if admins|length > 0 %}#}
{% if admins is not string %}
    <div>
    <form id="list_table" method="post" action="{{ctx.homepath}}/admins">
        <table id="account_list" class="tablesorter">
        <thead>
        <tr>
            <th>{{ _('Display Name') }}</th>
            <th>{{ _('Mail Address') }}</th>
            <th>{{ _('Global Admin') }}</th>
        </tr>
        </thead>

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

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

            {# Display username part of mail address when cn is empty. #}
            {% if cn == '' %}
                {% set cn = mail.split('@', 1)[0] %}
            {% endif %}

            <tr class="{{ accountStatus |lower }}">
                <td>
                    <span class="float_left">
                        <input type="checkbox" name="mail" value="{{mail}}" />
                        <a href="{{ctx.homepath}}/profile/admin/general/{{mail}}" title="{{ _('Edit admin profile.') }}">{{ cn }}</a>
                    </span>
                    <span class="float_right">{{ set_account_status_img(accountStatus) }}</span>
                </td>
                <td>{{mail}}</td>
                <td>{{ set_account_status_img(domainGlobalAdmin) }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

        <div class="frm-buttons">
            <span class="submit">
                <input type="checkbox" id="checkall" onClick="checkAll(list_table);" />{{ _('Select/Unselect all') }}
                <input type="submit" name="delete" value="{{ _('Delete') }}" onclick="return confirm('{{ _('Are you sure want to delete selected account(s)?') }}');" }}" />
                <input type="submit" name="disable" value="{{ _('Disable') }}" onclick="return confirm('{{ _('Are you sure want to disable selected account(s)?') }}');" }}" />
                <input type="submit" name="enable" value="{{ _('Enable') }}" onclick="return confirm('{{ _('Are you sure want to enable selected account(s)?') }}');" }}" />
            </span>
        </div>
    </form>
</div>
{% endif %}

{% endblock main %}