{# ------------ Load JS files ------------- #} {% macro load_jquery(plugins=[], nonSortedCols=[], defaultPlugins=['tooltip', 'idtabs', 'fancybox'], quarantined=false) -%} {# Available jQuery plugins: [idtabs, jeditable, visualize, fancybox, idtabs, ui, jcarousel, validate] #} {% for p in defaultPlugins %} {% endfor %} {% for p in plugins %} {% endfor %} {# Addition JS/jQuery functions #} {%- endmacro %} {# ------------ END Load JS files ------------- #} {% macro load_jquery_quicksearch() -%} $("input.quickSearch").quicksearch("table.dataList tbody tr"); {%- endmacro %} {# ------------ END Load jQuery $(document).read() functions ------------- #} {%- macro display_subnav(crumbs) -%} {# Crumb format: (link, label), ('active', link, label) #} {% if crumbs | length > 0 %} {% endif %} {%- endmacro -%} {% macro set_account_status_img(status, float="right", tooltip=true, vcenter=true) -%} {% 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 status == 'active' or status |string == '1' %} {% else %} {% set tooltip = _('Account is disabled.') %} {% endif %} {%- endmacro %} {% macro set_admin_type_img(value) -%} {% if value == 'yes' %} {% else %} {% endif %} {%- endmacro %} {% macro display_button_submit(label=none, color='green') -%}

 

{%- 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 tooltip = 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 is sameas true %}
{% endif %} {%- endmacro %} {% macro display_csrf_token(token=none) -%} {% if token is sameas none %} {% set token = csrf_token() %} {% else %} {% set token = token |e %} {% endif %} {%- endmacro %} {% macro display_input_employeeid(value='') -%} {% if value is sameas none %} {% set value = '' %} {% endif %}

{{ _('User ID') }}

{%- endmacro %} {% macro display_input_jobtitle(value='') -%}

{{ _('Job Title/Responsibility') }}

{%- endmacro %} {% macro display_input_mobile(value) -%}

{{ _('Mobile') }}

{%- endmacro %} {% macro display_input_phone(value=[]) -%} {% if value |length == 0 %}

{{ _('Telephone Number') }}

{% else %} {% for phone in value %}
{% 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',]) -%}

{{ _('Preferred language') }}

{%- endmacro %} {% macro display_in_global_address_book(enabledService=[]) %}

{{ _("Displayed in Global LDAP Address Book") }}

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

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

{# ldap: yes, no mysql: true, false #}
{%- endmacro %} {% macro display_mark_user_as_admin(is_domain_admin=false, is_global_admin=false) %} {# possible value: 0, 1 (SQL), or true, yes, false, no (LDAP) #} {% if session.get('domainGlobalAdmin') is sameas true %}

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

{{ _('Global admin') }}
{% 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(accountStatus, accountType='user') %} {% if accountStatus is sameas none %} {% set accountStatus = none %} {% endif %}
{% if accountType == 'domain' %}

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

{% else %}

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

{% endif %}
{%- endmacro %} {% macro display_reset_password(show_oldpw=false, show_confirmpw=true, min_passwd_length='0', max_passwd_length='0', store_in_plain=false) -%} {% if min_passwd_length != '0' and max_passwd_length != '0'%} {% set tooltip = _('At least %s characters, but no more than %s.') |format(min_passwd_length, max_passwd_length) %} {% elif min_passwd_length != '0' and max_passwd_length == '0' %} {% set tooltip = _('At least %s characters.') |format(min_passwd_length) %} {% elif max_passwd_length == '0' and max_passwd_length != '0' %} {% set tooltip = _('No more than %s characters.') |format(max_passwd_length) %} {% else %} {% set tooltip = '' %} {% endif %} {% if show_oldpw is sameas true %}

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

{% endif %}

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

{% if show_confirmpw is sameas true %}

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

{% endif %} {% if store_in_plain is sameas true %} {% if session.get('storePasswordInPlain') is sameas true %}

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

{% endif %} {% endif %} {%- endmacro %} {% macro display_quota(value='', label='', comment='', used_quota=none, spare_quota_bytes=0, show_spare_quota=false, show_value_in_input=true, hide_zero=true, show_used_quota=false) -%} {# 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 is sameas true %} {% if value == '0' %} {% set value = '' %} {% endif %} {% endif %}
{% if label == '' %}

{{ _('Mailbox Quota') }}

{% else %}

{{ label |e }}

{% endif %} {% if spare_quota_bytes |int >= 0 %} {% if show_spare_quota is sameas true %} {% endif %} {% elif spare_quota_bytes |int == -1 %} {% set comment = _('Set to 0 for unlimited.') %} {% endif %}
{%- endmacro %} {% macro display_domain_transport(transport='') -%}

{{ _('Relay/Transport Setting') }}

{#-- .col2-3 --#}
  • {{ _('Per-user relay setting will override per-domain relay setting you set in this page.') }}
  • {{ _('Sample') }}
{#-- .col1-3 --#}
{%- endmacro %} {% macro display_recipient_bcc(address='') -%} {% if address is sameas none %} {% set address = '' %} {% endif %}

{{ _('BCC incoming emails to single address') }}

{%- endmacro %} {% macro display_sender_bcc(address='') -%} {% if address is sameas none %} {% set address = '' %} {% endif %}

{{ _('BCC outgoing emails to single address') }}

{%- endmacro %} {% macro display_input_mail(mail='', name='mail', required=false) -%}

{{ _('Mail Address') }} {% if required is sameas true %}*{% endif %}

{%- endmacro %} {% macro display_input_domain(domain='', name='domainName', required=false) -%}

{{ _('Domain Name') }} {% if required is sameas true %}*{% endif %}

{%- endmacro %} {% macro display_input_cn(cn='', name='cn', accountType='user', tooltip='', size="size-250", show_first_last_name=false, first_name='', last_name='') -%} {% if cn is sameas none %} {% set cn = '' %} {% endif %}
{% if accountType == 'domain' %}

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

{% else %}

{{ _('Display Name') }}

{% endif %}
{% if show_first_last_name is sameas true %}

 

{% endif %} {%- endmacro %} {% macro display_add_admin(min_passwd_length='0', max_passwd_length='0', lang='en_US', languagemaps=['en_US',]) -%}
{{ display_csrf_token() }} {{ 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_button_submit(label=_('Add')) }}
{%- endmacro %} {% macro display_domain_quota(quota='', quotaUnit='GB')%}
 

{{ _('Domain quota size') }}

{% endmacro %} {% macro display_domain_default_userquota(quota='1024') %}

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

{% endmacro %} {% macro display_add_domain(label=false) -%}
{% if label is sameas true %}

{{ _('Add domain') }}

{% endif %}
{{ display_csrf_token() }} {{ display_input_domain(required=true) }} {{ display_input_cn(accountType='domain') }}

 

{%- endmacro %} {% macro display_maillist_restrictions(policy, maillist_email) -%} {% set policy = policy.lower() %} {% if policy == 'open' %} {{ _('Unrestricted') }} {% elif policy == 'domain' %} {{ _("Domain users") |format(ctx.homepath + '/users/' + maillist_email.split('@')[-1] ) }} {% elif policy == 'subdomain' %} {{ _("Domain and sub-domain users") |format(ctx.homepath + '/users/' + maillist_email.split('@')[-1] ) }} {% elif policy == 'membersonly' %} {{ _("Members") |format(ctx.homepath + '/profile/maillist/members/' + maillist_email) }} {% elif policy == 'allowedonly' %} {{ _("Moderators") |format(ctx.homepath + '/profile/maillist/moderators/' + maillist_email) }} {% elif policy == 'membersandmoderatorsonly' %} {{ _("Members and moderators") |format(ctx.homepath + '/profile/maillist/members/' + maillist_email, ctx.homepath + '/profile/maillist/moderators/' + maillist_email) }} {% else %} {{ _('Unrestricted') }} {% endif %} {% endmacro %} {% macro highlight_username_in_mail(mail) -%} {{ mail.split('@')[0] |e }}@{{ mail.split('@')[-1] |e }} {% endmacro %} {%- macro display_random_password(length) -%}

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

{{ length | generate_random_strings }}

{%- endmacro -%} {% macro show_pages(baseurl, total, cur_page, near_pages=4, sep='/page/') -%} {% if total % pageSizeLimit > 0 %} {% set total_pages = total // pageSizeLimit + 1 %} {% else %} {% set total_pages = total // pageSizeLimit %} {% 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', 'cron_delete_mailboxes': _('Delete mailboxes')} %} {% if event in event_names %} {{ event_names[event] }} {% else %} {{ event |e }} {% endif %} {%- endmacro %}