]> git.parisson.com Git - teleforma.git/commitdiff
update desk to always handle periods
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 4 Jul 2013 20:58:17 +0000 (22:58 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 4 Jul 2013 20:58:17 +0000 (22:58 +0200)
12 files changed:
teleforma/templates/teleforma/annals.html
teleforma/templates/teleforma/conferences.html [deleted file]
teleforma/templates/teleforma/course_conference.html
teleforma/templates/teleforma/course_conference_audio.html
teleforma/templates/teleforma/course_detail.html
teleforma/templates/teleforma/course_media.html
teleforma/templates/teleforma/courses.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/templates/telemeta/base.html
teleforma/templates/telemeta/profile_detail.html
teleforma/urls.py
teleforma/views/core.py

index 23308c4f48bf823c3f9a5652302f7d34bb367231..2e0c8f5b55c8817392087b4007fce8a70dffc2b2 100644 (file)
@@ -12,7 +12,7 @@
 <div id="module-set-left" style="width: 20%">
 
 <div class="module">
-<h3><a href="{% url teleforma-desk %}"><img src="{{ STATIC_URL }}telemeta/images/module_playlist.png" alt="playlists" style="vertical-align:middle" />{% trans "My courses" %}</a></h3>
+<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;">
 <ul>
 {% block courses %}
diff --git a/teleforma/templates/teleforma/conferences.html b/teleforma/templates/teleforma/conferences.html
deleted file mode 100644 (file)
index 94e8472..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-{% extends "telemeta/base.html" %}
-{% load teleforma_tags %}
-{% load telemeta_utils %}
-{% load i18n %}
-
-
-{% block extra_javascript %}
-{% endblock extra_javascript %}
-
-
-{% block content %}
-
-<div id="module-set-left" style="width: 18%">
-
-{% block modules %}
-<div class="module">
-
-<h3><a href="{% url teleforma-desk %}"><img src="{{ STATIC_URL }}telemeta/images/module_playlist.png" alt="playlists" style="vertical-align:middle" />{% trans "My courses" %}</a></h3>
-<div style="background: white;">
-<ul>
-{% block courses %}
-{% for c in all_courses %}
-  {% with c.course as course %}
-   <li><a href="{% url teleforma-course-detail course.id %}">{{ course.title }}</a></li>
-  {% endwith %}
- {% endfor %}
-{% endblock courses %}
-</ul>
-</div>
-</div>
-
-{% block module-action %}
-{% get_telecaster as telecaster %}
-{%  if telecaster %}
-<div class="module_action">
-<a href="{% url teleforma-conference-record %}" class="component_icon button" id="action_red">{% trans "New conference" %}</a>
-</div>
-{% endif %}
-{% endblock module-action %}
-
-{% block notes %}
-<!--<div class="module">
-<h3><img src="{{ STATIC_URL }}telemeta/images/view-pim-notes.png" alt="playlists" style="vertical-align:middle" />{% trans "My notes" %}</h3>
-<div style="background: white;">
-<ul>
-{% for note in notes %}
-<li>{{ note.content }}</li>
-{% endfor %}
-</ul>
-</div>
-</div>
-<div class="module_action">
-<a href="#" class="component_icon button" id="action_violet">{% trans "New note" %}</a>
-</div>-->
-{% endblock notes %}
-
-</div>
-{% endblock modules %}
-
-
-{% block course %}
-<div class="desk_center">
-    {% for c in object_list %}
-     {% with c.course as course %}
-      {% for type in c.types %}
-      <div class="course">
-        <div class="course_title">
-         <a href="{% url teleforma-course-detail course.id %}">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}</a>
-        </div>
-
-        {% block conference %}
-         {% include "teleforma/inc/conference_list.html" %}
-        {% endblock %}
-
-        {% block media %}
-         {% include "teleforma/inc/media_list.html" %}
-        {% endblock %}
-
-        {% block document %}
-         {% with forloop.counter as type_counter %}
-          {% include "teleforma/inc/document_list.html" %}
-         {% endwith %}
-        {% endblock %}
-
-      </div>
-     {% endfor %}
-    {% endwith %}
-   {% endfor %}
-</div>
-{% endblock course %}
-
-
-<div id="module-set" style="width: 22%">
-
-{% block status %}
-{% get_telecaster as telecaster %}
-{%  if telecaster %}
-<div class="module">
- <h3><img src="{{STATIC_URL}}teleforma/images/status.png" alt="status" style="vertical-align:middle" /> {% trans "Status" %}</h3>
- <div id="server_status_table_wrapper" class="status"></div>
-</div>
-
-<script type="text/javascript">
-server_status_callback();
-</script>
-{% endif %}
-{% endblock status %}
-
-{% block chat %}
-{% if room %}
-{% with "General tweeter" as title %}
-{% include "teleforma/inc/chat_room.html" %}
-{% endwith %}
-{% endif %}
-{% endblock chat %}
-
-</div>
-
-{% endblock content %}
index 0cfc6b37325d740834546a84ba1f45f349e50737..a5120265f07bb21bdc68d881473d13a0591f3dc6 100644 (file)
@@ -37,7 +37,7 @@
         <a href="{% url teleforma-conference-audio conference.id %}" class="component_icon button icon_speaker">&nbsp;{% trans "Audio" %}</a>
     </div>
 
-<a href="{% url teleforma-course-detail course.id %}" style="color: #000;">{{ course.title }}</a> - {{ type }} - {% trans "Session" %} {{ conference.session }}
+<a href="{% url teleforma-desk-period-course period.id course.id %}" style="color: #000;">{{ course.title }}</a> - {{ type }} - {% trans "Session" %} {{ conference.session }}
 
 </div>
 
@@ -67,7 +67,7 @@
 <dl class="listing">
 
 {% if conference.professor %}
-<dt>{% trans "Course" %}</dt><dd><a href="{% url teleforma-course-detail course.id %}">{{ conference.course.title }} - {{ conference.course_type }}</a></dd>
+<dt>{% trans "Course" %}</dt><dd><a href="{% url teleforma-desk-period-course period.id course.id %}">{{ conference.course.title }} - {{ conference.course_type }}</a></dd>
 <dt>{% trans "Session" %}</dt><dd>{{ conference.session }}</dd>
 <dt>{% trans "Professor" %}</dt>
     <dd><a href="{% url telemeta-profile-detail conference.professor.user.username %}" target="_blank">{{ conference.professor }}</a></dd>
index a2995f3002bdaee81740c15c853aed69ffedacbe..bc9692a40b50414ae3732a20756e8f2e84166734 100644 (file)
@@ -8,7 +8,7 @@
     var conferenceUtils = {
         stop : function(id){
             json([id],'teleforma.conference_stop',function(){
-                location.href = '{% url teleforma-desk %}';});
+                location.href = '{% url teleforma-home %}';});
         }}
 
     jQuery(window).ready(function(){
index 60d58f6f55359fd17827e64e93f9185ba9c6dffe..d6c9440980a04396fea2188bb13dedae0927eb65 100644 (file)
@@ -12,7 +12,7 @@ $(document).ready(function(){
 {% block courses %}
 {% for c in all_courses %}
   {% with c.course as course %}
-   <li><a href="{% url teleforma-course-detail course.id %}">{{ course.title }}</a></li>
+   <li><a href="{% url teleforma-desk-period-course period.id course.id %}">{{ course.title }}</a></li>
   {% endwith %}
  {% endfor %}
 {% endblock courses %}
index c57eb0bc9a3b38977bcff597428d0a50008f21de..92632182d0fd7431d9be2a7605b83d7de62c2ad5 100644 (file)
@@ -83,7 +83,7 @@ $(document).ready(function(){
         {% endif %}
     </div>
 
-    <a href="{% url teleforma-course-detail course.id %}">{{ course.title }} - {{ type }}{% if media.conference.session %} - {% trans "Session" %} {{ media.conference.session }}{% endif %}</a>
+    <a href="{% url teleforma-desk-period-course period.id course.id %}">{{ course.title }} - {{ type }}{% if media.conference.session %} - {% trans "Session" %} {{ media.conference.session }}{% endif %}</a>
 
 </div>
 
@@ -130,7 +130,7 @@ $(document).ready(function(){
 <dl class="listing">
 
 {% if media.conference %}
-<dt>{% trans "Course" %}</dt><dd><a href="{% url teleforma-course-detail course.id %}">{{ media.course.title }} - {{ media.course_type }}</a></dd>
+<dt>{% trans "Course" %}</dt><dd><a href="{% url teleforma-desk-period-course period.id course.id %}">{{ media.course.title }} - {{ media.course_type }}</a></dd>
 <dt>{% trans "Session" %}</dt><dd>{{ media.conference.session }}</dd>
 {% if media.conference.professor %}
 <dt>{% trans "Professor" %}</dt>
index b28c41f7afa23094dbfda9b3a64f5b9a082c7187..dec2defbae798c49ad3fc9bbd3c6a06a530ed79a 100644 (file)
@@ -20,13 +20,13 @@ $(document).ready(function(){
 {% block modules %}
 <div class="module">
 
-<h3><a href="{% url teleforma-desk %}"><img src="{{ STATIC_URL }}telemeta/images/module_playlist.png" alt="playlists" style="vertical-align:middle" />{% trans "My courses" %}</a></h3>
+<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;">
 <ul>
 {% block courses %}
 {% for c in all_courses %}
   {% with c.course as course %}
-   <li><a href="{% url teleforma-course-detail course.id %}">{{ course.title }}</a></li>
+   <li><a href="{% url teleforma-desk-period-course period.id course.id %}">{{ course.title }}</a></li>
   {% endwith %}
  {% endfor %}
 {% endblock courses %}
@@ -71,7 +71,7 @@ $(document).ready(function(){
       {% for type in c.types %}
       <div class="course">
         <div class="course_title">
-         <a href="{% url teleforma-course-detail course.id %}">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}</a>
+         <a href="{% url teleforma-desk-period-course period.id course.id %}">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}</a>
         </div>
 
         {% block conference %}
index bc1eb967da2c91a5c673f01c3a27238fe0e13f19..d5a2bbe64f0159f7aceb0e2ee4591a0b422eee31 100644 (file)
@@ -10,7 +10,7 @@
     <table class="listing" width="100%">
     <tbody>
         {% for media in course.media.all|from_course_type:type|from_period:period %}
-         {% if media.is_published or user.is_staff %}
+         {% if media.is_published or user.is_staff and course_view %}
           {% if media.type == 'webm' %}
             <tr>
             <td {% if forloop.first %}class="border-top"{% endif %} width="230px" style="vertical-align:middle">
index 7dd8c6a60eda472c24304315d2a83e5e38aab91b..40585fcc44af76e204aff5f925a9f67dc1efc533 100644 (file)
@@ -91,12 +91,12 @@ alt="logo" />
     <li><a href="#desk#" class="red">&nbsp;{% trans "Desk" %}&nbsp;</a>
       <ul>
        {% for period in periods %}
-        <li><a href="{% url teleforma-desk-period period.id %}" class="red">{{ period.name }}</a></li>
+        <li><a href="{% url teleforma-desk-period-list period.id %}" class="red">{{ period.name }}</a></li>
        {% endfor %}
       </ul>
     </li>
   {% else %}
-   <li><a href="{% url teleforma-desk %}" class="red">{% trans "Desk" %}</a></li>
+   <li><a href="{% url teleforma-desk-period-list period.id %}" class="red">{% trans "Desk" %}</a></li>
   {% endif %}
 
  {% else %}
index 53bd0212303d6c2b27c1643490c1f76c9f898d7d..efb267a2426095fb90155b636bcf48116189975e 100644 (file)
   {% block modules %}
 
     <div class="module">
-    <h3><a href="{% url teleforma-desk %}"><img src="{{ STATIC_URL }}telemeta/images/module_playlist.png" alt="playlists" style="vertical-align:middle" />{% if user.username != usr.username%}{% trans "His courses" %}{% else %}{% trans "My courses" %}{% endif %}</a></h3>
+    <h3><a href="{% url teleforma-home %}"><img src="{{ STATIC_URL }}telemeta/images/module_playlist.png" alt="playlists" style="vertical-align:middle" />{% if user.username != usr.username%}{% trans "His courses" %}{% else %}{% trans "My courses" %}{% endif %}</a></h3>
     <div style="background: white;">
     <ul>
     {% block courses %}
     {% with usr|user_courses as courses %}
      {% for c in courses %}
        {% with c.course as course %}
-       <li><a href="{% url teleforma-course-detail course.id %}">{{ course.title}} {{ course.type }}</a></li>
+       <li>{{ course.title}} {{ course.type }}</li>
        {% endwith %}
      {% endfor %}
     {% endwith %}
@@ -60,7 +60,7 @@
       <dt>{% trans "Last Name" %}</dt><dd>{{ usr.last_name }}</dd>
       <dt>{% trans "Username" %}</dt><dd>{{ usr.username }}</dd>
 
-      {% if usr.student.get %}
+      {% if usr.crfpa_student.get %}
         {% if user.is_staff %}
         <dt>{% trans "IEJ" %}</dt><dd><a href="{% url teleforma-iej-users usr.student.get.iej.id %}">{{ usr.student.get.iej }}</a></dd>
         <dt>{% trans "Training" %}</dt><dd><a href="{% url teleforma-training-users usr.student.get.training.id %}">{{ usr.student.get.training }}</a></dd>
index 6f2d7acef2d2414e6a8658036adbed7d29ca685e..d90f95e253ee96b64540c1222f2a9d6d85ee0f46 100644 (file)
@@ -63,41 +63,44 @@ urlpatterns = patterns('',
     # Telemeta
     url(r'^', include('telemeta.urls')),
 
-    # Desk
+    # Desk (no periods)
     url(r'^desk/$', CoursesView.as_view(), name="teleforma-desk"),
-    url(r'^desk/periods/(?P<period_id>.*)/$', PeriodView.as_view(), name="teleforma-desk-period"),
-    url(r'^desk/courses/(?P<pk>.*)/$', CourseView.as_view(), name="teleforma-course-detail"),
+    url(r'^desk/course/(?P<pk>.*)/list/$', CourseView.as_view(), name="teleforma-course-detail"),
 
-    url(r'^desk/medias/(?P<pk>.*)/detail/$', MediaView.as_view(), name="teleforma-media-detail"),
-    url(r'^desk/medias/(?P<pk>.*)/download/$', media.download, name="teleforma-media-download"),
+    # Desk (with periods)
+    url(r'^desk/period/(?P<period_id>.*)/list/$', PeriodListView.as_view(), name="teleforma-desk-period-list"),
+    url(r'^desk/period/(?P<period_id>.*)/course/(?P<pk>.*)/$', PeriodCourseView.as_view(),
+        name="teleforma-desk-period-course"),
 
-    url(r'^desk/documents/(?P<pk>.*)/detail/$', DocumentView.as_view(),
+    url(r'^desk/media/(?P<pk>.*)/detail/$', MediaView.as_view(), name="teleforma-media-detail"),
+    url(r'^desk/media/(?P<pk>.*)/download/$', media.download, name="teleforma-media-download"),
+
+    url(r'^desk/document/(?P<pk>.*)/detail/$', DocumentView.as_view(),
         name="teleforma-document-detail"),
-    url(r'^desk/documents/(?P<pk>.*)/download/$', document.download,
+    url(r'^desk/document/(?P<pk>.*)/download/$', document.download,
         name="teleforma-document-download"),
-    url(r'^desk/documents/(?P<pk>.*)/view/$', document.view,
+    url(r'^desk/document/(?P<pk>.*)/view/$', document.view,
         name="teleforma-document-view"),
 
     url(r'^archives/annals/$', AnnalsView.as_view(), name="teleforma-annals"),
     url(r'^archives/annals/by-iej/(\w+)/$', AnnalsIEJView.as_view(), name="teleforma-annals-iej"),
     url(r'^archives/annals/by-course/(\w+)/$', AnnalsCourseView.as_view(), name="teleforma-annals-course"),
 
-    url(r'^desk/conferences/(?P<pk>.*)/video/$',
-        ConferenceView.as_view(),
-        name="teleforma-conference-detail"),
-    url(r'^desk/conferences/(?P<pk>.*)/audio/$',
+    url(r'^desk/conference/(?P<pk>.*)/video/$',
+        ConferenceView.as_view(), name="teleforma-conference-detail"),
+    url(r'^desk/conference/(?P<pk>.*)/audio/$',
         ConferenceView.as_view(template_name="teleforma/course_conference_audio.html"),
         name="teleforma-conference-audio"),
     url(r'^desk/conference_record/$', ConferenceRecordView.as_view(),
         name="teleforma-conference-record"),
-    url(r'^desk/conferences/$', ConferenceListView.as_view(),
+    url(r'^desk/conference/list/$', ConferenceListView.as_view(),
         name="teleforma-conferences"),
 
     # Postman
     url(r'^messages/', include('postman.urls')),
 
     # Users
-    url(r'^users/$', UsersView.as_view(), name="teleforma-users"),
+    url(r'^users/all/$', UsersView.as_view(), name="teleforma-users"),
     url(r'^users/(?P<username>[A-Za-z0-9._-]+)/profile/$', profile_view.profile_detail,
                                name="teleforma-profile-detail"),
     url(r'^users/(?P<id>.*)/login/$', UserLoginView.as_view(), name="teleforma-user-login"),
index d45082268218c8d3f4858acc1fd61e7439a6c977..83c3cd784db274a08af705ee5ac88b7b26851f72 100644 (file)
@@ -180,10 +180,7 @@ class HomeRedirectView(View):
     def get(self, request):
         if request.user.is_authenticated():
             periods = get_periods(request.user)
-            if len(periods) > 1:
-                return HttpResponseRedirect(reverse('teleforma-desk-period', kwargs={'period_id': periods[0].id}))
-            else:
-                return HttpResponseRedirect(reverse('teleforma-desk'))
+            return HttpResponseRedirect(reverse('teleforma-desk-period-list', kwargs={'period_id': periods[0].id}))
         else:
             return HttpResponseRedirect(reverse('teleforma-login'))
 
@@ -207,6 +204,7 @@ class CourseView(DetailView):
         context['room'] = get_room(name=course.title, content_type=content_type,
                                    id=course.id)
         context['doc_types'] = DocumentType.objects.all()
+        context['course_view'] = True
         return context
 
     @method_decorator(login_required)
@@ -214,6 +212,14 @@ class CourseView(DetailView):
         return super(CourseView, self).dispatch(*args, **kwargs)
 
 
+class PeriodCourseView(CourseView):
+
+    def get_context_data(self, **kwargs):
+        context = super(PeriodCourseView, self).get_context_data(**kwargs)
+        context['period'] = Period.objects.get(id=int(self.kwargs['period_id']))
+        return context
+
+
 class CoursesView(ListView):
 
     model = Course
@@ -237,7 +243,7 @@ class CoursesView(ListView):
         return super(CoursesView, self).dispatch(*args, **kwargs)
 
 
-class PeriodView(CoursesView):
+class PeriodListView(CoursesView):
 
     def get_queryset(self):
         self.period = Period.objects.get(id=int(self.kwargs['period_id']))
@@ -245,7 +251,7 @@ class PeriodView(CoursesView):
         return self.all_courses[:5]
 
     def get_context_data(self, **kwargs):
-        context = super(PeriodView, self).get_context_data(**kwargs)
+        context = super(PeriodListView, self).get_context_data(**kwargs)
         context['period'] = self.period
         return context