<%namespace name='static' file='../static_content.html'/>
<%!
  from django.core.urlresolvers import reverse
  from django.utils.translation import ugettext as _
  from contentstore.context_processors import doc_url
%>
<%page args="online_help_token"/>

<div class="wrapper-header wrapper" id="view-top">
  <header class="primary" role="banner">

    <div class="wrapper wrapper-l">
      ## "edX Studio" should not be translated
      <h1 class="branding"><a href="/"><img src="${static.url("img/logo-edx-studio.png")}" alt="edX Studio" /></a></h1>

      % if context_course:
      <%
            course_key = context_course.id
            index_url = reverse('contentstore.views.course_handler', kwargs={'course_key_string': unicode(course_key)})
            checklists_url = reverse('contentstore.views.checklists_handler', kwargs={'course_key_string': unicode(course_key)})
            course_team_url = reverse('contentstore.views.course_team_handler', kwargs={'course_key_string': unicode(course_key)})
            assets_url = reverse('contentstore.views.assets_handler', kwargs={'course_key_string': unicode(course_key)})
            textbooks_url = reverse('contentstore.views.textbooks_list_handler', kwargs={'course_key_string': unicode(course_key)})
            import_url = reverse('contentstore.views.import_handler', kwargs={'course_key_string': unicode(course_key)})
            course_info_url = reverse('contentstore.views.course_info_handler', kwargs={'course_key_string': unicode(course_key)})
            export_url = reverse('contentstore.views.export_handler', kwargs={'course_key_string': unicode(course_key)})
            settings_url = reverse('contentstore.views.settings_handler', kwargs={'course_key_string': unicode(course_key)})
            grading_url = reverse('contentstore.views.grading_handler', kwargs={'course_key_string': unicode(course_key)})
            advanced_settings_url = reverse('contentstore.views.advanced_settings_handler', kwargs={'course_key_string': unicode(course_key)})
            tabs_url = reverse('contentstore.views.tabs_handler', kwargs={'course_key_string': unicode(course_key)})
      %>
      <h2 class="info-course">
        <span class="sr">${_("Current Course:")}</span>
        <a class="course-link" href="${index_url}">
          <span class="course-org">${context_course.display_org_with_default | h}</span><span class="course-number">${context_course.display_number_with_default | h}</span>
          <span class="course-title" title="${context_course.display_name_with_default}">${context_course.display_name_with_default}</span>
        </a>
      </h2>

      <nav class="nav-course nav-dd ui-left">
        <h2 class="sr">${_("{course_name}'s Navigation:").format(course_name=context_course.display_name_with_default)}</h2>
        <ol>
          <li class="nav-item nav-course-courseware">
            <h3 class="title"><span class="label"><span class="label-prefix sr">${_("Course")} </span>${_("Content")}</span> <i class="icon-caret-down ui-toggle-dd"></i></h3>

            <div class="wrapper wrapper-nav-sub">
              <div class="nav-sub">
                <ul>
                  <li class="nav-item nav-course-courseware-outline">
                    <a href="${index_url}">${_("Outline")}</a>
                  </li>
                  <li class="nav-item nav-course-courseware-updates">
                    <a href="${course_info_url}">${_("Updates")}</a>
                  </li>
                  <li class="nav-item nav-course-courseware-pages">
                    <a href="${tabs_url}">${_("Pages")}</a>
                  </li>
                  <li class="nav-item nav-course-courseware-uploads">
                    <a href="${assets_url}">${_("Files &amp; Uploads")}</a>
                  </li>
                  <li class="nav-item nav-course-courseware-textbooks">
                    <a href="${textbooks_url}">${_("Textbooks")}</a>
                  </li>
                </ul>
              </div>
            </div>
          </li>

          <li class="nav-item nav-course-settings">
            <h3 class="title"><span class="label"><span class="label-prefix sr">${_("Course")} </span>${_("Settings")}</span> <i class="icon-caret-down ui-toggle-dd"></i></h3>

            <div class="wrapper wrapper-nav-sub">
              <div class="nav-sub">
                <ul>
                  <li class="nav-item nav-course-settings-schedule">
                    <a href="${settings_url}">${_("Schedule &amp; Details")}</a>
                  </li>
                  <li class="nav-item nav-course-settings-grading">
                    <a href="${grading_url}">${_("Grading")}</a>
                  </li>
                  <li class="nav-item nav-course-settings-team">
                    <a href="${course_team_url}">${_("Course Team")}</a>
                  </li>
                  <li class="nav-item nav-course-settings-advanced">
                    <a href="${advanced_settings_url}">${_("Advanced Settings")}</a>
                  </li>
                </ul>
              </div>
            </div>
          </li>

          <li class="nav-item nav-course-tools">
            <h3 class="title"><span class="label">${_("Tools")}</span> <i class="icon-caret-down ui-toggle-dd"></i></h3>

            <div class="wrapper wrapper-nav-sub">
              <div class="nav-sub">
                <ul>
                  <li class="nav-item nav-course-tools-checklists">
                    <a href="${checklists_url}">${_("Checklists")}</a>
                  </li>
                  <li class="nav-item nav-course-tools-import">
                    <a href="${import_url}">${_("Import")}</a>
                  </li>
                  <li class="nav-item nav-course-tools-export">
                    <a href="${export_url}">${_("Export")}</a>
                  </li>
                  % if settings.FEATURES.get('ENABLE_EXPORT_GIT') and context_course.giturl:
                  <li class="nav-item nav-course-tools-export-git">
                    <a href="${reverse('export_git', kwargs=dict(course_key_string=unicode(course_key)))}">${_("Export to Git")}</a>
                  </li>
                  % endif
                </ul>
              </div>
            </div>
          </li>
        </ol>
      </nav>
      % endif
    </div>

    <div class="wrapper wrapper-r">
      % if user.is_authenticated():
      <nav class="nav-account nav-is-signedin nav-dd ui-right">
        <h2 class="sr">${_("Help &amp; Account Navigation")}</h2>
        <ol>
          <li class="nav-item nav-account-help">
            <h3 class="title"><span class="label"><a href="${get_online_help_info(online_help_token)['doc_url']}" title="${_("Contextual Online Help")}" target="${_("_blank")}">${_("Help")}</a></span></h3>
          </li>

          <li class="nav-item nav-account-user">
            <h3 class="title"><span class="label"><span class="label-prefix sr">${_("Currently signed in as:")}</span><span class="account-username" title="${ user.username }">${ user.username }</span></span> <i class="icon-caret-down ui-toggle-dd"></i></h3>

            <div class="wrapper wrapper-nav-sub">
              <div class="nav-sub">
                <ul>
                  <li class="nav-item nav-account-dashboard">
                    <a href="/">${_("My Courses")}</a>
                  </li>
                  <li class="nav-item nav-account-signout">
                    <a class="action action-signout" href="${reverse('logout')}">${_("Sign Out")}</a>
                  </li>
                </ul>
              </div>
            </div>
          </li>
        </ol>
      </nav>

      % else:
      <nav class="nav-not-signedin nav-pitch">
        <h2 class="sr">${_("You're not currently signed in")}</h2>
        <ol>
          <li class="nav-item nav-not-signedin-help">
            <a href="${get_online_help_info(online_help_token)['doc_url']}" title="${_("Contextual Online Help")}" target="${_("_blank")}">${_("Help")}</a>
          </li>
          <li class="nav-item nav-not-signedin-signup">
            <a class="action action-signup" href="${reverse('signup')}">${_("Sign Up")}</a>
          </li>
          <li class="nav-item nav-not-signedin-signin">
            <a class="action action-signin" href="${reverse('login')}">${_("Sign In")}</a>
          </li>
        </ol>
      </nav>
      % endif
    </div>
  </header>
</div>
