## mako

<%page expression_filter="h" args="online_help_token"/>

<%namespace name='static' file='../static_content.html'/>
<%namespace file='../main.html' import="login_query"/>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _

from lms.djangoapps.ccx.overrides import get_current_ccx
from openedx.core.djangolib.markup import HTML, Text

# App that handles subdomain specific branding
from branding import api as branding_api
# app that handles site status messages
from status.status import get_site_status_msg
from openedx.core.djangoapps.lang_pref.api import header_language_selector_is_enabled, released_languages
%>

## Provide a hook for themes to inject branding on top.
<%block name="navigation_top" />

## Add UI Toolkit components if using the Pattern Library
% if uses_pattern_library:
    <%block name="js_extra">
    <%static:require_module module_name="js/header_factory" class_name="HeaderFactory">
    HeaderFactory();
    </%static:require_module>
    </%block>
% endif

<%block>
<%
course_id = course.id if course else None
site_status_msg = get_site_status_msg(course_id)
%>
% if site_status_msg:
  <div class="site-status">
    <div class="inner-wrapper">
      <span class="icon fa fa-warning" aria-hidden="true"></span>
      <p>${site_status_msg}</p>
    </div>
  </div>
% endif
</%block>

<header class="global-header ${'slim' if course else ''}">
    <div class="main-header">
        <%include file="navbar-logo-header.html" args="online_help_token=online_help_token"/>
        <div class="hamburger-menu" role="button" aria-label=${_("Options Menu")} aria-expanded="false" aria-controls="mobile-menu" tabindex="0">
            <span class="line"></span>
            <span class="line"></span>
            <span class="line"></span>
            <span class="line"></span>
        </div>
        % if user.is_authenticated():
            <%include file="navbar-authenticated.html" args="online_help_token=online_help_token"/>
        % else:
            <%include file="navbar-not-authenticated.html" args="online_help_token=online_help_token"/>
        % endif
    </div>
    <div class="mobile-menu hidden" aria-label=${_("More Options")} role="menu" id="mobile-menu"></div>
</header>

% if course:
<!--[if lte IE 9]>
<div class="ie-banner" aria-hidden="true">${Text(_('{begin_strong}Warning:{end_strong} Your browser is not fully supported. We strongly recommend using {chrome_link} or {ff_link}.')).format(
    begin_strong=HTML('<strong>'),
    end_strong=HTML('</strong>'),
    chrome_link=HTML('<a href="https://www.google.com/chrome" target="_blank">Chrome</a>'),
    ff_link=HTML('<a href="http://www.mozilla.org/firefox" target="_blank">Firefox</a>'),
)}</div>
<![endif]-->
% endif

<%include file="../help_modal.html"/>
% if settings.FEATURES.get('ENABLE_COOKIE_CONSENT', False):
  <%include file="../widgets/cookie-consent.html" />
% endif

% if header_language_selector_is_enabled():
    <% languages = released_languages() %>
    % if len(languages) > 1:
        <form action="/i18n/setlang/" method="post" class="settings-language-form" 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('session_language')}" data-user-is-authenticated="false">
            % endif
            <label><span class="sr">${_("Choose Language")}</span>
            <select class="input select language-selector" id="settings-language-value" name="language">
                % for language in languages:
                    % if language[0] == LANGUAGE_CODE:
                        <option value="${language[0]}" selected="selected">${language[1]}</option>
                    % else:
                        <option value="${language[0]}" >${language[1]}</option>
                    % endif
                % endfor
            </select>
            </label>
        </form>
    % endif
% endif