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

<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:
      <% 
            ctx_loc = context_course.location
            location = loc_mapper().translate_location(ctx_loc.course_id, ctx_loc, False, True)
            index_url = location.url_reverse('course/')
            checklists_url = location.url_reverse('checklists/')
            course_team_url = location.url_reverse('course_team/')
            assets_url = location.url_reverse('assets/')
            import_url = location.url_reverse('import/')
            course_info_url = location.url_reverse('course_info/')
            export_url = location.url_reverse('export/', '')
      %>
      <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="${reverse('edit_tabs', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, coursename=ctx_loc.name))}">${_("Static 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="${reverse('textbook_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("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="${reverse('contentstore.views.get_course_settings', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("Schedule &amp; Details")}</a>
                  </li>
                  <li class="nav-item nav-course-settings-grading">
                    <a href="${reverse('contentstore.views.course_config_graders_page', kwargs={'org' : ctx_loc.org, 'course' : ctx_loc.course, 'name': ctx_loc.name})}">${_("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="${reverse('course_advanced_settings', kwargs={'org' : ctx_loc.org, 'course' : ctx_loc.course, 'name': ctx_loc.name})}">${_("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>
                </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">${_("Help")}</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-help-documentation">
                    <a href="http://files.edx.org/Getting_Started_with_Studio.pdf" title="${_("This is a PDF Document")}">${_("Studio Documentation")}</a>
                  </li>
                  <li class="nav-item nav-help-helpcenter">
                    <a href="http://help.edge.edx.org/" rel="external">${_("Studio Help Center")}</a>
                  </li>
                  <li class="nav-item nav-help-feedback">
                    <a href="http://help.edge.edx.org/discussion/new" class="show-tender" title="${_("Use our feedback tool, Tender, to share your feedback")}">${_("Contact Us")}</a>
                  </li>
                </ul>
              </div>
            </div>
          </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-hiw">
            <a href="/">${_("How Studio Works")}</a>
          </li>
          <li class="nav-item nav-not-signedin-help">
            <a href="http://help.edge.edx.org/" rel="external">${_("Studio 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>
