[%#
Parameters we are expecting:
============================
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.
is_jupiter_style:
boolean, used to opt into the new jupiter styles for globally available
page styles, rather than the older style system which includes master-ltr/
master-rtl and ux-styles
hide_header:
boolean, used to hide the page header
1 to hide, 0 to show; 0 by default
hide_license_warnings:
boolean, used to hide trial/dev license banners
1 to hide, 0 to show; 0 by default
hide_main_menu:
boolean, used to hide the main menu
1 to hide, 0 to show; 0 by default
hide_quicklinks:
boolean, used to hide the quicklinks section
1 to hide, 0 to show; 0 by default
include_legacy_stylesheets:
boolean, used to include legacy stylesheets on the page; 1 by default
include_legacy_scripts:
boolean, used to include legacy javascript sections; 1 by default
include_cjt:
boolean, used to include cjt; 1 by default
app_key:
The key used to lookup application information in dynamicui.conf.
Hides page heading if the app_key is not defined.
page_title:
string, displayed as part of the browser title, preceded by cPanel.
Defaults to application description from dynamicui.conf
e.g. cPanel - <your page title here>
page_sub_heading:
sub heading for page header.
SSL <sub heading>
meta:
a string containing meta tags to be injected after the master
template meta tags. Highly recommend using a Template Toolkit block
and processing the block to get the output into a string.
embed_stylesheets:
array containing the server path of stylesheets specific to
your page that will be included with the INSERT directive.
embed_scripts:
array containing the server path of scripts specific to your page
that will be included with the INSERT directive.
page_stylesheets:
array containing the path of stylesheets specific to
your page that must be relative to the root of the theme.
page_scripts:
array containing the path of scripts specific to your page
that must be relative to the root of the theme.
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_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_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.
page_js_top:
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_js_first:
a string containing a <script> block that defines page specific
javascript to be injected into the html HEAD area BEFORE any other JS. Highly recommend using a
Template Toolkit block and processing the block to get the output into a
string.
feature:
a 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.
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.
hide_banner_ad:
Boolean - supress the banner ad for the page if one would otherwise render.
%]
[%-
USE CacheBuster;
USE CPBranding;
USE VarCache;
USE Master;
USE Resource;
USE NVData;
USE Content_Includes;
USE UIAnalytics;
# 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;
# used to set default values
SET include_legacy_stylesheets = 1 IF !include_legacy_stylesheets.defined;
SET hide_header = 0 IF !hide_header.defined;
SET hide_license_warnings = 0 IF !hide_license_warnings.defined;
SET hide_quicklinks = 0 IF !hide_quicklinks.defined;
SET include_legacy_scripts = 1 IF !include_legacy_scripts.defined;
SET include_cjt = 1 IF !include_cjt.defined;
SET use_master_bootstrap = 1 IF !use_master_bootstrap.defined;
SET focus_feature_search = 0 IF !focus_feature_search.defined;
SET show_breadcrumb = 0 IF !show_breadcrumb.defined;
# Page meta data for analytics purpose.
SET analytics_page_meta = {
product_feature => app_key,
product_feature_group => "unknown",
framework_js => "YUI",
framework_css => "",
# Add additional page meta to be sent to analytics.
};
# 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 user = CPANEL.user;
SET documentation_url = "https://go.cpanel.net/cpaneldocsHome";
SET applications = CPBranding.flatten_available_applications(varcache.available_applications);
varcache.set('site_software_app_info',CPBranding.get_implementer_from_available_applications(varcache.available_applications, 'site_software'));
IF varcache.site_software_app_info;
SET cpaddons = varcache.available_addons;
FOREACH cpaddons; # We use the short format here because it is much faster with Template::Stash::XS, but only safe if there are no missing keypairs
applications.push({ name => description, searchText => description _ " " _ module, url => varcache.site_software_app_info.url _ "?addon=" _ module });
END;
END;
applications.push({ name => 'Notifications', searchText => locale.maketext('Notifications'), url => "notifications/index.html.tt" });
applications.push({ name => 'Home', searchText => locale.maketext('Home Main'), url => "index.html"});
varcache.set('pwd_app_info',CPBranding.get_application_from_available_applications(varcache.available_applications, 'change_password'));
varcache.set('lang_app_info',CPBranding.get_application_from_available_applications(varcache.available_applications, 'change_language'));
varcache.set('contact_app_info',CPBranding.get_application_from_available_applications(varcache.available_applications, 'contact_information'));
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
};
SET app_info = CPBranding.get_application_from_available_applications(varcache.available_applications, app_key);
IF app_info && app_info.group;
analytics_page_meta.product_feature_group = app_info.group;
END;
IF is_ng;
analytics_page_meta.framework_js = "Angular";
ELSIF use_master_bootstrap == 0 && include_legacy_scripts == 0;
analytics_page_meta.framework_js = "AngularJS";
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;
SET placement = direction == "rtl" ? "left" : "right";
# Put together a list of stylesheets.
SET stylesheets = [];
# Stylesheets that are new to Jupiter
stylesheets.push(
# Main layout Stylesheet
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", "brand/favicon.ico"));
IF !is_jupiter_style;
IF optimized;
SET css_include_name = '_assets/css/master';
analytics_page_meta.framework_css = "bootstrap3";
IF include_legacy_stylesheets;
css_include_name = css_include_name _ '-legacy';
analytics_page_meta.framework_css = analytics_page_meta.framework_css _ " + YUI";
END;
css_include_name = css_include_name _ '-' _ direction _ '.cmb.css';
stylesheets.push(css_include_name);
IF is_ng;
stylesheets.push('css/ux-styles.css');
END;
ELSE;
# Legacy stylesheets
IF include_legacy_stylesheets;
stylesheets.push('css/yui-core.css');
stylesheets.push('css/yui-custom.css');
END;
# Base stylesheets
stylesheets.push('libraries/bootstrap/optimized/css/bootstrap.min.css');
IF direction == 'rtl';
stylesheets.push('libraries/bootstrap-rtl/optimized/dist/css/bootstrap-rtl.min.css');
END;
stylesheets.push('libraries/ui-fonts/open_sans/optimized/open_sans.min.css');
stylesheets.push('libraries/fontawesome/css/all.min.css');
stylesheets.push('css/cpanel_base.min.css');
IF is_ng;
stylesheets.push('css/ux-styles.min.css');
END;
END;
ELSE;
stylesheets.push(
get_stylesheet_based_on_direction('styles/jupiter-styles/dist/css/main.min.css', CPANEL.locale_info.is_rtl),
);
END;
SET display_cpanel_doclinks = ExpVar.expand('$display_cpanel_doclinks');
SET baseFile = ExpVar.expand('$basefile');
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>
<!-- Avoid indexing from search engines -->
<meta name="robots" content="noindex, nofollow" />
<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">
<link rel="apple-touch-icon" href="[% varcache.directory_prefix %]assets/brand/cP_orange.png">
<meta name="apple-mobile-web-app-title" content="[% app_info.itemdesc %]">
<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)) %]" id="preload-stylesheet"/>
[%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" />
<link rel="stylesheet" type="text/css" href="[% theme_magic_url('assets/application_icons/sprites/icon_spritemap.css') %]" />
[%-
# 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 -%]
[%- # Page specified <style> block for css -%]
[%- IF page_styles %]
[%- page_styles -%]
[% END -%]
<!-- base overrides css file should go below the page specific styles.
These are overrides written in the past based on the assumption that
it gets loded last on every page.
NOTE: Do not move below the header JS or you delay the
download start time. These just need to be below the
last css in the header. -->
[%- IF !is_jupiter_style; %]
<link rel="stylesheet" type="text/css" href="[% varcache.directory_prefix %]css/base_overrides.min.css" />
[% END -%]
[%- # TODO: We want to move these script blocks to the bottom of the page in the future. -%]
[%- # JavaScript Globals %]
<script>
(function(){
window.PAGE = {};
window.MASTER = {};
window.NVData = {};
window.thisTheme = [% CPANEL.CPDATA.RS.json() %];
})();
</script>
[%- # Page specified <script> block for javascript needed before any other JS of the document -%]
[%- IF page_js_first AND authorized_to_access -%]
[%- page_js_first -%]
[%- END -%]
[%- # Legacy javascript -%]
[%- IF include_legacy_scripts;
IF optimized; %]
<script type="text/javascript" src="[% theme_magic_url('_assets/js/master-legacy.cmb.min.js') %]"></script>
[% ELSE %]
<script type="text/javascript" src="[% theme_magic_url('_assets/js/master-legacy.cmb.js') %]"></script>
[%- END -%]
[% ELSE %]
<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>
[%- END -%]
[%- IF include_cjt;
IF optimized;
SET url = MagicRevision('/cjt/cjt-min.js');
ELSE;
SET url = MagicRevision('/cjt/cjt.js');
END;
%]
<script type="text/javascript" src="[% url _ locale_query_string %]"></script>
<script>
CPANEL.validate.hide_validation_summary = true;
</script>
[% END -%]
[%- # Page specified <script> block for javascript needed at the top of the document -%]
[%- IF page_js_top AND authorized_to_access -%]
[%- page_js_top -%]
[%- END -%]
<!-- Content Include point: GLOBAL HTML HEAD -->
[% Content_Includes.render("cpanel_jupiter_head.html.tt") %]
<!-- End: Content Include point -->
</head>
<body id="[% app_key %]" class="cpanel yui-skin-sam cpanel_body" data-app-key="[% app_key %]">
[%
# Data for analytics purpose.
SET cp_analytics_data = UIAnalytics.get_cpanel_analytics_data();
FOREACH key IN analytics_page_meta.keys.sort;
cp_analytics_data.$key = analytics_page_meta.$key;
END;
# cp_analytics_data = cp_analytics_data.merge(analytics_page_meta);
SET analyticsConfig = {
cpAnalyticsData => cp_analytics_data,
debugMode => CPANEL.is_debug_mode_enabled(),
loginUser => CPANEL.authuser,
isSandbox => CPANEL.is_sandbox(),
canTrackUserAnalytics => can_track_user_analytics,
isUserAnalyticsRequiredByLeika => is_user_analytics_required_by_leika,
# Add additional page meta to be sent to analytics.
};
%]
<cp-ui-load-analytics
analytics-config="[% analyticsConfig.json() | html %]"
>
</cp-ui-load-analytics>
[%
PROCESS _assets/master_content.html.tt;
%]
[% IF varcache.customizations.stylesheet %]
<style id="style-customizations">
[% varcache.customizations.stylesheet %]
</style>
[% END -%]
[%#
TODO: This will cause double loading of CLDR data and functions on pages where CJT2 or YUI is used,
as their bundles load CLDR as well. We may be able to conditionally exclude these cases as an optimization
in later iterations.
%]
<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 -%]
[%- # 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;
-%]
<script type="text/javascript" src="[% url _ locale_query_string %]"></script>
[% END;
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 -%]
[% IF use_master_bootstrap == 1 %]
[% PROCESS '_assets/cjt2_header_include.tt' file = 'master' %]
[% END %]
[%- # Do not move this script tag from this location.
# cjt2_header_include.tt and master.js has some dependencies
# This is for feature search to work -%]
<script>
MASTER.applicationList = [% applications.json() %];
MASTER.securityToken = [% CPANEL.ENV.cp_security_token.json() || '""' %];
MASTER.cpanelTheme = [% CPANEL.CPDATA.RS.json() || '""' %]
MASTER.footerLogo = "cpanel-logo-orange.svg";
MASTER.debug = [% mode == 'debug' ? 'true' : 'false' %];
MASTER.focus_feature_search = [% focus_feature_search ? 'true': 'false' %];
</script>
<script type="text/javascript" defer>
// Wait for require.js to load using the new event, then load the master bundle.
window.addEventListener("library-loaded", function(e){
if (e.detail.library.match(/requirejs/) ) {
[% IF use_master_bootstrap == 1 && !CPANEL.is_debug_mode_enabled(); %]
// master.cmb module is a bundled file with master.js its dependency cjt/util/locale.
// Bundling it helps in making master totally independent of frameworks yet be able to
// use the locale module.
require(["master/master.cmb"], function() {
require(["master"], function(MASTER){ MASTER(); });
});
[% ELSIF use_master_bootstrap == 0 && !CPANEL.is_debug_mode_enabled() %]
// This will ensure the CLDR data from the cjt2.cmb file is loaded and processed
// before loading master module.
require(["locale!cjtBuild"], function(){
require(["master/master"], function(MASTER){ MASTER(); });
});
[% ELSE %]
require(["master/master"], function(MASTER){ MASTER(); });
[% END %]
}
});
</script>
[% IF is_ng %]
<script type="text/javascript" src="[% theme_magic_url('_assets/breadcrumb.js') %]"></script>
[% END %]
[% IF !CPANEL.is_debug_mode_enabled(); %]
<script type="text/javascript" src="[% theme_magic_url('_assets/deferred/master.deferred.cmb.min.js') %]" defer async></script>
[% ELSE %]
<script type="text/javascript" src="[% theme_magic_url('_assets/deferred/open-links-on-ios.js') %]"></script>
<script type="text/javascript" src="[% theme_magic_url('_assets/deferred/register-nvdata.js') %]"></script>
<script type="text/javascript" src="[% theme_magic_url('_assets/deferred/focus-feature-search.js') %]"></script>
<script type="text/javascript" src="[% theme_magic_url('_assets/deferred/powered-by-cpanel.js') %]"></script>
[% END %]
<script>
register_interfacecfg_nvdata('cp-welcome-panel_dismissed');
</script>
</body>
</html>