courseware.html 6.55 KB
Newer Older
1 2
<%inherit file="/main.html" />
<%namespace name='static' file='/static_content.html'/>
3
<%block name="bodyclass">courseware ${course.css_class}</%block>
4
<%block name="title"><title>${course.number} Courseware</title></%block>
5

6 7
<%block name="headextra">
  <%static:css group='course'/>
Rocky Duan committed
8
  <%include file="../discussion/_js_head_dependencies.html" />
9 10
</%block>

11
<%block name="js_extra">
12
  <script type="text/javascript" src="${static.url('js/vendor/jquery.scrollTo-1.4.2-min.js')}"></script>
13 14 15 16 17 18 19 20 21 22
  <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script>

  ## codemirror
  <script type="text/javascript" src="${static.url('js/vendor/codemirror-compressed.js')}"></script>

  ## alternate codemirror
  ##  <script type="text/javascript" src="${static.url('js/vendor/CodeMirror-2.25/lib/codemirror.js')}"></script>
  ##  <script type="text/javascript" src="${static.url('js/vendor/CodeMirror-2.25/mode/xml/xml.js')}"></script>
  ##  <script type="text/javascript" src="${static.url('js/vendor/CodeMirror-2.25/mode/python/python.js')}"></script>

23

24
  <%static:js group='courseware'/>
25
  <%static:js group='discussion'/>
26

Rocky Duan committed
27
  <%include file="../discussion/_js_body_dependencies.html" />
28 29 30
  % if staff_access:
  	<%include file="xqa_interface.html"/>
  % endif
31

32 33 34
  <!-- TODO: http://docs.jquery.com/Plugins/Validation -->
  <script type="text/javascript">
    document.write('\x3Cscript type="text/javascript" src="' +
35
        document.location.protocol + '//www.youtube.com/iframe_api">\x3C/script>');
36
  </script>
37 38 39

  <script type="text/javascript">
    var $$course_id = "${course.id}";
40 41

    $(function(){
42
        $(".ui-accordion-header a, .ui-accordion-content .subtitle").each(function() {
kimth committed
43 44
          var elemText = $(this).text().replace(/^\s+|\s+$/g,''); // Strip leading and trailing whitespace
          var wordArray = elemText.split(" ");
45
          var finalTitle = "";
kimth committed
46
          if (wordArray.length > 0) {
47 48 49 50
            for (i=0;i<=wordArray.length-1;i++) {
              finalTitle += wordArray[i];
              if (i == (wordArray.length-2)) {
                finalTitle += "&nbsp;";
kimth committed
51 52
              } else if (i == (wordArray.length-1)) {
                // Do nothing
53 54 55
              } else {
                finalTitle += " ";
              }
56 57
            }
          }
kimth committed
58
          $(this).html(finalTitle);
59 60
        });
      });
61
  </script>
62

63
% if timer_expiration_duration:
64
  <script type="text/javascript">
65
    var timer = {
66 67 68
      timer_inst : null,
      end_time : null,
      get_remaining_secs : function(endTime) {
69 70 71 72 73 74 75 76 77 78 79 80 81
        var currentTime = new Date();
        var remaining_secs = Math.floor((endTime - currentTime)/1000);
        return remaining_secs;
      },
      get_time_string : function() {
        function pretty_time_string(num) {
          return ( num < 10 ? "0" : "" ) + num;
        }
        // count down in terms of hours, minutes, and seconds:
        var hours = pretty_time_string(Math.floor(remaining_secs / 3600));
        remaining_secs = remaining_secs % 3600;
        var minutes = pretty_time_string(Math.floor(remaining_secs / 60));
        remaining_secs = remaining_secs % 60;
82 83
        var seconds = pretty_time_string(Math.floor(remaining_secs));

84 85 86 87
        var remainingTimeString = hours + ":" + minutes + ":" + seconds;
        return remainingTimeString;
      },
      update_time : function(self) {
88
        remaining_secs = self.get_remaining_secs(self.end_time);
89 90 91 92 93 94
        if (remaining_secs <= 0) {
          self.end(self);
        }
        $('#exam_timer').text(self.get_time_string(remaining_secs));
      },
      start : function() { var that = this;
95 96 97
        // set the end time when the template is rendered.
        // This value should be UTC time as number of milliseconds since epoch.
        this.end_time = new Date((new Date()).getTime() + ${timer_expiration_duration});
98 99 100 101 102
        this.timer_inst = setInterval(function(){ that.update_time(that); }, 1000);
      },
      end : function(self) {
        clearInterval(self.timer_inst);
        // redirect to specified URL:
103
        window.location = "${time_expired_redirect_url}";
104
      }
105 106 107
    }
    // start timer right away:
    timer.start();
108 109 110
  </script>
% endif

111
</%block>
pmitros committed
112

113
% if timer_expiration_duration:
114 115 116
<div class="timer-main">
  <div id="timer_wrapper">
    % if timer_navigation_return_url:
117
    <a href="${timer_navigation_return_url}" class="timer_return_url">Return to Exam</a>
118
    % endif
119
    <div class="timer_label">Time Remaining:</div> <div id="exam_timer" class="timer_value">&nbsp;</div>
120 121 122 123 124 125 126
  </div>
</div>
% endif

% if accordion:
 <%include file="/courseware/course_navigation.html" args="active_page='courseware'" />
% endif
127

Matthew Mongeau committed
128
<section class="container">
129
  <div class="course-wrapper">
130 131

% if accordion:
132
    <section aria-label="Course Navigation" class="course-index">
133
      <header id="open_close_accordion">
134
        <a href="#">close</a>
135
      </header>
136

137
      <div id="accordion" style="display: none">
138 139 140
        <nav>
          ${accordion}
        </nav>
141 142
      </div>
    </section>
143
% endif
pmitros committed
144

145 146 147 148
    <section class="course-content">
      ${content}
    </section>
  </div>
149
</section>
Matthew Mongeau committed
150

151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177

% if course.show_calculator:
    <div class="calc-main">
        <a aria-label="Open Calculator" href="#" class="calc">Calculator</a>

        <div id="calculator_wrapper">
            <form id="calculator">
                <div class="input-wrapper">
                    <input type="text" id="calculator_input" />

                    <div class="help-wrapper">
                        <a href="#">Hints</a>
                        <dl class="help">
                            <dt>Suffixes:</dt>
                            <dd> %kMGTcmunp</dd>
                            <dt>Operations:</dt>
                            <dd>^ * / + - ()</dd>
                            <dt>Functions:</dt>
                            <dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd>
                            <dt>Constants</dt>
                            <dd>e, pi</dd>

                            <!-- Students won't know what parallel means at this time.  Complex numbers aren't well tested in the courseware, so we would prefer to not expose them.  If you read the comments in the source, feel free to use them. If you run into a bug, please let us know. But we can't officially support them right now.

                            <dt>Unsupported:</dt> <dd>||, j </dd>  -->
                        </dl>
                    </div>
Matthew Mongeau committed
178
                </div>
179 180 181
                <input id="calculator_button" type="submit" value="="/>
                <input type="text" id="calculator_output"  readonly />
            </form>
Matthew Mongeau committed
182

183
        </div>
Matthew Mongeau committed
184
    </div>
185
% endif