diff options
author | Hardik Ghaghada | 2013-04-26 16:40:34 +0530 |
---|---|---|
committer | Hardik Ghaghada | 2013-04-26 16:40:34 +0530 |
commit | c8b68813ca80aee16261e5f02d541ed48712feae (patch) | |
tree | 85ee9038f09b7aab4fb1b57cbb444108736f708e /testapp/templates | |
parent | 1dd9573cfaa0587cd3217495847a0b456ceb6223 (diff) | |
download | online_test-c8b68813ca80aee16261e5f02d541ed48712feae.tar.gz online_test-c8b68813ca80aee16261e5f02d541ed48712feae.tar.bz2 online_test-c8b68813ca80aee16261e5f02d541ed48712feae.zip |
Dumped JS from HTML pages to separate JS files
Diffstat (limited to 'testapp/templates')
-rw-r--r-- | testapp/templates/exam/add_questionpaper.html | 30 | ||||
-rw-r--r-- | testapp/templates/exam/add_quiz.html | 12 | ||||
-rw-r--r-- | testapp/templates/exam/automatic_questionpaper.html | 18 | ||||
-rw-r--r-- | testapp/templates/exam/grade_user.html | 17 | ||||
-rw-r--r-- | testapp/templates/exam/manual_questionpaper.html | 16 | ||||
-rw-r--r-- | testapp/templates/exam/question.html | 30 |
6 files changed, 38 insertions, 85 deletions
diff --git a/testapp/templates/exam/add_questionpaper.html b/testapp/templates/exam/add_questionpaper.html index 664093c..4cce8a9 100644 --- a/testapp/templates/exam/add_questionpaper.html +++ b/testapp/templates/exam/add_questionpaper.html @@ -10,36 +10,11 @@ {% 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> -function load_data() -{ - var value = document.getElementById('mode').value; - var pathArray = window.location.pathname.split( '/' ); - length = pathArray.length; - var digit = parseInt(pathArray[length-2]); - - if (! isNaN(digit) && value == 'Automatic') - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/automatic/" + digit; - } - else if(!isNaN(digit) && value == 'Manual') - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/manual/" + digit; - } - else if(value == 'Automatic') - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/automatic"; - } - else if( value == 'Manual') - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/manual"; - } -} -</script> +<script src="{{ URL_ROOT }}/static/exam/js/add_questionpaper.js"></script> {% endblock %} {% block manage %} +<input type=hidden id="url_root" value={{ URL_ROOT }}> <form> {% csrf_token %} Select mode to design Question Paper: @@ -50,5 +25,4 @@ Select mode to design Question Paper: </select> </form> - {% endblock %} diff --git a/testapp/templates/exam/add_quiz.html b/testapp/templates/exam/add_quiz.html index 2667c0c..9851584 100644 --- a/testapp/templates/exam/add_quiz.html +++ b/testapp/templates/exam/add_quiz.html @@ -10,17 +10,7 @@ {% 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 type='text/javascript'> - function test() - { - - if (document.getElementById("id_description").value != "") - { - document.getElementById("submit").innerHTML = "Save"; - } - } - -</script> +<script src="{{ URL_ROOT }}/static/exam/js/add_quiz.js"></script> {% endblock %} {% block onload %} onload="javascript:test();" {% endblock %} {% block manage %} diff --git a/testapp/templates/exam/automatic_questionpaper.html b/testapp/templates/exam/automatic_questionpaper.html index 7a70748..1175f55 100644 --- a/testapp/templates/exam/automatic_questionpaper.html +++ b/testapp/templates/exam/automatic_questionpaper.html @@ -16,26 +16,12 @@ select {% 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> -function load_data() -{ - var value = document.getElementById('mode').value; - if (value == 'Automatic') - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/automatic"; - } - else if(value == "Manual") - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/manual"; - } -} -</script> +<script src="{{ URL_ROOT }}/static/exam/js/add_questionpaper.js"></script> {% endblock %} {% block manage %} +<input type=hidden id="url_root" value={{ URL_ROOT }}> <center><b>Automatic mode to design the Question Paper</center><br> - <form action="" method="post" name=frm> {% csrf_token %} <center> diff --git a/testapp/templates/exam/grade_user.html b/testapp/templates/exam/grade_user.html index 58e118b..ae9274e 100644 --- a/testapp/templates/exam/grade_user.html +++ b/testapp/templates/exam/grade_user.html @@ -9,20 +9,7 @@ {% endblock %} {% block script %} -<script type='text/javascript'> -function data(showHideDiv) -{ - var ele=document.getElementById(showHideDiv); - if (ele.style.display=="block") - { - ele.style.display = "none"; - } - else - { - ele.style.display = "block"; - } -} -</script> +<script src= "{{ URL_ROOT }}/static/exam/js/edit_question.js"></script> {% endblock %} {% block manage %} @@ -59,7 +46,7 @@ Start time: {{ paper.start_time }} <br/> <p><strong> Question: {{ question.id }}. {{ question.summary }} (Points: {{ question.points }}) </strong> -<strong><a href="" onClick="data('myContent{{question.id}}'); return false;" style="cursor:pointer;" />Details</strong></p></a> +<strong><a href="" onClick="grade_data('myContent{{question.id}}'); return false;" style="cursor:pointer;" />Details</strong></p></a> <div id="contentDiv"> <div id="myContent{{question.id}}" style="padding:5px; display:none;"> <p> Description : {{ question.description }} </p> diff --git a/testapp/templates/exam/manual_questionpaper.html b/testapp/templates/exam/manual_questionpaper.html index 47df1ed..1a1f95c 100644 --- a/testapp/templates/exam/manual_questionpaper.html +++ b/testapp/templates/exam/manual_questionpaper.html @@ -17,23 +17,11 @@ select <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> -function load_data() -{ - var value = document.getElementById('mode').value; - if (value == 'Automatic') - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/automatic"; - } - else if(value == "Manual") - { - window.location = "{{ URL_ROOT }}/exam/manage/designquestionpaper/manual"; - } -} -</script> +<script src="{{ URL_ROOT }}/static/exam/js/add_questionpaper.js"></script> {% endblock %} {% block manage %} +<input type=hidden id="url_root" value={{ URL_ROOT }}> <center><b>Manual mode to design the Question Paper</center><br> <form action="" method="post" name=frm> diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html index c74564c..8cd2599 100644 --- a/testapp/templates/exam/question.html +++ b/testapp/templates/exam/question.html @@ -11,6 +11,35 @@ {% block script %} <script src="{{ URL_ROOT }}/static/exam/js/question.js"></script> + +<script> +var time_left = {{ time_left }} +function secs_to_time(secs) +{ + var h = Math.floor(secs/3600); + var h_s = (h > 0) ? h+'h:' : ''; + var m = Math.floor((secs%3600)/60); + var m_s = (m > 0) ? m+'m:' : ''; + var s_s = Math.floor(secs%60) + 's'; + return h_s + m_s + s_s; +} + +function update_time() +{ + time_left -= 1; + if (time_left) + { + var elem = document.getElementById("time_left"); + var t_str = secs_to_time(time_left); + elem.innerHTML = "<strong>" + t_str + "</strong>"; + setTimeout("update_time()", 1000); + } + else + { + document.forms["code"].submit(); + } +} +</script> {% endblock script %} @@ -28,7 +57,6 @@ {% endblock %} {% block content %} -<input type=hidden id="time" value={{ time_left }}> <div class="topbar"> <div class="fill"> <div class="container"> |