diff options
Diffstat (limited to 'testapp')
-rw-r--r-- | testapp/exam/forms.py | 2 | ||||
-rw-r--r-- | testapp/exam/views.py | 3 | ||||
-rw-r--r-- | testapp/static/exam/css/base.css | 5 | ||||
-rw-r--r-- | testapp/static/exam/css/question_quiz.css | 6 | ||||
-rw-r--r-- | testapp/templates/exam/add_quiz.html | 14 | ||||
-rw-r--r-- | testapp/templates/exam/edit_question.html | 40 | ||||
-rw-r--r-- | testapp/templates/exam/edit_quiz.html | 21 | ||||
-rw-r--r-- | testapp/templates/exam/grade_user.html | 29 | ||||
-rw-r--r-- | testapp/templates/exam/monitor.html | 18 | ||||
-rw-r--r-- | testapp/templates/exam/show_quiz.html | 5 | ||||
-rw-r--r-- | testapp/templates/exam/user_data.html | 4 | ||||
-rw-r--r-- | testapp/templates/manage.html | 31 |
12 files changed, 122 insertions, 56 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py index e622b88..272a3d4 100644 --- a/testapp/exam/forms.py +++ b/testapp/exam/forms.py @@ -113,7 +113,7 @@ class QuizForm(forms.Form): start_date = forms.DateField(initial=datetime.date.today) duration = forms.IntegerField() active = forms.BooleanField(required = False) - description = forms.CharField(max_length=256, widget=forms.Textarea(attrs={'cols':20,'rows':2})) + description = forms.CharField(max_length=256, widget=forms.Textarea(attrs={'cols':20,'rows':1})) def save(self): start_date = self.cleaned_data["start_date"] diff --git a/testapp/exam/views.py b/testapp/exam/views.py index 2803538..ffb1b1e 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -246,7 +246,8 @@ def prof_manage(request): user = request.user if user.is_authenticated() and user.groups.filter(name='moderator').count() > 0: - return render_to_response('manage.html',{}) + context = {'user':user} + return render_to_response('manage.html',context) return my_redirect('/exam/login/') def user_login(request): diff --git a/testapp/static/exam/css/base.css b/testapp/static/exam/css/base.css index b7a9fbb..7099aab 100644 --- a/testapp/static/exam/css/base.css +++ b/testapp/static/exam/css/base.css @@ -1845,8 +1845,9 @@ footer { -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } -.page-header h1 { - margin-bottom: 8px; +.page-header h3 { + margin-top: 20px; + margin-bottom : -17px; } .btn.danger, .alert-message.danger, diff --git a/testapp/static/exam/css/question_quiz.css b/testapp/static/exam/css/question_quiz.css index 2e13364..643e5c6 100644 --- a/testapp/static/exam/css/question_quiz.css +++ b/testapp/static/exam/css/question_quiz.css @@ -2,8 +2,4 @@ table th, table td { text-align: left; } -textarea -{ -width : 300px; -height : 150px; -} + diff --git a/testapp/templates/exam/add_quiz.html b/testapp/templates/exam/add_quiz.html index dedc627..fe99ce6 100644 --- a/testapp/templates/exam/add_quiz.html +++ b/testapp/templates/exam/add_quiz.html @@ -6,9 +6,18 @@ {% block css %} <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> {% endblock %} +{% block script %} +<script type='text/javascript'> + function test() + { + document.getElementById('id_description').onFocus="javascript:test2()"; + } +</script> +{% endblock %} +{% block onload %} onload="javascript:test();" {% endblock %} {% block manage %} -<form name=frm action="" method="post"> +<form name=frm id=frm action="" method="post" > {% csrf_token %} <center> <table class=span1> @@ -16,6 +25,7 @@ </table> </center> <center><button class="btn" type="submit" name="save">Save</button> - <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/showquiz/");'>Cancel</button> </center> + <button class="btn" type="button" name="button" onClick="javascript:test()">Cancel</button> </center> + <!--button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/showquiz/");'>Cancel</button> </center--> </form> {% endblock %} diff --git a/testapp/templates/exam/edit_question.html b/testapp/templates/exam/edit_question.html index a189ac5..b1395e9 100644 --- a/testapp/templates/exam/edit_question.html +++ b/testapp/templates/exam/edit_question.html @@ -15,15 +15,49 @@ function my_render(frm) } } +function load_form() +{ + +} + +function data(showContent,showHideDiv) +{ + var con = document.getElementById(showContent); + var ele=document.getElementById(showHideDiv); + if (ele.style.display=="block") + { + con.style.display = "none" + ele.style.display = "none"; + } + else + { + con.style.display = "block"; + ele.style.display = "block"; + } +} </script> {% endblock %} +{% block onload %} onload='javascript:load_form();' {% endblock %} {% block manage %} <form name='frm' action="{{URL_ROOT}}/exam/manage/editquestion/" method="post" onKeyPress='javascript:my_render(frm);'> {% csrf_token %} - {% for form in forms %} -<b>Look of Question in HTML Format :</b> + {% for form in forms %} + + {{ form.summary.value }}<a onClick="data('contentDiv{{forloop.counter}}','myContent{{forloop.counter}}');" style='cursor:pointer;'>Show</a> <br> + <b>Look of Question in HTML Format :</b> <p id='{{forloop.counter}}'></p> + <div id="contentDiv{{forloop.counter}}"> + <div id="myContent{{forloop.counter}}" style="display: none;"> + <table> {{ form.as_table }} </table> + + </div> + </div> + <hr> + {% endfor %} + + {% for form in forms %} + <table class=span1> {{ form.as_table }} </table> @@ -32,5 +66,7 @@ function my_render(frm) <center><button class="btn" type="submit" name="savequestion">Save</button> <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/questions/");'>Cancel</button> </center> </form> + + {% endblock %} diff --git a/testapp/templates/exam/edit_quiz.html b/testapp/templates/exam/edit_quiz.html index 56eb0c0..d513e7a 100644 --- a/testapp/templates/exam/edit_quiz.html +++ b/testapp/templates/exam/edit_quiz.html @@ -5,19 +5,30 @@ {% block css %} <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> +<style type='text/css'> +table th, table td + { + text-align: center; + } +</style> {% endblock %} {% block manage %} <form name=frm action="{{URL_ROOT}}/exam/manage/editquiz/" method="post"> {% csrf_token %} - {% for form in forms %} <center> - <table class=span1> - {{ form.as_table }} + <table> + <tr> + <td><strong> Start Date <td><strong> Duration <td> <strong>Active <td> <strong>Description </strong> + </tr> + {% for form in forms %} + + <tr> + <td> {{ form.start_date}} <td> {{ form.duration }} <td> {{ form.active }} <td> {{ form.description }} + </tr> + {% endfor %} </table> </center> - <hr> - {% endfor %} <center><button class="btn" type="submit" name="save">Save</button> <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/showquiz/");'>Cancel</button> </center> </form> diff --git a/testapp/templates/exam/grade_user.html b/testapp/templates/exam/grade_user.html index b7970e8..c6f6343 100644 --- a/testapp/templates/exam/grade_user.html +++ b/testapp/templates/exam/grade_user.html @@ -10,17 +10,20 @@ {% block script %} <script type='text/javascript'> -function hidedata(showHideDiv) { - var ele = document.getElementById(showHideDiv); - ele.style.display = "none"; - - -} -function showdata(showHideDiv) +function data(showContent,showHideDiv) { - var ele = document.getElementById(showHideDiv); - ele.style.display = "block"; - + var con = document.getElementById(showContent); + var ele=document.getElementById(showHideDiv); + if (ele.style.display=="block") + { + con.style.display = "none" + ele.style.display = "none"; + } + else + { + con.style.display = "block"; + ele.style.display = "block"; + } } </script> {% endblock %} @@ -56,9 +59,9 @@ Start time: {{ paper.start_time }} <br/> {% csrf_token %} {% for question, answers in paper.get_question_answers.items %} <p><strong> - <a id='myHeader' href="{{URL_ROOT}}/admin/exam/question/{{question.id}}" onMouseOver="javascript:showdata('myContent{{question.id}}','myHeader');" onMouseOut="javascript:hidedata('myContent{{question.id}}','myHeader');"> Question: {{ question.id }}. {{ question.summary }} </a> (Points: {{ question.points }})</strong> </p> -<div style="clear:both;"></div> -<div id="contentDiv"> + Question: {{ question.id }}. {{ question.summary }} <font color='red'><img style="cursor: pointer" alt='...' onClick="data('contentDiv{{question.id}}','myContent{{question.id}}');"></font> + (Points: {{ question.points }})</strong> </p> +<div id="contentDiv{{question.id}}" style="display:none;"> <div id="myContent{{question.id}}" style="display: none;"> <p> Description : {{ question.description }} </p> <p> Points : {{ question.points }} </p> diff --git a/testapp/templates/exam/monitor.html b/testapp/templates/exam/monitor.html index 9385e73..29cb6e9 100644 --- a/testapp/templates/exam/monitor.html +++ b/testapp/templates/exam/monitor.html @@ -7,17 +7,25 @@ {% block css %} <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/question_quiz.css" type="text/css" /> {% endblock %} - +{% block subtitle %} + {% if not quizzes and not quiz %} + Quiz Results + {% endif %} + {% if quizzes %} + Available Quizzes + {% endif %} + {% if quiz %} + {{ quiz.description }} Results + {% endif %} +{% endblock %} {% block manage %} {% if not quizzes and not quiz %} - <h1><center> Quiz results </center></h1> - <center><h5> No quizzes available. </h5></center> + <center><h5> No quizzes available. </h5></center> {% endif %} {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor #} {% if quizzes %} -<center><h1> Available quizzes </h1></center> <ul> {% for quiz in quizzes %} <li><a href="{{URL_ROOT}}/exam/manage/monitor/{{quiz.id}}/">{{ quiz.description }}</a></li> @@ -28,7 +36,6 @@ {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor/quiz_num #} {% if quiz %} -<center><h1> {{ quiz.description }} results </h1></center> {% if papers %} {# <p> Quiz: {{ quiz_name }}</p> #} @@ -59,5 +66,4 @@ <p> No answer papers so far. </p> {% endif %} {# if papers #} {% endif %} -<a href="{{URL_ROOT}}/admin/">Admin</a> {% endblock %} diff --git a/testapp/templates/exam/show_quiz.html b/testapp/templates/exam/show_quiz.html index e6aecd6..684cfd2 100644 --- a/testapp/templates/exam/show_quiz.html +++ b/testapp/templates/exam/show_quiz.html @@ -27,19 +27,18 @@ if(n == frm.quiz.length) location.replace("{{URL_ROOT}}/exam/manage/showquiz"); } + </script> {% endblock %} - +{% block subtitle %} Quiz List {% endblock %} {% block manage %} {% if not quizzes and not quiz %} -<h5><center> Available Quiz </center></h5> <center><h5> No quizzes available. </h5></center> {% endif %} {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor #} {% if quizzes %} -<center><h3>Quiz List</h3></center> <form method="post" action="" name='frm'> {% csrf_token %} diff --git a/testapp/templates/exam/user_data.html b/testapp/templates/exam/user_data.html index fad0310..61a3a97 100644 --- a/testapp/templates/exam/user_data.html +++ b/testapp/templates/exam/user_data.html @@ -21,7 +21,7 @@ Last login: {{ data.user.last_login }} </p> {% if data.papers %} -<p><a href="{{URL_ROOT}}/exam/manage/grade_user/{{ data.user.username }}/"> +<p><a href="{{URL_ROOT}}/exam/manage/gradeuser/{{ data.user.username }}/"> Grade/correct paper</a> </p> @@ -66,7 +66,7 @@ User IP address: {{ paper.user_ip }} {% endif %} {# if data.papers #} <br /> <hr /> -<a href="{{URL_ROOT}}/exam/manage/grade_user/{{ data.user.username }}/"> +<a href="{{URL_ROOT}}/exam/manage/gradeuser/{{ data.user.username }}/"> Grade/correct paper</a> <br/> {% if data.papers.count > 1 %} diff --git a/testapp/templates/manage.html b/testapp/templates/manage.html index 9995450..77e0b7a 100644 --- a/testapp/templates/manage.html +++ b/testapp/templates/manage.html @@ -23,28 +23,31 @@ </head> <body {% block onload %}{% endblock %}> - +<div class="topbar"> + <div class="fill"> + <div class="container"> + <h3 class="brand"><strong>Online Test</h3></strong> + <ul class='pull-right'> + <li><a href="{{ URL_ROOT }}/exam/manage/questions">Questions</a></li> + <li><a href="{{ URL_ROOT }}/exam/manage/showquiz">Quizzes</a></li> + <li><a href="{{ URL_ROOT }}/exam/manage/gradeuser">Grade User</a></li> + <li><a href="{{ URL_ROOT }}/exam/manage/monitor">Monitor</a></li> + <li><a class='pull-right' style='cursor:pointer' onClick='location.replace("{{URL_ROOT}}/exam/complete/");'>Log out</a></li> + </ul> + + </div> + </div> +</div> <div class="container"> <div class="content"> <div class="page-header"> - <font size=6><strong>Online Test</font></strong> - <button class="btn pull-right" type="submit" onClick='location.replace("{{URL_ROOT}}/exam/complete/");'>Log out</button> + <h3><center>{% block subtitle %}Welcome {{ user.first_name.title }} {{user.last_name.title}} {% endblock %}</center></h3><br> </div> <div class=row> - <div class=span10> - <h3><center>{% block subtitle %} {% endblock %}</center></h3><br> + <div class=span14> {% block manage %} {% endblock %} </div> - <div class=span4> - <h5>Manage</h5> - <ul> - <li><a href="{{ URL_ROOT }}/exam/manage/questions">Questions</a></li> - <li><a href="{{ URL_ROOT }}/exam/manage/showquiz">Quizzes</a></li> - <li><a href="{{ URL_ROOT }}/exam/manage/gradeuser">Grade User</a></li> - <li><a href="{{ URL_ROOT }}/exam/manage/monitor">Monitor</a></li> - </ul> - </div> </div> </div> <footer> |