]> git.parisson.com Git - teleforma.git/commitdiff
Merge branch 'dev' into no-telemeta
authorYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 4 May 2021 15:11:03 +0000 (17:11 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 4 May 2021 15:11:03 +0000 (17:11 +0200)
29 files changed:
1  2 
teleforma/admin.py
teleforma/exam/templates/exam/scripts.html
teleforma/exam/views.py
teleforma/forms.py
teleforma/management/commands/teleforma-copy-conferences.py
teleforma/management/commands/teleforma-send-payment-emails.py
teleforma/models/core.py
teleforma/models/crfpa.py
teleforma/static/teleforma/css/teleforma.css
teleforma/static/teleforma/js/application.js
teleforma/templates/registration/registration_complete.html
teleforma/templates/registration/registration_corrector_complete.html
teleforma/templates/registration/registration_form.html
teleforma/templates/registration/registration_pdf.html
teleforma/templates/teleforma/appointments.html
teleforma/templates/teleforma/course_conference.html
teleforma/templates/teleforma/course_conference_audio.html
teleforma/templates/teleforma/course_media.html
teleforma/templates/teleforma/course_media_video_embed.html
teleforma/templates/teleforma/courses.html
teleforma/templates/teleforma/inc/conference_list.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/templates/teleforma/inc/media_list_pending.html
teleforma/urls.py
teleforma/views/core.py
teleforma/views/crfpa.py
teleforma/webclass/models.py
teleforma/webclass/templates/webclass/appointments.html
teleforma/webclass/templates/webclass/inc/webclass_list.html

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 761a3790f0ffa1fd9ad03a6d919758dc8058477b,5b7aac20a2615e2f58164b8f7383f467a8b3b4ed..4ff122fcd35371c48fde2265ea5dd68a808474b9
@@@ -40,253 -40,27 +40,276 @@@ $(document).ready(function()
           })
       }
       $('.tabs').tabs();
 +});
 +
 +
 +
 +/*
 + * Copyright (C) 2007-2012 Guillaume Pellerin, Parisson
 + * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
 + * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
 + *
 + * This file is part of TimeSide.
 + *
 + * TimeSide is free software: you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation, either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * TimeSide is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with TimeSide.  If not, see <http://www.gnu.org/licenses/>.
 + *
 + * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
 + *          Olivier Guilyardi <olivier@samalyse.com>
 + */
 +
 +/**
 + * Class for teleforma global functions.
 + * Note that the dollar sign is a reserved keyword in some browsers
 + * (see http://davidwalsh.name/dollar-functions)
 + * which might be in conflict with jQuery dollar sign.
 + */
 +
 +//returns the full path of the current url location removing the last slash '/' followed by one or more '#', if any
 +function urlNormalized(){
 +    var sPath = window.location.href;
 +    sPath = sPath.replace(/\/#*$/,"");
 +    return sPath;
 +}
 +/**
 + *sets up few stuff when the page is ready (see functions below it)
 + */
 +jQuery(document).ready(function() {
 +    foldInfoBlocks();
 +    setSelectedMenu();
 +});
 +
 +/**
 + *function inherited from old code, never touched. Guess fixes the click on the left data table, if any
 + */
 +function foldInfoBlocks() {
 +    var $J = jQuery;
 +    var extra = $J('.extraInfos');
 +    extra.find('.folded dl, .folded table').css('display', 'none');
 +    extra.find('h4').click(function() {
 +        $J(this).parents('.extraInfos').children().toggleClass('folded').find('dl, table').toggle(100);
 +        //toggle toggles the visibility of elements
 +        return false;
 +    });
 +}
 +
 +/**
 + * Global teleforma function which sets the current selected menu according to the current url
 + */
 +function setSelectedMenu(){
 +    var $J = jQuery;
 +    var menus = $J('#menu a');
 +    //build collections/items from http:/site/collections/items,
 +    //being http:/site/ = window.location.origin
 +    
 +    //function for normalizing paths (removes last n occurrences of the slash)
 +    var normalize = function(str){
 +        return str.replace(/\/+#*$/,"");
 +    }
 +    
 +    var host = window.location.host;
 +    var protocol = window.location.protocol
 +    var href = normalize(window.location.href);
 +     
 +    if(!(host) || !(protocol) || !(href)){
 +        return;
 +    }
 +
 +    //var pageOrigin = normalize(window.location.origin); //does not exist in FF, so:
 +    var pageOrigin = normalize(protocol+"//"+host);
 +    var pageHref = normalize(href);
 +
 +    menus.each(function(){
 +        ///if we are at home, the window location href corresponds to window location origin,
 +        //so we select only links whose link points EXACTLY to the origin (home link)
 +        var linkHref = normalize(this.href);
 +        var elm = $J(this);
 +
 +        if(linkHref.indexOf("#") != -1){
 +            var reg = new RegExp("[#]+", "g");
 +            var baseHref = linkHref.split(reg);
 +            linkHref = pageOrigin + "/" + baseHref[1]
 +        }
 +
 +        if(pageOrigin===pageHref){
 +            if(pageHref == linkHref){
 +                elm.addClass('active');
 +            }else{
 +                elm.removeClass('active');
 +            }
 +        }else{
 +            //here, on the other hand, we select if a link points to a page or super page
 +            //of the current page
 +            if(linkHref!=pageOrigin && pageHref.match("^"+linkHref+".*")){
 +                elm.addClass('active');
 +            }else{
 +                elm.removeClass('active');
 +            }
 +        }
 +        
 +    })
 +}
 +
 +
 +
 +
 +/*****************************************************************************
 + * json(param, method, onSuccesFcn(data, textStatus, jqXHR), onErrorFcn(jqXHR, textStatus, errorThrown))
 + * global function to senbd/retrieve data with the server
 + *
 + * param: the data to be sent or retrieved.
 + *   param will be converted to string, escaping quotes newlines and backslashes if necessary.
 + *   param can be a javascript string, boolean, number, dictionary and array.
 + *       If dictionary or array, it must contain only the above mentioned recognized types.
 + *       So, eg, {[" a string"]} is fine, {[/asd/]} not
 + *
 + * method: the json method, eg "telemeta.update_marker". See base.py
 + *
 + * onSuccesFcn(data, textStatus, jqXHR) OPTIONAL --IF MISSING, NOTHING HAPPENS --
 + *    A function to be called if the request succeeds with the same syntax of jQuery's ajax onSuccess function.
 + *    The function gets passed three arguments
 + *       The data returned from the server, formatted according to the dataType parameter;
 + *       a string describing the status;
 + *       and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object
 + *
 + * onErrorFcn(jqXHR, textStatus, errorThrown) OPTIONAL. --IF MISSING, THE DEFAULT ERROR DIALOG IS SHOWN--
 + *     A function to be called if the request fails with the same syntax of jQuery ajax onError function..
 + *     The function receives three arguments:
 + *       The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object,
 + *       a string describing the type of error that occurred and
 + *       an optional exception object, if one occurred.
 + *       Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror".
 + * ****************************************************************************/
 +
 +var json = function(param,method,onSuccessFcn,onErrorFcn){
 +    //this function converts a javascript object to a string
 +    var toString_ = function(string){
 +        if(typeof string == "string"){
 +            //escapes newlines quotes and backslashes
 +            string = string.replace(/\\/g,"\\\\")
 +            .replace(/\n/g,"\\n")
 +            .replace(/"/g,"\\\"");
 +        }
 +        var array; //used for arrays and objects (see below)
 +        if(typeof string == "boolean" || typeof string== "number" || typeof string == "string"){
 +            string = '"'+string+'"';
 +        }else if(string instanceof Array){
 +            array = [];
 +            for(var i = 0;i <string.length ; i++){
 +                array.push(toString_(string[i])); //recursive invocation
 +            }
 +            string='[';
 +            string+=array.join(",");
 +            string+=']';
 +        }else{
 +            array = [];
 +            for(var k in string){
 +                array.push(toString_(k)+":"+toString_(string[k])); //recursive invocation
 +            }
 +            string='{';
 +            string+=array.join(",");
 +            string+='}';
 +        }
 +        return string;
 +    };
 +    
 +    //creating the string to send. 
 +    var param2string = toString_(param);
 +    var data2send = '{"id":"jsonrpc", "params":';
 +    data2send+=param2string;
 +    data2send+=', "method":"'
 +    data2send+=method;
 +    data2send+='","jsonrpc":"1.0"}';
 +    
 +    var $J = jQuery;
 +    $J.ajax({
 +        type: "POST",
 +        url: 'json/',
 +        contentType: "application/json",
 +        data: data2send,
 +        dataType: "json",
 +        success: function(data, textStatus, jqXHR){
 +            if(onSuccessFcn){
 +                onSuccessFcn(data, textStatus, jqXHR);
 +            }
 +        },
 +        error: function(jqXHR, textStatus, errorThrown){
 +            if(onErrorFcn){
 +                onErrorFcn(jqXHR, textStatus, errorThrown);
 +                return;
 +            }
 +            //default:
 +            var details = "\n(no further info available)";
 +            if(jqXHR) {
 +                details="\nThe server responded witha status of "+jqXHR.status+" ("+
 +                jqXHR.statusText+")\n\nDetails (request responseText):\n"+jqXHR.responseText;
 +            }
 +            alert("ERROR: Failed to save"+details);
 +            
 +        }
 +    });
 +
 +};
 +
 +/**
 + * function for writing to the console. Catches errors, if any (eg, console == undefined) and does nothing in case
 + */
 +function consolelog(text){
 +    if(typeof console != 'undefined'){
 +        var c = console;
 +        if (c.log) {
 +            c.log(text);
 +        }
 +    }
 +}
 +
 +// Drop down menus
 +
 +$(document).ready(function () {
 +     
 +    $('#nav li').hover(
 +        function () {
 +            //show its submenu
 +            $('ul', this).slideDown(200);
 + 
 +        },
 +        function () {
 +            //hide its submenu
 +            $('ul', this).slideUp(100);        
 +        }
 +    );
 +     
+      // add a "read more" button after first video and hide others vidéos by default
+      $('.course_content.content_video table.listing').each(function(){
+         var $this = $(this);
+         // do nothing if not enough videos
+         var numberOfVideos = $this.find('tr').length
+         if(numberOfVideos <= 2)
+             return
+         $this.find('tr:not(:first)').hide();
+         
+         var colspan = $(this).find('tr:first td').length
+         var buttonRow = $('<tr><td class="show_more_videos" colspan="'+colspan+'"></td></tr>')
+         var button = $('<a class="component_icon button icon_next">Voir les vidéos plus anciennes</a>').bind('click', function(){
+             $this.find('tr:not(:first)').show('fast');
+             buttonRow.hide();
+         });
+         // $this.find('tr:first').appendAfter(buttonRow);
+         $this.find('tr:not(:first)').hide();
+         buttonRow.find('td').append(button)
+         buttonRow.insertAfter($this.find('tr:first'))
+      })
  });
index 9d48dda3f746d1fee5b51dffb2c0856f07f9cc59,ce1f6e7f5c175f7ac2753d68eb565a9044829e30..3b4c0adb2d01a32b66de960bfe7729f2a4555af7
@@@ -11,16 -12,11 +11,11 @@@ Vous venez de réaliser avec succès vo
  
  <br><br>
  
- Afin de compléter votre inscription, il est nécessaire d’imprimer le formulaire ci-dessous, de le dater et le signer, et nous le retourner accompagné de deux photos d’identité à l’adresse suivante :
- <br><br>
+ Afin de compléter votre inscription, il est nécessaire d’imprimer le formulaire ci-dessous, de le dater et le signer, et nous le retourner à l'adresse <a href="mailto:CRFPA@pre-barreau.com">CRFPA@pre-barreau.com</a>
  
- LE PRE-BARREAU<br>
- Service inscription<br>
- 3, rue de Nesle<br>
- 75006 Paris
- <br><br><br>
+ <br/><br/><br/>
  
 -<a href="{% url teleforma-registration-view username %}" class="component_icon button" id="action_green" target="_blank"><img src="/static/telemeta/images/download.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
 +<a href="{% url teleforma-registration-view username %}" class="component_icon button" id="action_green" target="_blank"><img src="/static/teleforma/images/download.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
  <br><br><br>
  
  Une fois votre dossier reçu et confirmé par nos services, vous recevrez un mail vous invitant à procéder au règlement des arrhes par carte bancaire. <b>Votre inscription ne sera validée qu’au terme de cette ultime étape.</b>
index 8bb91ccb2019f1996c5b3e406d23299dae8159fa,1841ecd55048c37aedabe15ef54aedb2b7e5c715..5c3d6b4e90b5b16b8bde95c49d585aeb1d6d02eb
@@@ -57,10 -58,10 +57,10 @@@ $(document).ready(function()
  {% endblock extra_javascript %}
  
  {% block module-action %}
 -{% if media.item.file and media.is_published or user.is_superuser or user.is_staff %}
 - {% if not "video" in media.mime_type or perms.telemeta.can_play_all_items or request.user_agent.os.family == 'iOS' %}
 +{% if media.file and media.is_published or user.is_superuser or user.is_staff %}
 + {% if not "video" in media.mime_type or request.user_agent.os.family == 'iOS' %}
    <div class="module_action">
-    <a href="{% url teleforma-media-download period.id media.id %}" class="component_icon button" id="action_red"><img src="/static/teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
+    <a href="{{ MEDIA_URL }}{{ media.item.file }}" class="component_icon button" id="action_red" download><img src="/static/teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
    </div>
   {% endif %}
  {% endif %}
index 71eca43a7b7f976976658eb9ef3ff57b76a07078,c2f63cf7501766aaca8c70642f132d9b845c3637..673104a80b62fb640fd1877ae428ea0145e47034
@@@ -94,8 -78,11 +94,11 @@@ urlpatterns = patterns(''
      # Home
      url(r'^$', HomeRedirectView.as_view(), name="teleforma-home"),
  
 -    # Unauthorized
 +    # Flat pages
 +    url(r'^pages/(?P<path>.*)$', home_view.render_flatpage, name="teleforma-flatpage"),
++        # Unauthorized
+     url(r'^unauthorized/$', TemplateView.as_view(template_name="teleforma/unauthorized.html"), name="teleforma-unauthorized"),
 -    # Telemeta
 -    url(r'^', include('telemeta.urls')),
  
      # Desk
      url(r'^desk/$', HomeRedirectView.as_view(), name="teleforma-desk"),
index 863a7caafcc5cb3213af98bb1d4b86243e291674,ce49dddd3b11499198477a6834964b2daa24f86b..6b8b820b28d4263863b3f13cb88e4b10fb4ef7d5
@@@ -74,7 -73,8 +73,8 @@@ from teleforma.models import 
  from teleforma.forms import *
  from teleforma.models.appointment import AppointmentPeriod
  from teleforma.webclass.models import Webclass, WebclassSlot, WebclassRecord
 -from teleforma.decorators import access_required
 +import pages
+ from telemeta.views import *
  import jqchat.models
  from xlwt import Workbook
  
index a9592e231d2f447a42565e7138f7a7b5a3fcb3ba,3aa08f6b31c38b77c00d8998375da46436310b5e..d22f1257442e8d78c526df7ca9d2fc9cca159597
@@@ -36,7 -36,8 +36,8 @@@ from teleforma.models.crfpa import Para
  from teleforma.models.core import Period
  from teleforma.views.core import *
  from teleforma.forms import WriteForm
 -from telemeta.views import ProfileView
 +from teleforma.views.profile import ProfileView
+ from teleforma.decorators import access_required
  from registration.views import *
  from extra_views import CreateWithInlinesView, UpdateWithInlinesView, InlineFormSet
  from postman.views import WriteView as PostmanWriteView
Simple merge