Viewing File: /usr/local/cpanel/base/frontend/jupiter/email_accounts/index.html.tt

[%
    USE ExpVar;
    USE Uapi;
    USE JSON;

    SET CPANEL.CPVAR.dprefix = "../";

    SET has_remote_calcard_feature = CPANEL.feature('caldavcarddav');

    # prefer ExpVar over Uapi here as its 1000% faster in this context
    SET is_cpdavd_enabled = ExpVar.expand('$hascpdavd') ? 1 : 0;
    SET has_external_auth_modules_configured = execute("ExternalAuthentication","has_external_auth_modules_configured",{appname=>'webmaild'}).data;
    SET show_calendar_and_contacts_items = has_remote_calcard_feature && is_cpdavd_enabled;
    SET show_config_section = has_remote_calcard_feature && is_cpdavd_enabled;

    SET has_popaccts_feature = CPANEL.feature('popaccts');
    SET has_user_manager = CPANEL.feature('user_manager');

    SET hostname = ExpVar.expand('$hostname');

    SET is_invite_sub_enabled = ExpVar.expand('$is_invite_sub_enabled') && (has_user_manager || CPANEL.is_team_user) ? 1 : 0;

    SET ROOT_URL = (CPANEL.ENV.HTTPS == 'on' ? 'https://' : 'http://') _ CPANEL.ENV.HTTP_HOST _ ':' _ CPANEL.ENV.SERVER_PORT _ cp_security_token;
    SET debug_mode = CPANEL.is_debug_mode_enabled();

    IF has_popaccts_feature;
        USE Email;
        USE CPBranding;
        USE VarCache;
        USE Master;

        SET upgrade_url = CPBranding.get_implementer_from_available_applications(varcache.available_applications, 'upgrade').url;

        SET upgradeUrl = upgrade_url != "" ? CPANEL.CPVAR.dprefix _ upgrade_url : "";

        SET CPANEL.CPVAR.userdefined_quota_default_value = Email.get_user_default_email_quota().html();

        IF !(CPANEL.CPCONF.email_account_quota_default_selected == "unlimited");
            SET CPANEL.CPVAR.default_quota_selected = "userdefined";
        END;

        IF !(CPANEL.CPVAR.default_quota_selected);
            SET CPANEL.CPVAR.default_quota_selected = "unlimited";
        END;

        # list domains
        SET list_mail_domains =  execute("Email", "list_mail_domains", {} );
        SET CPANEL.CPVAR.maildomainscount = list_mail_domains.data.size();
        SET primary_domain = CPANEL.CPDATA.DNS;

        # Fetch the required strength
        SET required_strength_resp = execute("PasswdStrength", "get_required_strength", {"app"=>"pop"} );

        IF required_strength_resp.size();
            SET required_strength = required_strength_resp.data.strength;
        END;

        SET has_max_emailacct_quota = CPANEL.CPDATA.MAX_EMAILACCT_QUOTA && CPANEL.CPDATA.MAX_EMAILACCT_QUOTA != "unlimited";

        SET max_email_quota = execute("Email", "get_max_email_quota_mib").data;

        SET page_styles_list = ['email_accounts/index.css'];
        SET embeded_styles_list = [];

        IF !CPANEL.ua_is_mobile;
            embeded_styles_list.push("css/angular-chosen-spinner.css");
            page_styles_list.push("libraries/chosen/1.5.1/chosen.min.css");
        END;

        SET view_templates = [
            "views/create.ptt",
            "views/list.ptt",
            "views/manage.ptt",
            "views/manageDefault.ptt",
        ];
    END;

    SET emailAccountsNVData = execute('Personalization', 'get', { names = ['CSSS_cpanel_email_accounts'] }).data;
    SET has_max_emailacct_quota = CPANEL.CPDATA.MAX_EMAILACCT_QUOTA && CPANEL.CPDATA.MAX_EMAILACCT_QUOTA != "unlimited";
-%]

[% js_code = PROCESS js_block %]

[% WRAPPER '_assets/master.html.tt'
    app_key = 'email_accounts'
    feature = 'popaccts'
    page_js = js_code
    include_legacy_stylesheets = 0
    include_legacy_scripts = 0
    include_cjt = 0
    use_master_bootstrap = 0
    focus_feature_search = 0
    page_stylesheets = page_styles_list
    embed_stylesheets = embeded_styles_list
    show_breadcrumb = 1
-%]

<div id="body-content" class="body-content">

    <!-- NOTE: leave the alert-group in single quotes -->
    <cp-alert-list alert-group="'emailAccounts'"></cp-alert-list>

    <div id="viewContent"
                class="ng-cloak section"
                ng-view
                ng-cloak>
    </div>

    [% FOREACH ptt IN view_templates %]
    <script id="[% ptt %]" type="text/ng-template">
        [%- PROCESS $ptt -%]
    </script>
    [% END %]

    <script id="decorators/pagination.phtml" type="text/ng-template">
        [%- INSERT "decorators/pagination.phtml" -%]
    </script>

    [% PROCESS '_assets/cjt2_header_include.tt' %]

</div><!-- end body-content div -->
[% END #wrapper %]

[% BLOCK js_block %]
<script type="text/javascript">
var PAGE = PAGE || {};
[%- IF emailAccountsNVData.personalization.CSSS_cpanel_email_accounts.value -%]
PAGE.nvdata = JSON.parse([%- JSON.stringify(emailAccountsNVData.personalization.CSSS_cpanel_email_accounts.value) -%]);
[%- END -%]

PAGE.securityToken = [% CPANEL.ENV.cp_security_token.json() || '""' %];
PAGE.requiredPasswordStrength = [% required_strength ? required_strength : 0 %];
PAGE.defaultQuotaSelected = '[% CPANEL.CPVAR.default_quota_selected.html() %]';
PAGE.userDefinedQuotaDefaultValue = parseInt([% CPANEL.CPVAR.userdefined_quota_default_value.json() %]);
PAGE.canSetUnlimited = [%- has_max_emailacct_quota ? 'false' : 'true' %];
PAGE.maxEmailQuota = parseInt("[% max_email_quota %]");
PAGE.isInviteSubEnabled = [% is_invite_sub_enabled ? 'true' : 'false' %];

PAGE.upgradeUrl = [% upgradeUrl.json() || '""' %]

PAGE.webmailEnabled = [%- CPANEL.feature('webmail') ? 'true' : 'false' -%];
PAGE.mailDomains = [%- JSON.stringify(list_mail_domains.data) -%];
PAGE.primaryDomain = [%- JSON.stringify(primary_domain) -%];
PAGE.showConfigSection = [% show_calendar_and_contacts_items == 1 ? 'true' : 'false' %];
PAGE.showCalendarAndContactItems = [% show_calendar_and_contacts_items ? 'true' : 'false' %];
PAGE.externalAuthModulesConfigured = [%- has_external_auth_modules_configured ? 'true' : 'false' -%];
PAGE.emailDiskUsageEnabled = [%- CPANEL.feature('email_disk_usage') ? 'true' : 'false' -%];
PAGE.defaultAccountEnabled = [%- CPANEL.feature('defaultaddress') ? 'true' : 'false' -%];
PAGE.emailFiltersEnabled = [%- CPANEL.feature('blockers') ? 'true': 'false' -%];
PAGE.defaultAddressEnabled = [%- CPANEL.feature('defaultaddress') ? 'true': 'false' -%];
PAGE.autoResponderEnabled = [%- CPANEL.feature('autoresponders') ? 'true': 'false' -%];
PAGE.isRTL = document.getElementsByTagName("HTML")[0].getAttribute("dir") === "rtl";
PAGE.mainEmailAccount = [%- CPANEL.user.json() || '""' -%];
PAGE.hostname = [%- JSON.stringify(hostname) -%];
PAGE.dprefix = [%- CPANEL.CPVAR.dprefix.json() || '""' -%];
</script>
[% END #js_block %]
Back to Directory File Manager