The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MonLabo
Summary Activity Tracker Tasks Docs SCM Files Dokuwiki Continious Integration Listes Sympa

SCM Repository

authorHerve Suaudeau <herve.suaudeau@parisdescartes.fr>
Thu, 1 Oct 2020 17:54:48 +0000 (19:54 +0200)
committerHerve Suaudeau <herve.suaudeau@parisdescartes.fr>
Thu, 1 Oct 2020 17:54:48 +0000 (19:54 +0200)
admin/MonLabo-edit-members.php
admin/css/MonLabo-admin.css
admin/includes/inc-lib-forms.php
admin/js/MonLabo-admin.js
includes/MonLabo-translate.php
mon-laboratoire.php

index df0f8e9..5022800 100644 (file)
@@ -137,6 +137,9 @@ function edit_members_form() {
                                );
                                $retval .= "<input type='url' name='submit_wp_post_url_table[".$page_number."]' id='submit_wp_post_url_table_".$page_number."' value='".$wp_post_url."' placeholder='" .  __( "URL au format https://... ou http://...", 'mon-laboratoire' ) . "'/>" ;
                                $retval .= '<div id="delayedLoadDivThumbnail_' . $page_number . '" class="delayedLoadDivThumbnail"><!-- Nous allons afficher ici la suite en asynchone grâce à ajax. --></div>';
+                               if ( 0 === $page_number) {
+                                       $retval .= generate_champ_formulaire_pub( "alternate_image", false, __( "URL de l&apos;image de la page", 'mon-laboratoire' ) , "", $member_information->alternate_image );
+                               }
                                $retval .= "</div>";
                        }
                        $retval .= __( "Pages sur lesquelles le panneau et les publications de cet auteur seront automatiquement affichés (avec les shortcodes [perso_panel] et [publications_list]).", 'mon-laboratoire' ) . '<br />';
index f902e6d..573d639 100644 (file)
@@ -286,6 +286,10 @@ a:hover.hover-zoom-square60 img {
        margin-left: 15px;
 }
 
+input[name=submit_alternate_image] {
+       display: none;
+}
+
 label[for^="submit_wp_post_id_table"] {
        width: 110px;
 }
index a6a0560..1eda00e 100644 (file)
@@ -10,6 +10,7 @@ function generate_champ_formulaire_pub( $typeOfField, $isMandatory, $legend, $de
                case 'descartes_publi_author_id':
                        return generate_number_form( $isMandatory, $legend, 'submit_'.$typeOfField, $description, $valeur_initiale, $id );
                case 'external_url':
+               case 'alternate_image':
                        return generate_url_form( $isMandatory, $legend, 'submit_'.$typeOfField, $description, $valeur_initiale, $id );
                /*
                //Non utilisé
@@ -373,7 +374,7 @@ function generate_update_member_thumbnail( $person_id, $page_number, $wp_post_id
        // Person with edited address
        //---------------------------
        if ( EDIT_PAGE_URL_OPTION_VALUE == $wp_post_id  ) {
-               //$retval .= "<label>Editer l'url</label>";
+               /*$retval .= "<label>Editer l'url</label>";*/
        // Person with no page
        //--------------------
        } elseif ( NO_PAGE_OPTION_VALUE ==  $wp_post_id  ) {
index 1768efb..5731d96 100644 (file)
@@ -89,15 +89,18 @@ function touchPersonFunction() {
  */
 
 function ajaxLoadPostThumbnailsNow(  ) {
-    //nbPages = jQuery( '[id^=delayedLoadDivThumbnail_]' ).length;
-       nbPages = jQuery( '#wp_post_id_table_lenght' ).val();
-    for (var page_number = 0; page_number < nbPages; page_number++) {
-               wp_post_id = jQuery( "select[name='submit_wp_post_id_table[" + page_number + "]']" ).val();
-               if ( wp_post_id == '0' ) {
-                       jQuery( "input[name='submit_wp_post_url_table[" + page_number + "]']" ).show();
-               }
-               ajaxLoadPostThumbnailNow( page_number );
+  //nbPages = jQuery( '[id^=delayedLoadDivThumbnail_]' ).length;
+  nbPages = jQuery( '#wp_post_id_table_lenght' ).val();
+  for (var page_number = 0; page_number < nbPages; page_number++) {
+    wp_post_id = jQuery( "select[name='submit_wp_post_id_table[" + page_number + "]']" ).val();
+    if ( wp_post_id == '0' ) {
+      jQuery( "input[name='submit_wp_post_url_table[" + page_number + "]']" ).show();
+      if ( page_number == '0' ) {
+        jQuery( "input[name='submit_alternate_image']" ).show();
+      }
     }
+    ajaxLoadPostThumbnailNow( page_number );
+  }
 }
 
 function touchPersonPage( page_number = '__no_change__' ){
@@ -105,8 +108,14 @@ function touchPersonPage( page_number = '__no_change__' ){
        wp_post_id = jQuery( "select[name='submit_wp_post_id_table[" + page_number + "]']" ).val();
        if ( wp_post_id == '0' ) {
                jQuery( "input[name='submit_wp_post_url_table[" + page_number + "]']" ).show();
+         if ( page_number == '0' ) {
+      jQuery( "input[name='submit_alternate_image']" ).show();
+    }
        } else {
                jQuery( "input[name='submit_wp_post_url_table[" + page_number + "]']" ).hide();
+    if ( page_number == '0' ) {
+      jQuery( "input[name='submit_alternate_image']" ).hide();
+    }
        }
 
        //Clean URL field
@@ -358,6 +367,12 @@ jQuery( document ).ready( function($) {
                                        function(event) { touchPersonPage( event.data.msg ); }
                                );
                }
+
+    //Hide submit_alternate_image if necessary
+    wp_post_id_0 = jQuery( "select[name='submit_wp_post_id_table[0]']" ).val();
+    if ( wp_post_id_0 != '0' ) {
+      jQuery( "input[name='submit_alternate_image']" ).hide();
+    }
        }
 
 });
index 4d80a42..3ecd3a2 100644 (file)
@@ -58,7 +58,6 @@ class MonLabo_translate {
                }
        }
 
-
        public static function translate( $sentence_to_translate, $language = '' ) {
                $translation_table = array(
                        'Nom' => array( 'en-US'=> 'Name',
index 9ad85eb..a9f1eb8 100644 (file)
@@ -8,7 +8,7 @@ defined( 'ABSPATH' ) or die( 'No direct script access allowed' );
 * Plugin Name:       Mon Laboratoire
 * Plugin URI:        http://www.monlabo.org
 * Description:       Simplify the management of a research unit's website
-* Version:           3.0.997
+* Version:           3.0.9986
 * Requires at least: 4.8
 * Requires PHP:      5.4
 * License:           GPLv2 or later
@@ -21,7 +21,7 @@ defined( 'ABSPATH' ) or die( 'No direct script access allowed' );
 /* Delphine RIDER was co-author before versions v2.0 */
 
 //Currently plugin version, use SemVer - https://semver.org
-function get_version() { return '3.0.997'; }
+function get_version() { return '3.0.9986'; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 //                                        PLUGIN CLASS DEFINITIONS