diff options
-rw-r--r-- | yaksh/forms.py | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_modules.html | 16 | ||||
-rw-r--r-- | yaksh/templates/yaksh/courses.html | 11 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 16 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quit.html | 10 | ||||
-rw-r--r-- | yaksh/templates/yaksh/view_answerpaper.html | 10 | ||||
-rw-r--r-- | yaksh/views.py | 6 |
7 files changed, 47 insertions, 24 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 84db33e..8399bc9 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -176,7 +176,7 @@ class UserLoginForm(forms.Form): class ExerciseForm(forms.ModelForm): class Meta: model = Quiz - fields = ['description'] + fields = ['description', 'view_answerpaper'] class QuizForm(forms.ModelForm): 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 2456433..b6b9f7e 100644 --- a/yaksh/templates/yaksh/courses.html +++ b/yaksh/templates/yaksh/courses.html @@ -151,7 +151,7 @@ {% for unit in module.get_learning_units %} <ul class="inputs-list"> <li> - {% if unit.learning_type == "quiz" %} + {% if unit.type == "quiz" %} {% if unit.quiz.is_exercise %} <a href="{{URL_ROOT}}/exam/manage/add_exercise/{{unit.quiz.id}}/{{course.id}}"> {{unit.quiz.description}}</a> @@ -288,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> diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index fe5917c..b7251ad 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -199,20 +199,18 @@ question_type = "{{ question.type }}" {% 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 %} + {% 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"> 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/> diff --git a/yaksh/views.py b/yaksh/views.py index ca22c9a..a4d9e78 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -586,7 +586,7 @@ def show_question(request, question, paper, error_message=None, notification=Non reason = 'The quiz has been deactivated!' return complete( request, reason, paper.attempt_number, paper.question_paper.id, - module_id=module_id + course_id=course_id, module_id=module_id ) if not quiz.is_exercise: if paper.time_left() <= 0: @@ -955,7 +955,7 @@ def enroll_request(request, course_id): user = request.user ci = RequestContext(request) course = get_object_or_404(Course, pk=course_id) - if not course.is_active_enrollment and course.hidden: + if not course.is_active_enrollment() and course.hidden: msg = ( 'Unable to add enrollments for this course, please contact your ' 'instructor/administrator.' @@ -1028,7 +1028,7 @@ def enroll(request, course_id, user_id=None, was_rejected=False): raise Http404('You are not allowed to view this page') course = get_object_or_404(Course, pk=course_id) - if not course.is_active_enrollment: + if not course.is_active_enrollment(): msg = ( 'Enrollment for this course has been closed,' ' please contact your ' |