14,7 → 14,7 |
this.mettreAJourInfosImage(); |
} |
|
WidgetPhotoPopup.prototype = new WidgetPhotoCommun(); |
WidgetPhotoPopup.prototype = new WidgetPhotoCommun(); |
|
WidgetPhotoPopup.prototype.initTpl = function() { |
this.redimensionnerGalerie(); |
53,17 → 53,39 |
WidgetPhotoPopup.prototype.mettreAJourInfosImage = function() { |
this.item = this.infos_images[this.urls[this.indexImage]]; |
this.titreImage = this.item['titre']; |
this.lienEflore = this.item['lien']; |
this.urlLienEflore = this.item['lien']; |
this.idImage = this.item['id_photo']; |
this.urlThisImage = this.item['url_photo']+'.jpg'; |
this.obs = this.item['obs']; |
this.nn = '[nn' + this.obs['nom_sel_nn']+']'; |
this.urlIP = this.obs['url_ip']; |
this.tagsImage = this.tagsToArray( this.item['tags_photo'] ); |
this.tagsObs = this.tagsToArray( this.obs['tags_obs'] ); |
this.auteur = this.item['utilisateur']['nom_utilisateur']; |
this.urlProfil = '/profil-par-id/'+this.item['utilisateur']['id_utilisateur']; |
this.date = this.item['date']; |
}; |
|
WidgetPhotoPopup.prototype.tagsToArray = function( tags ) { |
tags = tags.replace( new RegExp('\\.'), '' ).split( ',' ); |
|
let cleanTags = [], |
nbTags = tags.length, |
tag = '', |
tagsSansEspaces = '', |
cleanTagIndex = 0; |
|
for(let i = 0; i < nbTags; i++) { |
tag = tags[i]; |
tagsSansEspaces = tag.replace( ' ', ''); |
if( '' !== tagsSansEspaces ) { |
cleanTags.push( tag.trim() ); |
} |
} |
|
return cleanTags; |
}; |
|
WidgetPhotoPopup.prototype.initEvtsDefilerImage = function() { |
const lthis = this; |
|
78,7 → 100,7 |
case left: |
return 'suivant'; |
case right: |
return 'precedent' |
return 'precedent'; |
default: |
break; |
} |
226,7 → 248,7 |
} |
|
$( '#bloc-infos-img' ).html( |
'<a href="' + this.lienEflore + '">' + this.obs['nom_sel'] + '</a> '+ |
this.afficherLien( this.urlLienEflore, this.obs['nom_sel'] )+ |
' par '+ |
'<a class="lien_contact" href="' + lienContact + '">' + this.auteur + '</a> '+ |
' le ' + this.date + ' - ' + this.obs['localisation'] |
352,7 → 374,7 |
WidgetPhotoPopup.prototype.afficherMetas = function() { |
const lthis = this; |
const META_CONTENUS = { |
'nom' : '<a href="' + this.lienEflore + '" target="_blank">' + this.obs['nom_sel'] + '</a> ', |
'nom' : this.afficherLien( this.urlLienEflore, this.obs['nom_sel'] ), |
'localisation' : this.obs['localisation'], |
'auteur' : this.auteur, |
'date-obs' : this.date, |
378,7 → 400,7 |
break; |
case 'nom' : |
$( '.contenu', $metaContainer ).html( contenu ); |
$( '.bouton', $metaContainer ).attr( 'href', lthis.lienEflore ); |
$( '.bouton', $metaContainer ).attr( 'href', lthis.urlLienEflore ); |
break; |
case 'auteur' : |
$( '.bouton', $metaContainer ).attr( 'href', lthis.urlProfil ); |
414,6 → 436,7 |
const META_LABELS = { |
'id_obs' : 'observation n°', |
'projet' : 'projet', |
'nom_referentiel' : 'réferentiel', |
'date_obs' : 'date d´observation', |
'nom_sel': 'nom scientifique', |
'nom_sel_nn' : 'nom scientifique n°', |
420,12 → 443,7 |
'nom_ret' : 'nom retenu', |
'nom_ret_nn' : 'nom retenu n°', |
'famille' : 'famille', |
'nom_referentiel' : 'réferentiel', |
'commentaire' : 'commentaire', |
'certitude' : 'certitude', |
'fiabilite' : 'fiabilite', |
'tags_obs' : 'tags de l´observation', |
'localisation' : 'localisation', |
'lieudit' : 'lieu dit', |
'station' : 'station', |
'milieu' : 'milieu', |
449,19 → 467,51 |
'observateur' : 'observateur', |
'observateur_structure' : 'structure' |
}; |
|
const $contenuPlusMeta = $( '#contenu-meta-plus' ); |
let degres = '0'; |
let degres = $contenuPlusMeta.is( ':visible' ) ? '180' : '0'; |
|
this.rotationFleche( degres ); |
$contenuPlusMeta.empty(); |
|
$.each( META_LABELS, function( cle, label ) { |
let idAttr = cle.replace( '_', '-' ), |
contenu = lthis.obs[cle]; |
|
if ( 0 <= $.inArray( cle, ['est_ip_valide', 'herbier'] ) && '0' === contenu ) { |
contenu = 'non'; |
} else if ( 'date_obs' === cle ) { |
contenu = lthis.formaterDate(contenu); |
switch( cle ) { |
case 'nom_sel': |
contenu = lthis.afficherLien( lthis.urlLienEflore, contenu ); |
break; |
|
case 'nom_ret': |
let urlEfloreNomRetenu = lthis.urlLienEflore.replace( lthis.obs['nom_sel_nn'], lthis.obs['nom_ret_nn'] ); |
|
contenu = lthis.afficherLien( urlEfloreNomRetenu, contenu ); |
break; |
|
case 'url_ip': |
contenu = lthis.afficherLien( contenu, contenu ); |
break; |
|
case 'est_ip_valide': |
case 'herbier': |
if( '0' === contenu ) { |
contenu = 'non'; |
} |
break; |
|
case 'date_obs': |
contenu = lthis.formaterDate( contenu ); |
console.log(contenu); |
break; |
|
case 'tags_obs': |
let tagsObsLength = lthis.tagsObs.length; |
contenu = lthis.tagsObs.join( '<br>' ); |
break; |
|
default: |
break; |
} |
|
if ( lthis.valOk( contenu ) ) { |
474,12 → 524,18 |
} |
}); |
|
$contenuPlusMeta.hide(); |
if( !$contenuPlusMeta.hasClass( 'actif' ) ) { |
$contenuPlusMeta.hide(); |
} |
|
let estVisible = false; |
|
$( '#plus-meta' ).off( 'click' ).on( 'click', function( event ) { |
event.preventDefault(); |
|
$contenuPlusMeta.toggle( 200, function() { |
degres = $contenuPlusMeta.is( ':visible' ) ? '180' : '0'; |
estVisible = $contenuPlusMeta.is( ':visible' ); |
degres = estVisible ? '180' : '0'; |
$( this ).toggleClass( 'actif', estVisible ); |
lthis.rotationFleche( degres ); |
}); |
}); |
596,6 → 652,13 |
return dateFormatee; |
}; |
|
WidgetPhotoPopup.prototype.afficherLien = function( url, nom ) { |
if( !/https?:\/\//.test( url ) ) { |
url = 'https://' + url; |
} |
return '<a href="' + url + '" target="_blank">' + nom + '</a> '; |
}; |
|
WidgetPhotoPopup.prototype.fournirLienIdentiplante = function() { |
const lthis = this; |
$( '.signaler-erreur-obs' ).each( function() { |