<%inherit file="base.html" />
<%def name="online_help_token()"><% return "advanced" %></%def>
<%namespace name='static' file='static_content.html'/>
<%!
  from django.utils.translation import ugettext as _
  from contentstore import utils
  from openedx.core.djangolib.js_utils import (
      dump_js_escaped_json, js_escaped_string
  )
%>
<%block name="title">${_("Advanced Settings")}</%block>
<%block name="bodyclass">is-signedin course advanced view-settings</%block>

<%block name="header_extras">
% for template_name in ["advanced_entry", "basic-modal", "modal-button", "validation-error-modal"]:
  <script type="text/template" id="${template_name}-tpl">
    <%static:include path="js/${template_name}.underscore" />
  </script>
% endfor
</%block>

<%block name="requirejs">
    require(["js/factories/settings_advanced"], function(SettingsAdvancedFactory) {
        SettingsAdvancedFactory(
            ${advanced_dict | n, dump_js_escaped_json},
            "${advanced_settings_url | n, js_escaped_string}"
        );
    });
</%block>

<%block name="content">
<div class="wrapper-mast wrapper">
  <header class="mast has-subtitle">
    <h1 class="page-header">
      <small class="subtitle">${_("Settings")}</small>
      <span class="sr">&gt; </span>${_("Advanced Settings")}
    </h1>
  </header>
</div>

<div class="wrapper-content wrapper">
  <section class="content">
    <article class="content-primary" role="main">
      <form id="settings_advanced" class="settings-advanced" method="post" action="">

        <div class="message message-status confirm">
          ${_("Your policy changes have been saved.")}
        </div>

        <div class="message message-status error">
          ${_("There was an error saving your information. Please see below.")}
        </div>

        <section class="group-settings advanced-policies">
          <header>
            <h2 class="title-2">${_("Manual Policy Definition")}</h2>

          </header>

          <p class="instructions">${_("<strong>Warning</strong>: Do not modify these policies unless you are familiar with their purpose.")}</p>

          <div class="wrapper-options">
            <div class="wrapper-deprecated-setting">
              <input id="deprecated-settings" class="deprecated-settings-toggle" type="checkbox" name="Show Deprecated">
              <label for="deprecated-settings" class="deprecated-settings-label">${_("Show Deprecated Settings")}</label>
            </div>
          </div>

          <ul class="list-input course-advanced-policy-list enum">

          </ul>
        </section>
      </form>
    </article>

    <aside class="content-supplementary" role="complementary">
      <div class="bit">
        <h3 class="title-3">${_("What do advanced settings do?")}</h3>
        <p>${_("Advanced settings control specific course functionality. On this page, you can edit manual policies, which are JSON-based key and value pairs that control specific course settings.")}</p>

        <p>${_("Any policies you modify here override all other information you've defined elsewhere in {studio_name}. Do not edit policies unless you are familiar with both their purpose and syntax.").format(studio_name=settings.STUDIO_SHORT_NAME)}</p>

        <p>${_("{em_start}Note:{em_end} When you enter strings as policy values, ensure that you use double quotation marks (&quot;) around the string. Do not use single quotation marks (&apos;).").format(em_start='<strong>', em_end="</strong>")}</p>
      </div>

      <div class="bit">
      % if context_course:
        <%
          details_url = utils.reverse_course_url('settings_handler', context_course.id)
          grading_url = utils.reverse_course_url('grading_handler', context_course.id)
          course_team_url = utils.reverse_course_url('course_team_handler', context_course.id)
        %>
      <h3 class="title-3">${_("Other Course Settings")}</h3>
        <nav class="nav-related" aria-label="${_('Other Course Settings')}">
          <ul>
            <li class="nav-item"><a href="${details_url}">${_("Details &amp; Schedule")}</a></li>
            <li class="nav-item"><a href="${grading_url}">${_("Grading")}</a></li>
            <li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li>
            <li class="nav-item"><a href="${utils.reverse_course_url('group_configurations_list_handler', context_course.id)}">${_("Group Configurations")}</a></li>
          </ul>
        </nav>
      % endif
      </div>
    </aside>
  </section>
</div>
</%block>
