-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.html
274 lines (228 loc) · 10.8 KB
/
main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
## coding=utf-8
## This is the main Mako template that all page templates should include.
## Note: there are a handful of pages that use Django Templates and which
## instead include main_django.html. It is important that these two files
## remain in sync, so changes made in one should be applied to the other.
## Pages currently use v1 styling by default. Once the Pattern Library
## rollout has been completed, this default can be switched to v2.
<%page expression_filter="h"/>
<%! main_css = "style-main-v1" %>
<%namespace name='static' file='static_content.html'/>
<% online_help_token = self.online_help_token() if hasattr(self, 'online_help_token') else None %>
<%!
from lms.djangoapps.branding import api as branding_api
from django.urls import reverse
from urllib.parse import quote_plus
from django.utils.translation import gettext as _
from django.utils.translation import get_language_bidi
from lms.djangoapps.courseware.access import has_access
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
from openedx.core.release import RELEASE_LINE
from common.djangoapps.pipeline_mako import render_require_js_path_overrides
%>
<!DOCTYPE html>
<!--[if lte IE 9]><html class="ie ie9 lte9" lang="${LANGUAGE_CODE}"><![endif]-->
<!--[if !IE]><!--><html lang="${LANGUAGE_CODE}"><!--<![endif]-->
<head dir="${static.dir_rtl()}">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
## Define a couple of helper functions to make life easier when
## embedding theme conditionals into templates. All inheriting
## templates have access to these functions, and we can import these
## into non-inheriting templates via the %namespace tag.
## this needs to be here to prevent the title from mysteriously appearing in the body, in one case
<%def name="pagetitle()" />
<%block name="title">
<title>
${static.get_page_title_breadcrumbs(self.pagetitle())}
</title>
</%block>
% if not allow_iframing:
<script type="text/javascript">
/* immediately break out of an iframe if coming from the marketing website */
(function(window) {
if (window.location !== window.top.location) {
window.top.location = window.location;
}
})(this);
</script>
% endif
<%
jsi18n_path = "js/i18n/{language}/djangojs.js".format(language=LANGUAGE_CODE)
ie11_fix_path = "js/ie11_find_array.js"
%>
% if getattr(settings, 'CAPTURE_CONSOLE_LOG', False):
<script type="text/javascript">
var oldOnError = window.onerror;
window.localStorage.setItem('console_log_capture', JSON.stringify([]));
window.onerror = function (message, url, lineno, colno, error) {
if (oldOnError) {
oldOnError.apply(this, arguments);
}
var messages = JSON.parse(window.localStorage.getItem('console_log_capture'));
messages.push([message, url, lineno, colno, (error || {}).stack]);
window.localStorage.setItem('console_log_capture', JSON.stringify(messages));
}
</script>
% endif
<script type="text/javascript" src="${static.url(jsi18n_path)}"></script>
% if settings.DEBUG:
## Provides a fallback for gettext functions in development environment
<script type="text/javascript" src="${static.url('js/src/gettext_fallback.js')}"></script>
% endif
<script type="text/javascript" src="${static.url(ie11_fix_path)}"></script>
<% favicon_url = branding_api.get_favicon_url() %>
<link rel="icon" type="image/x-icon" href="${favicon_url}"/>
<%static:css group='style-vendor'/>
% if '/' in self.attr.main_css:
% if get_language_bidi():
<%
rtl_css_file = self.attr.main_css.replace('.css', '-rtl.css')
%>
<link rel="stylesheet" href="${str(static.url(rtl_css_file))}" type="text/css" media="all" />
% else:
<link rel="stylesheet" href="${static.url(self.attr.main_css)}" type="text/css" media="all" />
% endif
% else:
<%static:css group='${self.attr.main_css}'/>
% endif
% if disable_courseware_js:
<%static:js group='base_vendor'/>
<%static:js group='base_application'/>
% else:
<%static:js group='main_vendor'/>
<%static:js group='application'/>
% endif
<%static:webpack entry="commons"/>
% if uses_bootstrap:
## xss-lint: disable=mako-invalid-js-filter
<script type="text/javascript" src="${static.url('common/js/vendor/bootstrap.bundle.js')}"></script>
% endif
<script>
window.baseUrl = "${settings.STATIC_URL | n, js_escaped_string}";
(function (require) {
require.config({
baseUrl: window.baseUrl
});
}).call(this, require || RequireJS.require);
</script>
<script type="text/javascript" src="${static.url("lms/js/require-config.js")}"></script>
<%block name="js_overrides">
${render_require_js_path_overrides(settings.REQUIRE_JS_PATH_OVERRIDES) | n, decode.utf8}
</%block>
<%block name="headextra"/>
<%block name="head_extra"/>
<%include file="/courseware/experiments.html"/>
<%include file="/experiments/user_metadata.html"/>
<%static:optional_include_mako file="head-extra.html" is_theming_enabled="True" />
<%include file="widgets/optimizely.html" />
<%include file="widgets/segment-io.html" />
<meta name="path_prefix" content="${EDX_ROOT_URL}">
<% google_site_verification_id = configuration_helpers.get_value('GOOGLE_SITE_VERIFICATION_ID', settings.GOOGLE_SITE_VERIFICATION_ID) %>
% if google_site_verification_id:
<meta name="google-site-verification" content="${google_site_verification_id}" />
% endif
<meta name="openedx-release-line" content="${RELEASE_LINE}" />
<% branch_key = static.get_value("BRANCH_IO_KEY", settings.BRANCH_IO_KEY) %>
% if branch_key and not is_from_mobile_app:
<script type="text/javascript">
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode".split(" "), 0);
branch.init('${branch_key | n, js_escaped_string}');
</script>
% endif
% if course and course is not UNDEFINED and render_course_wide_assets:
% for css in course.course_wide_css:
<link rel="stylesheet" href="${css}" type="text/css">
% endfor
% endif
</head>
<body class="${static.dir_rtl()} <%block name='bodyclass'/> lang_${LANGUAGE_CODE}">
<%static:optional_include_mako file="body-initial.html" is_theming_enabled="True" />
<%include file="browser-alert.html" />
<div id="page-prompt"></div>
% if not disable_window_wrap:
<div class="window-wrap" dir="${static.dir_rtl()}">
% endif
<%block name="skip_links"/>
<a class="nav-skip sr-only sr-only-focusable" href="#main">${_("Skip to main content")}</a>
% if not disable_header:
<%include file="${static.get_template_path('header.html')}" args="online_help_token=online_help_token" />
<%include file="/preview_menu.html" />
% endif
<%include file="/page_banner.html" />
<div class="marketing-hero"><%block name="marketing_hero"></%block></div>
<div class="content-wrapper main-container" id="content" dir="${static.dir_rtl()}">
${next.body()}
<%block name="bodyextra"/>
</div>
% if not disable_footer:
<%include file="${static.get_template_path('footer.html')}" />
% endif
% if not disable_window_wrap:
</div>
% endif
<%block name="footer_extra"/>
<%block name="js_extra"/>
% if any('instructor_dashboard_2_html' in name[0] for name in context.namespaces) and getattr(settings,'EDUNEXT_HELP_SIDEBAR', False):
<%include file="widgets/help-sidebar.html" />
<script type="text/javascript" src="${static.url('js/help-widget.js')}" charset="utf-8"></script>
% endif
<%include file="widgets/segment-io-footer.html" />
<script type="text/javascript" src="${static.url('js/vendor/noreferrer.js')}" charset="utf-8"></script>
<script type="text/javascript" src="${static.url('js/utils/navigation.js')}" charset="utf-8"></script>
<script type="text/javascript" src="${static.url('js/header/header.js')}"></script>
<%static:optional_include_mako file="body-extra.html" is_theming_enabled="True" />
<script type="text/javascript" src="${static.url('js/src/jquery_extend_patch.js')}"></script>
<div id="lean_overlay"></div>
% if course and course is not UNDEFINED and render_course_wide_assets:
% for js in course.course_wide_js:
<script type="text/javascript" src="${js}"></script>
% endfor
% endif
% if scripts:
% for script in scripts:
% if script['type'] == 'external':
<script type="${script['media_type']}" src="${script['src']}"></script>
% elif script['type'] == 'inline':
<script type="${script['media_type']}">${script['content'] | n}</script>
% endif
% endfor
% endif
<%
header_langselector = theming.options('header', 'header_langselector', default= False)
footer_langselector = theming.options('footer','footer_langselector', default=False)
%>
%if footer_langselector or header_langselector:
<%
languages = configuration_helpers.get_value('released_languages', 'en').split(',')
%>
% if len(languages) > 1:
<form action="/i18n/setlang/" method="post" id="language-settings-form">
<input type="hidden" id="csrf_token" name="csrfmiddlewaretoken" value="${csrf_token}">
% if user.is_authenticated:
<input title="preference api" type="hidden" class="url-endpoint" value="${reverse('preferences_api', kwargs={'username': user.username})}" data-user-is-authenticated="true">
% else:
<input title="session update url" type="hidden" class="url-endpoint" value="${reverse('update_language')}" data-user-is-authenticated="false">
% endif
<input id="settings-language-value" type="hidden" name="language" value="${LANGUAGE_CODE}">
</form>
% endif
<script type="text/javascript">
$(window).load (function () {
$('.settings-language-values').on('change', function() {
var language_code = this.value;
$('#settings-language-value').val(language_code).change();
});
})
</script>
% endif
<%include file="google_analytics.html" />
</body>
</html>
<%def name="login_query()">${
u"?next={next}".format(
next=quote_plus(login_redirect_url if login_redirect_url else request.path)
) if (login_redirect_url or (request and not request.path.startswith("/logout"))) else ""
}</%def>