{# ------------ Load JS files ------------- #} {% macro load_jquery(plugins=[], sortFirstCol=False, defaultPlugins=['tooltip', 'idtabs',]) -%} {# Available jQuery plugins: [idtabs, jeditable, visualize, fancybox, idtabs, ui, jcarousel, validate,] excanvas.js, cufon.js, #} {% for p in defaultPlugins %} {% endfor %} {% for p in plugins %} {% endfor %} {# #} {%- 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) -%} {#-- crumbs = [(link, label), (link, label)] --#} {% if crumbs | length > 0 %} {% endif %} {%- endmacro -%} {% macro set_account_status_img(status, float="right") -%} {% 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 %} {% endif %} {%- endmacro %} {% macro set_admin_type_img(value) -%} {% if value == 'yes' %} {% else %} {% endif %} {%- endmacro %} {% macro set_status_img(status) -%} {% if status == 'active' or status == 'yes' %} {% set img = "enabled.png" %} {% else %} {% set img = "disabled.png" %} {% endif %} {%- endmacro %} {% macro display_input_img(image="", alt="") -%} {%- 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.1em' %} {% 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 input_hidden(name, value) -%} {%- endmacro %} {% macro display_input_employeeid(value='') -%}

{{ _('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_preferredLanguage(value='', languagemaps=['en_US',]) -%}

{{ _('Preferred language') }}

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

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

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

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

{%- endmacro %} {# Used to display domainMaxXXXNumber #} {% macro display_number_of_account_limited(value, hide_unlimited=true) -%} {% if value == '0' or value == 0 or value == 'None' %}{% if hide_unlimited is not sameas true %}/{{ _('Unlimited') }}{% endif %}{%else%}/ {{value}}{%endif%} {%- endmacro %} {%- macro display_quota_usage_percent(current, total) -%} {% set percent = (current |int * 100) // total |int %} {% if percent > 80 %} {{percent}}% {% else %} {{percent}}% {% endif %} {%- endmacro -%} {# Display accountStatus #} {% macro display_account_status(accountStatus, accountType='user') %}
{% if accountType == 'domain' %}

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

{% else %}

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

{% endif %}
{%- endmacro %} {# Display enabledService - accountType: domain, admin, user, maillist, alias. - enabledService: list of all enabled services. #} {% macro display_enabled_services(accountType, enabledService) -%} {# Set list of available services for different account types. Format: [ ('type_of_input', 'value_of_enabledService', 'label'), ... ] @type_of_input: value of attribute "type" in HTML tag. Available: hidden, checkbox. Note: This is an OPTIONAL. #} {% if accountType == 'domain' %} {% set available_services = [ ('checkbox', 'domainalias', _('Domain alias')), ('checkbox', 'recipientbcc', _('BCC incoming mails to other addresses')), ('checkbox', 'senderbcc', _('BCC outgoing mails to other addresses')), ] %} {% elif accountType == 'user' %} {% set available_services = [ ('hidden', 'internal', ''), ('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', 'deliver', _('Receiving mails for this account on mail server')), ('checkbox', 'forward', _('Forwarding mails to other addresses')), ('checkbox', 'shadowaddress', _('Alias account')), ('checkbox', 'managesieve', _('Customize mail filter rule')), ('checkbox', 'managesievesecured', _('Customize mail filter rule over TLS/SSL')), ('checkbox', 'recipientbcc', _('BCC incoming mails to other address')), ('checkbox', 'senderbcc', _('BCC outgoing mails to other address')), ('checkbox', 'displayedInGlobalAddressBook', _('Display mail address in global LDAP address book')), ] %} {% elif accountType == 'alias' %} {% set available_services = [ ('checkbox', 'displayedInGlobalAddressBook', _('Display mail address in global LDAP address book')), ] %} {% endif %}

{{ _('Enabled Services') }}

{% for srv in available_services %} {% if srv[0] != 'hidden' %}

 

{% endif %}
{% endfor %} {%- endmacro %} {% macro display_all_admins(domainAdmins=[], allAdmins=[]) -%}

{{ _('Domain Admins') }}

{% for admin in allAdmins %} {% set entry = admin[1] %} {% set adminMail = entry.get('mail')[0] %}
{% endfor %}
{%- endmacro %} {% macro display_reset_password(oldpw='', newpw='', confirmpw='', show_oldpw=false, show_confirmpw=true, min_passwd_length='6', max_passwd_length='0') -%} {% 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 %}
{%- endmacro %} {% macro display_quota(value='', label='', comment='', used_quota=none, spare_quota_bytes=0, show_spare_quota='no', show_value_in_input='no', hide_zero='yes', show_used_quota=true) -%} {# Convert to string #} {% set value = value |string %} {% set used_quota = used_quota |string %} {% if hide_zero == 'yes' and value == '0' %} {% set value = '' %} {% endif %}
{% if label == '' %}

{{ _('Mailbox Quota') }}

{% else %}

{{ label }}

{% endif %} {% if spare_quota_bytes |int >= 0 %} {% if show_spare_quota == 'yes' %} {% endif %} {% elif spare_quota_bytes |int == -1 %} {% set comment = _('Set to 0 for unlimited.') %} {% endif %} {% if show_used_quota is sameas true %} {% if session.get('enableShowUsedQuota') is sameas true and value.isdigit() and used_quota.isdigit() %} {% set percent = used_quota |getPercentage(value |int * 1024 * 1024) %} {% endif %} {% endif %}
{%- endmacro %} {% macro display_recipient_bcc(address='') -%}

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

{%- endmacro %} {% macro display_sender_bcc(address='') -%}

{{ _('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") -%}
{% if accountType == 'domain' %}

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

{% else %}

{{ _('Display Name') }}

{% endif %}
{%- endmacro %} {% macro display_add_admin(label=false, min_passwd_length='0', max_passwd_length='0', lang='en_US', languagemaps=['en_US',]) -%}
{% if label is sameas true %}

{{ _('Add admin') }}

{% endif %}
{{ 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_input_global_admin() }} {{ display_preferredLanguage(lang, languagemaps) }} {{ display_button_submit(label=_('Add')) }}
{%- endmacro %} {% macro display_add_domain(label=false) -%}
{% if label is sameas true %}

{{ _('Add domain') }}

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

 

{%- endmacro %} {% macro display_all_domains(managedDomains=[], allDomains=[]) -%}

{{ _('Managed Domains') }}

{% for domain in allDomains %} {% set domainName = domain[1].get('domainName')[0] %}
{% endfor %}
{#-- .col2-3 --#}
{#-- .columns --#} {%- 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 nav_links_of_account_types(domain, active='users') -%} {% set links = [ ('users', _('Users')), ('maillists', _('Mail Lists')), ('aliases', _('Aliases')), ] %} » {% for url, label in links %} {{ label }}{% if not loop.last %} » {% endif %} {% endfor %} {%- endmacro %} {% macro highlight_username_in_mail(mail) -%} {{ mail.split('@')[0] }}@{{ mail.split('@')[-1] }} {% endmacro %} {% macro show_pages(baseurl, total, cur_page, near_pages=2, sep='/page/') -%} {% if total % session.pageSizeLimit > 0 %} {% set total_pages = total // session.pageSizeLimit + 1 %} {% else %} {% set total_pages = total // session.pageSizeLimit %} {% endif %}
{% if total_pages > 0 %} {% if total_pages != 1 %} {{ _('First Page') }} {% endif %} {% if cur_page != 1 and cur_page != 0 %} {% endif %} {% endif %} {% if total_pages <= 4 %} {# 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 <= 3 %} {# 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. #} 1 {% if cur_page - near_pages >= 2 %} ... {% 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) -%} {% if event == 'all' %} {{ _('Events') }} {% elif event == 'login' %} {{ _('Admin login') }} {% elif event == 'create' %} {{ _('Add account') }} {% elif event == 'delete' %} {{ _('Delete account') }} {% elif event == 'disable' %} {{ _('Disable account') }} {% elif event == 'active' %} {{ _('Active account') }} {% endif %} {%- endmacro %} {# iRedAPD: per-user wblist #} {% macro display_per_user_wblist(values=[], htmlInputName, label) -%}

{{ label }}

{{ _('One record one line.') }} {% if values |length == 0 %} {% else %} {% endif %}
{%- endmacro %}