## -*- coding: utf-8 -*-
<%! from django.utils.translation import ugettext as _ %>
<%! from django.template.defaultfilters import escapejs %>
<%namespace name='static' file='static_content.html'/>

<!doctype html>
<!--[if IE 7]><html class="ie7 lte9 lte8 lte7" lang="${LANGUAGE_CODE}"><![endif]-->
<!--[if IE 8]><html class="ie8 lte9 lte8" lang="${LANGUAGE_CODE}"><![endif]-->
<!--[if IE 9]><html class="ie9 lte9" lang="${LANGUAGE_CODE}"><![endif]-->
<!--[if gt IE 9]><!--><html lang="${LANGUAGE_CODE}"><!--<![endif]-->
<%
    # set doc language direction
    from django.utils.translation import get_language_bidi
    dir_rtl = 'rtl' if get_language_bidi() else 'ltr'
%>
  <head dir="${dir_rtl}">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>
        <%block name="title"></%block> |
        % if context_course:
        <% ctx_loc = context_course.location %>
        ${context_course.display_name_with_default | h} |
        % endif
        edX Studio
    </title>

    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="path_prefix" content="${EDX_ROOT_URL}">

    <%static:css group='style-vendor'/>
    <%static:css group='style-vendor-tinymce-content'/>
    <%static:css group='style-vendor-tinymce-skin'/>
    <%static:css group='style-app'/>
    <%static:css group='style-app-extend1'/>
    <%static:css group='style-xmodule'/>

    <%include file="widgets/segment-io.html" />

    <%block name="header_extras"></%block>
  </head>

  <body class="${dir_rtl} <%block name='bodyclass'></%block> hide-wip lang_${LANGUAGE_CODE}">
  <%block name="view_notes"></%block>

    <a class="nav-skip" href="#content">${_("Skip to this view's content")}</a>

    <script type="text/javascript">
      window.baseUrl = "${settings.STATIC_URL}";
      var require = {baseUrl: window.baseUrl};
    </script>
    <script type="text/javascript" src="${static.url("js/vendor/require.js")}"></script>
    <script type="text/javascript" src="${static.url("require-config.js")}"></script>

    ## js templates
    <script id="system-feedback-tpl" type="text/template">
      <%static:include path="js/system-feedback.underscore" />
    </script>

    <!-- view -->
    <div class="wrapper wrapper-view" dir="${dir_rtl}">
        <% online_help_token = self.online_help_token() if hasattr(self, 'online_help_token') else None %>
        <%include file="widgets/header.html" args="online_help_token=online_help_token" />

      <div id="page-alert">
      <%block name="page_alert"></%block>
      </div>

      <div id="content">
      <%block name="content"></%block>
      </div>

      % if user.is_authenticated():
        <%include file="widgets/sock.html" args="online_help_token=online_help_token" />
      % endif
      <%include file="widgets/footer.html" />
      <%include file="widgets/tender.html" />

      <div id="page-notification"></div>
    </div>

    <div id="page-prompt"></div>
    <%block name="jsextra"></%block>
    <script type="text/javascript">
      require(['js/factories/common_deps'], function () {
          require(['js/factories/base'], function () {
            % if context_course:
              require(['js/factories/course'], function(CourseFactory) {
                  CourseFactory({
                      id: "${context_course.id | escapejs}",
                      name: "${context_course.display_name_with_default | h}",
                      url_name: "${context_course.location.name | h}",
                      org: "${context_course.location.org | h}",
                      num: "${context_course.location.course | h}",
                      revision: "${context_course.location.revision | h}"
                  });
              });
            % endif
            % if user.is_authenticated():
                require(['js/sock']);
            % endif
            <%block name='requirejs'></%block>
          });
      });
    </script>
    <div class="modal-cover"></div>
  </body>
</html>
