summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorPrabhu Ramachandran2018-01-03 22:23:19 +0530
committerGitHub2018-01-03 22:23:19 +0530
commitfeb295b4107a95621e9430f5c7042cfde4674cc0 (patch)
tree098c7cdc1e97d5e7bd859e35107a4733e800a586 /yaksh/templates
parente566d54239efcb46f253e324b7295a676378f656 (diff)
parent4310d5905a9cc702198e42830c1b670957cd7360 (diff)
downloadonline_test-feb295b4107a95621e9430f5c7042cfde4674cc0.tar.gz
online_test-feb295b4107a95621e9430f5c7042cfde4674cc0.tar.bz2
online_test-feb295b4107a95621e9430f5c7042cfde4674cc0.zip
Merge pull request #408 from prathamesh920/exercise
Exercise feature in video lessons
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/exam.html4
-rw-r--r--yaksh/templates/yaksh/add_exercise.html30
-rw-r--r--yaksh/templates/yaksh/add_question.html3
-rw-r--r--yaksh/templates/yaksh/course_modules.html16
-rw-r--r--yaksh/templates/yaksh/courses.html28
-rw-r--r--yaksh/templates/yaksh/question.html47
-rw-r--r--yaksh/templates/yaksh/quit.html10
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html10
8 files changed, 125 insertions, 23 deletions
diff --git a/yaksh/templates/exam.html b/yaksh/templates/exam.html
index 03c9ff8..ce1d3b8 100644
--- a/yaksh/templates/exam.html
+++ b/yaksh/templates/exam.html
@@ -23,9 +23,9 @@
<ul class="nav navbar-nav navbar">
<li style="padding: 10px"><button class="btn btn-danger btn-sm" type="submit" name="quit">
{% if paper.questions_unanswered.all %}
- Quit Exam
+ Quit {{ quiz_type }}
{% else %}
- Finish Exam
+ Finish {{ quiz_type }}
{% endif %}
<span class="glyphicon glyphicon-off"></span></button></li>
</ul>
diff --git a/yaksh/templates/yaksh/add_exercise.html b/yaksh/templates/yaksh/add_exercise.html
new file mode 100644
index 0000000..dac35d4
--- /dev/null
+++ b/yaksh/templates/yaksh/add_exercise.html
@@ -0,0 +1,30 @@
+{% extends "manage.html" %}
+
+
+{% block subtitle %}Add Exercise{% endblock %}
+
+{% block css %}
+<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/question_quiz.css" type="text/css" />
+{% endblock %}
+{% block script %}
+<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-1.9.1.min.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/add_quiz.js"></script>
+{% endblock %}
+{% block onload %} onload="javascript:test();" {% endblock %}
+{% block content %}
+
+<form name=frm id=frm action="" method="post" >
+ {% csrf_token %}
+ <center>
+ <table class="span1 table">
+ {{ form.as_table }}
+ </table>
+ <br/><br/>
+ </center>
+
+ <center><button class="btn" type="submit" id="submit" name="questionpaper"> Save
+ </button>
+
+ <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button> </center>
+</form>
+{% endblock %}
diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html
index fb8cb95..ed69657 100644
--- a/yaksh/templates/yaksh/add_question.html
+++ b/yaksh/templates/yaksh/add_question.html
@@ -24,7 +24,10 @@
<tr><td><strong>Rendered: </strong><td><p id='my'></p>
<tr><td>Description: <td>{{ qform.description}} {{qform.description.errors}}
<tr><td>Tags: <td>{{ qform.tags }}
+ <tr><td><strong>Rendered Solution: </strong><td><p id='rend_solution'></p>
+ <tr><td>Solution: <td>{{ qform.solution }}
<tr><td>Snippet: <td>{{ qform.snippet }}
+ <tr><td>Minimum Time(in minutes):<td> {{ qform.min_time }}
<tr><td>Partial Grading: <td>{{ qform.partial_grading }}
<tr><td>Grade Assignment Upload:<td> {{ qform.grade_assignment_upload }}
<tr><td> File: <td> {{ fileform.file_field }}{{ fileform.file_field.errors }}
diff --git a/yaksh/templates/yaksh/course_modules.html b/yaksh/templates/yaksh/course_modules.html
index 8e6f5a6..fad1be0 100644
--- a/yaksh/templates/yaksh/course_modules.html
+++ b/yaksh/templates/yaksh/course_modules.html
@@ -31,7 +31,7 @@
</span>
<span class="glyphicon glyphicon-chevron-up" id="learning_units{{module.id}}{{course.id}}_up" style="display: none;"></span>
<a data-toggle="collapse" data-target="#learning_units{{module.id}}{{course.id}}" onclick="view_unit('learning_units{{module.id}}{{course.id}}');">
- View Lessons/Quizzes</a>
+ View Lessons/Quizzes/Exercises</a>
</td>
<td>
{% get_module_status user module course as module_status %}
@@ -56,7 +56,7 @@
<div id="learning_units{{module.id}}{{course.id}}" class="collapse">
<table class="table">
<tr>
- <th>Lesson/Quiz</th>
+ <th>Lesson/Quiz/Exercise</th>
<th>Status</th>
<th>Type</th>
<th>View AnswerPaper</th>
@@ -85,7 +85,15 @@
{% endif %}
</td>
<td>
- {{unit.type|title}}
+ {% if unit.type == "quiz" %}
+ {% if unit.quiz.is_exercise %}
+ Exercise
+ {% else %}
+ Quiz
+ {% endif %}
+ {% else %}
+ Lesson
+ {% endif %}
</td>
<td>
{% if unit.type == "quiz" %}
@@ -109,4 +117,4 @@
{% else %}
<h3> No lectures found </h3>
{% endif %}
-{% endblock %} \ No newline at end of file
+{% endblock %}
diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html
index 0efa72a..b6b9f7e 100644
--- a/yaksh/templates/yaksh/courses.html
+++ b/yaksh/templates/yaksh/courses.html
@@ -152,8 +152,13 @@
<ul class="inputs-list">
<li>
{% if unit.type == "quiz" %}
- <a href="{{URL_ROOT}}/exam/manage/addquiz/{{unit.quiz.id}}/{{course.id}}">
- {{unit.quiz.description}}</a>
+ {% if unit.quiz.is_exercise %}
+ <a href="{{URL_ROOT}}/exam/manage/add_exercise/{{unit.quiz.id}}/{{course.id}}">
+ {{unit.quiz.description}}</a>
+ {% else %}
+ <a href="{{URL_ROOT}}/exam/manage/addquiz/{{unit.quiz.id}}/{{course.id}}">
+ {{unit.quiz.description}}</a>
+ {% endif %}
{% else %}
<a href="{{URL_ROOT}}/exam/manage/courses/edit_lesson/{{unit.lesson.id}}/{{course.id}}">
{{unit.lesson.name}}</a>
@@ -283,8 +288,13 @@
<ul class="inputs-list">
<li>
{% if unit.type == "quiz" %}
- <a href="{{URL_ROOT}}/exam/manage/addquiz/{{unit.quiz.id}}/{{course.id}}">
- {{unit.quiz.description}}</a>
+ {% if unit.quiz.is_exercise %}
+ <a href="{{URL_ROOT}}/exam/manage/add_exercise/{{unit.quiz.id}}/{{course.id}}">
+ {{unit.quiz.description}}</a>
+ {% else %}
+ <a href="{{URL_ROOT}}/exam/manage/addquiz/{{unit.quiz.id}}/{{course.id}}">
+ {{unit.quiz.description}}</a>
+ {% endif %}
{% else %}
<a href="{{URL_ROOT}}/exam/manage/courses/edit_lesson/{{unit.lesson.id}}/{{course.id}}">
{{unit.lesson.name}}</a>
@@ -313,7 +323,8 @@
<div id="all_quizzes" >
<div class="col-md-offset-2 main">
{% if type == "quiz" %}
- <a href="{{URL_ROOT}}/exam/manage/addquiz/" class="btn btn-primary">Add new Quiz</a>
+ <a href="{{URL_ROOT}}/exam/manage/addquiz/" class="btn btn-primary">Add New Quiz</a>
+ <a href="{{URL_ROOT}}/exam/manage/add_exercise/" class="btn btn-primary">Add New Exercise</a>
{% if not quizzes %}
<center><h4> No new Quiz Added</h4></center>
<br><br>
@@ -331,8 +342,11 @@
<td>{{forloop.counter}}</td>
<td width="30%">
<ul class="list-group">
- <a href="{{URL_ROOT}}/exam/manage/addquiz/{{quiz.id}}/">{{ quiz.description }}
- </a>
+ {% if quiz.is_exercise %}
+ <a href="{{URL_ROOT}}/exam/manage/add_exercise/{{quiz.id}}/">{{ quiz.description }}</a>
+ {% else %}
+ <a href="{{URL_ROOT}}/exam/manage/addquiz/{{quiz.id}}/">{{ quiz.description }}</a>
+ {% endif %}
{% if quiz.active %}
<span class="label label-success">Active</span>
{% else %}
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index d65e513..b7251ad 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -22,7 +22,18 @@
<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/shell/shell.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/mathjax/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script>
+init_val = '{{ last_attempt|escape_quotes|safe }}';
+lang = "{{ question.language }}"
+course_id = "{{course.id}}"
+module_id = "{{module.id}}"
+is_exercise = "{{ quiz.is_exercise }}"
+can_skip = "{{ can_skip }}"
+delay_time = new Number("{{ delay_time }}")
+
var time_left = {{ paper.time_left }}
+{% if quiz.is_exercise %}
+ time_left = {{ delay_time }}
+{% endif %}
function getTimeRemaining(endtime){
var t = Date.parse(endtime) - Date.parse(new Date());
@@ -51,13 +62,15 @@ function updateClock(){
var mm = ('0' + t.minutes).slice(-2);
var ss = ('0' + t.seconds).slice(-2);
- if(t.total<0){
-
+ if(t.total<0 && is_exercise=="False"){
document.forms["code"].submit();
clearInterval(timeinterval);
return null;
}
- if (t.total<=300000){
+ if(t.total<=0 && is_exercise=="True"){
+ clearInterval(timeinterval);
+ }
+ if (t.total<=300000 && t.total > 0){
clock.innerHTML = "<blink><center><span style='color:red'><strong>" + hh + ":" + mm + ":" + ss + "</strong></center></span></blink>";
}
if (t.total>=300000) {
@@ -67,6 +80,7 @@ function updateClock(){
var clock = document.getElementById("time_left");
updateClock();
var timeinterval = setInterval(updateClock,1000);
+
}
function validate(){
@@ -91,7 +105,6 @@ module_id = "{{module.id}}"
question_type = "{{ question.type }}"
</script>
-
{% endblock script %}
{% block onload %} onload="updateTime();" {% endblock %}
@@ -184,6 +197,21 @@ question_type = "{{ question.type }}"
<h5><a href="{{f_name.file.url}}">{{f_name.file.name}}</a></h5>
{% endfor %}
{% endif %}
+
+ {% if quiz.is_exercise %}
+ {% if can_skip %}
+ <div id="solution">
+ {% else %}
+ <div id="solution" style="display:none">
+ {% endif %}
+ {% if question.solution %}
+ <h4><u> Solution by teacher</u></h4>
+ {% else %}
+ <h4><u> No solution provided by teacher </u></h4>
+ {% endif%}
+ <font size=3 face=arial> {{ question.solution|safe }} </font>
+ </div>
+ {% endif %}
</div>
<div class="panel-body">
{% if question.type == "mcq" %}
@@ -253,16 +281,23 @@ question_type = "{{ question.type }}"
<br><button class="btn btn-primary" type="submit" name="check" id="check" onClick="return validate();">Upload</button>&nbsp;&nbsp;
{% else %}
- {% if question in paper.get_questions_unanswered %}
+ {% if question in paper.get_questions_unanswered or quiz.is_exercise %}
<button class="btn btn-primary" type="submit" name="check" id="check" >Check Answer <span class="glyphicon glyphicon-cog"></span></button>&nbsp;&nbsp;
{% endif %}
{% endif %}
+ {% if quiz.is_exercise %}
+ {% if can_skip %}
+ <button id="skip_ex" class="btn btn-primary" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ module.id }}/{{ paper.question_paper.id }}/{{course.id}}/')" name="skip"> Next <span class="glyphicon glyphicon-arrow-right"></span></button>
+ {% else %}
+ <button id="skip_ex" class="btn btn-primary" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ module.id }}/{{ paper.question_paper.id }}/{{course.id}}/')" name="skip" style="visibility:hidden"> Next <span class="glyphicon glyphicon-arrow-right"></span></button>
+ {% endif %}
+ {% endif %}
{% if paper.question_paper.quiz.allow_skip and not paper.get_questions_unanswered|length_is:"1" %}
{% if question in paper.get_questions_unanswered %}
<button class="btn btn-primary" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ module.id }}/{{ paper.question_paper.id }}/{{course.id}}/')" name="skip" id="skip">Attempt Later <span class="glyphicon glyphicon-arrow-right"></span></button>
{% endif %}
- {% endif %}
+ {% endif %}
</div>
</form>
</div>
diff --git a/yaksh/templates/yaksh/quit.html b/yaksh/templates/yaksh/quit.html
index 78a9b47..ee72026 100644
--- a/yaksh/templates/yaksh/quit.html
+++ b/yaksh/templates/yaksh/quit.html
@@ -28,9 +28,13 @@ width="80" alt="YAKSH"></img> {% endblock %}
{% endfor %}
</table></center>
- <center><h4>Your current answers are saved.</h4></center>
- <center><h4> Are you sure you wish to quit the exam?</h4></center>
- <center><h4> Be sure, as you won't be able to restart this exam.</h4></center>
+ {% if paper.question_paper.quiz.is_exercise %}
+ <center><h4> Are you sure you wish to quit the Exercise?</h4></center>
+ {% else %}
+ <center><h4>Your current answers are saved.</h4></center>
+ <center><h4> Are you sure you wish to quit the exam?</h4></center>
+ <center><h4> Be sure, as you won't be able to restart this exam.</h4></center>
+ {% endif %}
<form action="{{URL_ROOT}}/exam/complete/{{ paper.attempt_number }}/{{module_id}}/{{ paper.question_paper.id }}/{{course_id}}/" method="post">
{% csrf_token %}
<center>
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index 5f899e3..410b578 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -11,13 +11,21 @@
{% block main %}
{% if not data.papers %}
+ {% if quiz.is_exercise %}
+ <p><b> You have not attempted the Exercise {{ quiz.description }} </b></p>
+ {% else %}
<p><b> You have not attempted the quiz {{ quiz.description }} </b></p>
+ {% endif %}
{% else %}
{% for paper in data.papers %}
{% if forloop.counter == 2 and data.questionpaperid %}
<U><h2> Previous attempts </h2></U>
{% endif %}
- <h2> Quiz: {{ paper.question_paper.quiz.description }} </h2>
+ {% if quiz.is_exercise %}
+ <h2> Exercise: {{ paper.question_paper.quiz.description }} </h2>
+ {% else %}
+ <h2> Quiz: {{ paper.question_paper.quiz.description }} </h2>
+ {% endif %}
<p>
Attempt Number: {{ paper.attempt_number }}<br/>