{# @allDomains LDAP query result set @cur_domain Current domain name. @defaultUserQuota Default user quota @domainAccountSetting @numberOfCurrentAccounts [username, newpw, confirmpw, msg, ] #} {% extends "layout.html" %} {% from "macros/general.html" import display_subnav, display_input_cn, display_reset_password, display_quota, with context %} {% from "macros/msgHandlers.html" import userMsgHandler with context %} {% block title %}{{ _('Add user') }}{% endblock title %} {% block navlinks_active_create %}class="active"{% endblock %} {% block breadcrumb %} {% set crumbs = [ (ctx.homepath + '/domains', _('All domains'),), (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain,), (ctx.homepath + '/users/' + cur_domain, _('Users'),), (None, _('Add user'),), ] %} {{ display_subnav(crumbs) }} {% endblock %} {% block main %} {# Show system message #} {{ userMsgHandler(msg) }} {# Get domain quota size & unit #} {% set domainQuota = domainAccountSetting.get('domainQuota', '0:GB') %} {% set domainQuotaSize, domainQuotaUnit = domainQuota.split(':') %} {# -1 means temporary error. Don't allow to create new user. #} {% set domainSpareQuotaSize = -1 %} {% set domainQuotaBytes = 0 %} {% if domainQuotaSize |int > 0 %} {% if domainQuotaUnit == 'GB' %} {% set domainQuotaBytes = domainQuotaSize |int * 1024 * 1024 * 1024 %} {% elif domainQuotaUnit == 'MB' %} {% set domainQuotaBytes = domainQuotaSize |int * 1024 * 1024 %} {% endif %} {% set domainSpareQuotaSize = domainQuotaBytes - domainCurrentQuotaSize %} {% endif %} {# Number of accounts #} {% set numberOfAccounts = domainAccountSetting.get('numberOfUsers', '0') %} {# Password length #} {% set minPasswordLength = domainAccountSetting.get('minPasswordLength', '0') %} {% set maxPasswordLength = domainAccountSetting.get('maxPasswordLength', '0') %} {% set createNewAccount = true %} {% if domainQuotaBytes > 0 and domainSpareQuotaSize <= 0 %} {% set createNewAccount = false %} {% set whyDisabledCreation = _('No free domain quota left.') %} {% endif %} {# Display input field for adding new user. #}
{{ _('Error:') }} {{ _('You can NOT create more users under domain %s.') |format('' + cur_domain + '') }} {{ whyDisabledCreation }}
{{ _('Error:') }} {{ _('You can NOT create more users under domain %s.') |format('' + cur_domain + '') }} {% if numberOfCurrentAccounts >= numberOfAccounts |int %} {{ _('Already exceed max number of account limit (%s).') |format(numberOfAccounts) }} {% endif %} {# Show link to change limit #} {% if session.get('domainGlobalAdmin') is sameas true %} {{ _('Increase it now?') }} {% endif %}
{{ _('You can create %d more mail user(s) under domain %s.') |format(numberOfAccounts |int - numberOfCurrentAccounts, '' + cur_domain + '') }}