]> git.parisson.com Git - teleforma.git/commitdiff
Merge branch 'dev' into tc202
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 19 Jul 2017 09:54:41 +0000 (11:54 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 19 Jul 2017 09:54:41 +0000 (11:54 +0200)
14 files changed:
1  2 
example/settings.py
teleforma/admin.py
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/management/commands/teleforma-export-stream-m-slugs.py
teleforma/management/commands/teleforma-import-conferences.py
teleforma/models/core.py
teleforma/pages/fr/help.rst
teleforma/templates/teleforma/course_conference_record.html
teleforma/templates/teleforma/course_detail.html
teleforma/templates/teleforma/course_document.html
teleforma/templates/teleforma/course_media.html
teleforma/templates/telemeta/base.html
teleforma/templatetags/teleforma_tags.py
teleforma/views/core.py

Simple merge
Simple merge
index faf314c8ccff47982e063e1d2323c42f48feb7bd,8bfda9561a0ed30e5a0de3f346009bc913df5e6a..4a65d62b8ead01a2e6eb253ec19391e3d70f8eaf
@@@ -1192,20 -2007,56 +2007,58 @@@ msgstr "
  msgid "A new live conference has started : "
  msgstr "Une nouvelle conférence en direct a commencé : "
  
+ #: views/crfpa.py:406
+ msgid "You have successfully register your account."
+ msgstr ""
+ #, fuzzy
+ #~| msgid "Grouped message"
+ #~ msgid "Group messages"
+ #~ msgstr "Message groupé"
+ #~ msgid "Testimonials"
+ #~ msgstr "Attestations"
 +#~ msgid "Training"
 +#~ msgstr "Formation"
  
- #~ msgid "CRFPA student"
- #~ msgstr "Etudiant CRFPA"
+ #, fuzzy
+ #~ msgid "No testimonial"
+ #~ msgstr "attestation"
+ #, fuzzy
+ #~ msgid "General"
+ #~ msgstr "Tweeter général"
+ #~ msgid "Save and download the registration form"
+ #~ msgstr "Enregistrer et télécharger le formulaire"
+ #~ msgid "CRFPA Profile"
+ #~ msgstr "Profil CRFPA"
+ #~ msgid "Validate"
+ #~ msgstr "Validée"
  
- #~ msgid "amount"
- #~ msgstr "montant"
+ #~ msgid "Correctors"
+ #~ msgstr "Correcteurs"
  
- #~ msgid "payment"
- #~ msgstr "paiement"
+ #~ msgid "Treated"
+ #~ msgstr "Traitées"
  
- #~ msgid "Reject"
- #~ msgstr "Rejeter"
+ #, fuzzy
+ #~ msgid "Score : "
+ #~ msgstr "Note"
+ #~ msgid " marked"
+ #~ msgstr " corrigée"
+ #~ msgid " pending"
+ #~ msgstr " en attente"
+ #~ msgid "AE students"
+ #~ msgstr "Etudiants AE"
+ #~ msgid "CRFPA student"
+ #~ msgstr "Etudiant CRFPA"
  
  #~ msgid "is live"
  #~ msgstr "en direct"
Simple merge
index 8e41517ca2e3070da3e5d3ac6e128994ebd1a6b4,277ccd91f28700611e30f0e15ad6a09282157067..82be42c6797cb447cdff930e6f983ca5a2eb8bee
@@@ -31,6 -69,7 +69,6 @@@ Vous pouvez à tout moment réinitialis
  Support
  ========
  
- Pour les questions relatives à votre formation CRFPA, veuillez `contacter un administrateur depuis la messagerie <http://e-learning.ae.pre-barreau.com/messages/write/Admin-AE>`_ ou bien par mail à l'adresse suivante : `avocat.etranger@pre-barreau.com <mailto:avocat.etranger@pre-barreau.com>`_
+ Pour les questions relatives à votre formation, vos supports de cours, vos agendas, veuillez `contacter un administrateur depuis la messagerie <http://e-learning.crfpa.pre-barreau.com/messages/write/admin-CRFPA>`_ ou bien par mail à l'adresse suivante : `admin-crfpa@pre-bareau.com <mailto:admin-crfpa@pre-bareau.com>`_
  
- Pour obtenir une aide technique, veuillez `contacter un technicien depuis la messagerie <http://e-learning.ae.pre-barreau.com/messages/write/admin-tech>`_.
+ Pour obtenir une aide technique concernant **uniquement** les problèmes informatiques d'accès aux ressources, veuillez `contacter un technicien depuis la messagerie <http://e-learning.crfpa.pre-barreau.com/messages/write/admin-tech>`_. Les questions concernant votre formation ne sont pas prises en compte.
 -
index 16c896927418a869dfed25ba6a4405a9829c2c60,fe86cb0cb0e7a382a94f12efc050df1a282e5f89..14011027c23bb6a63584e624fb9de1a5c5f05f55
@@@ -23,9 -23,10 +23,10 @@@ $(document).ready(function()
       {% with c.course as course %}
        {% for type in c.types %}
        <div class="course">
 -        <div class="course_title">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}
 +        <div class="course_title">{{ course.title }}{% if type.name != "None" %} - {{ type }}{% endif %}{% if course.description %} - {{ course.description }}{% endif %}
          </div>
  
+         {% if not user.correctors.all or user.is_staff %}
          {% block conference %}
           {% include "teleforma/inc/conference_list.html" %}
          {% endblock %}
index 9bbfd641d74bf7197847f4a4ad6343735625de2d,ab55ef9e714342c1393bbb7073f5133281d8b069..2e08c68890400d035b5e9e14c30752f0b5ab2813
@@@ -193,7 -197,49 +197,48 @@@ def get_video_id(media)
      return
  
  @register.filter
 -def get_host(url, host):
 +def set_host(url, host):
      u = urlparse(url)
-     return u.scheme + '://' + host + ':' + str(u.port) + u.path
-     
+     if host == '127.0.0.1' or host == 'localhost':
+         nu = u.scheme + '://' + host + ':' + str(u.port) + u.path
+         return nu
+     else:
+         return url
+ @register.filter
+ def published(doc):
+     if doc:
+         return doc.filter(is_published=True)
+ @register.simple_tag
+ def untreated_scripts_count(user, period):
+     Q1 = Q(status=3, author=user, period=period)
+     Q2 = Q(status=3, corrector=user, period=period)
+     scripts = Script.objects.filter(Q1 | Q2)
+     if scripts:
+         return ' (' + str(len(scripts)) + ')'
+     else:
+         return ''
+ @register.simple_tag
+ def treated_scripts_count(user, period):
+     Q1 = Q(status=4, author=user, period=period)
+     Q2 = Q(status=4, corrector=user, period=period)
+     scripts = Script.objects.filter(Q1 | Q2)
+     if scripts:
+         return ' (' + str(len(scripts)) + ')'
+     else:
+         return ''
+ @register.simple_tag
+ def get_training_profile(user):
+     text = ''
+     if user:
+         student = user.student.all()
+         if student:
+             student = student[0]
+             if student.platform_only:
+                 text += 'Internaute - '
+             for training in student.trainings.all():
+                 text += unicode(training) + ' '
+     return text
 -
index 0817a0e6d14c68d9d34b0cdf0a9495fdd3105676,123c109a5c8dacb72d2c3bb45bd83f159a485950..28e5004920943b2fbd106cb84f2d90a897bef32b
@@@ -241,23 -309,21 +305,23 @@@ class CourseListView(CourseAccessMixin
          department = Department.objects.get(organization=organization, name=department_name)
          return [course.to_dict() for course in Course.objects.filter(department=department)]
  
 -    def pull(request, organization_name, department_name):
 +    def pull(request, organization_name):
 +        from teleforma.models import Organization, Department
          organization = Organization.objects.get(name=organization_name)
 -        department = Department.objects.get(name=department_name, organization=organization)
 -        url = 'http://' + department.domain + '/json/'
 -        s = ServiceProxy(url)
 -
 -        remote_list = s.teleforma.get_course_list(organization_name, department.name)
 -        for course_dict in remote_list['result']:
 -            course = Course.objects.filter(code=course_dict['code'])
 -            if not course:
 -                course = Course()
 -            else:
 -                course = course[0]
 -            course.from_dict(course_dict)
 +        departments = Department.objects.filter(organization=organization)
 +        for department in departments:
 +            url = 'http://' + department.domain + '/json/'
 +            s = ServiceProxy(url)
 +            remote_list = s.teleforma.get_course_list(organization_name, department.name)
 +            if remote_list['result']:
 +                for course_dict in remote_list['result']:
 +                    course = Course.objects.filter(code=course_dict['code'], department=department)
 +                    if not course:
 +                        course = Course()
 +                    else:
 +                        course = course[0]
 +                    course.from_dict(course_dict)
-                 
      @jsonrpc_method('teleforma.get_dep_courses')
      def get_dep_courses(request, id):
          department = Department.objects.get(id=id)
@@@ -659,37 -747,48 +746,56 @@@ class ProfessorListView(View)
          return [p.to_json_dict() for p in professors]
  
      def pull(request, host=None):
 -        if host:
 -            url = 'http://' + host + '/json/'
 -        else:
 -            url = 'http://' + settings.TELECASTER_MASTER_SERVER + '/json/'
 -        s = ServiceProxy(url)
 -
 -        remote_list = s.teleforma.get_professor_list()
 -        for professor_dict in remote_list['result']:
 -            user, c = User.objects.get_or_create(username=professor_dict['username'])
 -            user.first_name = professor_dict['first_name']
 -            user.last_name = professor_dict['last_name']
 -            user.email = professor_dict['email']
 -            user.save()
 +        from teleforma.models import Organization, Department
 +        departments = Department.objects.all()
 +        professors_old = Professor.objects.all()
 +        professors_new = []
  
 -            professor, c = Professor.objects.get_or_create(user=user)
 -            for course_code in professor_dict['courses']:
 -                course = Course.objects.filter(code=course_code)
 -                if course:
 -                    if not course[0] in professor.courses.all():
 -                        professor.courses.add(course[0])
 -            professor.save()
 +        for department in departments:
 +            url = 'http://' + department.domain + '/json/'
 +            s = ServiceProxy(url)
 +            remote_list = s.teleforma.get_professor_list()
 +            for professor_dict in remote_list['result']:
 +                user, c = User.objects.get_or_create(username=professor_dict['username'])
 +                user.first_name = professor_dict['first_name']
 +                user.last_name = professor_dict['last_name']
 +                user.email = professor_dict['email']
 +                user.save()
 +
 +                professor, c = Professor.objects.get_or_create(user=user)
 +                for course_code in professor_dict['courses']:
 +                    course = Course.objects.filter(code=course_code)
 +                    if course:
 +                        if not course[0] in professor.courses.all():
 +                            professor.courses.add(course[0])
 +                professor.save()
 +                professors_new.append(professor)
 +                #print professor
 +
 +        for professor in professors_old:
 +            if not professor in professors_new:
 +                professor.delete()
  
  
+ class WebClassGroupView(View):
+     @jsonrpc_method('teleforma.get_web_class_group_list')
+     def get_web_class_group_list(request):
+         web_class_groups = WebClassGroup.objects.all()
+         return [w.to_json_dict() for w in web_class_groups]
+     def pull(request, host=None):
+         if host:
+             url = 'http://' + host + '/json/'
+         else:
+             url = 'http://' + settings.TELECASTER_MASTER_SERVER + '/json/'
+         s = ServiceProxy(url)
+         remote_list = s.teleforma.get_web_class_group_list()
+         for web_class_group_dict in remote_list['result']:
+             web_class_group, c = WebClassGroup.objects.get_or_create(name=web_class_group_dict['name'])
  class HelpView(TemplateView):
  
      template_name='teleforma/help.html'
          return super(HelpView, self).dispatch(*args, **kwargs)
  
  
 +class SourcesStatusView(ListView):
 +
 +    model = Source
 +    template_name='teleforma/source_monitors.html'
 +
 +    @jsonrpc_method('telecaster.get_source_status')
 +    def get_source_status(request, public_id):
 +        source = Source.objects.get(public_id=public_id)
 +        url = 'http://' + source.ip + '/json/'
 +        service = ServiceProxy(url)
 +        status = s.teleforma.get_server_status()
 +        return status
 +
 +    @jsonrpc_method('telecaster.get_source_station_status')
 +    def get_source_station_status(request, public_id):
 +        source = Source.objects.get(public_id=public_id)
 +        url = 'http://' + source.ip + '/json/'
 +        service = ServiceProxy(url)
 +        station = s.teleforma.get_station_status()
 +        return station
 +
 +    @jsonrpc_method('telecaster.source_station_start')
 +    def start(request, station_dict):
 +        pass
 +
 +    @jsonrpc_method('telecaster.source_station_stop')
 +    def stop(request):
 +        pass
 +
++
+ class PDFTemplateResponseMixin(TemplateResponseMixin):
+     """
+     Mixin for Django class based views.
+     Switch normal and pdf template based on request.
+     The switch is made when the request has a particular querydict, e.g.::
+         http://www.example.com?format=pdf
+     The key and value of the querydict can be overridable using *as_view()*.
+     That pdf url will be present in the context as *pdf_url*.
+     For example it is possible to define a view like this::
+         from django.views.generic import View
+         class MyView(PDFTemplateResponseMixin, View):
+             template_name = 'myapp/myview.html'
+             pdf_filename = 'report.pdf'
+     The pdf generation is automatically done by *xhtml2pdf* using
+     the *myapp/myview_pdf.html* template.
+     Note that the pdf template takes the same context as the normal template.
+     """
+     pdf_template_name = None
+     pdf_template_name_suffix = '_pdf'
+     pdf_querydict_key = 'format'
+     pdf_querydict_value = 'pdf'
+     pdf_encoding = 'utf-8'
+     pdf_filename = None
+     pdf_url_varname = 'pdf_url'
+     pdf_kwargs = {}
+     def is_pdf(self):
+         value = self.request.REQUEST.get(self.pdf_querydict_key, '')
+         return value.lower() == self.pdf_querydict_value.lower()
+     def _get_pdf_template_name(self, name):
+         base, ext = os.path.splitext(name)
+         return '%s%s%s' % (base, self.pdf_template_name_suffix, ext)
+     def get_pdf_template_names(self):
+         """
+         If the template name is not given using the class attribute
+         *pdf_template_name*, then it is obtained using normal template
+         names, appending *pdf_template_name_suffix*, e.g.::
+             path/to/detail.html -> path/to/detail_pdf.html
+         """
+         if self.pdf_template_name is None:
+             names = super(PDFTemplateResponseMixin, self).get_template_names()
+             return map(self._get_pdf_template_name, names)
+         return [self.pdf_template_name]
+     def get_pdf_filename(self):
+         """
+         Return the pdf attachment filename.
+         If the filename is None, the pdf will not be an attachment.
+         """
+         return self.pdf_filename
+     def get_pdf_url(self):
+         """
+         This method is used to put the pdf url in the context.
+         """
+         querydict = self.request.GET.copy()
+         querydict[self.pdf_querydict_key] = self.pdf_querydict_value
+         return '%s?%s' % (self.request.path, querydict.urlencode())
+     def get_pdf_response(self, context, **response_kwargs):
+         return render_to_pdf(
+             request=self.request,
+             template=self.get_pdf_template_names(),
+             context=context,
+             encoding=self.pdf_encoding,
+             filename=self.get_pdf_filename(),
+             **self.pdf_kwargs
+         )
+     def render_to_response(self, context, **response_kwargs):
+         if self.is_pdf():
+             from django.conf import settings
+             context['STATIC_ROOT'] = settings.STATIC_ROOT
+             return self.get_pdf_response(context, **response_kwargs)
+         context[self.pdf_url_varname] = self.get_pdf_url()
+         return super(PDFTemplateResponseMixin, self).render_to_response(
+             context, **response_kwargs)