diff options
author | parth | 2011-12-09 04:02:19 +0530 |
---|---|---|
committer | parth | 2011-12-09 04:02:19 +0530 |
commit | 861d2cc5e36835f60bace61a919e73b4bd27274b (patch) | |
tree | d08d776f58167903781c371d147f5b9e1f83e168 /testapp/templates/exam/question.html | |
parent | 7104f495d01fb934af11c8dfd09da087174c1b12 (diff) | |
download | online_test-861d2cc5e36835f60bace61a919e73b4bd27274b.tar.gz online_test-861d2cc5e36835f60bace61a919e73b4bd27274b.tar.bz2 online_test-861d2cc5e36835f60bace61a919e73b4bd27274b.zip |
Moved all the apps to testapp folder
Diffstat (limited to 'testapp/templates/exam/question.html')
-rw-r--r-- | testapp/templates/exam/question.html | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html new file mode 100644 index 0000000..8b589b6 --- /dev/null +++ b/testapp/templates/exam/question.html @@ -0,0 +1,91 @@ +{% extends "base.html" %} + +{% block title %} Answer question {% endblock %} + +{% block script %} +<script type="text/javascript"> +<!-- +var time_left = {{ time_left }}; + +function submitCode() +{ + document.forms["code"].submit(); + var x = document.getElementById("status"); + x.innerHTML = "<strong>Checking answer ...</strong>"; + x = document.getElementById("check"); + x.disabled = true; + x.value = "Checking Answer ..."; + document.getElementById("skip").disabled = true; +} + +function secs_to_time(secs) +{ + var h = Math.floor(secs/3600); + var h_s = (h > 0) ? h+'h:' : ''; + var m = Math.floor((secs%3600)/60); + var m_s = (m > 0) ? m+'m:' : ''; + var s_s = Math.floor(secs%60) + 's'; + return h_s + m_s + s_s; +} + +function update_time() +{ + time_left -= 1; + if (time_left) { + var elem = document.getElementById("time_left"); + var t_str = secs_to_time(time_left); + elem.innerHTML = "<strong> Time left: " + t_str + "</strong>"; + setTimeout("update_time()", 1000); + } + else { + document.forms["code"].submit(); + } +} +//--> +</script> +{% endblock script %} + +{% block onload %} onload="update_time()" {% endblock %} + +{% block content %} +<h3> {{ question.summary }} </h3> + +<p>{{ question.description|safe }} +<br/> +(Marks: {{ question.points }}) </p> + +{% if error_message %}<p><strong>ERROR:</strong></p><pre>{{ error_message }}</pre>{% endif %} + +<p id="status"></p> + +<form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/" method="post"> +{% csrf_token %} +{% if question.type == "mcq" %} +{% for option in question.options.strip.splitlines %} +<input name="answer" type="radio" value="{{option}}" />{{option}} <br/> +{% endfor %} +{% else %} +<textarea rows="20" cols="100" name="answer">{% if last_attempt %}{{last_attempt.strip}}{% else %}{% if question.type == "bash" %}#!/bin/bash{% else %}# Enter your answer here.{% endif %}{% endif %}</textarea> +{% endif %} +<br/> +{% if question.type == "mcq" %} +<input id="check" type="submit" name="check" value="Submit answer"/> +{% else %} +<input id="check" type="submit" name="check" value="Check Answer" +onclick="submitCode();"/> +{% endif %} +<input id="skip" type="submit" name="skip" value="Skip question" /> +</form> + +<p> {{ user.first_name.title }} {{ user.last_name.title }}, +you have {{ paper.questions_left }} question(s) left in {{ quiz_name }}.</p> + +<p id="time_left"> <strong> Time left: </strong> </p> + +<hr/> +<form id="logout" action="{{URL_ROOT}}/exam/quit/" method="post"> +{% csrf_token %} +<input type="submit" name="quit" value="Quit exam and logout" /> +</form> + +{% endblock content %} |