summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
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/courses.html21
-rw-r--r--yaksh/templates/yaksh/question.html49
5 files changed, 93 insertions, 14 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/courses.html b/yaksh/templates/yaksh/courses.html
index 0efa72a..2456433 100644
--- a/yaksh/templates/yaksh/courses.html
+++ b/yaksh/templates/yaksh/courses.html
@@ -151,9 +151,14 @@
{% for unit in module.get_learning_units %}
<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.learning_type == "quiz" %}
+ {% 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 +318,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 +337,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..fe5917c 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,23 @@ question_type = "{{ question.type }}"
<h5><a href="{{f_name.file.url}}">{{f_name.file.name}}</a></h5>
{% endfor %}
{% endif %}
+
+ {% if quiz.is_exercise %}
+ {% if question.solution %}
+ <h4><u> Solution by teacher</u></h4>
+ {% else %}
+ <h4><u> No solution provided by teacher </u></h4>
+ {% endif%}
+ {% if can_skip %}
+ <div id="solution">
+ <font size=3 face=arial> {{ question.solution|safe }} </font>
+ </div>
+ {% else %}
+ <div id="solution" style="display:none">
+ <font size=3 face=arial> {{ question.solution|safe }} </font>
+ </div>
+ {% endif %}
+ {% endif %}
</div>
<div class="panel-body">
{% if question.type == "mcq" %}
@@ -253,16 +283,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>