Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/master_templates/_defheader.tmpl

[%#

#----------------------------------------------------------------------
# IMPORTANT:
#
# This template gets rendered via Cpanel/Template/Interactive.pm, which
# imposes significant limitations on Template Toolkit syntax. See that
# module’s documentation for more details.
#----------------------------------------------------------------------

    'extrahtml' - used when status is set to give HTML before the status
    'header'
    'icon'
    'extrastyle'
    'meta' - hash or list of hashes
    'scripts' - list or single value
    'stylesheets' - list or single value
    'theme' - string for the set of application styles to be used, defaults to legacy.
              Other options are yui, bootstrap, and jupiter.
    'unprotected' - TODO -REMOVE should linked files be unprotected
    'app_key" -  application key
    'breadcrumbdata'
    'breadcrumburl'
    'skipbreadcrumb' - hides only breadcrumbs
    'skipsupport' - hides only support tab
    'skipheader' - hides only Header icon/text
    'include_legacy_stylesheets' - includes old stylesheets for YUI stuff
    'base' - if defined, adds a <base href=""> tag to the header
    'is_ng' - handles special cases for angular applications
    'hide_navigation' - supress the navigation
    'hide_banner_ad' - supress the banner ad
    'url' - Relative links will prepend the session token and link within the product.
            Absolute links with http:// or https:// prefixes will link to pages outside of
            the product.

    # Add some block injection options to get parity with capabilities from the Jupiter wrapper template
    'meta_block' - a block of meta tags generated by the caller to merge into the head tag.
    'link_block' - a block of link tags generated by the caller to merge into the head tag.
    'js_first_block' - a block of javascript generated by the caller to merge into the head tag.
    'js_block' - a block of javascript generated by the caller to merge into the body at the end of the document.
-%]
[%# This introduces a new line. We need a newline to start this template to avoid errors, cf. case 34446 %]
[%-
    USE Whostmgr;
    USE NVData;
    USE VarCache;
    USE UIAnalytics;
    USE Verify;


    DEFAULT app_key = 'home';

    #Allows mainCommand features to display in left nav. To ensure that ACL init happens for all the pages that use _defheader so that Left navigation and ACL checks work.
    IF !Whostmgr.acls_are_initialized;
        SET acls_are_initialized = Whostmgr.init_acls();
    END;

    SET has_component_system = template_exists("/usr/local/cpanel/whostmgr/docroot/templates/master_templates/component.html.tt");
    IF has_component_system;
        USE Components;
    END;

    SET whm_variables = Whostmgr.template_vars;
    SET plugins = Whostmgr.plugins_data;
    SET show_reboot_banner = Whostmgr.check_flag('CPCONF=show_reboot_banner'),
        needs_reboot_result = whm_variables.needs_reboot,
        quota_broken = whm_variables.quota_broken,
        has_root_privileges =  Whostmgr.hasroot();

    IF Whostmgr.has_license_flag('dev');
        SET license_type = 'Developer';
    ELSIF Whostmgr.has_license_flag('trial');
        SET license_type = 'Trial';
    ELSIF Whostmgr.is_test_build();
        SET license_type = 'Test';
    ELSE;
        SET license_type = "Standard";
    END;

    SET app_list = Whostmgr.get_application_list();

    # NOTE: Notifications came from topframe.tmpl
    SET configserver_shutdown_notice_viewed = NVData.get('configserver_shutdown_notice', undef, 0, 'whm');
    SET site_publisher_deprecation_notice_viewed = NVData.get('site_publisher_deprecation_notice', undef, 0, 'whm');
    SET notifications = [
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'mysql_eol_warning',
            'text' => whm_variables.mysql_version_approaching_eol.soon ?
                locale.maketext('[_1][comment,a software name] [_2][comment,a software version] will reach [asis,EOL] soon.', whm_variables.mysql_version_approaching_eol.display_name, whm_variables.mysql_version_approaching_eol.version) :
                locale.maketext('[_1][comment,a software name] [_2][comment,a software version] has reached [asis,EOL].', whm_variables.mysql_version_approaching_eol.display_name, whm_variables.mysql_version_approaching_eol.version),
            'title' => locale.maketext('Upgrade Now'),
            'isShown' => whm_variables.mysql_version_approaching_eol ? 1 : 0,
            'url' => 'scripts/mysqlupgrade',
            'id' => 'lnkUpdateMysql'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'reboot_quota',
            'text' => locale.maketext('You must reboot your server to enable quotas.'),
            'title' => locale.maketext('You must reboot your server to enable quotas.'),
            'isShown' => (has_root_privileges && show_reboot_banner && needs_reboot_result.quota) ? 1 : 0,
            'url' => 'scripts/graceful_reboot_landing?suggest=1',
            'id' => 'lnkRebootRequiredQuota'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'quota_broken',
            'text' => locale.maketext('Quotas are currently broken on your server.'),
            'title' => locale.maketext('Quotas are currently broken on your server.'),
            'isShown' => (has_root_privileges && quota_broken) ? 1 : 0,
            'url' => 'scripts/dialog?dialog=quotas', # TODO: point directly to documentation when able to do so
            'id' => 'lnkBrokenQuota'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'reboot_kernel',
            'text' => locale.maketext('You must reboot your server to apply kernel updates.'),
            'title' => locale.maketext('You must reboot your server to apply kernel updates.'),
            'isShown' => (has_root_privileges && show_reboot_banner && needs_reboot_result.kernel) ? 1 : 0,
            'url' => 'scripts/graceful_reboot_landing?suggest=1',
            'id' => 'lnkRebootRequiredKernel'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'reboot_updates',
            'text' => locale.maketext('You must reboot your server to apply software updates.'),
            'title' => locale.maketext('You must reboot your server to apply software updates.'),
            'isShown' => (has_root_privileges && show_reboot_banner && needs_reboot_result.kernel) ? 1 : 0,
            'url' => 'scripts/graceful_reboot_landing?suggest=1',
            'id' => 'lnkRebootRequiredSoftware'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'reboot_updates',
            'text' => locale.maketext('You must reboot your server to use CloudLinux features.'),
            'title' => locale.maketext('You must reboot your server to use CloudLinux features.'),
            'isShown' => (has_root_privileges && show_reboot_banner && needs_reboot_result.needs_cloudlinux) ? 1 : 0,
            'url' => 'scripts/graceful_reboot_landing?suggest=1',
            'id' => 'lnkRebootRequiredCloudLinux'
        },
        {
            'type' => 'warning',
            'api_check' => !Whostmgr.dnsonly && has_root_privileges && !whm_variables.needs_reboot.quota,
            'name' => 'quota_disabled',
            'text' => locale.maketext('Filesystem quotas are currently disabled.'),
            'title' => locale.maketext('Click to enable quotas.'),
            'isShown' => 0,
            'url' => 'scripts/dialog?dialog=quotas',
            'id' => 'lnkUpdateBlocker'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'version_update_blocked',
            'text' => locale.maketext('The last attempt to update [asis,cPanel amp() WHM] was blocked.'),
            'title' => locale.maketext('Details'),
            'isShown' => whm_variables.update_blocked ? 1 : 0,
            'url' => 'scripts7/review_upcp_blockers',
            'id' => 'lnkUpdateBlocker'
        },
        {
            'type' => 'warning',
            'api_check' => !whm_variables.update_blocked,
            'name' => 'version_update_available',
            'text' => "",
            'title' => locale.maketext('Update Now'),
            'isShown' => 0,
            'url' => 'scripts2/upcpform',
            'id' => 'lnkUpdateNow'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'configserver_shutdown_notice',
            'text' => locale.maketext('Notice: [asis,ConfigServer] will be closing down 31st August 2025 - Plugins like [asis,ConfigServer Security amp() Firewall (csf)], [asis,ConfigServer Exploit Scanner (cxs)], [asis,Outgoing Spam Monitor (osm)], and [asis,MailScanner Front-End (MSFE)] and others may be impacted. Click for more information.'),
            'title' => locale.maketext('[asis,ConfigServer] Shutdown Notice'),
            'isShown' => whm_variables.profile != 'WP2' && has_root_privileges && !configserver_shutdown_notice_viewed,
            'url' => 'https://go.cpanel.net/configserver-shutdown',
            'id' => 'lnkConfigserverShutdownNotice'
        },
        {
            'type' => 'warning',
            'api_check' => 0,
            'name' => 'site_publisher_deprecation_notice',
            'text' => locale.maketext('Site Publisher is no longer available since cPanel [output,amp] WHM version 134. Click for more information.'),
            'title' => locale.maketext('Site Publisher has been deprecated'),
            'isShown' => whm_variables.profile != 'WP2' && has_root_privileges && !site_publisher_deprecation_notice_viewed,
            'url' => 'https://go.cpanel.net/exportspdata',
            'id' => 'lnkSitePublisherDeprecationNotice'
        }
    ];

    SET breadcrumbdata = Whostmgr.get_breadcrumb_data_for_master() IF !breadcrumbdata.defined; #reads breadcrumburl for all templates used by page templates in main frame.
    SET dnsonlytext = breadcrumbdata.dnsonly ? 'dnsonly' : '';

    IF ( breadcrumbdata.url );  #if we got anything useful...
        IF ( ! icon );
            icon = breadcrumbdata.icon;
        END;

        IF ( ! header );
            header = locale.makevar(breadcrumbdata.name);       # Variable can translate (extracted from whostmgr/docroot/themes/x/breadcrumb)
        END;
    END;

    USE Command;

    # TODO: TENTATIVE REMOVE Unprotected.
    IF ( !unprotected );
        unprotected = 0;
    END;

    # REMOVE this after we no longer have YUI in WHM
    SET include_legacy_stylesheets = 0 IF !include_legacy_stylesheets.defined;
    SET inside_frame_or_tab_or_popup = 0 IF !inside_frame_or_tab_or_popup.defined;
    SET skipheader = 0 IF !skipheader.defined;
    SET hide_header = 0 IF !hide_header.defined; # hide top chrome
    SET hide_navigation = 0 IF !hide_navigation.defined;
    SET hide_license_warnings = 0 IF !hide_license_warnings.defined;
    SET locale_tag = locale.get_language_tag();
    SET locale_version = calculate_magic_lex_mtime(locale_tag);
    SET locale_query_string = '?locale=' _ locale_tag _ '&locale_revision=' _ locale_version;
    SET app_key = '' IF !app_key.defined;

    SET is_home_page = (Whostmgr.page_name() == '' ||  Whostmgr.page_name() == 'Home') && app_key != '';
    SET server_environment = whm_variables.BASEOS _ " " _ whm_variables.profile _ " " _ whm_variables.envtype;

    #When the breadcrumb data does not exist for an application (like a plugin) the value of `breadcrumdata` is `{}`
    IF is_home_page || breadcrumbdata.list.size == 0;
        SET skipbreadcrumb = 1;
    END;

    # From this template the top navigation element should only be hidden on
    # the initial setup pages in any iframes (Exim Configuration Manager).
    IF inside_frame_or_tab_or_popup;
        SET hide_header = 1,
            hide_navigation = 1,
            hide_license_warnings = 1,
            skipbreadcrumb = 1,
            skipsupport = 1;
    END;

    # Skip loading the support JS if we don't have the template loaded
    IF skipbreadcrumb;
        SET skipsupport = 1;
    END;

    # Get the permissions for the nav account search feature
    SET permissions = {
        'all'          => Whostmgr.checkacl('all'),
        'listAccounts' => Whostmgr.checkacl('list-accts'),
        'modifyAccount'=> Whostmgr.checkacl('edit-account'),
        'impersonateAccountTweakSettingValue' => Whostmgr.get_account_impersonation_permission_value(),
        'basicWHMFunctions' => Whostmgr.checkacl('basic-whm-functions'),
    };

    IF hide_header;
        SET hide_top_chrome = 1;
    ELSE;
        SET hide_top_chrome = 0;
    END;

    # Data for analytics purpose.
    SET whm_analytics_include_template = '/var/cpanel/customizations/whm/includes/cp_analytics_whm.html.tt';
    SET is_analytics_enabled_server_side = CPANEL.is_server_analytics_enabled();

    # Page meta data for analytics purpose.
    SET analytics_page_meta = {
        product_feature => app_key,
        product_feature_group => "",
        framework_js => "",
        framework_css => "",
        # Add additional page meta to be sent to analytics.
    };

    SET cp_analytics_data = UIAnalytics.get_whm_analytics_data();
    FOREACH key IN analytics_page_meta.keys.sort;
        cp_analytics_data.$key = analytics_page_meta.$key;
    END;

    SET analyticsConfig = {
        cpAnalyticsData => cp_analytics_data,
        debugMode => CPANEL.is_debug_mode_enabled(),
        loginUser => CPANEL.authuser,
        isSandbox => Whostmgr.is_sandbox(),
        canTrackUserAnalytics => can_track_user_analytics,
        isUserAnalyticsRequiredByLeika => is_user_analytics_required_by_leika,
        # Add additional page meta to be sent to analytics.
    };

-%]
<!DOCTYPE html>
<html lang="[% locale_tag %]" dir="[% locale.get_html_dir_attr() %]">
    <head>

        <!-- HTML HEAD SECTION -->
        <!-- bootstrap requires IE=edge -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- Title -->
        <title>WHM [[% Whostmgr.shorthostname() %]] [% header %] - [% Whostmgr.WHM_VERSION %]</title>
        [% IF base %]
        <base href="[% (base.match(cp_security_token)) ? base : cp_security_token _ base %]">
        [% END %]
        <!-- Fav Icon -->
        <link rel="shortcut icon" href="[% Whostmgr.find_file_url( 'favicon.ico', unprotected ) %]" type="image/x-icon" />
        [% SET rtl_extension = locale.get_html_dir_attr() == 'rtl' ? '.rtl' : ''; %]
        <link rel='stylesheet' type='text/css' href='[% MagicRevision("/jupiter_styles/fonts${rtl_extension}.min.css") %]' id='custom-fonts-stylesheet' />
        <link rel='stylesheet' type='text/css' href='[% MagicRevision("/core/main_content/main_content_spacing${rtl_extension}.min.css") %]' />
        <link rel='stylesheet' type='text/css' href='[% MagicRevision("/core/main_content/main_content${rtl_extension}.min.css") %]' />
        <link rel='stylesheet' type='text/css' href='[% MagicRevision("/jupiter_styles/preload_styles${rtl_extension}.min.css") %]' />

        <!-- Meta Data -->
        <meta http-equiv="Content-Type" content="text/html; charset=[% locale.encoding() %]" />

        <meta name="referrer" content="origin">

        [%
            IF meta_block;
                meta_block;
            END;
            IF meta;
                IF ref(meta) == 'ARRAY';
                    FOR meta_item = meta;
                        '<meta ';
                        FOR key = meta_item.keys;
                            key _ '="' _ meta_item.$key _ '" ';
                        END;
                        '/>';
                    END;
                ELSE;
                    '<meta ';
                    FOR key = meta.keys;
                        key _ '="' _ meta.$key _ '" ';
                    END;
                    '/>';
                END;
            END;
        -%]
        [%#
            NOTE: These are most common things any page JS
            would need to exposing them so that it's available
            for all js files
        %]
        <script nonce="[% CPANEL.nonce() %]">
            window.COMMON = window.COMMON || {};
            window.COMMON.hasRootPrivileges = [% IF Whostmgr.hasroot() %]true[% ELSE %]false[% END %];
            window.COMMON.securityToken = [% JSON.stringify(cp_security_token) %];
            window.COMMON.userName = "[% whm_variables.remote_user %]";
            window.COMMON.isDnsOnly = [% IF Whostmgr.dnsonly %]true[% ELSE %]false[% END %];
            [% IF !hide_navigation %]
            window.COMMON.leftNavNVData = [% NVData.get("whmcommand:", "", 1, "whm").json() || 'null' -%];
            [% END %]
        </script>

        [% # Script for Google Tag Manager. This one is not optional. %]
        [% IF !inside_frame_or_tab_or_popup %]
        <script>

        [% # Calculate the license type
            SET license_type = CPANEL.get_producttype();
            IF Whostmgr.has_license_flag('dev');
                license_type = license_type _ ' DEVELOPER';
            ELSIF Whostmgr.has_license_flag('trial');
                license_type = license_type _ ' TRIAL';
            ELSIF Whostmgr.is_test_build();
                license_type = license_type _ ' TEST';
            END;
        %]

        </script>
        [% END %]

        [%
            SET src_js = [];

            #
            # utilities_container.js is currently not localized
            # because locale.cpanel_get_lex_path will enumerate every
            # possible fallback locale object when it cannot find
            # a localized file this is expensive and will stat
            # every potential option.  If we localize utilities_container.js
            # we should uncomment the below
            #
            #lex_path = locale.cpanel_get_lex_path('/usr/local/cpanel/base/yui-gen/utilities_container/utilities_container.js', '/yui-gen/utilities_container/utilities_container.js');
            #IF lex_path;
            #    src_js.push( CPANEL.get_js_url(lex_path) );
            #END;

            # Will bring back the exclusive logic back when we figure out how best we can load
            # topframe javascript
            DEFAULT CJT2_EXCLUSIVE = 0;
            IF !CJT2_EXCLUSIVE && !is_ng;
                src_js.push(CPANEL.get_js_url('/yui-gen/utilities_container/utilities_container.js'));

                # Then CJT itself
                IF CPANEL.is_debug_mode_enabled();
                    src_js.push( CPANEL.get_js_url('/cjt/cjt.js') _ locale_query_string );
                ELSE;
                    src_js.push( CPANEL.get_js_url('/cjt/cjt-min.js') _ locale_query_string );
                END;
            END;

            FOR src = src_js;
                IF src;
                    IF ! LOADED;
                        SET LOADED = [];
                    END;

                    SET src = CPANEL.get_js_localized_url( src );

                    IF LOADED.grep('^' _ src _ '$').size == 0;
                        "<script type='text/javascript' src='$src'></script>";
                        LOADED.push(src);
                    END;
                END;
            END;
        -%]
        [% IF theme == "bootstrap"; %]
                [% # load minimal whm styles for breadcrumbs and help %]
                    [% IF locale.get_html_dir_attr() == 'rtl'; %]
                    <link rel='stylesheet' type='text/css' href="[% Whostmgr.find_file_url('/styles/master-rtl.cmb.min.css') %]" />
                    [% ELSE %]
                    <link rel='stylesheet' type='text/css' href="[% Whostmgr.find_file_url('/styles/master-ltr.cmb.min.css') %]" />
                    [% END %]

                [% IF include_legacy_stylesheets; %]
                    <link rel='stylesheet' type='text/css' href="[% Whostmgr.find_file_url('/styles/legacy_yui_styles.min.css') %]" />
                [% END; %]

                [% FOR page_css_url=Whostmgr.get_page_css_url();
                    # load page specific css
                    "<link rel='stylesheet' type='text/css' href='$page_css_url' />";
                     END; %]
        [% ELSIF theme == "jupiter"; %]
                <link rel='stylesheet' type='text/css' href='[% MagicRevision("/jupiter_styles/jupiter-styles/dist/css/main${rtl_extension}.min.css") %]' />
                <link rel='stylesheet' type='text/css' href='[% MagicRevision("/jupiter_styles/main${rtl_extension}.min.css") %]' />
                [% FOR page_css_url=Whostmgr.get_page_css_url();
                    # load page specific css
                    "<link rel='stylesheet' type='text/css' href='$page_css_url' />";
                END; %]
        [% ELSIF theme == "yui";%]
               [% IF unprotected;
                  FOR src=Whostmgr.defheader_unprot_css_urls();
                    "<link rel='stylesheet' type='text/css' href='$src' />";
                  END;
                ELSE;
                  FOR src=Whostmgr.basic_css_urls();
                    "<link rel='stylesheet' type='text/css' href='$src' />";
                  END;
                END; %]

                [% #Load scripts from the template scripts parameter
                    IF scripts;
                        FOR src=scripts.list();
                            PROCESS '_loadjs.tmpl';
                        END;
                    END;
                %]
            [% ELSE; %]
                <link rel='stylesheet' type='text/css' href="[% Whostmgr.find_file_url('styles/unified_optimized.css') %]" />

                [% #Load scripts from the template scripts parameter
                    IF scripts;
                        FOR src=scripts.list();
                            PROCESS '_loadjs.tmpl';
                        END;
                    END;
            END;
        -%]

        [%

            IF is_ng && theme != "jupiter";
                stylesheets.push("/css/ux-styles.min.css");
            END;

        %]

        [%
            stylesheets = stylesheets.list();
            FOR src=stylesheets;
                IF unprotected;
                "<link rel='stylesheet' type='text/css' href='/unprotected/cpanel" _ src _ "' />";
                ELSE;
                "<link rel='stylesheet' type='text/css' href='" _ MagicRevision(src) _ "' />";
                END;
            END;
        -%]

        <style type="text/css">
        [% IF theme == "yui" %]
            [% Whostmgr.get_page_css() -%]
        [% END %]

        /* Extra Styles - 'extrastyle' */
        [% IF extrastyle -%]
            [% extrastyle -%]
        [% END -%]

        [% IF hide_navigation %]
        html[dir="rtl"] #pageContainer,
        #pageContainer {
            margin-left: auto;
            margin-right: auto;
        }
        [% END %]

        [% IF inside_frame_or_tab_or_popup %]
        body
        {
            overflow: auto;
            height: auto;
        }

        #masterContainer,
        #contentContainer,
        #pageContainer{
            height: auto;
        }

        #masterContainer,
        #pageContainer{
            margin: 0;
            padding: 0;
            height: 100%;
        }

        #contentContainer{
            padding: 20px 20px 0 20px;
        }
        [% END %]
        [% IF (whm_variables.osname == 'CENTOS' || whm_variables.osname == 'CLOUDLINUX') && whm_variables.osversion >= 8 && !inside_frame_or_tab_or_popup %]
        #pageContainer #contentContainer #c8Warn.callout-warning {
            color: black;
        }
        #c8DocsLink
        {
            color: #428BCA;
        }
        #c8Warn .callout {
            padding-top: 10px;
            padding-bottom: 10px;
        }
        #c8Warn h3 {
            margin-top: 5px;
        }
        #c8Warn p {
            margin-bottom: 0;
        }
        [% END %]
        [% IF Whostmgr.is_mobile_or_tablet() %]
        /* This is needed because of how Mobile Safari and Mobile Google Chrome treat
         * VH units. Until we restructure WHM to not need VH units for the height, this
         * is required for WHM to display properly on mobile devices using those browsers.
         */
        html, body {
            height: 100% !important;
        }
        /* We increase the height here to make sure we can clear the lower browser bar
         * that shows up on the mobile browsers.
         */
        /* mobile first */
        #contentContainer {
            min-height: calc(100vh - 135px) !important;
        }
        /* tablets next */
        @media (min-width: 769px) {
            #contentContainer {
                min-height: calc(100vh - 185px) !important;
            }
        }
        [% END %]
        html
        {
            font-size: 16px;
        }
        </style>
        [%- # Angular 7+ apps include the standalone CLDR file for the current locale. -%]
        [%- IF is_ng || CJT2_EXCLUSIVE -%]
            <script>
            window.LEXICON = window.LEXICON || {};
            [%
                cldr_path = 'libraries/cldr/' _ locale.get_language_tag() _ '.js';
                INSERT $cldr_path
            %]
            </script>
        [%- END -%]
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1">

        [% IF CPANEL.is_debug_mode_enabled() %]
        <script src="[% MagicRevision('/core/web-components/dist/jupiter-web-components.cmb.js') %]"></script>
        [% ELSE %]
        <script src="[% MagicRevision('/core/web-components/dist/jupiter-web-components.cmb.min.js') %]"></script>
        [% END %]

        [% IF link_block -%]
            [% link_block -%]
        [% END -%]

        [% IF js_first_block -%]
            [% js_first_block -%]
        [% END -%]
    </head>
    [%# NOTE: Do NOT UNDER ANY CIRCUMSTANCE REMOVE THE BODY ID %]
    [%# NOTE: It is used by QA tests and NVData components to save state %]
    [% SET whmnav = NVData.get("whmcommand:navigation") || 0 %]
    [% SET page_class = (breadcrumburl.length) ? breadcrumburl.replace('/', '-').substr(1) : '' %]
    [% IF theme == "yui" %]
    <body class="whostmgr yui-skin-sam [%- whmnav == 1 ? 'nav-collapsed' : ''-%] page-[%- page_class -%]" id="[% breadcrumburl %]">
    [% ELSIF skipbreadcrumb %]
    <body class="whostmgr no-breadcrumbs [%- whmnav == 1 ? 'nav-collapsed' : ''-%] page-[%- page_class -%]" id="[% breadcrumburl %]">
    [% ELSE %]
    <body class="whostmgr [%- whmnav == 1 ? 'nav-collapsed' : ''-%] page-[%- page_class -%]" id="[% breadcrumburl %]">
    [% END %]

    [%# NOTE: This block is what allows Google Tag Manager and the NPS survey to work. Code is copied from topframe.tmpl %]
    <div id="topFrameWrapper" class="topFrameWrapper" style="display:none;visibility:hidden">
        <div class="informationWrapper">
            <div class="infoContainer">
                [% IF has_root_privileges %]
                <a id="lnkWHMVersion"></a>
                [% ELSE %]
                <span id="lblWHMVersion"></span>
                [% END %]
            </div>
        </div>
    </div>

    [%
        SET whm_logos = ['WhmDarkLg', 'WhmWhiteLg'];
        whm_logos = Whostmgr.get_whm_logos(whm_logos);
    -%]

    [% FOR name_path = whm_logos.pairs %]
        <link rel="preload" as="image" href="[% name_path.value %]">
    [% END -%]

    <cp-root-variables
        directory-prefix="[% cp_security_token %]"
        permissions="[% permissions.json().html %]"
        app-name="whm"
        host-name=[% JSON.stringify(Whostmgr.hostname()) %]
        category-list="[% Whostmgr.get_application_list().json().html %]"
        favorites="[% Whostmgr.get_favorites().json().html %]"
        server-environment="[% server_environment %]"
        user="[% whm_variables.remote_user %]"
        version="[% Whostmgr.WHM_VERSION %]"
        [% IF plugins %]
        plugins="[% plugins.json().html %]"
        [% END %]
        whm-notifications="[% notifications.json().html %]"
        license-type="[% license_type %]"
        app-search-results-limit="7"
        initial-nav-url="[% Whostmgr.get_initial_nav_url().html %]"
        whm-logos-json="[% JSON.stringify(whm_logos).html %]"
    >
    </cp-root-variables>

    [%  # NOTE: Analytics UI includes are disabled by default and are strictly opt-in only.

        IF !inside_frame_or_tab_or_popup && is_user_analytics_required_by_leika
            && template_exists(whm_analytics_include_template);

            # The package updates setting check is required to avoid regressions during cPanel&WHM upgrade to v112.
            # This regression may occur only for users who have package updates disabled. (Details available in PH-19613)
            IF varcache.is_package_update_enabled;
                TRY;
                    '<div id="cp-analytics-whm">';
                    INCLUDE $whm_analytics_include_template;
                    '</div>';
                CATCH;
                    "";
                END;
            ELSIF is_analytics_enabled_server_side;
                TRY;
                    '<div id="cp-analytics-whm">';
                    INCLUDE $whm_analytics_include_template;
                    '</div>';
                CATCH;
                    "";
                END;
            END;
        END;
    %]

    <cp-ui-load-analytics
        analytics-config="[% analyticsConfig.json() | html %]"
    >
    </cp-ui-load-analytics>

    <div id="page-overlay" class="page-overlay"></div>

    <div id="wrap" class="cp-layout-page">
        <div id="glass-navbar-overlay"></div>
        <!-- Global Banner -->
        [% IF template_exists("/var/cpanel/customizations/whm/includes/global_banner.html.tt"); %]
            [% INCLUDE "/var/cpanel/customizations/whm/includes/global_banner.html.tt" %]
        [% END %]

        [% IF !hide_navigation %]
        <nav aria-label="[% locale.maketext("Main menu")%]" id="cp-main-menu-container" class="cp-layout-main-menu">
            <cp-main-menu
                logo-alt-text='[% locale.maketext("WebHost Manager Logo") %]'
            ></cp-main-menu>
        </nav>
        [% END %]
        <div class="cp-layout-wrapper [% hide_navigation ? 'cp-layout-wrapper--full-width' : '' %]">
            <!-- Header Section -->
            [% IF !hide_top_chrome %]
            <header role="banner" class="cp-layout-header cp-layout-header--with-main-menu">
                <cp-whm-header-stats-control>
                </cp-whm-header-stats-control>
                [%# Single quotes needed to pass the props into the web component correctly. %]
                <cp-header
                    focus-search='true'
                    logo-alt-text='[% locale.maketext("WebHost Manager Logo") %]'>
                </cp-header>
            </header>
            [% END %]

        <script type="text/javascript">
            (function() {
                const header = document.querySelector('cp-header');
                if(header) {
                    header.addEventListener('menuItemPress', event => {
                    if(event.detail.id === "menu-reset-link") {
                        reset_all_interface_settings('[% cp_security_token %]')
                    }

                    if(event.detail.id === "lnkConfigserverShutdownNotice") {
                        var data = {
                            "api.version": 1,
                            "personalization": {"configserver_shutdown_notice" : 1},
                        };

                        fetch('[% cp_security_token %]' + "/json-api/personalization_set", {
                            method: "POST",
                            headers: { "Content-Type": "application/json" },
                            body: JSON.stringify(data),
                        }).then(function(response) {
                            window.location.reload();
                        }).catch(function(error) {
                            // Error is caught but intentionally ignored as we
                            // do not inform users errors regarding system logic
                        });
                    }

                    if(event.detail.id === "lnkSitePublisherDeprecationNotice") {
                        var data = {
                            "api.version": 1,
                            "personalization": {"site_publisher_deprecation_notice" : 1},
                        };

                        fetch('[% cp_security_token %]' + "/json-api/personalization_set", {
                            method: "POST",
                            headers: { "Content-Type": "application/json" },
                            body: JSON.stringify(data),
                        }).then(function(response) {
                            window.location.reload();
                        }).catch(function(error) {
                            // Error is caught but intentionally ignored as we
                            // do not inform users errors regarding system logic
                        });
                    }
                });
                }
            })();
        </script>
        <!-- masterContainer Start -->
        [% IF theme != "legacy" %]
        <div id="masterContainer" data-app-key="[% app_key %]">
        [% ELSE %]
        <div id="masterContainer" class="grid-container-fluid" data-app-key="[% app_key %]">
        [% END %]
        [% IF !hide_navigation %]
        <div style="display: none;">
            [% Command.get() -%]
        </div>
        [% END %]
        <!-- pageContainer Start -->
        <div id="pageContainer">
            <!-- contentContainer Start -->
            <div id="contentContainer">
            [% IF !hide_license_warnings %]
                <div>
                    <!-- unsupported distro -->
                    [% PROCESS 'menu/_unsupported_distro.tmpl' -%]
                    <!-- trial or dev license warning -->
                    [% PROCESS 'menu/_trial.tmpl' -%]
                </div>
            [% END %]

            [% IF !hide_banner_ad && banner.defined && !(theme == 'bootstrap' || theme == 'jupiter') %]
                [% IF locale.get_html_dir_attr() == 'rtl'; %]
                    <link rel='stylesheet' type='text/css' href="[% Whostmgr.find_file_url('/styles/master-rtl.cmb.min.css') %]" />
                [% ELSE %]
                    <link rel='stylesheet' type='text/css' href="[% Whostmgr.find_file_url('/styles/master-ltr.cmb.min.css') %]" />
                [% END %]
            [% END %]

            <!-- PAGE HEADER -->
            [%- IF !skipheader %]
                <div class="pageTitle" id="pageTitle-[% app_key %]">
            [% header = header || locale.maketext('Results of Your Request') -%]
            [% IF icon -%]
            [% IF !icon.match('\A/'); icon = Whostmgr.find_file_url( 'icons/' _ icon); END; -%]
                    <h1><img class="whm-app-title__image" src="[% icon %]" alt="" /> <span>[% header %]</span></h1>
            [% ELSE -%]
                [% IF !is_home_page %]
                    <h1>[% header %]</h1>
                [% END %]
            [% END -%]
                </div>
            [% END -%]
            <!-- Breadcrumbs Section -->
            [%- IF !skipbreadcrumb %]
                [% PROCESS 'master_templates/breadcrumbs.tmpl' -%]
            [% END %]

            <!-- Banner Section - now controlled via a plugin -->
            [% IF template_exists("/usr/local/cpanel/whostmgr/docroot/templates/master_templates/banner.tmpl") %]
            [% INCLUDE 'master_templates/banner.tmpl' -%]
            [% END%]

            <!-- PageTop Component -->
            <!-- has_component_system: [% has_component_system ? "true" : "false" %] -->
            [% IF has_component_system
                   && ( app_key != 'home' || is_home_page )
                   && Components.has_components_for('whostmgr', app_key, 'page-top') %]
                [% PROCESS "master_templates/component.html.tt",
                    APP_KEY => app_key,
                    TAG     => 'div',
                    SLOT    => 'page-top'; %]
            [% END %]
            <!-- PageTop Component End -->

            [% IF theme == "yui" %]
            [%-   # For Legacy apps that dump html on pages
                    extrahtml || '';

                    IF status;
                        PROCESS '_loadstatusbox.tmpl' appname = statusapp || header;
                        PROCESS '_setstatus.tmpl';
                    END;
                -%]
            [% END %]
            <!-- PAGE TEMPLATE'S CONTENT -->

            [% IF warn_linked_nodes -%]
                [% num_linked_nodes = Whostmgr.count_linked_nodes() -%]
                [% IF num_linked_nodes -%]
                <div class="callout callout-warning">
                    [% locale.maketext('This server uses [quant,_1,linked node,linked nodes]. To adjust a linked node’s configuration you must log in to that node directly. This interface will only affect the local server’s configuration. Use the “[output,url,_2,_3]” interface to manage this server’s linked nodes.', num_linked_nodes, "$cp_security_token/scripts7/link-server-nodes/", locale.maketext('Link Server Nodes')) -%]
                </div>
                [% END -%]
            [% END -%]
Back to Directory File Manager