diff options
Diffstat (limited to 'testapp/templates/exam')
-rw-r--r-- | testapp/templates/exam/add_question.html | 121 | ||||
-rw-r--r-- | testapp/templates/exam/add_quiz.html | 3 | ||||
-rw-r--r-- | testapp/templates/exam/edit_question.html | 171 | ||||
-rw-r--r-- | testapp/templates/exam/question.html | 40 | ||||
-rw-r--r-- | testapp/templates/exam/show_quiz.html | 28 | ||||
-rw-r--r-- | testapp/templates/exam/showquestions.html | 26 |
6 files changed, 18 insertions, 371 deletions
diff --git a/testapp/templates/exam/add_question.html b/testapp/templates/exam/add_question.html index 3f8637e..9651600 100644 --- a/testapp/templates/exam/add_question.html +++ b/testapp/templates/exam/add_question.html @@ -4,124 +4,15 @@ {% block subtitle %}Add Question{% endblock %} {% block css %} -<link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> +<link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> +<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/exam/css/autotaggit.css" /> {% endblock %} {% block script %} -<script type="text/javascript" src="{{ URL_ROOT }}/static/exam/css/min.js"></script> -<script type="text/javascript"> - - -function increase(frm) -{ - if(frm.points.value == "") - { - frm.points.value = "0.5"; - return; - } - frm.points.value = parseFloat(frm.points.value) + 0.5; -} - -function decrease(frm) -{ - if(frm.points.value > 0) - { - frm.points.value = parseFloat(frm.points.value) - 0.5; - } - else - { - frm.points.value=0; - } - - -} - -function textareaformat() -{ - - document.getElementById('id_type').setAttribute('class','select-type'); - - document.getElementById('id_points').setAttribute('class','mini-text'); - document.getElementById('id_tags').setAttribute('class','tag-text'); - - $('#id_description').bind('focus', function( event ){ - document.getElementById("id_description").rows=5; - document.getElementById("id_description").cols=40; - }); - - $('#id_description').bind('blur', function( event ){ - document.getElementById("id_description").rows=1; - document.getElementById("id_description").cols=40; - }); - - $('#id_description').bind('keypress', function (event){ - document.getElementById('my').innerHTML = document.getElementById('id_description').value ; - }); - - $('#id_test').bind('focus', function( event ){ - document.getElementById("id_test").rows=5; - document.getElementById("id_test").cols=40; - }); - - $('#id_test').bind('blur', function( event ){ - document.getElementById("id_test").rows=1; - document.getElementById("id_test").cols=40; - }); - $('#id_options').bind('focus', function( event ){ - document.getElementById("id_options").rows=5; - document.getElementById("id_options").cols=40; - }); - - $('#id_options').bind('blur', function( event ){ - document.getElementById("id_options").rows=1; - document.getElementById("id_options").cols=40; - }); - - $('#id_type').bind('change',function(event){ - var value = document.getElementById('id_type').value; - if(value == 'mcq') - { - document.getElementById('id_options').style.visibility='visible'; - document.getElementById('label_option').innerHTML="Options :" - - } - else - { - document.getElementById('id_options').style.visibility='hidden'; - document.getElementById('label_option').innerHTML = ""; - } - }); - - document.getElementById('my').innerHTML = document.getElementById('id_description').value ; - var value = document.getElementById('id_type').value; - if(value == 'mcq') - { - document.getElementById('id_options').style.visibility='visible'; - document.getElementById('label_option').innerHTML="Options :" - - } - else - { - document.getElementById('id_options').style.visibility='hidden'; - document.getElementById('label_option').innerHTML = ""; - } -} - -function autosubmit() -{ - if (document.getElementById('id_type').value == 'mcq') - { - var value = document.getElementById('id_options').value; - if(value.split('\n').length != 4) - { - alert("Enter 4 options. One option per line."); - return false; - } - return true; - } - -} -</script> +<script type="text/javascript" src="{{ URL_ROOT }}/static/exam/js/min.js"></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/add_question.js"></script> {% endblock %} {% block onload %} onload='javascript:textareaformat();' {% endblock %} diff --git a/testapp/templates/exam/add_quiz.html b/testapp/templates/exam/add_quiz.html index 570b3c2..c5998d8 100644 --- a/testapp/templates/exam/add_quiz.html +++ b/testapp/templates/exam/add_quiz.html @@ -5,8 +5,11 @@ {% block css %} <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> +<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/exam/css/autotaggit.css" /> {% 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 type='text/javascript'> function test() { diff --git a/testapp/templates/exam/edit_question.html b/testapp/templates/exam/edit_question.html index 9d92a71..8ede7f0 100644 --- a/testapp/templates/exam/edit_question.html +++ b/testapp/templates/exam/edit_question.html @@ -4,173 +4,12 @@ {% block css %} <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> +<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/exam/css/autotaggit.css" /> {% endblock %} {% block script %} -<script type='text/javascript'> -function render_question(frm) -{ - for(var i=1;i<=frm.description.length;i++) - { - document.getElementById('my'+i).innerHTML = frm.description[i-1].value; - } - -} - -function increase(frm,n) -{ - var newValue = document.getElementById('id_points'+ (n-1)).value ; - - if( newValue == "") - { - document.getElementById('id_points'+(n-1)).value = "0.5"; - return; - } - document.getElementById('id_points' + (n-1)).value = parseFloat(newValue) + 0.5; -} - -function decrease(frm,n) -{ - var newValue = document.getElementById('id_points'+ (n-1)).value ; - - if( newValue > 0) - { - document.getElementById('id_points' + (n-1)).value = parseFloat(newValue) - 0.5; - } - else - { - document.getElementById('id_points' + (n-1)).value = 0; - } -} - - -function data(showContent,showHideDiv,a,summary) -{ - var con = document.getElementById(showContent); - var ele=document.getElementById(showHideDiv); - var atag=document.getElementById(a); - if (ele.style.display=="block") - { - con.style.display = "none" - ele.style.display = "none"; - atag.text = summary; - } - else - { - con.style.display = "block"; - ele.style.display = "block"; - } -} - -function textareaformat() -{ - var point = document.getElementsByName('points'); - var test = document.getElementsByName('test'); - var option = document.getElementsByName('options'); - var descriptions = document.getElementsByName('description'); - var type = document.getElementsByName('type'); - - for (var i=0;i<point.length;i++) - { - point[i].id = point[i].id + i; - descriptions[i+1].id=descriptions[i+1].id + i; - test[i].id=test[i].id + i; - option[i].id=option[i].id + i; - type[i].id = type[i].id + i; - - - } - - for(var i=0;i<point.length;i++) - { - var point_id = document.getElementById('id_points'+i); - point_id.setAttribute('class','mini-text'); - - var type_id = document.getElementById('id_type'+i); - type_id.setAttribute('class','select-type'); - type_id.onchange = showOptions; - var value = type_id.value; - - var desc_id = document.getElementById('id_description'+i); - desc_id.onfocus = gainfocus; - desc_id.onblur = lostfocus; - - var test_id = document.getElementById('id_test' + i); - test_id.onfocus = gainfocus; - test_id.onblur = lostfocus; - - var option_id = document.getElementById('id_options' + i); - option_id.onfocus = gainfocus; - option_id.onblur = lostfocus; - - if(value != 'mcq') - { - document.getElementById('id_options'+i).style.visibility='hidden'; - document.getElementById('label_option'+(i+1)).innerHTML = ""; - - } - - document.getElementById('my'+ (i+1)).innerHTML = desc_id.value; - } -} - -function showOptions(e) -{ - var value = this.value; - var no = parseInt(this.id.substring(this.id.length-1)); - if( value == 'mcq') - { - document.getElementById('id_options'+no).style.visibility = 'visible'; - document.getElementById('label_option'+ (no+1)).innerHTML = "Options : " - } - else - { - document.getElementById('id_options'+no).value = ""; - document.getElementById('id_options'+no).style.visibility = 'hidden'; - document.getElementById('label_option'+ (no+1)).innerHTML = ""; - } - - - -} - -function gainfocus(e) -{ - this.rows = 5; -} -function lostfocus(e) -{ - this.rows = 1; -} - -function autosubmit() -{ - var total_form = document.getElementsByName('summary').length; - var empty_options = 0 ; - var count_mcq = 0; - - for (var i=0;i<total_form;i++) - { - if (document.getElementById('id_type' + i).value != 'mcq') - { - continue; - } - else - { - count_mcq = count_mcq + 1; - var options = document.getElementById('id_options' + i).value; - var total_words = options.split("\n").length ; - if ( total_words < 4) - empty_options = empty_options + 1 ; - } - } - if (empty_options > 0) - { - alert('Enter 4 options. One option per line.'); - return false; - } - return true; -} -</script> +<script src="{{ URL_ROOT }}/static/exam/js/edit_question.js"></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> {% endblock %} {% block onload %} onload = 'javascript:textareaformat();' {% endblock %} @@ -196,9 +35,9 @@ function autosubmit() <tr><td><strong>Rendered: </strong><td><p id='my{{forloop.counter}}'></p> <tr><td><b>Description: <td>{{ form.description }} {{form.description.errors}} <tr><td><b>Test: <td>{{ form.test }}{{form.test.errors}} + <tr><td>Tags: <td>{{ form.tags }} <tr><td id='label_option{{forloop.counter}}'><b>Options: <td>{{ form.options }} {{form.options.errors}} {{form.options.helptext}} </table></center> - </div> </div> {% endfor %} diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html index b4b171e..981af7f 100644 --- a/testapp/templates/exam/question.html +++ b/testapp/templates/exam/question.html @@ -9,45 +9,7 @@ {% endblock %} {% block script %} - <script type="text/javascript"> - var time_left = {{ time_left }}; - function submitCode() - { - document.forms["code"].submit(); - var x = document.getElementById("status"); - x.innerHTML = "<strong>Checking answer ...</strong>"; - x = document.getElementById("check"); - x.disabled = true; - x.value = "Checking Answer ..."; - document.getElementById("skip").disabled = true; - } - - 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> +<script src="{{ URL_ROOT }}/static/exam/js/question.js"></script> {% endblock script %} {% block onload %} onload="update_time()" {% endblock onload %} diff --git a/testapp/templates/exam/show_quiz.html b/testapp/templates/exam/show_quiz.html index 684cfd2..1a4c289 100644 --- a/testapp/templates/exam/show_quiz.html +++ b/testapp/templates/exam/show_quiz.html @@ -3,33 +3,9 @@ {% block title %} Quiz List {% endblock title %} {% block script %} - <script type='text/javascript'> - function my_confirm(frm) - { - var r = confirm("Are you Sure ?"); - if(r==false) - { - for(i=0;i<frm.quiz.length;i++) - { - frm.quiz[i].checked=false; - } - location.replace("{{URL_ROOT}}/exam/manage/showquiz"); - } - } - function confirm_edit(frm) - { - var n = 0; - for (var i =0;i<frm.quiz.length;i++) - { - if (frm.quiz[i].checked == false) - n = n + 1 ; - } - if(n == frm.quiz.length) - location.replace("{{URL_ROOT}}/exam/manage/showquiz"); - } - - </script> +<script src="{{ URL_ROOT }}/static/exam/js/show_quiz.js"></script> {% endblock %} + {% block subtitle %} Quiz List {% endblock %} {% block manage %} {% if not quizzes and not quiz %} diff --git a/testapp/templates/exam/showquestions.html b/testapp/templates/exam/showquestions.html index 116e747..d406522 100644 --- a/testapp/templates/exam/showquestions.html +++ b/testapp/templates/exam/showquestions.html @@ -4,31 +4,7 @@ {% block subtitle %}List of Questions {% endblock %} {% block script %} - <script type='text/javascript'> - function confirm_delete(frm) - { - var r = confirm("Are you Sure ?"); - if(r==false) - { - for(i=0;i<frm.question.length;i++) - { - frm.question[i].checked=false; - } - location.replace("{{URL_ROOT}}/exam/manage/showquestion"); - } - } - function confirm_edit(frm) - { - var n = 0; - for(i=0;i<frm.question.length;i++) - { - if(frm.question[i].checked==true) - n = n+1; - } - if(n==0) - location.replace("{{URL_ROOT}}/exam/manage/showquestion"); - } - </script> +<script src="{{ URL_ROOT }}/static/exam/js/show_question.js"></script> {% endblock %} {% block manage %} |