{% extends "layout.html" %} {% from "macros/form_inputs.html" import input_csrf_token with context %} {% from "macros/general.html" import display_subnav, set_account_status_img, set_account_activity_img, set_forwarding_address_img, set_alias_address_img, set_assigned_groups_img, set_user_admin_type_img, highlight_username_in_mail, display_progress_bar, display_filter_by_first_char, show_pages, display_remove_mailbox_days with context %} {% from "macros/msg_handlers.html" import user_msg_handler with context %} {% block title %}{{ _('Mail Users') }}{% endblock %} {% block navlinks_domains %}class="active"{% endblock %} {% block breadcrumb %} {% if all_are_admins %} {% set crumbs = [ (ctx.homepath + '/domains', _('All domains')), (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain), (ctx.homepath + '/users/' + cur_domain, _('Users')), (ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')), (ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), ('active', ctx.homepath + '/admins/' + cur_domain, _('Admins')), ] %} {% else %} {% set crumbs = [ (ctx.homepath + '/domains', _('All domains')), (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain), ('active', ctx.homepath + '/users/' + cur_domain, _('Users')), (ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')), (ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), ] %} {% if session.get('is_global_admin') %} {% set crumbs = crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %} {% endif %} {% endif %} {% if backend != "pgsql" %} {% set crumbs = crumbs + [(ctx.homepath + '/users/' + cur_domain + '/last_logins', _('Last Logins'))] %} {% endif %} {{ display_subnav(crumbs) }} {% endblock %} {% block main %} {# Show system message #} {{ user_msg_handler(msg) }} {% if users is defined %} {% if users or (not users and first_char) %} {% if all_are_admins %} {{ display_filter_by_first_char(baseurl=ctx.homepath + '/admins/' + cur_domain, first_char=first_char, account_type='admin', disabled_only=disabled_only) }} {% else %} {{ display_filter_by_first_char(baseurl=ctx.homepath + '/users/' + cur_domain, available_chars=all_first_chars, first_char=first_char, account_type='user', disabled_only=disabled_only) }} {% endif %} {% endif %} {# List all users. #}

{% if all_are_admins %} {{ _('Admins under domain: %s') |format(cur_domain) }} {% else %} {{ _('Users under domain: %s') |format(cur_domain) }} {% endif %} {% if total is defined and users|length > 0 %} ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + users|length}}/{{ total }}) {% endif %} {{ set_account_activity_img('sent', 'domain', cur_domain, float=false) }}

{# Control whether we should redirect to /admins/[domain] or /usrs/[domain] #} {% if all_are_admins %} {% endif %} {{ input_csrf_token() }} {# #} {% if all_are_admins %} {% else %} {% endif %} {% if last_logins %} {% endif %} {% if users %} {% for r in users %} {% set mail = r.username |e %} {# mail quota #} {% set usedQuotaBytes = used_quotas.get(mail, {}).get('bytes', 0) %} {% set usedQuotaMessages = used_quotas.get(mail, {}).get('messages', 0) %} {% if r.quota == 0 %} {% if session.get('show_used_quota') %} {% else %} {% endif %} {% else %} {% set percent = usedQuotaBytes |convert_to_percentage(r.quota |int * 1024 * 1024) %} {% endif %} {% if last_logins %} {% if mail in last_logins %} {% set _times = last_logins.get(mail, {}) %} {% set _imap = _times.get('imap') or 0 %} {% set _pop3 = _times.get('pop3') or 0 %} {% set _lda = _times.get('lda') or 0 %} {# imap or pop3 login time #} {% set _login_time = 0 %} {% set _login_service = None %} {% if (_imap > 0) and (_pop3 > 0) %} {% if _imap > _pop3 %} {% set _login_time = _imap %} {% set _login_service = 'imap' %} {% else %} {% set _login_time = _pop3 %} {% set _login_service = 'pop3' %} {% endif %} {% elif _imap > 0 %} {% set _login_time = _imap %} {% set _login_service = 'imap' %} {% elif _pop3 > 0 %} {% set _login_time = _pop3 %} {% set _login_service = 'pop3' %} {% endif %} {% else %} {% endif %} {% endif %} {% endfor %} {% else %} {% if all_are_admins %} {% else %} {% endif %} {% endif %}
{{ _('Display Name') }} {{ _('Mail Address') }} {{ _('User/Employee ID') }}{{ _('Job Title') }}{{ _('Quota') }}{{ _('Quota') }} {{ _('Last Login') }} {% if backend != "pgsql" %} ({{ _("All users") }}) {% endif %}
{{ set_account_activity_img('sent', 'user', mail) }} {{ set_account_status_img(r.active) }} {% if r.isglobaladmin %} {{ set_user_admin_type_img('globaladmin') }} {% elif r.isadmin %} {{ set_user_admin_type_img('domainadmin') }} {% endif %} {{ set_assigned_groups_img(addresses=user_assigned_groups.get(mail, [])) }} {{ set_forwarding_address_img(user=mail, addresses=user_forwardings.get(mail, [])) }} {{ set_alias_address_img(addresses=user_alias_addresses.get(mail, [])) }} {% if r.name %}{{ r.name |cut_string |e }}{% else %}{{ mail.split('@', 1)[0] }}{% endif %} {{ highlight_username_in_mail(mail) }} {% if r.employeeid %}{{ r.employeeid |e }}{% endif %}{{ usedQuotaBytes |file_size_format }} / {{ _('Unlimited') }}{{ _('Unlimited') }}
{{ percent }}% ({{ usedQuotaMessages }} {{_('Emails') }} / {{ usedQuotaBytes |file_size_format }}) / {{ r.quota |file_size_format(base_mb=True) }}
{{ display_progress_bar(percent, show_zero=true, width='60%', style='thin') }}
{% if _login_time %} {{ _login_time | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }} {% if _login_service %} {{ _login_service | upper }} {% endif %} {% endif %}
{{ _('No mail admin assigned.') }}{{ _('No mail user available.') }} {% if not (first_char or disabled_only) %} {{ _('Add one') }}? {% endif %}
{% if users %} {% endif %}
{# #user_list #}
{# .box-wrapper #}
{# -- End id=user_list -- #}
{% endif %} {% endblock main %}