diff options
author | hardythe1 | 2012-02-24 16:16:38 +0530 |
---|---|---|
committer | hardythe1 | 2012-02-24 16:16:38 +0530 |
commit | b1fbf5b02280de5b78b0249e777a179e34b50b98 (patch) | |
tree | f133bd5e556d4d0e8bbc94c9ffbac22bcc46bb31 /testapp/templates/exam/question.html | |
parent | dd3fd7b8c58d836baba24441e7d55c6d51858eab (diff) | |
download | online_test-b1fbf5b02280de5b78b0249e777a179e34b50b98.tar.gz online_test-b1fbf5b02280de5b78b0249e777a179e34b50b98.tar.bz2 online_test-b1fbf5b02280de5b78b0249e777a179e34b50b98.zip |
formating and identation
Diffstat (limited to 'testapp/templates/exam/question.html')
-rw-r--r-- | testapp/templates/exam/question.html | 190 |
1 files changed, 88 insertions, 102 deletions
diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html index a02e8c4..113a9ae 100644 --- a/testapp/templates/exam/question.html +++ b/testapp/templates/exam/question.html @@ -1,117 +1,103 @@ {% extends "base.html" %} + <!DOCTYPE html> - {% block title %} Answer question {% endblock %} +{% 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> + <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 onload %} {% block content %} - <div class="topbar"> - <div class="fill"> - <div class="container"> - <h3 class="brand"><strong>Online Test</h3></strong> - <!--a class="brand" href="#">Project name</a--> - - <form id="logout" action="{{URL_ROOT}}/exam/quit/" method="post" class="pull-right"> - {% csrf_token %} - <button class="btn" type="submit" name="quit">Quit Exam and Logout</button> - </form> - </div> - </div> - </div> + <div class="fill"> + <div class="container"> + <h3 class="brand"><strong>Online Test</h3></strong> + <form id="logout" action="{{URL_ROOT}}/exam/quit/" method="post" class="pull-right"> + {% csrf_token %} + <button class="btn" type="submit" name="quit">Quit Exam and Logout</button> + </form> + </div> + </div> +</div> <div class="container"> - <div class="content"> - <div class="page-header"> - <br><center><h4>Test for {{ user.first_name.title }} {{ user.last_name.title }} </h4></center> - </div> - <div class> - <div class> - - <h4><u> {{ question.summary }} </u></h4> - <h5>{{ question.description|safe }} </h5> - <h5>(Marks : {{ question.points }}) </h5> - - -{% if error_message %}<h5>ERROR:<h5><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="15" style="width:700px;" name="answer">{% if last_attempt %}{{last_attempt.strip}}{% else %}{% if question.type == "bash" %}#!/bin/bash{% else %}# Enter your answer here.{% endif %}{% endif %}</textarea> -{% endif %} - -{% if question.type == "mcq" %} -<br><button class="btn" type="submit" name="check" id="check">Submit Answer</button> -<!--input id="check" type="submit" name="check" value="Submit answer"/--> -{% else %} -<button class="btn" type="submit" name="check" id="check" onClick="submitCode();">Check Answer</button> -<!--input id="check" type="submit" name="check" value="Check Answer" onclick="submitCode();"/--> -{% endif %} -<button class="btn" type="submit" name="skip" id="skip">Skip Question</button> -<!--input id="skip" type="submit" name="skip" value="Skip question" /--> -</form> - -<h5> {{ user.first_name.title }} {{ user.last_name.title }}, You have {{ paper.questions_left }} question(s) left in {{ quiz_name }} </h5> - -<p id="time_left"><strong> Time left: </strong></p> - -<hr/> - -</div></div></div> -<footer> - <p>© FOSSEE group, IIT Bombay</p> - </footer> + <div class="content"> + <div class="page-header"> + <br><center><h4>Test for {{ user.first_name.title }} {{ user.last_name.title }} </h4></center> + </div> + <div class> + <div class> + <h4><u> {{ question.summary }} </u></h4> + <h5>{{ question.description|safe }} </h5> + <h5>(Marks : {{ question.points }}) </h5> + {% if error_message %}<h5>ERROR:<h5><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="15" style="width:700px;" name="answer">{% if last_attempt %}{{last_attempt.strip}}{% else %}{% if question.type == "bash" %} #!/bin/bash{% else %}# Enter your answer here.{% endif %}{% endif %}</textarea> + {% endif %} + + {% if question.type == "mcq" %} + <br><button class="btn" type="submit" name="check" id="check">Submit Answer</button> + {% else %} + <button class="btn" type="submit" name="check" id="check" onClick="submitCode();">Check Answer</button> + {% endif %} + <button class="btn" type="submit" name="skip" id="skip">Skip Question</button> + </form> + <h5>{{ user.first_name.title }} {{ user.last_name.title }}, You have {{ paper.questions_left }} question(s) left in {{ quiz_name }} </h5> + <p id="time_left"><strong> Time left: </strong></p> + <hr/> + </div> + </div> + </div> + <footer> + <p>© FOSSEE group, IIT Bombay</p> + </footer> </div> - {% endblock content %} |