{% from "macros/form_inputs.html" import input_text, input_csrf_token with context %} {# ------------ Load JS files ------------- #} {% macro load_jquery() -%} {%- endmacro %} {# ------------ END JS ------------- #} {% macro display_remove_mailbox_days(num) -%} {% if num == 0 %} {{ _('Keep mailbox forever') }} {% elif num == 1 %} {{ _('Keep mailbox for 1 day') }} {% elif 1 < num < 30 %} {% if num == 7 %} {{ _('Keep mailbox for 1 week') }} {% else %} {% set _div = num % 7 %} {% if _div == 0 %} {{ _('Keep mailbox for %d weeks') | format(num/7) }} {% else %} {{ _('Keep mailbox for %d days') | format(num) }} {% endif %} {% endif %} {% elif num == 30 %} {{ _('Keep mailbox for 1 month ') }} {% elif 30 < num < 365 %} {% set _div = num % 30 %} {% if _div == 0 %} {{ _('Keep mailbox for %d months') | format(num/30) }} {% else %} {{ _('Keep mailbox for %d days') | format(num) }} {% endif %} {% elif num == 365 %} {{ _('Keep mailbox for 1 year') }} {% else %} {# num > 365 #} {% set _div = num % 365 %} {% if _div == 0 %} {{ _('Keep mailbox for %d years') | format(num / 365) }} {% endif %} {% endif %} {% endmacro %} {%- macro display_subnav(crumbs) -%} {# Crumb format: (link, label), ('active', link, label) #} {% if crumbs %} {% endif %} {%- endmacro -%} {% macro set_account_status_img(status, account_type='user', is_relay=false, relay='', is_backupmx=false, backupmx='', float="right", tooltip=true, vcenter=true) -%} {# @relay is required if status == 'relay' #} {% if float == 'right' %} {% set imgfloat = 'fr-space' %} {% elif float == 'left' %} {% set imgfloat = 'fl-space' %} {% elif float == 'center' %} {% set imgfloat = 'fl-space' %} {% else %} {% set imgfloat = '' %} {% endif %} {% if is_relay in ['1', 1, true] %} {% set is_relay = true %} {% else %} {% set is_relay = false %} {% endif %} {% if is_backupmx in ['yes', '1', 1, true] %} {% set is_backupmx = true %} {% else %} {% set is_backupmx = false %} {% endif %} {% if status in ['active', '1', 1] %} {% if is_backupmx %} {{ _('Backup MX') }} {% elif is_relay %} {{ _('Relay') }} {% else %} {% endif %} {% else %} {% endif %} {%- endmacro %} {% macro set_user_admin_type_img(value) -%} {# :param value in [domainadmin, globaladmin] #} {% if value == 'domainadmin' %} {% elif value == 'globaladmin' %} {% endif %} {%- endmacro %} {% macro set_admin_type_img(value, hide_negative=true) -%} {% if value == 'yes' %} {% else %} {% if hide_negative is not sameas true %} {% endif %} {% endif %} {%- endmacro %} {% macro set_alias_domain_img(alias_domains=None) -%} {% if alias_domains %} A{{ alias_domains |length }} {% endif %} {%- endmacro %} {% macro set_member_of_mailing_list_img(user, addresses=None) -%} {% if addresses %} L{{ addresses |length }} {% endif %} {%- endmacro %} {% macro set_forwarding_address_img(user, addresses=None) -%} {% if addresses %} {% set total = addresses | length %} {% if user in addresses %} {% set total = (addresses | length) - 1 %} {% set title = _('Forwarding addresses (saved a copy in mailbox)') %} {% else %} {% set title = _('Forwarding addresses (without saving a copy in mailbox)') %} {% endif %} {% if total > 0 %} F{{ total }} {% endif %} {% endif %} {%- endmacro %} {% macro set_alias_address_img(addresses=None) -%} {% if addresses %} A{{ addresses |length }} {% endif %} {%- endmacro %} {% macro set_assigned_groups_img(addresses=None) -%} {% if addresses %} G{{ addresses |length }} {% endif %} {%- endmacro %} {% macro set_account_activity_img(activity, account_type, account, float=true) -%} {% if session.get('amavisd_enable_logging') and (session.get('disable_viewing_mail_log') is not sameas true) %} {% else %} {# Return a char (white space) to pretty html display. (required) #}   {%- endif -%} {%- endmacro %} {% macro display_progress_bar(percent, tooltip=none, show_zero=false, style='normal', width='100%') -%} {% set percent = percent |int %} {% if percent < 0 %} {% set percent = 0 %} {% elif percent > 100 %} {% set percent = 100 %} {% endif %} {% if tooltip is sameas none %} {% set title = percent |string + '%' %} {% else %} {% set title = tooltip |string + ' (' + percent | string + '%)' %} {% endif %} {% if style == 'thin' %} {% set height = '3px' %} {% else %} {% set height = '1.6em' %} {% endif %} {% if percent < 80 %} {% set bgcolor = '#ACE97C' %} {% elif 80 <= percent < 90 %} {% set bgcolor = 'yellow' %} {% elif 90 <= percent < 99 %} {% set bgcolor = '#F76541' %} {% else %} {% set bgcolor = '#F62217' %} {% endif %} {% if percent > 0 or show_zero %}
{% endif %} {%- endmacro %} {% macro display_filter_by_first_char(baseurl, first_char=None, account_type='user', disabled_only=False, available_chars=None, separator='?starts_with=') -%}
{% if not available_chars %} {% set available_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] %} {% endif %} {% for char in available_chars %} {{char}} {% endfor %} {% if account_type in ['domain', 'user', 'maillist', 'alias'] %} | {{ _('Disabled') }} {% endif %}
{%- endmacro %} {% macro display_input_mail(mail='', name='mail', required=false) -%} {{ input_text(label=_('Mail Address'), input_name=name, value=mail, required=required) }} {%- endmacro %} {% macro display_input_domain(domain='', name='domainName', required=false, enable_input=true) -%} {{ input_text(label=_('Domain Name'), input_name=name, value=domain, required=required, enable_input=enable_input) }} {%- endmacro %} {% macro display_input_employeeid(value=None) -%} {{ input_text(label=_('User/Employee ID'), input_name='employeeNumber', value=value) }} {%- endmacro %} {% macro display_input_mobile(value=None) -%} {{ input_text(label=_('Mobile'), input_name='mobile', value=value) }} {%- endmacro %} {% macro display_phone_numbers(phone_numbers=None) -%} {% if not phone_numbers %}

{{ _('Telephone Number') }}

{% else %} {% for phone in phone_numbers %}
{% if loop.first %}

{{ _('Telephone Number') }}

{% else %}

 

{% endif %}
{% endfor %} {% endif %} {#-- Always display one more field to input new value --#}

 

{%- endmacro %} {% macro display_preferred_language(value='', languagemaps=['en_US'], label=none, enable_input=true) -%}
{% if label is sameas none %}

{{ _('Preferred language') }}

{% else %}

{{ label }}

{% endif %}
{%- endmacro %} {% macro display_timezones(value, timezones) -%} {% if not timezones %} {% set timezones = {} %} {% endif %}

{{ _('Time zone') }}

{%- endmacro %} {% macro display_in_global_address_book(enabled_services=None) %} {% if not enabled_services %} {% set enabled_services = [] %} {% endif %}

{{ _("Show in Global Address Book") }}

{%- endmacro %} {% macro display_input_global_admin(value='no') %}

{{ _('Mark as global admin') }}

{# ldap: yes, no mysql: true, false #}
{%- endmacro %} {% macro display_domain_creation_options_of_normal_admin(admin_settings=None, disabled_services=None) %} {# Options for normal domain admin #} {% if session.get('is_global_admin') %} {% if not admin_settings %} {% set admin_settings = {} %} {% endif %} {% if not disabled_services %} {% set disabled_services = [] %} {% endif %}

{{ _('Privileges') }}

{{ _('Disallow to view log of inbound/outbound mails') }}

 

{{ _('Disallow to manage quarantined mails') }}

{{ _('Create new mail domains with up to') }}

{{ _('Domains') }}

 

{% set _quota_unit = admin_settings.get('create_quota_unit', 'TB') %} {{ _('Mailbox Quota') }}

 

{{ _('Mail Users') }}

 

{{ _('Mail Aliases') }}

 

{{ _('Mailing Lists') }}

 

{{ _('No need to verify ownership for new domain') }}
{% endif %} {% endmacro %} {% macro display_mark_user_as_admin(is_domain_admin=false, is_global_admin=false, allowed_to_grant_admin='no', user_settings=None, disabled_services=None) %} {# @is_domain_admin: 0, 1 (SQL), or true, yes, false, no (LDAP) @is_global_admin: 0, 1 (SQL), or true, yes, false, no (LDAP) @allowed_to_grant_admin: 'yes', 'no', None, none @user_settings: a dict of per-user account settings. @disabled_services: a list/tuple/set of disabled service names, used for LDAP backends (usually its value of LDAP attribute 'disabledService'). #} {% if not user_settings %} {% set user_settings = {} %} {% endif %} {% if not disabled_services %} {% set disabled_services = [] %} {% endif %}

{{ _('Mark this user as') }}

{% if session.get('is_global_admin') %}
{{ _('Global admin') }} {{ _('Note: Global admin can manage all mail domains.') }}

 

{% endif %}
{{ _('Domain admin') }} {{ _('Please choose managed domains below.') }}

 

  |-- {{ _('Disallow to view log of inbound/outbound mails') }}

 

  |-- {{ _('Disallow to manage quarantined mails') }}

 

{% if allowed_to_grant_admin in ['yes', true] %} {% endif %}   |-- {{ _('Allow this admin to mark other mail user as domain admin') }}
{# # Options for normal domain admin #} {% if session.get('is_global_admin') %}

 

  |-- {{ _('Allow this admin to create new mail domains with up to') }}

 

        |-- {{ _('No need to verify ownership for new domain') }}

 

        |-- {{ _('Domains') }}

 

        |-- {% set _quota_unit = user_settings.get('create_quota_unit', 'TB') %} {{ _('Mailbox Quota') }}

 

        |-- {{ _('Mail Users') }}

 

        |-- {{ _('Mail Aliases') }}
{% endif %}
{%- endmacro %} {# Used to display domainMaxXXXNumber #} {% macro display_number_of_account_limited(value, hide_unlimited=true, hide_slash=false) -%} {% if value == '0' or value == 0 or value == 'None' %} {% if hide_unlimited is not sameas true %} {% if hide_slash is not sameas true %}/{% endif %}{{ _('Unlimited') }} {% endif %} {%else%} {% if hide_slash is not sameas true %}/ {% endif %}{{ value |e }} {%endif%} {%- endmacro %} {# Display accountStatus #} {% macro display_account_status(status, account_type='user', last_login_epoch_seconds=None, last_login_service=None) %}
{% if account_type == 'domain' %}

{{ _('Enable this domain') }}

{% else %}

{{ _('Enable this account') }}

{% endif %}
{% if last_login_epoch_seconds %} {{ _('Last Login:') }} {{ last_login_epoch_seconds | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }}{% if last_login_service %} ({{ last_login_service | upper }}){% endif %}{% endif %}
{%- endmacro %} {% macro display_domain_backupmx(domain, backupmx=false, transport='') %} {% set is_real_backupmx = false %} {% if backupmx in [true, 'yes', 1, '1'] and transport.startswith('relay:') %} {% set is_real_backupmx = true %} {% endif %}

{{ _('Mark as backup MX') }}

{% if transport.startswith('relay:') %} {% if transport == 'relay:' + domain %} {% set primary_mx = '' %} {% else %} {% set primary_mx = transport.lstrip('relay:') %} {% endif %} {% else %} {% set primary_mx = '' %} {% endif %}

{{ _('Primary MX') }}

{# .col2-3 #}
  • {{ _('When smtp service on primary MX mail server is down, emails sent to this domain will be delivered to backup MX server.') }}
  • {{ _('Received emails on backup MX will be relayed to primary MX server when its smtp service is back online.') }}
{#-- .col1-3 --#}
{# .columns #} {%- endmacro %} {% macro display_reset_password(show_oldpw=false, show_confirmpw=true, min_passwd_length='0', max_passwd_length='0', store_password_in_plain_text=false, enable_input=true) -%} {% set min_passwd_length = min_passwd_length | string %} {% set max_passwd_length = max_passwd_length | string %} {% if min_passwd_length != '0' and max_passwd_length != '0' %} {% set pw_hint = _('Must be %s - %s characters.') |format(min_passwd_length, max_passwd_length) %} {% elif min_passwd_length != '0' and max_passwd_length == '0' %} {% set pw_hint = _('At least %s characters.') |format(min_passwd_length) %} {% elif max_passwd_length == '0' and max_passwd_length != '0' %} {% set pw_hint = _('No more than %s characters.') |format(max_passwd_length) %} {% else %} {% set pw_hint = '' %} {% endif %} {% if show_oldpw %}

{{ _('Old password') }} *

{% endif %}

{{ _('New password') }} *

{% if pw_hint != '' %} {{ pw_hint }} {% endif %}
{% if show_confirmpw %}

{{ _('Confirm new password') }} *

{% endif %} {% if store_password_in_plain_text %}

{{ _('Store password in plain text') }}

{% endif %} {%- endmacro %} {% macro display_quota(value='', label='', comment='', used_quota=0, stored_messages=0, spare_quota_bytes=0, show_spare_quota=false, show_value_in_input=true, hide_zero=true, show_used_quota=false, enable_input=true) -%} {# Convert to string #} {% set used_quota = used_quota |string %} {% if spare_quota_bytes > 0 %} {% if value > spare_quota_bytes/1024/1024 %} {% set value = spare_quota_bytes/1024/1024 %} {% endif %} {% endif %} {% set value = value |string %} {% if hide_zero %} {% if value == '0' %} {% set value = '' %} {% endif %} {% endif %}
{% if label == '' %}

{{ _('Mailbox Quota') }}

{% else %}

{{ label |e }}

{% endif %}
{% if show_used_quota %} {% if (value |int) > 0 %} {% if session.get('show_used_quota') and value.isdigit() and used_quota.isdigit() %} {% set percent = used_quota |convert_to_percentage(value |int * 1024 * 1024) %} {% if (stored_messages | int) > 0 %} {% else %} {% endif %} {% endif %} {% elif (value | int) == 0 %} {% if (stored_messages | int) > 0 %} {% endif %} {% endif %} {% endif %}
{%- endmacro %} {% macro display_user_forwarding(mail, enabled=0, forwarding_addresses=None) %} {% if not forwarding_addresses %} {% set forwarding_addresses = [] %} {% endif %} {% if enabled is not sameas none %}

{{ _('Enable mail forwarding') }}

{% endif %}

{{ _('Save a copy in mailbox') }}

{{ _('Forward mails to address') }}

{{ _('One mail address per line. Invalid address will be discarded.') }}
{%- endmacro %} {% macro display_relay(transport='', default_mta_transport='dovecot', account_type='domain', url='', is_backupmx=false) -%} {# transport 'relay:[IP]:port' is used for backup mx #} {# @url is required when (account_type == 'user'), link to domain relay setting #} {% if is_backupmx in [true, 'yes', 1, '1'] %} {% set is_backupmx = true %} {% else %} {% set is_backupmx = false %} {% endif %} {# Check whether this is a real backup mx #} {% set is_real_backupmx = false %} {% if is_backupmx and transport.startswith('relay:') %} {% set is_real_backupmx = true %} {% endif %}

{{ _('Relay received email to') }}

{% if is_real_backupmx %} {% endif %}
{% if account_type == 'domain' %} {% set relay_without_verify_local_recipient = false %} {% if is_backupmx %} {% if transport.startswith('smtp:') or transport.startswith(':') or transport.startswith('uucp:') %} {% set relay_without_verify_local_recipient = true %} {% endif %} {% endif %}

{{ _('Relay without verifying local recipients') }}

{% endif %}
{%- endmacro %} {% macro display_sender_relayhost(relayhost=None) %}

{{ _('Relay outgoing email to') }}

{%- endmacro %} {% macro display_recipient_bcc(address='', label='', input_name='recipientBccAddress') -%} {% if not address %} {% set address = '' %} {% endif %} {% if not label %} {% set label = _('BCC incoming emails to other address') %} {% endif %}

{{ label }}

{%- endmacro %} {% macro display_sender_bcc(address='', label='', input_name='senderBccAddress') -%} {% if not address %} {% set address = '' %} {% endif %} {% if not label %} {% set label = _('BCC outgoing emails to other address') %} {% endif %}

{{ label }}

{%- endmacro %} {% macro display_domain_cn(cn='', input_name='cn', enable_input=true) -%} {% if cn in [None, 'None'] %} {% set cn = '' %} {% endif %}

{{ _('Company/Organization Name') }}

{% endmacro %} {% macro display_input_cn(value='', input_name='cn', account_type='user', tooltip='', size="size-250", show_first_last_name=false, first_name='', last_name='', email='', empty_if_equal_to_username=true, enable_input=true) -%} {% if value is sameas none %} {% set value = '' %} {% endif %} {% if account_type == 'user' and mail %} {% set username = email.split('@', 1)[0] %} {% if value == username and empty_if_equal_to_username %} {% set value = '' %} {% endif %} {% if first_name == username and empty_if_equal_to_username %} {% set first_name = '' %} {% endif %} {% if last_name == username and empty_if_equal_to_username %} {% set last_name = '' %} {% endif %} {% endif %}

{{ _('Display Name') }}

{% if show_first_last_name %}

 

{% endif %} {%- endmacro %} {% macro display_add_admin(min_passwd_length='0', max_passwd_length='0', lang='en_US', languagemaps=['en_US']) -%} {{ display_input_mail(required=true) }}
 
{{ display_reset_password(show_confirmpw=true, min_passwd_length=min_passwd_length, max_passwd_length=max_passwd_length) }}
{{ display_input_cn() }} {{ display_preferred_language(lang, languagemaps) }}
{{ display_input_global_admin() }} {%- endmacro %} {# quota must be in MB #} {% macro display_domain_quota(quota=0, required=False, num_allocated_quota=0, num_max_quota=0, num_spare_quota=0, enable_input=true) -%} {% set quota_in_mb = quota %} {% if num_max_quota < num_allocated_quota %} {% set enable_input = false %} {% endif %} {# required, allocated, max are used by normal domain admin #} {% if quota_in_mb >= (1024 * 1024) and quota_in_mb % (1024*1024) == 0 %} {% set quota = (quota_in_mb / (1024*1024)) | int %} {% set quota_unit = 'TB' %} {% elif quota_in_mb >= 1024 and quota_in_mb % 1024 == 0 %} {% set quota = (quota_in_mb / 1024) | int%} {% set quota_unit = 'GB' %} {% else %} {% set quota = quota |int %} {% if quota == 0 %} {# defaults to GB to avoild one more click #} {% set quota_unit = 'GB' %} {% else %} {% set quota_unit = 'MB' %} {% endif %} {% endif %}

{{ _('Domain quota size') }} {% if required -%} * {%- endif %}

{% if num_max_quota %} {% if num_max_quota < num_allocated_quota %} {{ _('Exceeded:') }} {{ (num_allocated_quota - num_max_quota) | file_size_format(base_mb=True) }} {% else %} {{ _('Max:') }} {{ (quota_in_mb + num_spare_quota) | file_size_format(base_mb=True) }} ({{ quota_in_mb + num_spare_quota }} MB) {% endif %} {% endif %}
{% endmacro %} {% macro display_domain_default_userquota(quota=0, enable_input=true, max_user_quota=0) %}

{{ _('Default quota of new user') }}

{% if not session.get('is_global_admin') %} {% if max_user_quota > 0 %} ({{ _('Max:') }} {{ max_user_quota }} MB) {% endif %} {% endif %}
{% endmacro %} {# quota in MB #} {% macro display_domain_max_user_quota(quota=0, enable_input=true) %} {% if quota >= 1024 * 1024 and quota % 1024 == 0 %} {% set quota = (quota / (1024*1024)) | int %} {% set quota_unit = 'TB' %} {% elif 1024*1024 > quota >= 1024 and quota % 1024 == 0 %} {% set quota = (quota / 1024) | int %} {% set quota_unit = 'GB' %} {% else %} {% set quota = quota | int %} {% if quota == 0 %} {# defaults to GB to avoild one more click #} {% set quota_unit = 'GB' %} {% else %} {% set quota_unit = 'MB' %} {% endif %} {% endif %}

{{ _('Max quota of mail user') }}

{% endmacro %} {% macro display_add_domain(label=false, preferred_language='en_US', languagemaps=['en_US'], timezones=None, create_new_domain=true, num_max_domains=0, num_managed_domains=0, num_spare_domains=-1, num_max_quota=0, num_allocated_quota=0, num_spare_quota=-1, num_max_users=0, num_allocated_users=0, num_spare_users=-1, num_max_aliases=0, num_allocated_aliases=0, num_spare_aliases=-1, num_max_lists=0, num_allocated_lists=0, num_spare_lists=-1) -%} {% if session.get('is_global_admin') %} {% set create_new_domain = true %} {% endif %}
{% if label %}

{{ _('Add domain') }}

{% endif %}
{{ input_csrf_token() }} {{ display_input_domain(required=true, enable_input=create_new_domain) }} {{ display_domain_cn(enable_input=create_new_domain) }} {{ display_preferred_language(value=preferred_language, languagemaps=languagemaps, label=_('Default language for new user')) }} {{ display_timezones(value=None, timezones=timezones) }}
{% if num_max_quota %} {{ display_domain_quota(required=True, num_allocated_quota=num_allocated_quota, num_max_quota=num_max_quota, num_spare_quota=num_spare_quota, enable_input=create_new_domain) }} {% else %} {{ display_domain_quota(enable_input=create_new_domain) }} {% endif %} {{ display_domain_default_userquota(quota='1024', enable_input=create_new_domain) }} {{ display_domain_max_user_quota(enable_input=create_new_domain) }}

{{ _('Number of max mail users') }} {% if num_max_users > 0 -%} * {% endif %}

{% if num_max_users > 0 %} {{ _('Available: %d (Existing: %d, Max: %d.)') % (num_spare_users, num_allocated_users, num_max_users) }} {%- endif %}

{{ _('Number of max mail aliases') }} {% if num_max_aliases > 0 -%} * {% endif %}

{% if num_max_aliases > 0 -%} {{ _('Available: %d (Existing: %d, Max: %d.)') % (num_spare_aliases, num_allocated_aliases, num_max_aliases) }} {% endif %}

{{ _('Number of max mailing lists') }} {% if num_max_lists > 0 -%} * {% endif %}

{% if num_max_lists > 0 -%} {{ _('Available: %d (Existing: %d, Max: %d.)') % (num_spare_lists, num_allocated_lists, num_max_lists) }} {% endif %}

 

{%- endmacro %} {% macro display_list_access_policy_name(policy, enable_input=true) -%} {% if policy %} {% set policy = policy.lower() %} {% if policy not in ['public', 'domain', 'subdomain', 'membersonly', 'moderatorsonly', 'allowedonly', 'membersandmoderatorsonly'] %} {% set policy = 'public' %} {% endif %} {% else %} {% set policy = 'public' %} {% endif %} {% if policy == 'public' %} {{ _('Unrestricted') }} {% elif policy == 'domain' %} {{ _('Users under same domain') }} {% elif policy == 'subdomain' %} {{ _('Users under same domain and its sub-domains') }} {% elif policy == 'membersonly' %} {{ _('Members') }} {% elif policy in ['allowedonly', 'moderatorsonly'] %} {{ _('Moderators') }} {% elif policy == 'membersandmoderatorsonly' %} {{ _('Members and moderators') }} {% else %} {{ _('Unrestricted') }} {% endif %} {% endmacro %} {% macro display_list_access_policies(policy, enable_members_and_moderators_only=true, enable_input=true) -%} {% if policy %} {% set policy = policy.lower() %} {% if policy not in ['public', 'domain', 'subdomain', 'membersonly', 'allowedonly', 'moderatorsonly', 'membersandmoderatorsonly'] %} {% set policy = 'public' %} {% endif %} {# Use 'moderatorsonly' instead of 'allowedonly' #} {% if policy == 'allowedonly' %} {% set policy = 'moderatorsonly' %} {% endif %} {% else %} {% set policy = 'public' %} {% endif %} {% set policies = [ ('public', _('Unrestricted') + '. ' + _('Everyone can send mail to this address')), ('domain', _('Users under same domain')), ('subdomain', _('Users under same domain and its sub-domains')), ('membersonly', _('Members')), ('moderatorsonly', _('Moderators')), ] %} {% if enable_members_and_moderators_only %} {% set policies = policies + [('membersandmoderatorsonly', _('Members and moderators'))] %} {% endif %} {% for p in policies %}
{% if not loop.first %}

 

{% else %}

{{ _('Who can send email to this list') }}

{% endif %} {{ p[1] }}
{% endfor %} {% endmacro %} {% macro highlight_username_in_mail(mail) -%} {{ mail.split('@')[0] |e }}@{{ mail.split('@')[-1] |e }} {% endmacro %} {%- macro display_random_password(password_length, password_policies, replace_ids=None, password_last_change_date=None, password_last_change_date_with_hour=true) -%}
{% if true in password_policies.values() %}

{{ _('Password must contain') }}

{% endif %}
{% set random_password = password_length | generate_random_password %}

{{ _('Need a strong password?') }}

{{ random_password | e }}

{% if password_last_change_date %}

{{ _('Password last change:') }}

{% if password_last_change_date_with_hour %} {% set format = "%Y-%m-%d %H:%M:%S" %} {% else %} {% set format = "%Y-%m-%d" %} {% endif %}

{{ password_last_change_date | utc_to_timezone(timezone=session.get('timezone'), format=format) }}

{% endif %}
{%- endmacro -%} {%- macro display_disabled_account_profiles(account_type='domain', disabled_profiles=[]) -%} {% if account_type == 'domain' %} {% set label = _('Disabled domain profiles') %} {% set html_input_name = 'disabledDomainProfile' %} {% set all_profiles = [('disabled_mail_services', _('Disabled mail services')), ('password_policies', _('Password policies')), ('aliases', _('Aliases')), ('bcc', _('BCC')), ('catchall', _('Catch-all')), ('relay', _('Relay')), ('backupmx', _('Backup MX')), ('throttle', _('Throttling')), ('wblist', _('White/Blacklist')), ('spampolicy', _('Spam Policy')), ] %} {% if session.get('iredapd_enabled') %} {% set all_profiles = all_profiles + [('greylisting', _('Greylisting'))] %} {% endif %} {% elif account_type == 'user' %} {% set label = _('Disabled user profiles') %} {% set html_input_name = 'disabledUserProfile' %} {% set all_profiles = [ ('aliases', _('Aliases')), ('bcc', _('BCC')), ('forwarding', _('Forwarding')), ('relay', _('Relay')), ('throttle', _('Throttling')), ('wblist', _('White/Blacklist')), ('spampolicy', _('Spam Policy')), ] %} {% if session.get('iredapd_enabled') %} {% set all_profiles = all_profiles + [('greylisting', _('Greylisting'))] %} {% endif %} {% elif account_type == 'user_preference' %} {% set label = _('Disabled self-service preferences') %} {% set html_input_name = 'disabledUserPreference' %} {% set all_profiles = [ ('personal_info', _('Personal information')), ('password', _('Change password')), ('forwarding', _('Set mail forwarding')), ('manageml', _('Manage moderated or owned mailing lists')), ('wblist', _('Manage per-user white/blacklists')), ('quarantine', _('Manage quarantined mails')), ('rcvd_mails', _('View received mails and white/blacklist senders')), ('spampolicy', _('Spam Policy')), ] %} {% endif %}
{% for profile in all_profiles %} {% if loop.first %}

{{ label }}

{% else %}

 

{% endif %}
{% endfor %}
{# .col2-3 #}
    {% if account_type == 'user_preference' %}
  • {{ _('Normal mail user cannot view and update disabled preferences.') }}
  • {% else %}
  • {{ _('Normal admin cannot view and update disabled profiles in account profile page.') }}
  • {% endif %}
{# .col1-3 #}
{# .columns #} {%- endmacro -%} {% macro show_pages(baseurl, total, cur_page, near_pages=4, sep='/page/', url_suffix='') -%} {% if total % page_size_limit > 0 %} {% set total_pages = total // page_size_limit + 1 %} {% else %} {% set total_pages = total // page_size_limit %} {% endif %} {% set baseurl = baseurl |e %} {% set sep = sep |e %}
{# Show links of 'First Page', 'Previous Page' #} {%- if total_pages > 0 -%} {% if total_pages > 3 %} {{ _('First Page') }} {% endif %} {% if cur_page != 1 and cur_page != 0 %} {% endif %} {%- endif -%} {% if total_pages <= near_pages %} {# Show all cur_page numbers if total pages is less than or equal to 4 pages.#} {% for page_no in range(1, total_pages + 1) %} {{page_no}} {% endfor %} {% else %} {# Show current cur_page number and near numbers.#} {% if cur_page <= near_pages %} {# Show near pages. #} {% if total_pages - cur_page <= near_pages %} {% set end_page = cur_page + (total_pages - cur_page) %} {% else %} {% set end_page = cur_page + near_pages %} {% endif %} {% for page_no in range(1, end_page) %} {% if page_no != cur_page %} {{page_no}} {% else %} {{ cur_page }} {% endif %} {% endfor %} {# Show last page. #} {% if cur_page + near_pages < total_pages %} {% if cur_page + near_pages <= total_pages - 1 %}...{% endif %} {% endif %} {{total_pages}} {% else %} {# Show first page number. #} {%- if cur_page - near_pages == 2 -%} 1 {%- elif cur_page - near_pages > 2 -%} 1 ... {%- endif -%} {# Show nearby pages which number larger than cur_page. #} {% if total_pages - cur_page < near_pages %} {% set end_page = cur_page + (total_pages - cur_page) %} {% else %} {% set end_page = cur_page + near_pages %} {% endif %} {% for page_no in range((cur_page-near_pages), end_page + 1) %} {% if page_no != cur_page %} {{page_no}} {% else %} {{ cur_page }} {% endif %} {% endfor %} {% if total_pages - cur_page > near_pages and total_pages - cur_page != near_pages + 1 %} ... {% endif %} {% if end_page < total_pages %} {{total_pages}} {% endif %} {% endif %} {% endif %} {# -- Show 'Next' and 'Last' -- #} {% if total_pages > 0 %} {% if cur_page < total_pages and cur_page != 0 %} {% endif %} {% if total_pages != 1 %} {{ _('Last Page') }} {% endif %} {% endif %}
{%- endmacro %} {# Convert event code to event name #} {% macro show_event_name(event) -%} {% set event_names = {'all': _('Events'), 'login': _('Admin login'), 'user_login': _('User login (self-service)'), 'create': _('Add account'), 'delete': _('Delete account'), 'disable': _('Disable account'), 'active': _('Activate account'), 'update': _('Edit account profile'), 'grant': _('Grant admin'), 'revoke': _('Revoke admin privilege'), 'backup': _('Backup'), 'update_wblist': _('Update whitelists and blacklists'), 'iredapd': 'iRedAPD', 'unban': _('Unban IP address'), 'delete_mailboxes': _('Delete mailboxes')} %} {% if event in event_names %} {{ event_names[event] }} {% else %} {{ event |e }} {% endif %} {%- endmacro %} {% macro display_change_email_address(current_domain, post_url) %} {# modal window #} {%- endmacro %} {% macro display_migrate_list_to_ml(mail) %} {% set (listname, domain) = mail.split('@', 1) %} {# modal window #} {%- endmacro %} {% macro display_migrate_alias_to_ml(mail) %} {% set (listname, domain) = mail.split('@', 1) %} {# modal window #} {%- endmacro %} {# iRedAPD: per-user wblist #} {% macro display_per_account_wblist(values, htmlInputName, label, rows=20) -%}

{{ label |e }} ({{ _('One record per line.') }} {% if values %}{{ _('%d in total.') |format(values |length) }}{% endif %})

{% if values |length == 0 %} {% else %} {% endif %}
{%- endmacro %} {% macro display_per_account_wblist_formats() -%}

{{ _('Valid record formats') }}

{# col1-3 #} {%- endmacro %} {% macro display_per_account_wblist_all(inbound_whitelists=[], inbound_blacklists=[], outbound_whitelists=[], outbound_blacklists=[], show_inbound_wblist=True, show_outbound_wblist=True) -%}
{% if show_inbound_wblist %}

{{ _('For Inbound Mails') }}

{{ display_per_account_wblist(values=inbound_whitelists, htmlInputName='whitelistSender', label=_('Whitelisted senders'), rows=6) }} {{ display_per_account_wblist(values=inbound_blacklists, htmlInputName='blacklistSender', label=_('Blacklisted senders'), rows=6) }} {% endif %} {% if show_outbound_wblist %}

{{ _('For Outbound Mails') }}

{{ display_per_account_wblist(values=outbound_whitelists, htmlInputName='whitelistRecipient', label=_('Whitelisted recipients'), rows=6) }}
{{ display_per_account_wblist(values=outbound_blacklists, htmlInputName='blacklistRecipient', label=_('Blacklisted recipients'), rows=6) }}
{% endif %}
{{ display_per_account_wblist_formats() }}
{# .columns #} {%- endmacro %} {% macro display_allow_nets(allow_nets) -%}

{{ _('Restrict to login from specified addresses') }}

{{ _('One IP address or CIDR network per line.') }}

{{ _('Address format') }}

  • {{ _('Single IP Address') }}: 192.168.2.10
  • {{ _('CIDR formatted range of IP addresses') }}: 192.168.2.0/24
{%- endmacro %} {% macro display_disabled_domain_mail_services(disabled_mail_services) -%} {# service names MUST be SAME as list of variable - `AVAILABLE_DOMAIN_DISABLED_MAIL_SERVICES`: libs/sqllib/domain.py #} {% set available_services = [ ('checkbox', 'smtp', _('Sending mails via SMTP')), ('checkbox', 'smtpsecured', _('Sending mails via SMTP over TLS/SSL')), ('checkbox', 'pop3', _('Fetching mails via POP3')), ('checkbox', 'pop3secured', _('Fetching mails via POP3 over TLS/SSL')), ('checkbox', 'imap', _('Fetching mails via IMAP')), ('checkbox', 'imapsecured', _('Fetching mails via IMAP over TLS/SSL')), ('checkbox', 'managesieve', _('Customize mail filter rule')), ('checkbox', 'managesievesecured', _('Customize mail filter rule over TLS/SSL')), ('checkbox', 'sogo', _('SOGo Groupware (Calendar, Contacts, Tasks, ActiveSync)')), ] %}

{{ _('Disabled mail services') }}

{% for srv in available_services %} {% if not loop.first %}

 

{% endif %}
{% endfor %}
{# .col2-3 #}

{{ _('Disabling service will be applied to newly created mail user by default. If you want to update existing mail users, please toggle on checkbox below.') }}

{# .columns #} {%- endmacro %} {% macro display_per_account_alias_addresses(mail, alias_addresses=None) %} {% if not alias_addresses %} {% set alias_addresses = [] %} {% endif %}

{{ _('Alias email addresses') }}

{{ _('One mail address per line. Invalid address will be discarded.') }}

{# .col2-3 #}
  • {{ _('Emails sent to alias addresses will be delivered to %s.') |format('' + mail + '') }}
  • {{ _('Alias addresses must end with domain name: %s') |format('' + mail.split('@', 1)[-1] + '') }}
{# .col1-3 #}
{# .columns #} {% endmacro %}