Subversion Repositories eFlore/Applications.cel

Compare Revisions

Regard whitespace Rev 1585 → Rev 1586

/trunk/widget/modules/cartopoint/squelettes/carte_defaut.tpl.html
38,9 → 38,10
<!-- Javascript : appli carto -->
<script type="text/javascript">
//<![CDATA[
var urlsLimitesCommunales = <?= $url_limites_communales; ?>;
var nt = '<?=$num_taxon?>';
var filtreCommun =
var urlWidgetSaisie = '<?= $url_widget_saisie; ?>',
urlsLimitesCommunales = '<?= $url_limites_communales; ?>',
nt = '<?=$num_taxon?>',
filtreCommun =
'&taxon=<?=rawurlencode($taxon)?>'+
'&utilisateur=<?=$utilisateur?>'+
'&projet=<?=rawurlencode($projet)?>'+
48,37 → 49,33
'&date=<?=$date?>'+
'&dept=<?=$dept?>'+
'&commune=<?=rawurlencode($commune)?>'+
'&commentaire=<?=rawurlencode($commentaire)?>';
var utilisateur = '<?=$utilisateur?>';
var photos = '<?= ($photos != null) ? $photos : null; ?>';
'&commentaire=<?=rawurlencode($commentaire)?>',
utilisateur = '<?=$utilisateur?>',
photos = '<?= ($photos != null) ? $photos : "null"; ?>';
if(photos != null) {
filtreCommun += '&photos=<?=rawurlencode($photos)?>';
}
var nbJours = '<?= ($nbjours != null) ? $nbjours : null; ?>';
var nbJours = '<?= ($nbjours != null) ? $nbjours : "null"; ?>';
if(nbJours != null) {
filtreCommun += '&nbjours=<?=rawurlencode($nbjours)?>';
}
var referentiel = '<?= ($referentiel != null) ? $referentiel : null; ?>';
var referentiel = '<?= ($referentiel != null) ? $referentiel : "null"; ?>';
if(referentiel != null) {
filtreCommun += '&referentiel=<?=rawurlencode($referentiel)?>';
}
var titreCarte = '<?= ($titre != null) ? addslashes($titre) : "null"; ?>';
var urlLogo = '<?= ($logo != null) ? $logo : "null"; ?>';
var urlSite = '<?= ($url_site != null) ? $url_site : "null"; ?>';
var urlImage = '<?= ($image != null) ? $image : "null"; ?>';
var stationsUrl = '<?=$url_cel_carto?>/tout'+'?'+
'num_taxon='+nt+
filtreCommun;
var taxonsUrl = '<?=$url_cel_carto?>/taxons'+'?'+
'num_taxon='+nt+
filtreCommun;
var observationsUrl = '<?=$url_cel_carto?>/observations'+'?'+
var titreCarte = '<?= ($titre != null) ? addslashes($titre) : "null"; ?>',
urlLogo = '<?= ($logo != null) ? $logo : "null"; ?>',
urlSite = '<?= ($url_site != null) ? $url_site : "null"; ?>',
urlImage = '<?= ($image != null) ? $image : "null"; ?>',
stationsUrl = '<?=$url_cel_carto?>/tout'+'?' + 'num_taxon=' + nt + filtreCommun,
taxonsUrl = '<?=$url_cel_carto?>/taxons'+'?' + 'num_taxon=' + nt + filtreCommun,
observationsUrl = '<?=$url_cel_carto?>/observations' + '?' +
'station={stationId}'+
'&num_taxon={nt}'+
filtreCommun;
var communeImageUrl = '<?= $communeImageUrl; ?>';
var pointImageUrl = '<?= $pointImageUrl; ?>';
var groupeImageUrlTpl = '<?= $groupeImageUrlTpl; ?>';
filtreCommun,
communeImageUrl = '<?= $communeImageUrl; ?>',
pointImageUrl = '<?= $pointImageUrl; ?>',
groupeImageUrlTpl = '<?= $groupeImageUrlTpl; ?>';
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/cartopoint/squelettes/scripts/carto.js"></script>
236,8 → 233,8
<p>Id : <span id="obs-station-id">&nbsp;</span></p>
</div>
<div class="navigation">&nbsp;</div>
<div class="conteneur-lien-saisie">
<a href="http://www.tela-botanica.org/widget:cel:saisie{parametres-lien-saisie}" class="lien-widget-saisie">
<div class="conteneur-lien-saisie" style="display:none;">
<a href="#" class="lien-widget-saisie">
Ajouter une observation pour ce site
</a>
</div>
/trunk/widget/modules/cartopoint/squelettes/scripts/carto.js
1,7 → 1,5
/*+--------------------------------------------------------------------------------------------------------+*/
// PARAMÊTRES et CONSTANTES
// Mettre à true pour afficher les messages de débogage
var DEBUG = false;
/**
* Indication de certaines variables ajoutée par php
* var communeImageUrl ;
8,15 → 6,16
* var pointImageUrl ;
* var groupeImageUrlTpl ;
*/
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
var map = null;
var infoBulle = new google.maps.InfoWindow();
var stations = null;
var pointClique = null;
var carteCentre = new google.maps.LatLng(25, 10);
var carteOptions = {
var DEBUG = false,// Mettre à true pour afficher les messages de débogage
pointsOrigine = null,
boundsOrigine = null,
markerClusterer = null,
map = null,
infoBulle = new google.maps.InfoWindow(),
stations = null,
pointClique = null,
carteCentre = new google.maps.LatLng(25, 10),
carteOptions = {
zoom: 3,
center:carteCentre,
mapTypeId: google.maps.MapTypeId.ROADMAP,
32,8 → 31,8
position: google.maps.ControlPosition.LEFT_CENTER
},
panControl: false
};
var osmMapType = new google.maps.ImageMapType({
},
osmMapType = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" +
zoom + "/" + coord.x + "/" + coord.y + ".png";
43,18 → 42,19
alt: "OpenStreetMap",
name: "OSM",
maxZoom: 19
});
var ctaLayer = null;
var pagineur = {'limite':300, 'start':0, 'total':0, 'stationId':null, 'format':'tableau'};
var station = {'commune':'', 'obsNbre':0};
var obsStation = new Array();
var obsPage = new Array();
var taxonsCarte = new Array();
var mgr = null;
var marqueursCache = new Array();
var zonesCache = new Array();
var requeteChargementPoints;
var urlVars = null;
}),
ctaLayer = null,
pagineur = {'limite':300, 'start':0, 'total':0, 'stationId':null, 'format':'tableau'},
station = {'commune':'', 'obsNbre':0},
obsStation = new Array(),
obsPage = new Array(),
taxonsCarte = new Array(),
mgr = null,
marqueursCache = new Array(),
zonesCache = new Array(),
requeteChargementPoints,
urlVars = null;
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INITIALISATION DU CODE
 
78,13 → 78,11
attribuerListenerCarte();
}
 
function getUrlVars()
{
function getUrlVars() {
var vars = [], hash;
if(window.location.href.indexOf('?') != -1) {
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
160,7 → 158,6
}
 
function attribuerListenersOverlay() {
$(window).resize(function() {
dimensionnerCarte();
definirTailleOverlay();
182,12 → 179,12
 
var tailleMaxFiltreUtilisateur;
function definirTailleOverlay() {
var largeurViewPort = $(window).width();
var taille = '1.6';
var tailleMaxLogo = 60;
var tailleMaxIcones = 10;
var padding_icones = 8;
var tailleFiltre = 80;
var largeurViewPort = $(window).width(),
taille = '1.6',
tailleMaxLogo = 60,
tailleMaxIcones = 10,
padding_icones = 8,
tailleFiltre = 80;
tailleMaxFiltreUtilisateur = 350;
$('#raz-filtre-utilisateur').css('display', 'block');
if (largeurViewPort <= 450) {
304,10 → 301,11
}
 
function centrerTitre() {
var largeurViewPort = $(window).width();
var largeurTitre = $('#zone-titre').width();
var marge = (largeurViewPort - largeurTitre)/2;
var largeurViewPort = $(window).width(),
largeurTitre = $('#zone-titre').width(),
marge = (largeurViewPort - largeurTitre)/2;
$('#zone-titre').css("margin-left",marge);
var tailleRestante = largeurViewPort - (marge + largeurTitre);
if(tailleRestante <= 170) {
$('#zone-titre').css("top", "25px");
317,9 → 315,9
}
 
function centrerStats() {
var largeurViewPort = $(window).width();
var largeurStats = $('#zone-stats').width();
var marge = ((largeurViewPort - largeurStats)/2);
var largeurViewPort = $(window).width(),
largeurStats = $('#zone-stats').width(),
marge = ((largeurViewPort - largeurStats)/2);
$('#zone-stats').css("margin-left",marge);
}
 
353,8 → 351,9
}
}
 
var listener = null;
var timer = null;
var listener = null,
timer = null;
 
function attribuerListenerCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', function(){
programmerRafraichissementCarte();
363,6 → 362,7
programmerRafraichissementCarte();
});
}
 
function programmerRafraichissementCarte() {
if(timer != null) {
window.clearTimeout(timer);
372,15 → 372,15
}
timer = window.setTimeout(function() {
if(map.getBounds() != undefined) {
var zoom = map.getZoom();
var lngNE = map.getBounds().getNorthEast().lng();
var lngSW = map.getBounds().getSouthWest().lng()
var zoom = map.getZoom(),
lngNE = map.getBounds().getNorthEast().lng(),
lngSW = map.getBounds().getSouthWest().lng()
if(map.getBounds().getNorthEast().lng() < map.getBounds().getSouthWest().lng()) {
lngNE = 176;
lngSW = -156;
}
var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(lngNE);
var SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(lngSW);
var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(lngNE),
SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(lngSW);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
} else {
programmerRafraichissementCarte();
413,11 → 413,11
}
 
function centrerDansLaPage(selecteur) {
var largeurViewport = $(window).width();
var hauteurViewport = $(window).height();
var largeurViewport = $(window).width(),
hauteurViewport = $(window).height();
selecteur.css('display','block');
var left = (largeurViewport/2) - (selecteur.width())/2;
var top = (hauteurViewport/2) - (selecteur.height())/2
var left = (largeurViewport/2) - (selecteur.width())/2,
top = (hauteurViewport/2) - (selecteur.height())/2
selecteur.css('left',left);
selecteur.css('top',top);
}
447,7 → 447,6
}
 
function rafraichirMarqueurs(data) {
$.each(marqueurs, function(index, marqueur) {
marqueur.setMap(null);
});
457,7 → 456,6
if(data.points.length > 0) {
marqueurs = new Array();
stations = data;
$.each(stations.points, function (index, station) {
469,9 → 467,9
if(doitCentrerCarte()) {
premierChargement = false;
var bounds = new google.maps.LatLngBounds();
var latMax = new google.maps.LatLng(data.stats.coordmax.latMax, data.stats.coordmax.lngMax);
var latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
var bounds = new google.maps.LatLngBounds(),
latMax = new google.maps.LatLng(data.stats.coordmax.latMax, data.stats.coordmax.lngMax),
latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
bounds.extend(latMax);
bounds.extend(latMin);
rendrePointsVisibles(bounds);
491,9 → 489,9
}
}
var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']);
var latLng = new google.maps.LatLng(station['lat'], station['lng']);
var marqueur = new google.maps.Marker({
var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']),
latLng = new google.maps.LatLng(station['lat'], station['lng']),
marqueur = new google.maps.Marker({
position: latLng,
icon: icone,
title: ''+titre,
517,9 → 515,9
} else if (etreMarqueurStation(id)) {
marqueurImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(16, 16));
} else if (etreMarqueurGroupe(id)) {
var type = 0;
var largeur = 0;
var hauteur = 0;
var type = 0,
largeur = 0,
hauteur = 0;
if (nbreMarqueur != null) {
if (nbreMarqueur >= 2 && nbreMarqueur < 100 ) {
type = '1';
570,10 → 568,10
infoBulle.open(map, this);
actualiserPagineur();
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
var limites = map.getBounds(),
centre = limites.getCenter(),
nordEst = limites.getNorthEast(),
centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
afficherInfoBulle();
587,8 → 585,8
}
 
function etreMarqueurGroupe(id) {
var groupe = false;
var motif = /^GROUPE/;
var groupe = false,
motif = /^GROUPE/;
if (motif.test(id)) {
groupe = true;
}
596,8 → 594,8
}
 
function etreMarqueurCommune(id) {
var commune = false;
var motif = /^COMMUNE:/;
var commune = false,
motif = /^COMMUNE:/;
if (motif.test(id)) {
commune = true;
}
605,8 → 603,8
}
 
function etreMarqueurStation(id) {
var station = false;
var motif = /^STATION:/;
var station = false,
motif = /^STATION:/;
if (motif.test(id)) {
station = true;
}
642,19 → 640,18
}
 
function centrerInfoBulle() {
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
var limites = map.getBounds(),
centre = limites.getCenter(),
nordEst = limites.getNorthEast(),
centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
}
 
function afficherInfoBulle() {
var obsHtml = $("#tpl-obs").html();
var largeur = definirLargeurInfoBulle();
var taillePolice = definirTaillePoliceInfoBulle();
var obsHtml = $('#tpl-obs').html(),
largeur = definirLargeurInfoBulle(),
taillePolice = definirTaillePoliceInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
obsHtml = mettreAJourUrlSaisie(obsHtml);
infoBulle.setContent(obsHtml);
$('#observations').css('font-size',taillePolice+'em');
chargerObs(0, 0);
664,9 → 661,9
//TODO utiliser cette fonction lors des remplacements de
//paramètres url sur changement de filtre
function parserFiltre(filtre) {
var nvpair = {};
var qs = filtre.replace('?', '');
var pairs = qs.split('&');
var nvpair = {},
qs = filtre.replace('?', ''),
pairs = qs.split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
nvpair[pair[0]] = pair[1];
674,26 → 671,30
return nvpair;
}
 
function mettreAJourUrlSaisie(obsHtml) {
var filtreTableau = parserFiltre(filtreCommun);
var filtresGardes = new Array();
function mettreAJourUrlSaisie(obs) {
if (obs.observations.length > 0) {
var filtreTableau = parserFiltre(filtreCommun),
filtresGardes = new Array()
idObs = obs.observations[0].idObs;
filtre = '';
for(i in filtreTableau) {
if(filtreTableau[i] != undefined && filtreTableau[i] != '' && decodeURIComponent(filtreTableau[i]) != '*') {
console.log(i+" "+filtreTableau[i]);
console.log(i + ' ' + filtreTableau[i]);
filtresGardes.push(i+'='+filtreTableau[i]);
}
}
filtresGardes.push('id-obs=' + idObs);
if(filtresGardes.length > 0) {
filtre = '?'+filtresGardes.join('&');
}
obsHtml = obsHtml.replace(/\{parametres-lien-saisie\}/, filtre);
return obsHtml;
var urlAvecFiltre = urlWidgetSaisie + filtre;
$('.lien-widget-saisie').attr('href', urlAvecFiltre).parents('.conteneur-lien-saisie').show();
}
}
 
function definirLargeurInfoBulle() {
var largeurViewPort = $(window).width();
var largeurInfoBulle = null;
var largeurViewPort = $(window).width(),
largeurInfoBulle = null;
if (largeurViewPort < 400) {
largeurInfoBulle = 300;
} else if (largeurViewPort < 800) {
707,8 → 708,8
}
 
function definirTaillePoliceInfoBulle() {
var largeurViewPort = $(window).width();
var taillePolice = null;
var largeurViewPort = $(window).width(),
taillePolice = null;
if (largeurViewPort < 400) {
taillePolice = 0.8;
} else if (largeurViewPort < 800) {
776,6 → 777,8
actualiserInfosStation(observations);
creerTitreInfoBulle();
surClicPagePagination(0, null);
console.log(observations);
mettreAJourUrlSaisie(observations);
}
afficherPagination();
789,8 → 792,8
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
$('#obs-total').text(station.obsNbre);
$('#obs-commune').text(station.commune);
var titre = '';
titre += pointClique.stationInfos.obsNbre+' observation';
titre += (pointClique.stationInfos.obsNbre > 1) ? 's': '' ;
801,7 → 804,7
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
$('#obs-station-titre').text(titre);
}
 
function actualiserPagineur() {
817,7 → 820,7
}
 
function afficherPagination(observations) {
$(".navigation").pagination(pagineur.total, {
$('.navigation').pagination(pagineur.total, {
items_per_page:pagineur.limite,
callback:surClicPagePagination,
next_text:'Suivant',
830,8 → 833,8
}
 
function surClicPagePagination(pageIndex, paginationConteneur) {
var index = pageIndex * pagineur.limite;
var indexMax = index + pagineur.limite;
var index = pageIndex * pagineur.limite,
indexMax = index + pagineur.limite;
pagineur.depart = index;
obsPage = new Array();
for(index; index < indexMax; index++) {
844,15 → 847,15
}
 
function mettreAJourObservations() {
$("#obs-"+pagineur.format+"-lignes").empty();
$("#obs-vue-"+pagineur.format).css('display', 'block');
$(".obs-conteneur").css('counter-reset', 'item '+pagineur.depart);
$("#tpl-obs-"+pagineur.format).tmpl(obsPage).appendTo("#obs-"+pagineur.format+"-lignes");
$('#obs-'+pagineur.format+'-lignes').empty();
$('#obs-vue-'+pagineur.format).css('display', 'block');
$('.obs-conteneur').css('counter-reset', 'item '+pagineur.depart);
$('#tpl-obs-'+pagineur.format).tmpl(obsPage).appendTo('#obs-'+pagineur.format+'-lignes');
// Actualisation de Fancybox
ajouterFormulaireContact("a.contact");
ajouterFormulaireContact('a.contact');
if (pagineur.format == 'liste') {
ajouterGaleriePhoto("a.cel-img");
ajouterGaleriePhoto('a.cel-img');
}
}
 
860,14 → 863,14
afficherMessageChargement('#observations');
cacherContenuOnglets();
afficherOnglets();
ajouterTableauTriable("#obs-tableau");
ajouterTableauTriable('#obs-tableau');
afficherTextStationId();
corrigerLargeurInfoWindow();
}
 
function cacherContenuOnglets() {
$("#obs-vue-tableau").css("display", "none");
$("#obs-vue-liste").css("display", "none");
$('#obs-vue-tableau').css('display', 'none');
$('#obs-vue-liste').css('display', 'none');
}
 
function afficherOnglets() {
955,9 → 958,9
titleFormat:function (titre, currentArray, currentIndex, currentOpts) {
var motif = /urn:lsid:tela-botanica[.]org:cel:img([0-9]+)$/;
motif.exec(titre);
var id = RegExp.$1;
var info = $('#cel-info-'+id).clone().html();
var tpl =
var id = RegExp.$1,
info = $('#cel-info-'+id).clone().html(),
tpl =
'<div class="cel-legende">'+
'<p class="cel-legende-vei">'+'Image n°' + (currentIndex + 1) + ' sur ' + currentArray.length +'<\/p>'+
(titre && titre.length ? '<p>'+info+'<\/p>' : '' )+
1144,7 → 1147,6
}
 
function attribuerListenersFiltreUtilisateur() {
$('#valider-filtre-utilisateur').click(function() {
var utilisateur = $('#filtre-utilisateur').val();
filtrerParUtilisateur(utilisateur);
1189,8 → 1191,8
utilisateurFiltre = '*';
}
utilisateur = utilisateurFiltre;
var pattern = /utilisateur=[^&]*/i;
var utilisateurCourant = pattern.exec(stationsUrl);
var pattern = /utilisateur=[^&]*/i,
utilisateurCourant = pattern.exec(stationsUrl);
stationsUrl = stationsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
taxonsUrl = taxonsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
observationsUrl = observationsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
1214,8 → 1216,8
//console.log(urlTax);
$.getJSON(urlTax, function(infos) {
nbTaxons += infos.taxons.length;
$(".plantes-nbre").text(nbTaxons);
$("#tpl-taxons-liste").tmpl({'taxons':infos.taxons}).appendTo("#taxons");
$('.plantes-nbre').text(nbTaxons);
$('#tpl-taxons-liste').tmpl({'taxons': infos.taxons}).appendTo('#taxons');
taxonsCarte = taxonsCarte.concat(infos.taxons);
//console.log("Nbre taxons :"+taxonsCarte.length);
chargerTaxons(depart+limite, infos.total);
1249,8 → 1251,8
};
 
function cacherPanneauLateral() {
$('#panneau-lateral').height(25+"px");
$('#panneau-lateral').width(largeurPanneauLateralFerme+"px");
$('#panneau-lateral').height(25 + 'px');
$('#panneau-lateral').width(largeurPanneauLateralFerme + 'px');
$('#pl-contenu').css('display', 'none');
$('#pl-ouverture').css('display', 'block');
$('#pl-fermeture').css('display', 'none');
1386,7 → 1388,7
if (_sNombre.indexOf('.') == -1) {
for (i = 0; i < decimales; i++) {
_sDecimales += "0";
_sDecimales += '0';
}
_sRetour = separeMilliers(_sNombre) + signe + _sDecimales;
} else {
1408,10 → 1410,10
var msg = '';
if (objet != null) {
$.each(objet, function (cle, valeur) {
msg += cle+":"+valeur + "\n";
msg += cle+':'+valeur + "\n";
});
} else {
msg = "La variable vaut null.";
msg = 'La variable vaut null.';
}
console.log(msg);
}