summaryrefslogtreecommitdiff
path: root/testapp/templates
diff options
context:
space:
mode:
Diffstat (limited to 'testapp/templates')
-rw-r--r--testapp/templates/404.html5
-rw-r--r--testapp/templates/500.html7
-rw-r--r--testapp/templates/base.html25
-rw-r--r--testapp/templates/exam/complete.html12
-rw-r--r--testapp/templates/exam/grade_user.html83
-rw-r--r--testapp/templates/exam/intro.html53
-rw-r--r--testapp/templates/exam/login.html20
-rw-r--r--testapp/templates/exam/monitor.html67
-rw-r--r--testapp/templates/exam/question.html91
-rw-r--r--testapp/templates/exam/quit.html14
-rw-r--r--testapp/templates/exam/register.html17
-rw-r--r--testapp/templates/exam/user_data.html84
12 files changed, 478 insertions, 0 deletions
diff --git a/testapp/templates/404.html b/testapp/templates/404.html
new file mode 100644
index 0000000..7d33dd3
--- /dev/null
+++ b/testapp/templates/404.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+
+{% block content %}
+The requested page does not exist.
+{% endblock %}
diff --git a/testapp/templates/500.html b/testapp/templates/500.html
new file mode 100644
index 0000000..d02721f
--- /dev/null
+++ b/testapp/templates/500.html
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+
+{% block content %}
+Internal Server error.<br />
+This event will be reported.<br />
+Sorry for the inconvinience.
+{% endblock %}
diff --git a/testapp/templates/base.html b/testapp/templates/base.html
new file mode 100644
index 0000000..c2bbabb
--- /dev/null
+++ b/testapp/templates/base.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+<title>
+{% block title %}
+{% endblock %}
+</title>
+{% block meta %}
+{% endblock %}
+<link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/base.css" type="text/css" />
+{% block css %}
+{% endblock %}
+{% block script %}
+{% endblock %}
+</head>
+
+<body {% block onload %}{% endblock %}>
+ <div class=box>
+{% block content %}
+{% endblock %}
+ </div>
+</body>
+</html>
diff --git a/testapp/templates/exam/complete.html b/testapp/templates/exam/complete.html
new file mode 100644
index 0000000..4c3f3d5
--- /dev/null
+++ b/testapp/templates/exam/complete.html
@@ -0,0 +1,12 @@
+{% extends "base.html" %}
+
+{% block title %}Good bye!{% endblock %}
+
+{% block content %}
+<h2> Good bye! </h2>
+
+<p> {{message}} </p>
+<br />
+<p>You may now close the browser.</p>
+
+{% endblock content %}
diff --git a/testapp/templates/exam/grade_user.html b/testapp/templates/exam/grade_user.html
new file mode 100644
index 0000000..75ed2e0
--- /dev/null
+++ b/testapp/templates/exam/grade_user.html
@@ -0,0 +1,83 @@
+{% extends "base.html" %}
+
+{% block title %} Grading papers for {{ data.user.get_full_name.title }} {% endblock title %}
+
+{% block content %}
+
+<h1> Grading papers for {{ data.user.get_full_name.title }} </h1>
+
+<p>
+Name: {{ data.user.get_full_name.title }}
+{% if data.profile %}
+(roll number: {{ data.profile.roll_number }}) <br/>
+{{ data.profile.position }},
+{{ data.profile.department }},
+{{ data.profile.institute }}
+{% endif %}
+</p>
+
+{% if data.papers %}
+
+{% for paper in data.papers %}
+
+<h2> Quiz: {{ paper.quiz.description }} </h2>
+
+<p>
+Questions correctly answered: {{ paper.get_answered_str }} <br/>
+Total attempts at questions: {{ paper.answers.count }} <br/>
+Marks obtained: {{ paper.get_total_marks }} <br/>
+Start time: {{ paper.start_time }} <br/>
+</p>
+
+{% if paper.answers.count %}
+<h3> Answers </h3>
+<form id="q{{ paper.quiz.id }}_form"
+ action="{{URL_ROOT}}/exam/grade_user/{{data.user.username}}/" method="post">
+{% csrf_token %}
+{% for question, answers in paper.get_question_answers.items %}
+<p><strong>
+ <a href="{{URL_ROOT}}/admin/exam/question/{{question.id}}">
+ Question: {{ question.id }}. {{ question.summary }} </a>
+ (Points: {{ question.points }})</strong> </p>
+{% if question.type == "mcq" %}
+<p> Choices:
+{% for option in question.options.strip.splitlines %} {{option}}, {% endfor %}
+</p>
+<p>Student answer: {{ answers.0 }}</p>
+{% else %}{# non-mcq questions #}
+<pre>
+{% for answer in answers %}################################################################################
+{{ answer.answer.strip }}
+# Autocheck: {{ answer.error }}
+{% endfor %}</pre>
+{% endif %} {# if question.type #}
+{% with answers|last as answer %}
+Marks: <input id="q{{ question.id }}" type="text"
+ name="q{{ question.id }}_marks" size="4"
+ value="{{ answer.marks }}" />
+{% endwith %}
+{% endfor %} {# for question, answers ... #}
+<h3>Teacher comments: </h3>
+<textarea id="comments_{{paper.quiz.id}}" rows="10" cols="80"
+ name="comments_{{ paper.quiz.id }}">{{ paper.comments }}</textarea>
+<br/>
+<input type="submit" name="submit_{{paper.quiz.id}}" value="Save marks" />
+</form>
+{% endif %} {# if paper.answers.count #}
+
+{% endfor %} {# for paper in data.papers #}
+
+{% endif %} {# if data.papers #}
+
+{% if data.papers.count > 1 %}
+<a href="{{URL_ROOT}}/exam/monitor/">
+ Monitor quiz</a>
+{% else %}
+{% with data.papers.0 as paper %}
+<a href="{{URL_ROOT}}/exam/monitor/{{paper.quiz.id}}/">
+ Monitor quiz</a>
+{% endwith %}
+{% endif %}
+<br />
+<a href="{{URL_ROOT}}/admin/">Admin</a>
+{% endblock content %}
diff --git a/testapp/templates/exam/intro.html b/testapp/templates/exam/intro.html
new file mode 100644
index 0000000..1d3e5de
--- /dev/null
+++ b/testapp/templates/exam/intro.html
@@ -0,0 +1,53 @@
+{% extends "base.html" %}
+
+{% block title %}Instructions and Rules {% endblock %}
+
+{% block content %}
+<h2>Important rules and instructions</h2>
+
+<p> Welcome <strong>{{user.first_name.title}} {{user.last_name.title}}</strong>,
+to the programming quiz! </p>
+
+<p>
+This examination system has been developed with the intention of making you
+learn programming and be assessed in an interactive and fun manner.
+You will be presented with a series of programming questions and problems that
+you will answer online and get immediate feedback for.
+</p>
+
+<p> Here are some important instructions and rules that you should understand
+carefully.
+</p>
+
+<ul>
+
+ <li>For any programming questions, you can submit solutions as many times as
+ you want without a penalty. You may skip questions and solve them later.
+ </li>
+
+ <li> You <strong>may</strong> use your computer's Python/IPython shell or
+ an editor to solve
+ the problem and cut/paste the solution to the web interface.
+ </li>
+
+ <li> <strong>You are <strong>not allowed</strong> to use any internet
+ resources, i.e. no google etc.</strong> </li>
+
+ <li> Do not copy or share the questions or answers with anyone until the
+ exam is complete <strong>for everyone</strong>.</li>
+
+ <li> <strong>All</strong> your attempts at the questions are logged.
+ Do not try to outsmart and break the testing system. If you do, we know
+ who you are and we will expell you from the course. You have been warned.
+ </li>
+
+</ul>
+
+<p> We hope you enjoy taking this exam.</p>
+
+<form action="{{URL_ROOT}}/exam/start/" method="post" align="center">
+{% csrf_token %}
+<input type="submit" name="start" value="Start Exam!">
+</form>
+
+{% endblock content %} \ No newline at end of file
diff --git a/testapp/templates/exam/login.html b/testapp/templates/exam/login.html
new file mode 100644
index 0000000..8e6352e
--- /dev/null
+++ b/testapp/templates/exam/login.html
@@ -0,0 +1,20 @@
+{% extends "base.html" %}
+
+{% block title %}Login{% endblock title %}
+
+{% block content %}
+<p> Welcome to the Examination.
+Please login to proceed.</p>
+
+<form action="" method="post">
+{% csrf_token %}
+
+<table>
+{{ form.as_table }}
+</table>
+
+<input type="submit" value="Login" />
+</form>
+<!-- <a href="{{URL_ROOT}}/exam/forgotpassword/">Forgot Password</a> <br /> -->
+<a href="{{URL_ROOT}}/exam/register/">New User Registration</a>
+{% endblock content %} \ No newline at end of file
diff --git a/testapp/templates/exam/monitor.html b/testapp/templates/exam/monitor.html
new file mode 100644
index 0000000..fb6cb58
--- /dev/null
+++ b/testapp/templates/exam/monitor.html
@@ -0,0 +1,67 @@
+{% extends "base.html" %}
+
+{% block title %} Quiz results {% endblock title %}
+
+{% block meta %} <meta http-equiv="refresh" content="30"/> {% endblock meta %}
+
+{% block content %}
+
+{% if not quizzes and not quiz %}
+<h1> Quiz results </h1>
+
+<p> No quizzes available. </p>
+
+{% endif %}
+
+{# ############################################################### #}
+{# This is rendered when we are just viewing exam/monitor #}
+{% if quizzes %}
+<h1> Available quizzes </h1>
+
+<ul>
+{% for quiz in quizzes %}
+<li><a href="{{URL_ROOT}}/exam/monitor/{{quiz.id}}/">{{ quiz.description }}</a></li>
+{% endfor %}
+</ul>
+{% endif %}
+
+{# ############################################################### #}
+{# This is rendered when we are just viewing exam/monitor/quiz_num #}
+{% if quiz %}
+<h1> {{ quiz.description }} results </h1>
+{% if papers %}
+{# <p> Quiz: {{ quiz_name }}</p> #}
+<p>Number of papers: {{ papers|length }} </p>
+
+<table border="1" cellpadding="3">
+ <tr>
+ <th> Name </th>
+ <th> Username </th>
+ <th> Roll number </th>
+ <th> Institute </th>
+ <th> Questions answered </th>
+ <th> Total marks </th>
+ <th> Attempts </th>
+ </tr>
+ {% for paper in papers %}
+ <tr>
+ <td> <a href="{{URL_ROOT}}/exam/user_data/{{paper.user.username}}">
+ {{ paper.user.get_full_name.title }}</a> </td>
+ <td> <a href="{{URL_ROOT}}/exam/user_data/{{paper.user.username}}">
+ {{ paper.user.username }}</a> </td>
+ <td> {{ paper.profile.roll_number }} </td>
+ <td> {{ paper.profile.institute }} </td>
+ <td> {{ paper.get_answered_str }} </td>
+ <td> {{ paper.get_total_marks }} </td>
+ <td> {{ paper.answers.count }} </td>
+ </tr>
+ {% endfor %}
+</table>
+{% else %}
+<p> No answer papers so far. </p>
+{% endif %} {# if papers #}
+{% endif %}
+
+<a href="{{URL_ROOT}}/admin/">Admin</a>
+
+{% endblock content %}
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 %}
diff --git a/testapp/templates/exam/quit.html b/testapp/templates/exam/quit.html
new file mode 100644
index 0000000..37b5c08
--- /dev/null
+++ b/testapp/templates/exam/quit.html
@@ -0,0 +1,14 @@
+{% extends "base.html" %}
+
+{% block title %}Quit exam {% endblock %}
+
+{% block content %}
+<p>Your current answers are saved.</p>
+<p> Are you sure you wish to quit the exam?</p>
+
+<form action="{{URL_ROOT}}/exam/complete/" method="post">
+{% csrf_token %}
+<input type="submit" name="yes" value="Yes!" />
+<input type="submit" name="no" value="No!" />
+</form>
+{% endblock content %} \ No newline at end of file
diff --git a/testapp/templates/exam/register.html b/testapp/templates/exam/register.html
new file mode 100644
index 0000000..921e7b5
--- /dev/null
+++ b/testapp/templates/exam/register.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+
+{% block title %}Registration form {% endblock %}
+
+{% block content %}
+Please provide the following details.
+<form action="" method="post">
+{% csrf_token %}
+
+<table>
+{{ form.as_table }}
+</table>
+
+<input type="submit" value="Register" />
+</form>
+
+{% endblock content %} \ No newline at end of file
diff --git a/testapp/templates/exam/user_data.html b/testapp/templates/exam/user_data.html
new file mode 100644
index 0000000..9fb442a
--- /dev/null
+++ b/testapp/templates/exam/user_data.html
@@ -0,0 +1,84 @@
+{% extends "base.html" %}
+
+{% block title %} Data for user {{ data.user.get_full_name.title }} {% endblock title %}
+
+{% block content %}
+
+<h1> Data for user {{ data.user.get_full_name.title }} </h1>
+
+<p>
+Name: {{ data.user.get_full_name.title }} <br/>
+Username: {{ data.user.username }} <br/>
+{% if data.profile %}
+Roll number: {{ data.profile.roll_number }} <br/>
+Position: {{ data.profile.position }} <br/>
+Department: {{ data.profile.department }} <br/>
+Institute: {{ data.profile.institute }} <br/>
+{% endif %}
+Email: {{ data.user.email }} <br/>
+Date joined: {{ data.user.date_joined }} <br/>
+Last login: {{ data.user.last_login }}
+</p>
+
+{% if data.papers %}
+<p><a href="{{URL_ROOT}}/exam/grade_user/{{ data.user.username }}/">
+ Grade/correct paper</a>
+</p>
+
+{% for paper in data.papers %}
+
+<h2> Quiz: {{ paper.quiz.description }} </h2>
+
+<p>
+Questions correctly answered: {{ paper.get_answered_str }} <br/>
+Total attempts at questions: {{ paper.answers.count }} <br/>
+Marks obtained: {{ paper.get_total_marks }} <br/>
+Start time: {{ paper.start_time }} <br/>
+User IP address: {{ paper.user_ip }}
+</p>
+
+{% if paper.answers.count %}
+<h3> Answers </h3>
+{% for question, answers in paper.get_question_answers.items %}
+<p><strong> Question: {{ question.id }}. {{ question.summary }} (Points: {{ question.points }})</strong> </p>
+{% if question.type == "mcq" %}
+<p> Choices:
+{% for option in question.options.strip.splitlines %} {{option}}, {% endfor %}
+</p>
+<p>Student answer: {{ answers.0 }}</p>
+{% else %}{# non-mcq questions #}
+<pre>
+{% for answer in answers %}################################################################################
+{{ answer.answer.strip }}
+# Autocheck: {{ answer.error }}
+{% endfor %}</pre>
+{% endif %}
+{% with answers|last as answer %}
+<p><em>Marks: {{answer.marks}} </em> </p>
+{% endwith %}
+{% endfor %} {# for question, answers ... #}
+<h3>Teacher comments: </h3>
+{{ paper.comments|default:"None" }}
+{% endif %} {# if paper.answers.count #}
+
+{% endfor %} {# for paper in data.papers #}
+
+{% endif %} {# if data.papers #}
+<br />
+<hr />
+<a href="{{URL_ROOT}}/exam/grade_user/{{ data.user.username }}/">
+ Grade/correct paper</a>
+<br/>
+{% if data.papers.count > 1 %}
+<a href="{{URL_ROOT}}/exam/monitor/">
+ Monitor quiz</a>
+{% else %}
+{% with data.papers.0 as paper %}
+<a href="{{URL_ROOT}}/exam/monitor/{{paper.quiz.id}}/">
+ Monitor quiz</a>
+{% endwith %}
+{% endif %}
+<br />
+<a href="{{URL_ROOT}}/admin/">Admin</a>
+
+{% endblock content %}