From 6e428623dc307ecc7c5eb36b61bf71a22a5b8dbb Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 4 Jul 2013 14:38:45 +0200 Subject: [PATCH] add multiple period management for the desk, update login procedure --- teleforma/context_processors.py | 47 +++++++++++++++++++ .../teleforma/inc/conference_list.html | 2 +- .../teleforma/inc/document_list.html | 2 +- .../templates/teleforma/inc/media_list.html | 2 +- teleforma/templates/telemeta/base.html | 15 +++++- teleforma/templates/telemeta/login.html | 16 ++++++- teleforma/templatetags/teleforma_tags.py | 10 ++-- teleforma/urls.py | 28 +++++------ teleforma/views/core.py | 35 ++++++++++++-- teleforma/views/crfpa.py | 2 +- 10 files changed, 124 insertions(+), 35 deletions(-) create mode 100644 teleforma/context_processors.py diff --git a/teleforma/context_processors.py b/teleforma/context_processors.py new file mode 100644 index 00000000..94fadbbb --- /dev/null +++ b/teleforma/context_processors.py @@ -0,0 +1,47 @@ +# -*- 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 + + +from teleforma.views.core import * + + +def periods(request): + """return the periods assigned to the user """ + + user = request.user + + if not user.is_authenticated(): + return {'periods': None} + else: + return {'periods': get_periods(user)} diff --git a/teleforma/templates/teleforma/inc/conference_list.html b/teleforma/templates/teleforma/inc/conference_list.html index 57840dc4..453bf8fb 100644 --- a/teleforma/templates/teleforma/inc/conference_list.html +++ b/teleforma/templates/teleforma/inc/conference_list.html @@ -9,7 +9,7 @@ - {% for conference in conferences|from_periods:periods %} + {% for conference in conferences|from_period:period %} {% for stream in conference.livestream.all %} {% if stream.stream_type == 'webm' %} diff --git a/teleforma/templates/teleforma/inc/document_list.html b/teleforma/templates/teleforma/inc/document_list.html index 0982c352..4d86e250 100644 --- a/teleforma/templates/teleforma/inc/document_list.html +++ b/teleforma/templates/teleforma/inc/document_list.html @@ -13,7 +13,7 @@ {{ doc_type }}
- {% for doc in docs|from_course_type:type|from_doc_type:doc_type|from_periods:periods %} + {% for doc in docs|from_course_type:type|from_doc_type:doc_type|from_period:period %} {% if doc.course_type.all|length > 1 and type_counter > 1 %} {% else %} diff --git a/teleforma/templates/teleforma/inc/media_list.html b/teleforma/templates/teleforma/inc/media_list.html index e0770566..bc1eb967 100644 --- a/teleforma/templates/teleforma/inc/media_list.html +++ b/teleforma/templates/teleforma/inc/media_list.html @@ -9,7 +9,7 @@
- {% for media in course.media.all|from_course_type:type|from_periods:periods %} + {% for media in course.media.all|from_course_type:type|from_period:period %} {% if media.is_published or user.is_staff %} {% if media.type == 'webm' %} diff --git a/teleforma/templates/telemeta/base.html b/teleforma/templates/telemeta/base.html index eb907b00..7dd8c6a6 100644 --- a/teleforma/templates/telemeta/base.html +++ b/teleforma/templates/telemeta/base.html @@ -86,8 +86,19 @@ alt="logo" />