+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013 Parisson SARL
-
-# This software is a computer program whose purpose is to backup, analyse,
-# transcode and stream any audio content with its metadata over a web frontend.
-
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-
-# In this respect, the user's attention is drawn to the risks associated
-# with loading, using, modifying and/or developing or reproducing the
-# software by the user in light of its specific status of free software,
-# that may mean that it is complicated to manipulate, and that also
-# therefore means that it is reserved for developers and experienced
-# professionals having in-depth computer knowledge. Users are therefore
-# encouraged to load and test the software's suitability as regards their
-# requirements in conditions enabling the security of their systems and/or
-# data to be ensured and, more generally, to use and operate it in the
-# same conditions as regards security.
-
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-#
-# Authors: Guillaume Pellerin <yomguy@parisson.com>
-
-
-from teleforma.views.core import *
-
-
-def exam_access(request):
- user = request.user
-
- if user.is_authenticated():
- students = user.student.all()
- quotas = user.quotas.all()
- professor = user.professor.all()
-
- # Option for restricting access to platform user only
- if students:
- platform_only = students[0].platform_only
- else:
- platform_only = False
-
- if students or quotas or user.is_staff or user.is_superuser:
- return {'exam_access': True}
- else:
- return {'exam_access': False}
- else:
- return {'exam_access': False}
-
{% load_chart data.charttype data.chartdata data.chartcontainer data.extra %}
{% endblock extra_javascript %}
-{% block module-action %}
+{% block modules %}
<div class="module">
<h3><a href="{% url teleforma-home %}"><img src="{{ STATIC_URL }}telemeta/images/module_playlist.png" alt="playlists" style="vertical-align:middle" />{% trans "My courses" %}</a></h3>
<div style="background: white;">
</div>
</div>
+{% block module-action %}
{% endblock module-action %}
+{% endblock modules %}
+
+
{% block answers %}
<div class="course_title">
urlpatterns = patterns('',
- url(r'^exam/periods/(?P<period_id>.*)/script/(?P<pk>.*)/detail/$', ScriptView.as_view(),
+ url(r'^scripts/periods/(?P<period_id>.*)/(?P<pk>.*)/detail/$', ScriptView.as_view(),
name="teleforma-exam-script-detail"),
-
- url(r'^exam/periods/(?P<period_id>.*)/scripts/list/$', ScriptsView.as_view(),
+ url(r'^scripts/periods/(?P<period_id>.*)/list/$', ScriptsView.as_view(),
name="teleforma-exam-script-list"),
-
- url(r'^exam/periods/(?P<period_id>.*)/scripts/create/$', ScriptCreateView.as_view(),
+ url(r'^scripts/periods/(?P<period_id>.*)/create/$', ScriptCreateView.as_view(),
name="teleforma-exam-script-create"),
+ url(r'^scripts/periods/(?P<period_id>.*)/pending/$', ScriptsPendingView.as_view(), name="teleforma-exam-scripts-pending"),
+ url(r'^scripts/periods/(?P<period_id>.*)/treated/$', ScriptsTreatedView.as_view(), name="teleforma-exam-scripts-treated"),
+ url(r'^scripts/periods/(?P<period_id>.*)/rejected/$', ScriptsRejectedView.as_view(), name="teleforma-exam-scripts-rejected"),
- url(r'^exam/periods/(?P<period_id>.*)/scripts_pending/$', ScriptsPendingView.as_view(), name="teleforma-exam-scripts-pending"),
- url(r'^exam/periods/(?P<period_id>.*)/scripts_treated/$', ScriptsTreatedView.as_view(), name="teleforma-exam-scripts-treated"),
- url(r'^exam/periods/(?P<period_id>.*)/scripts_rejected/$', ScriptsRejectedView.as_view(), name="teleforma-exam-scripts-rejected"),
- url(r'^exam/periods/(?P<period_id>.*)/scripts_scores_all/$', ScriptsScoreAllView.as_view(), name="teleforma-exam-scripts-scores-all"),
- url(r'^exam/periods/(?P<period_id>.*)/scripts_scores/(?P<course_id>.*)/$', ScriptsScoreCourseView.as_view(), name="teleforma-exam-scripts-scores-course"),
+ url(r'^scores/periods/(?P<period_id>.*)/all/$', ScriptsScoreAllView.as_view(), name="teleforma-exam-scripts-scores-all"),
+ url(r'^scores/periods/(?P<period_id>.*)/courses/(?P<course_id>.*)/$', ScriptsScoreCourseView.as_view(), name="teleforma-exam-scripts-scores-course"),
- url(r'^exam/periods/(?P<period_id>.*)/quotas/$', QuotasView.as_view(), name="teleforma-exam-quotas"),
+ # url(r'^exam/periods/(?P<period_id>.*)/quotas/$', QuotasView.as_view(), name="teleforma-exam-quotas"),
)
def get_queryset(self):
user = self.request.user
period = Period.objects.get(id=self.kwargs['period_id'])
- Q1 = Q(status=3, author=user, period=period)
- Q2 = Q(status=2, author=user, period=period)
- Q3 = Q(status=3, corrector=user, period=period)
- scripts = Script.objects.filter(Q1 | Q2 | Q3)
+ if user.professor.all():
+ Q1 = Q(status=3, period=period)
+ Q2 = Q(status=2, period=period)
+ scripts = Script.objects.filter(Q1 | Q2)
+ else:
+ Q1 = Q(status=3, author=user, period=period)
+ Q2 = Q(status=2, author=user, period=period)
+ Q3 = Q(status=3, corrector=user, period=period)
+ scripts = Script.objects.filter(Q1 | Q2 | Q3)
return scripts
def get_context_data(self, **kwargs):
def get_queryset(self):
user = self.request.user
- Q1 = Q(status=4, author=user)
- Q2 = Q(status=5, author=user)
- Q3 = Q(status=4, corrector=user)
- Q4 = Q(status=5, corrector=user)
- scripts = Script.objects.filter(Q1 | Q2 | Q3 | Q4)
+ period = Period.objects.get(id=self.kwargs['period_id'])
+ if user.professor.all():
+ Q1 = Q(status=4, period=period)
+ Q2 = Q(status=5, period=period)
+ scripts = Script.objects.filter(Q1 | Q2)
+ else:
+ Q1 = Q(status=4, author=user, period=period)
+ Q2 = Q(status=5, author=user, period=period)
+ Q3 = Q(status=4, corrector=user, period=period)
+ Q4 = Q(status=5, corrector=user, period=period)
+ scripts = Script.objects.filter(Q1 | Q2 | Q3 | Q4)
return scripts
def get_context_data(self, **kwargs):
def get_queryset(self):
user = self.request.user
- Q1 = Q(status=0, author=user)
- Q2 = Q(status=0, corrector=user)
- scripts = Script.objects.filter(Q1 | Q2)
+ period = Period.objects.get(id=self.kwargs['period_id'])
+ if user.professor.all():
+ Q1 = Q(status=0)
+ scripts = Script.objects.filter(Q1)
+ else:
+ Q1 = Q(status=0, author=user)
+ Q2 = Q(status=0, corrector=user)
+ scripts = Script.objects.filter(Q1 | Q2)
return scripts
def get_context_data(self, **kwargs):
def get_context_data(self, **kwargs):
context = super(ScriptsScoreAllView, self).get_context_data(**kwargs)
- scripts = self.get_queryset()
+
+ if self.request.user.is_staff or self.request.user.professor.all():
+ scripts = Script.objects.all().exclude(score=None)
+ else:
+ scripts = self.get_queryset()
+
sessions = []
scores = []
def get_context_data(self, **kwargs):
context = super(ScriptsScoreCourseView, self).get_context_data(**kwargs)
course = Course.objects.get(id=self.kwargs['course_id'])
- scripts = self.get_queryset()
- scripts = scripts.filter(course=course)
+
+ if self.request.user.is_staff or self.request.user.professor.all():
+ scripts = Script.objects.all().filter(course=course).exclude(score=None)
+ else:
+ scripts = self.get_queryset().filter(course=course)
+
sessions = []
scores = []
<li><a href="{% url teleforma-annals %}" class="yellow">{% trans "Annals" %}</a></li>
- {% if exam_access %}
{% if periods|length == 1 %}
<li><a href="{% url teleforma-exam-scripts-pending periods.0.id %}" class="green"> {% trans "Scripts" %}
{% if user.is_staff or user.quotas.all %}{% untreated_scripts_count user periods.0.id %}
{% else %}{% treated_scripts_count user periods.0.id %}{% endif %}</a>
</li>
{% else %}
- <li><a href="#exam#" class="green"> {% trans "Scripts" %}
+ <li><a href="#scripts#" class="green"> {% trans "Scripts" %}
{% if user.is_staff or user.quotas.all %}{% untreated_scripts_count user periods.0.id %}
{% else %}{% treated_scripts_count user periods.0.id %}{% endif %}</a>
<ul>
</ul>
</li>
{% endif %}
+
+ {% if periods|length == 1 %}
+ <li><a href="{% url teleforma-exam-scripts-scores-all periods.0.id %}" class="green"> {% trans "Scores" %}</a></li>
+ {% else %}
+ <li><a href="#scores#" class="green"> {% trans "Scores" %}</a>
+ <ul>
+ {% for period in periods %}
+ <li><a href="{% url teleforma-exam-scripts-scores-all period.id %}" class="green">{{ period.name }}</a></li>
+ {% endfor %}
+ </ul>
+ </li>
{% endif %}
{% if user.is_authenticated %}