diff options
author | prathamesh | 2015-04-07 13:39:47 +0530 |
---|---|---|
committer | prathamesh | 2015-04-07 13:39:47 +0530 |
commit | bd5b1e21c4d837dab410f9a3eb332d7af3d0185a (patch) | |
tree | 99b4fb8ff258fe8ed496dd7100a0c5e23b6e7319 /testapp/exam/templates | |
parent | 28415b148617057674d85aee9a2d3aaac36bf0d2 (diff) | |
download | online_test-bd5b1e21c4d837dab410f9a3eb332d7af3d0185a.tar.gz online_test-bd5b1e21c4d837dab410f9a3eb332d7af3d0185a.tar.bz2 online_test-bd5b1e21c4d837dab410f9a3eb332d7af3d0185a.zip |
Multiple attempts and file upload question type.
Can have multiple attempts for a quiz.
Can also specify time lag between two successive attempts for a given
quiz.
Students can upload their code through the interface.
The code will be saved in the folder named after their roll number.
And the file name will be the question id.
Diffstat (limited to 'testapp/exam/templates')
-rw-r--r-- | testapp/exam/templates/exam/intro.html | 2 | ||||
-rw-r--r-- | testapp/exam/templates/exam/question.html | 49 | ||||
-rw-r--r-- | testapp/exam/templates/exam/quit.html | 4 |
3 files changed, 45 insertions, 10 deletions
diff --git a/testapp/exam/templates/exam/intro.html b/testapp/exam/templates/exam/intro.html index ec1888a..58068ed 100644 --- a/testapp/exam/templates/exam/intro.html +++ b/testapp/exam/templates/exam/intro.html @@ -27,7 +27,7 @@ </ul> <p> We hope you enjoy taking this exam !!!</p> - <form action="{{URL_ROOT}}/exam/start/{{ paper_id }}/" method="post" align="center"> + <form action="{{URL_ROOT}}/exam/start/{{ attempt_no }}/{{ paper_id }}/" method="post" align="center"> {% csrf_token %} <center><button class="btn" type="submit" name="start">Start Exam!</button></center> </form> diff --git a/testapp/exam/templates/exam/question.html b/testapp/exam/templates/exam/question.html index a3e8629..977b388 100644 --- a/testapp/exam/templates/exam/question.html +++ b/testapp/exam/templates/exam/question.html @@ -10,7 +10,10 @@ {% endblock %} {% block script %} +<script src="/static/taggit_autocomplete_modified/jquery.min.js" type="text/javascript"></script> +<script src="/static/taggit_autocomplete_modified/jquery.autocomplete.js" type="text/javascript"></script> <script src="{{ URL_ROOT }}/static/exam/js/question.js"></script> +<script src="{{ URL_ROOT }}/static/exam/js/bootstrap-modal.js"></script> <script> var time_left = {{ time_left }} @@ -49,6 +52,18 @@ function setSnippetHeight() autoresize(); } +function validate(){ + uploaded_file = document.getElementById("assignment").value; + if(uploaded_file == ""){ + $("#upload_alert").modal("show"); + return false; + } + else + { + return true; + } +} + </script> {% endblock script %} @@ -74,7 +89,7 @@ function setSnippetHeight() <ul> <li> <h5><a> Hi {{user.first_name.title}} {{user.last_name.title}} </a></h5> </ul> - <form id="logout" action="{{URL_ROOT}}/exam/quit/{{ paper.question_paper.id }}/" method="post" class="pull-right"> + <form id="logout" action="{{URL_ROOT}}/exam/quit/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post" class="pull-right"> {% csrf_token %} <button class="btn" type="submit" name="quit">Quit Exam</button> </li> @@ -94,19 +109,20 @@ function setSnippetHeight() {% endfor%} </div>{% endif %} - {% if success_msg %} - <script type="text/javascript"> - alert("Congratulations, that's correct. Let's go to next question"); - </script> - {% endif %} <p id="status"></p> - <form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/{{ paper.question_paper.id }}/" method="post"> + + <form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post" enctype="multipart/form-data"> {% csrf_token %} {% if question.type == "mcq" %} {% for option in question.options.strip.splitlines %} <input name="answer" type="radio" value="{{option}}" />{{option}} <br/> {% endfor %} {% endif %} + {% if question.type == "upload" %} + <p>Upload assignment file for the said question<p> + <input type=file id="assignment" name="assignment"> + <hr> + {% endif %} {% if question.type == "mcc" %} {% for option in question.options.strip.splitlines %} <input name="answer" type="checkbox" value="{{ option }}"> {{ option }} @@ -128,6 +144,8 @@ function setSnippetHeight() {% if question.type == "mcq" or question.type == "mcc "%} <br><button class="btn" type="submit" name="check" id="check">Submit Answer</button> + {% elif question.type == "upload" %} + <br><button class="btn" type="submit" name="check" id="check" onClick="return validate();">Upload</button> {% else %} <button class="btn" type="submit" name="check" id="check" onClick="submitCode();">Check Answer</button> {% endif %} @@ -135,4 +153,21 @@ function setSnippetHeight() </form> + <!-- Modal --> + <div class="modal fade " id="upload_alert" > + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title" id="myModalLabel">File not selected</h4> + </div> + <div id = "modal_body"class="modal-body"> + <font color="brown"><b>Kindly attach a file and then click upload.</b></font> + </div> + <div class="modal-footer"> + <button type="button" class="btn primary close" data-dismiss="modal">OK</button> + </div> + </div> + </div> + </div> + {% endblock content %} diff --git a/testapp/exam/templates/exam/quit.html b/testapp/exam/templates/exam/quit.html index fee11ed..2c347cb 100644 --- a/testapp/exam/templates/exam/quit.html +++ b/testapp/exam/templates/exam/quit.html @@ -7,8 +7,8 @@ <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> - <form action="{{URL_ROOT}}/exam/complete/{{ id }}/" method="post"> + <form action="{{URL_ROOT}}/exam/complete/{{ attempt_no }}/{{ id }}/" method="post"> {% csrf_token %} - <center><button class="btn" type="submit" name="yes">Yes!</button> <button class="btn" type="button" name="no" onClick="window.location='{{ URL_ROOT }}/exam/start/{{ id }}/'">No!</button></center> + <center><button class="btn" type="submit" name="yes">Yes!</button> <button class="btn" type="button" name="no" onClick="window.location='{{ URL_ROOT }}/exam/start/{{ attempt_no }}/{{ id }}/'">No!</button></center> </form> {% endblock content %} |