## -*- coding: utf-8 -*-
<%! from django.utils.translation import ugettext as _ %>
<%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]-->
  <head>
    <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} |
        % 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="<%block name='bodyclass'></%block> hide-wip lang_${LANGUAGE_CODE}">
    <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: baseUrl,
        waitSeconds: 60,
        paths: {
            "domReady": "js/vendor/domReady",
            "gettext": "/i18n",
            "mustache": "js/vendor/mustache",
            "codemirror": "js/vendor/codemirror-compressed",
            "codemirror/stex": "js/vendor/CodeMirror/stex",
            "jquery": "js/vendor/jquery.min",
            "jquery.ui": "js/vendor/jquery-ui.min",
            "jquery.form": "js/vendor/jquery.form",
            "jquery.markitup": "js/vendor/markitup/jquery.markitup",
            "jquery.leanModal": "js/vendor/jquery.leanModal.min",
            "jquery.ajaxQueue": "js/vendor/jquery.ajaxQueue",
            "jquery.smoothScroll": "js/vendor/jquery.smooth-scroll.min",
            "jquery.timepicker": "js/vendor/timepicker/jquery.timepicker",
            "jquery.cookie": "js/vendor/jquery.cookie",
            "jquery.qtip": "js/vendor/jquery.qtip.min",
            "jquery.scrollTo": "js/vendor/jquery.scrollTo-1.4.2-min",
            "jquery.flot": "js/vendor/flot/jquery.flot.min",
            "jquery.fileupload": "js/vendor/jQuery-File-Upload/js/jquery.fileupload",
            "jquery.iframe-transport": "js/vendor/jQuery-File-Upload/js/jquery.iframe-transport",
            "jquery.inputnumber": "js/vendor/html5-input-polyfills/number-polyfill",
            "jquery.immediateDescendents": "coffee/src/jquery.immediateDescendents",
            "datepair": "js/vendor/timepicker/datepair",
            "date": "js/vendor/date",
            "tzAbbr": "js/vendor/tzAbbr",
            "underscore": "js/vendor/underscore-min",
            "underscore.string": "js/vendor/underscore.string.min",
            "backbone": "js/vendor/backbone-min",
            "backbone.associations": "js/vendor/backbone-associations-min",
            "backbone.paginator": "js/vendor/backbone.paginator.min",
            "tinymce": "js/vendor/tinymce/js/tinymce/tinymce.full.min",
            "jquery.tinymce": "js/vendor/tinymce/js/tinymce/jquery.tinymce.min",
            "xmodule": "/xmodule/xmodule",
            "xblock": "coffee/src/xblock",
            "utility": "js/src/utility",
            "accessibility": "js/src/accessibility_tools",
            "draggabilly": "js/vendor/draggabilly.pkgd",
            "URI": "js/vendor/URI.min",

            // externally hosted files
            "tender": [
                "//edxedge.tenderapp.com/tender_widget",
                // if tender fails to load, fallback on a local file
                // so that require doesn't fall over
                "js/src/tender_fallback"
            ],
            "mathjax": "//edx-static.s3.amazonaws.com/mathjax-MathJax-727332c/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured",
            "youtube": [
                // youtube URL does not end in ".js". We add "?noext" to the path so
                // that require.js adds the ".js" to the query component of the URL,
                // and leaves the path component intact.
                "//www.youtube.com/player_api?noext",
                // if youtube fails to load, fallback on a local file
                // so that require doesn't fall over
                "js/src/youtube_fallback"
            ]
        },
        shim: {
            "gettext": {
                exports: "gettext"
            },
            "date": {
                exports: "Date"
            },
            "jquery.ui": {
                deps: ["jquery"],
                exports: "jQuery.ui"
            },
            "jquery.form": {
                deps: ["jquery"],
                exports: "jQuery.fn.ajaxForm"
            },
            "jquery.markitup": {
                deps: ["jquery"],
                exports: "jQuery.fn.markitup"
            },
            "jquery.leanmodal": {
                deps: ["jquery"],
                exports: "jQuery.fn.leanModal"
            },
            "jquery.ajaxQueue": {
                deps: ["jquery"],
                exports: "jQuery.fn.ajaxQueue"
            },
            "jquery.smoothScroll": {
                deps: ["jquery"],
                exports: "jQuery.fn.smoothScroll"
            },
            "jquery.cookie": {
                deps: ["jquery"],
                exports: "jQuery.fn.cookie"
            },
            "jquery.qtip": {
                deps: ["jquery"],
                exports: "jQuery.fn.qtip"
            },
            "jquery.scrollTo": {
                deps: ["jquery"],
                exports: "jQuery.fn.scrollTo",
            },
            "jquery.flot": {
                deps: ["jquery"],
                exports: "jQuery.fn.plot"
            },
            "jquery.fileupload": {
                deps: ["jquery.iframe-transport"],
                exports: "jQuery.fn.fileupload"
            },
            "jquery.inputnumber": {
                deps: ["jquery"],
                exports: "jQuery.fn.inputNumber"
            },
            "jquery.tinymce": {
                deps: ["jquery", "tinymce"],
                exports: "jQuery.fn.tinymce"
            },
            "datepair": {
                deps: ["jquery.ui", "jquery.timepicker"]
            },
            "underscore": {
                exports: "_"
            },
            "backbone": {
                deps: ["underscore", "jquery"],
                exports: "Backbone"
            },
            "backbone.associations": {
                deps: ["backbone"],
                exports: "Backbone.Associations"
            },
            "backbone.paginator": {
                deps: ["backbone"],
                exports: "Backbone.Paginator"
            },
            "tender": {
                exports: 'Tender'
            },
            "youtube": {
                exports: "YT"
            },
            "codemirror": {
                exports: "CodeMirror"
            },
            "codemirror/stex": {
                deps: ["codemirror"]
            },
            "tinymce": {
                exports: "tinymce"
            },
            "mathjax": {
                exports: "MathJax",
                init: function() {
                  MathJax.Hub.Config({
                    tex2jax: {
                      inlineMath: [
                        ["\\(","\\)"],
                        ['[mathjaxinline]','[/mathjaxinline]']
                      ],
                      displayMath: [
                        ["\\[","\\]"],
                        ['[mathjax]','[/mathjax]']
                      ]
                    }
                  });
                  MathJax.Hub.Configured();
                }
            },
            "URI": {
                exports: "URI"
            },
            "xblock/core": {
                exports: "XBlock",
                deps: ["jquery", "jquery.immediateDescendents"]
            },
            "xblock/runtime.v1": {
                exports: "XBlock",
                deps: ["xblock/core"]
            },

            "coffee/src/main": {
                deps: ["coffee/src/ajax_prefix"]
            },
            "coffee/src/logger": {
                exports: "Logger",
                deps: ["coffee/src/ajax_prefix"]
            }
        },
        // load jquery and gettext automatically
        deps: ["jquery", "gettext"],
        callback: function() {
            // load other scripts on every page, after jquery loads
            require(["js/base", "coffee/src/main", "coffee/src/logger", "datepair", "accessibility"]);
            // we need "datepair" because it dynamically modifies the page
            // when it is loaded -- yuck!
        }
    };
    </script>
    <script type="text/javascript" src="${static.url("js/vendor/require.js")}"></script>

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


    % if context_course:
      <script type="text/javascript">
  require(['js/models/course'], function(Course) {
    window.course = new Course({
      id: "${context_course.id}",
      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}"
    });
  });
      </script>
    % endif

    <!-- view -->
    <div class="wrapper wrapper-view">
      <%include file="widgets/header.html" />

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

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

      % if user.is_authenticated():
      <script type="text/javascript">
        require(['js/sock']);
      </script>
      <%include file="widgets/sock.html" />
      % 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>
    <div class="modal-cover"></div>
  </body>

  <%include file="widgets/qualaroo.html" />
</html>
