summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/base.html2
-rw-r--r--yaksh/templates/manage.html15
-rw-r--r--yaksh/templates/yaksh/add_question.html1
-rw-r--r--yaksh/templates/yaksh/add_quiz.html28
-rw-r--r--yaksh/templates/yaksh/intro.html5
-rw-r--r--yaksh/templates/yaksh/question.html64
-rw-r--r--yaksh/templates/yaksh/showquestions.html3
7 files changed, 93 insertions, 25 deletions
diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html
index efa1d58..17df0d9 100644
--- a/yaksh/templates/base.html
+++ b/yaksh/templates/base.html
@@ -31,8 +31,8 @@
{% block css %}
{% endblock %}
- <script src="{{ URL_ROOT }}/static/yaksh/js/bootstrap.min.js"></script>
<script language="JavaScript" type="text/javascript" src="{{ URL_ROOT }}/static/yaksh/js/jquery-1.4.2.min.js"></script>
+ <script src="{{ URL_ROOT }}/static/yaksh/js/bootstrap.min.js"></script>
{% block script %}
{% endblock %}
</head>
diff --git a/yaksh/templates/manage.html b/yaksh/templates/manage.html
index 4b9e2ba..334f6a2 100644
--- a/yaksh/templates/manage.html
+++ b/yaksh/templates/manage.html
@@ -77,6 +77,21 @@
<h5>Click on the button given below to add a new course.</h5>
<button class="btn" type="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/add_course");'>Add New Course</button>
</center>
+ {% if trial_quiz %}
+ <h5/> You have trial papers.
+ <table class="bordered-table zebra-striped">
+ <form action="" method="post">
+ {% csrf_token %}
+ {% for quiz in trial_quiz %}
+ <tr>
+ <td> <input type = "checkbox" name="delete_quiz" value = {{quiz.id}}></input></td>
+ <td> <a href="{{URL_ROOT}}/exam/manage/gradeuser/{{quiz.id}}">{{quiz.description}}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ <center><button class="btn" type="submit">Delete Selected</button></center>
+ </form>
+ {% endif %}
{% endblock %}
</div>
</div>
diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html
index d38aa1c..255deaa 100644
--- a/yaksh/templates/yaksh/add_question.html
+++ b/yaksh/templates/yaksh/add_question.html
@@ -25,6 +25,7 @@
<tr><td><strong>Rendered: </strong><td><p id='my'></p>
<tr><td>Description: <td>{{ form.description}} {{form.description.errors}}
<tr><td>Tags: <td>{{ form.tags }}
+ <tr><td>Snippet: <td>{{ form.snippet }}
<tr><td> Test Case Type: <td> {{ form.test_case_type }}{{ form.test_case_type.errors }}
<div class="form-group">
diff --git a/yaksh/templates/yaksh/add_quiz.html b/yaksh/templates/yaksh/add_quiz.html
index c47d1f7..5a0bee4 100644
--- a/yaksh/templates/yaksh/add_quiz.html
+++ b/yaksh/templates/yaksh/add_quiz.html
@@ -11,6 +11,7 @@
{% endblock %}
{% block onload %} onload="javascript:test();" {% endblock %}
{% block manage %}
+
<form name=frm id=frm action="" method="post" >
{% csrf_token %}
<center>
@@ -18,8 +19,33 @@
{{ form.as_table }}
</table>
</center>
-
+
<center><button class="btn" type="submit" id="submit" name="questionpaper">Design Question Paper</button>
+
<button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button> </center>
+
</form>
+{% if quiz_id %}
+
+ <h5>You can check the quiz by attempting it in the following modes:</h5>
+ <center>
+ <button class="btn" type="button" name="button" onClick='usermode("{{URL_ROOT}}/exam/manage/usermode/{{quiz_id}}");'>User Mode</button>
+
+ <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/godmode/{{quiz_id}}");'>God Mode</button>
+ <a href="" onclick="$('#help').show(); return false;">Help </a>
+ </center>
+ <br/>
+ <div style="display: none;" id="help">
+ <ol>
+ <li><b>User Mode:</b> Attempt quiz the way normal users will attempt i.e. -
+ <ul>
+ <li><i>Quiz will have the same duration as that of the original quiz.</li>
+ <li>Quiz won't start if the course is inactive or the quiz time has expired.</li>
+ <li>You will be notified about quiz prerequisites.(You can still attempt the quiz though)</i></li>
+ </ul>
+ </p>
+ <li> <b>God Mode:</b> Attempt quiz without any time or eligibilty constraints.</p>
+ <a href="" onclick="$('#help').hide(); return false"> Close </a>
+ </div>
+ {% endif %}
{% endblock %}
diff --git a/yaksh/templates/yaksh/intro.html b/yaksh/templates/yaksh/intro.html
index f05e9a1..b4bc6d7 100644
--- a/yaksh/templates/yaksh/intro.html
+++ b/yaksh/templates/yaksh/intro.html
@@ -39,8 +39,11 @@
</li>
</ul>
<p> We hope you enjoy taking this exam !!!</p>
-
+ {% if user == "moderator" %}
+ <form action="{{URL_ROOT}}/exam/manage/" method="post" align="center">
+ {%else%}
<form action="{{URL_ROOT}}/exam/quizzes/" method="post" align="center">
+ {% endif %}
{% csrf_token %}
<center><button class="btn" name="home">Home</button></center>
</form>
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index 8a67818..b8be99f 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load custom_filters %}
<!DOCTYPE html>
@@ -6,13 +7,16 @@
{% block css %}
<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/question.css" type="text/css" />
-
+<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/codemirror/lib/codemirror.css" type="text/css" />
{% endblock %}
{% block script %}
-<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/question.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/bootstrap-modal.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/lib/codemirror.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/python/python.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/clike/clike.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/shell/shell.js"></script>
<script>
var time_left = {{ paper.time_left }}
@@ -63,15 +67,6 @@ updateClock();
var timeinterval = setInterval(updateClock,1000);
}
-function setSnippetHeight()
-{
- var ta = document.getElementById('snippet');
- var height = ta.scrollHeight+'px';
- ta.style.height = 'auto';
- ta.style.height = height;
- autoresize();
-}
-
function validate(){
uploaded_file = document.getElementById("assignment").value;
if(uploaded_file == ""){
@@ -109,7 +104,7 @@ function call_skip(url)
{% endblock script %}
-{% block onload %} onload="updateTime();setSnippetHeight()" {% endblock %}
+{% block onload %} onload="updateTime();" {% endblock %}
{% block content %}
<div class="topbar">
@@ -149,7 +144,7 @@ function call_skip(url)
<br><font size=3 face=arial> Language: {{ question.language }} </font><br>
{% if question.type == "code" %}
- <br><h3>Output:</h3></br>
+ <br><h4>Output:</h4></br>
{% if error_message %}
<div class="alert alert-error">
<textarea class="error" readonly="yes">{{ error_message }}</textarea>
@@ -181,15 +176,11 @@ function call_skip(url)
<hr>
{% endif %}
{% if question.type == "code" %}
- <h3>Program:</h3>
- <textarea rows="1" class="bash" readonly="yes" name="snippet" id="snippet" wrap="off" >{% if last_attempt %}{{ question.snippet }}{% else %}{% if question.type == "bash" %} #!/bin/bash&#13;&#10;{{ question.snippet }}{% else %}{{ question.snippet }}{% endif %}{% endif %}</textarea>
- <textarea rows="10" class="bash" name="answer" id="answer" wrap="off" onkeydown="return catchTab(this,event)">{% if last_attempt %}{{last_attempt}}{% else %}{% if question.type == "bash" %}{% else %}{% endif %}{% endif %}</textarea>
+
+ <h4>Program:</h4>
+ <textarea name="answer" id="answer"></textarea>
<br>
- <script type="text/javascript">
- addLineNumbers('answer');
- </script>
- <script>addLineNumbers('snippet');</script>
{% endif %}
{% if question.type == "mcq" or question.type == "mcc "%}
@@ -200,8 +191,9 @@ function call_skip(url)
<button class="btn" type="submit" name="check" id="check" onClick="submitCode();">Check Answer</button>&nbsp;&nbsp;
{% endif %}
{% if paper.unanswered.all|length != 1 %}
- <button class="btn" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')" name="skip" id="skip">Attempt Later</button>
+ <button class="btn" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')" name="skip" id="skip">Attempt Later</button>&nbsp;&nbsp;
{% endif %}
+ <button class="btn" type="button" onclick="reset_editor()" name="reset" id="reset">Reset Answer</button>
</form>
</div>
@@ -225,4 +217,34 @@ function call_skip(url)
{% csrf_token %}
<button class="btn" type="submit" name="quit">Quit Exam</button>
</form>
+
+<script>
+ // Codemirror object, language modes and initial content
+ // Get the textarea node
+ var textarea_node = document.querySelector('#answer');
+
+ // Code mirror Options
+ var options = {
+ mode: "{{ question.language }}",
+ gutter: true,
+ lineNumbers: true,
+
+ onChange: function (instance, changes) {
+ render();
+ }
+ };
+
+ // Initialize the codemirror editor
+ var editor = CodeMirror.fromTextArea(textarea_node, options);
+
+ // Setting code editors initial content
+ editor.setValue('{{ last_attempt|escape_quotes|safe }}')
+
+ function reset_editor() {
+ editor.setValue('{{ last_attempt|escape_quotes|safe }}');
+ editor.clearHistory();
+ }
+
+</script>
+
{% endblock content %}
diff --git a/yaksh/templates/yaksh/showquestions.html b/yaksh/templates/yaksh/showquestions.html
index ea42797..2f4d218 100644
--- a/yaksh/templates/yaksh/showquestions.html
+++ b/yaksh/templates/yaksh/showquestions.html
@@ -57,7 +57,8 @@
<button class="btn" type="button" onclick='location.replace("{{URL_ROOT}}/exam/manage/addquestion/");'>Add Question</button>&nbsp;&nbsp;
<button class="btn" type="submit" onClick="return confirm_delete(frm);" name='delete' value='delete'>Delete Selected</button>&nbsp;&nbsp;
{% if questions %}
-<button class="btn" type="submit" name='download' value='download'>Download Selected</button>
+<button class="btn" type="submit" name='download' value='download'>Download Selected</button>&nbsp;&nbsp;
+<button class="btn" type="submit" name="test" value="test">Test Selected</button>
{% endif %}
</form>
{% endblock %}