Viewing File: /usr/local/cpanel/base/frontend/jupiter/core/main.html.tt

[%#
    Parameters we are expecting:
    ============================
    hide_main_menu:
    Boolean used to hide the main menu
    1 to hide, 0 to show; 0 by default

    hide_page_heading:
    Boolean used to hide page heading
    1 to hide, 0 to show; 0 by default

    page_title:
    String text is displayed on browser tab
    and on page title

    app_key:
    String used to lookup application information in dynamicui.conf.
    Hides page heading if the app_key and page title is not defined.

    feature:
    String specifying a feature required in order to render the page.  If the
    user does not have the feature, an error will be rendered instead.

    meta:
    String containing meta tags to be injected after the main
    template meta tags. Highly recommend using a Template Toolkit block
    and processing the block to get the output into a string.

    page_stylesheets:
    Array containing the path of stylesheets specific to
    your page that must be relative to the root of the theme.

    embed_stylesheets:
    Array containing the server path of stylesheets specific to
    your page that will be included with the INSERT directive.

    page_styles:
    A string containing a <style> block that defines page specific
    styles. Highly recommend using a Template Toolkit block and processing the
    block to get the output into a string.

    page_js_head:
    A string containing a <script> block that defines page specific
    javascript to be injected into the html HEAD area. Highly recommend using a
    Template Toolkit block and processing the block to get the output into a
    string.

    page_init_js:
    A string containing a <script> block that defines page specific
    javascript. Highly recommend using a Template Toolkit block and processing
    the block to get the output into a string. Run before the page_scripts,
    embed_scripts and page_js.

    page_scripts:
    Array containing the path of scripts specific to your page
    that must be relative to the root of the theme.

    embed_scripts:
    Array containing the server path of scripts specific to your page
    that will be included with the INSERT directive.

    page_js:
    A string containing a <script> block that defines page specific
    javascript. Highly recommend using a Template Toolkit block and processing
    the block to get the output into a string. Run after page_init_js, page_scripts,
    and embed_scripts

    is_ng:
    Boolean, used to change the url calculation rules for angular 7
    apps built using the ng cli tool via webpack. You need this since
    the build products from ng cli do not use the .min suffix for minified
    files.

    focus_feature_search:
    Boolean, used to determine if the header search is focused. 1 means the focus is on the header search. The default is 0.
%]
[%-
    USE Master;
    USE CPBranding;
    USE VarCache;
    USE Resource;
    USE NVData;

    # Currently the only two modes are debug and release, but this
    # might be expanded in the future.
    IF CPANEL.is_debug_mode_enabled();
        SET mode = 'debug';
        SET optimized = 0;
    ELSE;
        SET mode = 'release';
        SET optimized = 1;
    END;

    # TODO: Rename this so it is more clear e.g. focus_on_global_search
    SET focus_feature_search = 0 IF !focus_feature_search.defined;

    # hide page heading if app_key is not provided, AND hide_page_heading isn't explicity defined
    IF !hide_page_heading.defined;
      SET hide_page_heading = !app_key.defined && !page_title.defined;
    END;

    SET locale_attributes = CPANEL.locale_info;

    varcache.set('directory_prefix', CPANEL.CPVAR.dprefix);

    SET applications = CPBranding.flatten_available_applications(varcache.available_applications);

    # Integrations are not included in the applications list so are saved separately to integrations_info
    varcache.set('billing_app_info',CPBranding.get_implementer_from_available_applications(varcache.available_applications, 'billing'));
    varcache.set('support_app_info',CPBranding.get_implementer_from_available_applications(varcache.available_applications, 'support'));
    varcache.set('customer_service_app_info',CPBranding.get_implementer_from_available_applications(varcache.available_applications, 'customer_service'));

    SET integrations_info = {
        billing_app_info => varcache.billing_app_info,
        support_app_info => varcache.support_app_info,
        customer_service_app_info => varcache.customer_service_app_info,
        upgrade_app_info => varcache.upgrade_app_info
    };

    IF !hide_page_heading;
        SET app_info = CPBranding.get_application_from_available_applications(varcache.available_applications,  app_key);
    END;

    SET title = "cPanel";
    IF page_title;
        SET title = "cPanel - " _ page_title;
    ELSIF app_key.defined;
        SET title = "cPanel - " _ app_info.itemdesc;
    ELSE;
        SET title = "cPanel";
    END;

    SET page_title = page_title || app_info.itemdesc;

    SET locale_query_string = "?locale=" _ locale.get_language_tag _ "&locale_optional=1&locale_revision=" _ calculate_magic_lex_mtime(locale.get_language_tag());
    SET direction = locale_attributes.direction;

    # Put together a list of stylesheets.
    SET stylesheets = [];

    # Stylesheets that are new to Jupiter
    stylesheets.push(

        # stylesheet for main_content.html.tt
        get_stylesheet_based_on_direction('core/main_content/main_content.css', CPANEL.locale_info.is_rtl),

        # spacing styles to ensure content clears fixed header and main menu
        get_stylesheet_based_on_direction('core/main_content/main_content_spacing.css', CPANEL.locale_info.is_rtl),
    );

    # If style customizations are available, save them to varcache to inject at the end of the template.
    varcache.set('customizations', CPBranding.get_customizations("brand/cpanel-logo-white.svg", "brand/cpanel-logo-orange.svg"));

    IF CPANEL.CPFLAGS.items('dev') == 1;
        SET host_name = ExpVar.expand('$hostname');
        SET main_server_ip = ExpVar.expand('$mainserverip');
        SET main_ip =  ExpVar.expand('$mainip');
    END;

    SET authorized_to_access = !feature.defined OR CPANEL.feature(feature);

    SET cPanel_version = CPANEL.version();
-%]
<!DOCTYPE html>

<html lang="[% locale_attributes.locale %]" dir="[% direction %]">
    <head>
        <title>[% title %]</title>
        <meta charset="[% locale_attributes.encoding %]" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1">

        <!-- Chrome, Firefox OS and Opera -->
        <meta name="theme-color" content="#293a4a">

        <!-- Mobile Chrome-->
        <meta name="mobile-web-app-capable" content="yes">
        <meta name="mobile-web-app-status-bar-style" content="default">

        <!-- iOS Safari -->
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="default">
        [% IF app_info %]
          <link rel="apple-touch-icon"
          href="">
          <meta name="apple-mobile-web-app-title" content="[% app_info.itemdesc %]">
        [% END %]

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

        [%- IF meta -%]
        [% meta %]
        [% END -%]

        <!-- Add pre-loaded styles. This is used for styles that need to be loaded before the web component bundle loads. -->
        <link rel="stylesheet" type="text/css" href="[% theme_magic_url(calculate_mode_css_url('styles/preload_styles.min.css', optimized)) %]" />

        [%IF varcache.customizations.favicon %]
        <link rel="icon" href="[% varcache.customizations.favicon %]" type="image/x-icon" />
        [% ELSE %]
        <link rel="icon" href="[% varcache.directory_prefix %]assets/brand/favicon.ico" type="image/x-icon" />
        [% END %]

        <!--
            Load the font faces we need. These must be defined in the master template in order for our
            global web components to have access to them. They cannot be defined in the Shadow DOM.
        -->
        <link rel="stylesheet" type="text/css" href="[% theme_magic_url(calculate_mode_css_url('styles/fonts.css', optimized)) %]" id="custom-fonts-stylesheet" />

        [%-
            # Shared stylesheets generated in this template
            FOR source IN stylesheets;
                SET url = theme_magic_url(calculate_mode_css_url(source, optimized));
        -%]
        <link rel="stylesheet" type="text/css" href="[% url %]" />
        [%- END -%]

        [%-
            # Page specific stylesheets remotely included
            FOR source IN page_stylesheets;
                IF is_ng;
                    SET url = theme_magic_url(source);
                ELSE;
                    SET url = theme_magic_url(calculate_mode_css_url(source, optimized));
                END;
        -%]
        <link rel="stylesheet" type="text/css" href="[% url %]" />
        [%- END -%]

        [%- # Page specific stylesheets embedded in initial request -%]
        [%- IF embed_stylesheets %]
        <style type="text/css">
            [%- FOR source IN embed_stylesheets;
                    SET path = theme_magic_path(calculate_mode_css_url(source, optimized));
                -%]
                /* Embedding: [% path %] */
                [% INSERT $path %]
            [%- END -%]
        </style>
        [%- END -%]

        [% # stylsheet for main_content.html.tt %]
        [% # TODO: Load this stylesheet based on language  %]
        <link rel="stylesheet" type="text/css" href="[% theme_magic_url(calculate_mode_css_url("core/main_content/main_content.css", optimized)) %]" />

        [%- # Page specified <style> block for css -%]
        [%- IF page_styles %]
            [%- page_styles -%]
        [% END -%]

        [%- # Page specified <script> block for javascript needed before any other JS of the document -%]
        [%- IF page_js_head AND authorized_to_access -%]
            [%- page_js_head -%]
        [%- END -%]
    </head>
    <body id="[% app_key %]" class="" data-app-key="[% app_key %]">
        [%
            PROCESS core/main_content/main_content.html.tt;
        %]

        [% IF varcache.customizations.stylesheet %]
            <style id="style-customizations">
            [% varcache.customizations.stylesheet %]
            </style>
        [% END -%]

        [%- # JavaScript Globals %]
        <script>
            (function(){
                window.PAGE = {};
                window.MASTER = {};
                window.MASTER.footerLogo = "cpanel-logo-orange.svg";
                window.NVData = {};
                window.thisTheme = [% CPANEL.CPDATA.RS.json() %];
                // This is used in Protractor tests
                window.PROTRACTOR = {};
                window.PROTRACTOR.userName = [% CPANEL.user.json() %];
            })();
            [% IF CPANEL.is_qa_mode_enabled() %]
                [% INSERT 'libraries/axe-core/axe.min.js' %]
                window.AXE_CONFIG = [% INSERT 'axe_config.json' %];
                [% INSERT 'libraries/cjt2/webAccessibilityChecker.js' %]

                [% INSERT 'libraries/cjt2/e2e.js' %]
            [% END %]
        </script>

        <script>
        window.LEXICON = window.LEXICON || {};
        [%
            cldr_path = 'libraries/cldr/' _ locale.get_language_tag() _ '.js';
            INSERT $cldr_path
        %]
        </script>

        [%
            page_scripts = page_scripts || [];
            page_scripts.unshift("core/web-components/dist/jupiter-web-components.cmb.js");
        %]

        [%- # Page specified <script> block for javascript that run at the top of the end of page script -%]
        [%- IF page_init_js AND authorized_to_access -%]
            [%- page_init_js -%]
        [%- END -%]

        [% # Interface reset script for NVData Reset Page Settings %]
        <script type="text/javascript">
            [% IF optimized %]
                [% SET path = theme_magic_path("js/interfacereset.min.js") %]
            [% ELSE %]
                [% SET path = theme_magic_path("js/interfacereset.js") %]
            [% END %]
            [% INSERT $path %]
        </script>

        [%- # Page specific javascript files -%]
        [%- IF page_scripts AND authorized_to_access; -%]
            [%- FOR source IN page_scripts; -%]
                [% IF is_ng; %]
                    [% SET url = theme_magic_url(source); %]
                [% ELSE; %]
                   [% SET url = theme_magic_url(calculate_mode_js_url(source, optimized)); %]
                [% END; %]
            [% END %]
            <script type="text/javascript" src="[% url _ locale_query_string %]"></script>
        [% END; %]

        [%- # Page specific javascript embedded in initial request -%]
        [%- IF embed_scripts AND authorized_to_access %]
        <script type="text/javascript">
            [%- FOR source IN embed_scripts; -%]
                [% SET path = theme_magic_path(calculate_mode_js_url(source, optimized)); %]
                /* Embedding: [% path %] */
                [% INSERT $path %]
                [% SET lex_path = CPANEL.get_js_lex_app_full_path(path); %]
                [% IF lex_path; %]
                    /* Embedding: [% lex_path %] */
                    [% INSERT $lex_path %]
                [%- END %]
            [%- END -%]
        </script>
        [%- END %]

        [%- # Page specified <script> block for javascript -%]
        [%- IF page_js AND authorized_to_access -%]
            [%- page_js -%]
        [%- END -%]

        <script>
            register_interfacecfg_nvdata('cp-welcome-panel_dismissed');
        </script>
        [% IF !CPANEL.is_debug_mode_enabled(); %]
        <script type="text/javascript" src="[% theme_magic_url('_assets/deferred/powered-by-cpanel.min.js') %]" defer async></script>
        [% ELSE %]
        <script type="text/javascript" src="[% theme_magic_url('_assets/deferred/powered-by-cpanel.js') %]"></script>
        [% END %]
    </body>
</html>
Back to Directory File Manager