09f6a8faf49e8b87e4867a5b9134dcbc8dcfb2ea
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / acp / templates / header.tpl
1 <!DOCTYPE html>
2 <html
3 dir="{@$__wcf->getLanguage()->getPageDirection()}"
4 lang="{$__wcf->getLanguage()->getBcp47()}"
5 data-color-scheme="{$__wcf->getStyleHandler()->getColorScheme()}"
6 >
7 <head>
8 <meta charset="utf-8">
9 <meta name="viewport" content="width=device-width, initial-scale=1">
10 <meta name="robots" content="noindex">
11 <title>{if $pageTitle|isset}{@$pageTitle|language} - {/if}{jslang}wcf.global.acp{/jslang}{if PACKAGE_ID} - {PAGE_TITLE|phrase}{/if}</title>
12
13 {* work-around for Microsoft Edge that sometimes does not apply this style, if it was set via an external stylesheet *}
14 <style>ol, ul { list-style: none; }</style>
15
16 <!-- Stylesheets -->
17 {@$__wcf->getStyleHandler()->getStylesheet(true)}
18 {event name='stylesheets'}
19
20 <!-- Icons -->
21 {if PACKAGE_ID && $__wcf->getStyleHandler()->getDefaultStyle()}
22 <link rel="apple-touch-icon" sizes="180x180" href="{$__wcf->getStyleHandler()->getDefaultStyle()->getFaviconAppleTouchIcon()}">
23 <link rel="manifest" href="{$__wcf->getStyleHandler()->getDefaultStyle()->getFaviconManifest()}">
24 <link rel="icon" type="image/png" sizes="48x48" href="{$__wcf->getStyleHandler()->getDefaultStyle()->getFavicon()}">
25 <meta name="msapplication-config" content="{$__wcf->getStyleHandler()->getDefaultStyle()->getFaviconBrowserconfig()}">
26 {else}
27 <link rel="apple-touch-icon" sizes="180x180" href="{$__wcf->getPath()}images/favicon/default.apple-touch-icon.png">
28 <link rel="manifest" href="{$__wcf->getPath()}images/favicon/default.manifest.json">
29 <link rel="icon" href="{$__wcf->getPath()}images/favicon/default.favicon.ico">
30 <meta name="msapplication-config" content="{$__wcf->getPath()}images/favicon/default.browserconfig.xml">
31 {/if}
32 <script data-eager="true">
33 {
34 {if $__wcf->getStyleHandler()->getColorScheme() === 'system'}
35 {
36 const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
37 document.documentElement.dataset.colorScheme = colorScheme;
38 }
39 {/if}
40
41 const themeColor = document.createElement("meta");
42 themeColor.name = "theme-color";
43 themeColor.content = window.getComputedStyle(document.documentElement).getPropertyValue("--wcfHeaderBackground");
44 document.currentScript.replaceWith(themeColor);
45 }
46 </script>
47
48 <meta name="timezone" content="{$__wcf->user->getTimeZone()->getName()}">
49
50 <script data-eager="true">
51 var WCF_PATH = '{@$__wcf->getPath()}';
52 var WSC_API_URL = '{@$__wcf->getPath()}acp/';
53 var WSC_RPC_API_URL = '{link controller="Api" forceFrontend=true id="rpc"}{/link}';
54 {* The SECURITY_TOKEN is defined in wcf.globalHelper.js *}
55 var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
56 var LANGUAGE_USE_INFORMAL_VARIANT = {if LANGUAGE_USE_INFORMAL_VARIANT}true{else}false{/if};
57 var TIME_NOW = {@TIME_NOW};
58 var LAST_UPDATE_TIME = {@LAST_UPDATE_TIME};
59 var ENABLE_DEBUG_MODE = {if ENABLE_DEBUG_MODE}true{else}false{/if};
60 var ENABLE_PRODUCTION_DEBUG_MODE = {if ENABLE_PRODUCTION_DEBUG_MODE}true{else}false{/if};
61 var ENABLE_DEVELOPER_TOOLS = {if ENABLE_DEVELOPER_TOOLS}true{else}false{/if};
62
63 {* This constant is a compiler option, it does not exist in production. *}
64 {* Unlike the frontend, this option must be defined in the ACP at all times. *}
65 var COMPILER_TARGET_DEFAULT = true;
66 </script>
67
68 <script data-eager="true" src="{$__wcf->getPath()}js/WoltLabSuite/WebComponent.min.js?v={@LAST_UPDATE_TIME}"></script>
69 <script data-eager="true" src="{$phrasePreloader->getUrl($__wcf->language)}"></script>
70
71 {js application='wcf' file='require' bundle='WoltLabSuite.Core' core='true'}
72 {js application='wcf' file='require.config' bundle='WoltLabSuite.Core' core='true'}
73 {js application='wcf' file='require.linearExecution' bundle='WoltLabSuite.Core' core='true'}
74 {js application='wcf' file='wcf.globalHelper' bundle='WoltLabSuite.Core' core='true'}
75 {js application='wcf' file='3rdParty/tslib' bundle='WoltLabSuite.Core' core='true'}
76 <script>
77 requirejs.config({
78 baseUrl: '{@$__wcf->getPath()}js',
79 urlArgs: 't={@LAST_UPDATE_TIME}'
80 {hascontent}
81 , paths: {
82 {content}{event name='requirePaths'}{/content}
83 }
84 {/hascontent}
85 });
86 {event name='requireConfig'}
87 </script>
88 <script>
89 require(['Language', 'WoltLabSuite/Core/Acp/Bootstrap', 'User'], function(Language, AcpBootstrap, User) {
90 Language.addObject({
91 'wcf.acp.search.noResults': '{jslang}wcf.acp.search.noResults{/jslang}',
92
93 {event name='javascriptLanguageImport'}
94 });
95
96 User.init(
97 {@$__wcf->user->userID},
98 {if $__wcf->user->userID}'{@$__wcf->user->username|encodeJS}'{else}''{/if},
99 {if $__wcf->user->userID}'{@$__wcf->user->getLink()|encodeJS}'{else}''{/if}
100 );
101
102 AcpBootstrap.setup({
103 bootstrap: {
104 dynamicColorScheme: {if $__wcf->getStyleHandler()->getColorScheme() === 'system'}true{else}false{/if},
105 enableMobileMenu: {if PACKAGE_ID && $__isLogin|empty}true{else}false{/if},
106 }
107 });
108 });
109 </script>
110
111 {include file='__devtoolsLanguageChooser'}
112
113 <script>
114 // prevent jQuery and other libraries from utilizing define()
115 __require_define_amd = define.amd;
116 define.amd = undefined;
117 </script>
118 {js application='wcf' lib='jquery'}
119 {js application='wcf' lib='jquery-ui'}
120 {js application='wcf' lib='jquery-ui' file='touchPunch' bundle='WCF.Combined'}
121 {js application='wcf' lib='jquery-ui' file='nestedSortable' bundle='WCF.Combined'}
122 {js application='wcf' file='WCF.Assets' bundle='WCF.Combined'}
123 {js application='wcf' file='WCF' bundle='WCF.Combined'}
124 {js application='wcf' acp='true' file='WCF.ACP'}
125 <script>
126 define.amd = __require_define_amd;
127 $.holdReady(true);
128 WCF.User.init(
129 {@$__wcf->user->userID},
130 {if $__wcf->user->userID}'{@$__wcf->user->username|encodeJS}'{else}''{/if}
131 );
132 </script>
133 {js application='wcf' file='WCF.Message' bundle='WCF.Combined'}
134 {js application='wcf' file='WCF.Label' bundle='WCF.Combined'}
135 <script>
136 $(function() {
137 if (jQuery.browser.touch) $('html').addClass('touch');
138
139 {if $__wcf->user->userID && $__isLogin|empty}
140 new WCF.ACP.Search();
141 {/if}
142
143 {event name='javascriptInit'}
144
145 $('form[method=get]').attr('method', 'post');
146
147 // rewrites legacy links using the `dereferrer.php` service
148 // see https://github.com/WoltLab/WCF/issues/2557
149 elBySelAll('a', undefined, function(link) {
150 if (/\/dereferrer.php$/.test(link.pathname) && link.search.match(/^\?url=([^&=]+)$/)) {
151 link.href = unescape(RegExp.$1);
152 }
153
154 if (link.classList.contains('externalURL')) {
155 var rel = (link.rel === '') ? [] : link.rel.split(' ');
156 if (rel.indexOf('noopener') === -1) rel.push('noopener');
157
158 link.rel = rel.join(' ');
159 }
160 });
161
162 WCF.DOMNodeInsertedHandler.execute();
163 });
164 </script>
165 {event name='javascriptInclude'}
166
167 {if !$headContent|empty}
168 {@$headContent}
169 {/if}
170 </head>
171
172 <body id="tpl{$templateName|ucfirst}" data-template="{$templateName}" data-application="{$templateNameApplication}" class="wcfAcp{if !$__isLogin|empty} acpAuthFlow{/if}">
173 <span id="top"></span>
174
175 {assign var=_acpPageSubMenuActive value=false}
176 {if PACKAGE_ID}
177 {assign var=_activeMenuItems value=$__wcf->getACPMenu()->getActiveMenuItems()}
178 {foreach from=$__wcf->getACPMenu()->getMenuItems('') item=_sectionMenuItem}
179 {if $_sectionMenuItem->menuItem|in_array:$_activeMenuItems}{assign var=_acpPageSubMenuActive value=true}{/if}
180 {/foreach}
181 {/if}
182 <div id="pageContainer" class="pageContainer{if !PACKAGE_ID || !$__wcf->user->userID || !$__isLogin|empty} acpPageHiddenMenu{elseif $_acpPageSubMenuActive} acpPageSubMenuActive{/if}">
183 {event name='beforePageHeader'}
184
185 {include file='pageHeader'}
186
187 {event name='afterPageHeader'}
188
189 <div id="acpPageContentContainer" class="acpPageContentContainer">
190 {include file='pageMenu'}
191
192 <section id="main" class="main" role="main">
193 <div class="layoutBoundary">
194 <div id="content" class="content">
195