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

from microsite_configuration import microsite
from microsite_configuration.templatetags.microsite import platform_name

# App that handles subdomain specific branding
import branding
# app that handles site status messages
from status.status import get_site_status_msg
%>

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

<%block>
<%
try:
    course_id = course.id
except:
    # can't figure out a better way to get at a possibly-defined course var
    course_id = None
site_status_msg = get_site_status_msg(course_id)
%>
% if site_status_msg:
<div class="site-status">
  <div class="inner-wrapper">
    <span class="white-error-icon"></span>
    <p>${site_status_msg}</p>
  </div>
</div>
% endif
</%block>

<header class="${"global slim" if course and not disable_courseware_header else "global-new"}" aria-label="Main" role="banner">
  <div class="${'rwd ' if responsive else ''}wrapper-header nav-container">
    <h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
      <a href="${marketing_link('ROOT')}" title="Home page" itemprop="url">
        <%block name="navigation_logo">
            <img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}" title="${platform_name()}" itemprop="url" />
            <span class="sr">${_("Home Page")}</span>
        </%block>
      </a>
    </h1>

    % if course and not disable_courseware_header:
    <h2 class="course-header"><span class="provider">${course.display_org_with_default | h}:</span> ${course.display_number_with_default | h} ${course.display_name_with_default}</h2>
    % endif

    % if user.is_authenticated():
      % if not course or disable_courseware_header:
        % if not nav_hidden:
    <nav aria-label="Main" class="nav-main">
      <ul class="left nav-global authenticated">
        <%block name="navigation_global_links_authenticated">
          <li class="nav-global-01">
            <a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
          </li>
          <li class="nav-global-02">
            <a href="${marketing_link('COURSES')}">${_("Find Courses")}</a>
          </li>
          <li class="nav-global-03">
            <a href="${marketing_link('SCHOOLS')}">${_("Schools & Partners")}</a>
          </li>
        </%block>
      </ul>
    </nav>
        % endif
      % endif

    <ul class="user">
      <li class="primary">
        <a href="${reverse('dashboard')}" class="user-link">
          <span class="sr">${_("Dashboard for:")}</span>
          <div>${user.username}</div>
        </a>
      </li>
      <li class="primary">
        <a href="#" class="dropdown" aria-haspopup="true" aria-expanded="false"><span class="sr">${_("More options dropdown")}</span> &#9662;</a>
        <ul class="dropdown-menu" aria-label="More Options" role="menu">
          <%block name="navigation_dropdown_menu_links" >
            <li><a href="${reverse('dashboard')}">${_("Dashboard")}</a></li>
            <li><a href="${reverse('learner_profile', kwargs={'username': user.username})}">${_("Profile")}</a></li>
            <li><a href="${reverse('account_settings')}">${_("Account")}</a></li>
          </%block>
          <li><a href="${reverse('logout')}" role="menuitem">${_("Sign Out")}</a></li>
        </ul>
      </li>
    </ul>

      % if should_display_shopping_cart_func(): # see shoppingcart.context_processor.user_has_cart_context_processor
    <ul class="user">
      <li class="primary">
        <a class="shopping-cart" href="${reverse('shoppingcart.views.show_cart')}">
          <i class="icon fa fa-shopping-cart" aria-hidden="true"></i> ${_("Shopping Cart")}
        </a>
      </li>
    </ul>
      % endif

    % else:
    <nav aria-label="Account" class="nav-account-management">
      <div class="right nav-courseware">
        <div class="nav-courseware-01">
          % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
              % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
              <a class="cta cta-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Sign in")}</a>
              % else:
              <a class="cta cta-login" href="/login${login_query()}">${_("Sign in")}</a>
              % endif
          % endif
        </div>
        % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
          % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
          <div class="nav-courseware-02">
            <a class="cta cta-register nav-courseware-button" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a>
          </div>
          % else:
          <div class="nav-courseware-02">
            <a class="cta cta-register nav-courseware-button" href="/register">${_("Register")}</a>
          </div>
          % endif
        % endif
      </div>
    </nav>
    % endif
  </div>
</header>
% if course:
<!--[if lte IE 9]>
<div class="ie-banner" aria-hidden="true">${_('<strong>Warning:</strong> Your browser is not fully supported. We strongly recommend using {chrome_link} or {ff_link}.').format(chrome_link='<a href="https://www.google.com/chrome" target="_blank">Chrome</a>', ff_link='<a href="http://www.mozilla.org/firefox" target="_blank">Firefox</a>')}</div>
<![endif]-->
% endif

<%include file="help_modal.html"/>
