<%! from django.core.urlresolvers import reverse %>
<%! from django.utils.translation import ugettext as _ %>

<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/img/logo-edx-studio.png" alt="edX Studio" /></a></h1>

      % if context_course:
      <% ctx_loc = context_course.location %>
      <h2 class="info-course">
        <span class="sr">${_("Current Course:")}</span>
        <a class="course-link" href="${reverse('course_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">
          <span class="course-org">${ctx_loc.org}</span><span class="course-number">${ctx_loc.course}</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="${reverse('course_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("Outline")}</a>
                  </li>
                  <li class="nav-item nav-course-courseware-updates">
                    <a href="${reverse('course_info', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("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="${reverse('asset_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("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="${reverse('manage_users', kwargs=dict(location=ctx_loc))}">${_("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="${reverse('checklists', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("Checklists")}</a>
                  </li>
                  <li class="nav-item nav-course-tools-import">
                    <a href="${reverse('import_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("Import")}</a>
                  </li>
                  <li class="nav-item nav-course-tools-export">
                    <a href="${reverse('export_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}">${_("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="https://groups.google.com/d/forum/openedx-studio" rel="external">${_("studio-users group")}</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>
