Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 980 → Rev 1091

/trunk/widget/modules/cartopoint/squelettes/carte_defaut.tpl.html
60,17 → 60,32
'station={stationId}'+
'&num_taxon={nt}'+
filtreCommun;
var communeImageUrl = '<?= $communeImageUrl ?>';
var pointImageUrl = '<?= $pointImageUrl ?>';
var groupeImageUrlTpl = '<?= $groupeImageUrlTpl ?>';
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/carto/squelettes/scripts/carto.js"></script>
<script type="text/javascript" src="<?=$url_base?>modules/cartopoint/squelettes/scripts/carto.js"></script>
<!-- CSS -->
<link rel="stylesheet" href="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<link rel="stylesheet" href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.15/css/smoothness/jquery-ui-1.8.15.custom.css" type="text/css" media="screen" />
<link href="<?=$url_base?>modules/carto/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?=$url_base?>modules/cartopoint/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body>
<div id="zone-chargement-point" style="background-color: white;border: 5px solid #D7DBEA;display: none;
height: 70px;
left: 40%;
padding: 10px;
position: fixed;
text-align: center;
top: 35px;
width: 230px;
z-index: 3000;">
<img src="<?=$url_base?>modules/cartopoint/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p> Chargement des points en cours... </p>
</div>
<div id="zone-titre">
<h1 id="carte-titre">
<span id="logo">
89,9 → 104,9
(<a href="http://www.tela-botanica.org/" onclick="ouvrirNouvelleFenetre(this, event)">Tela Botanica</a>)
</h1>
<div id="zone-info">
<a href="<?=$url_base?>carto?carte=avertissement"
<a href="<?=$url_base?>cartopoint?carte=avertissement"
onClick="ouvrirPopUp(this, 'Avertissement', event)">
<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
<img src="<?=$url_base?>modules/cartopoint/squelettes/images/information.png"
alt="Avertissements" title="Avertissements &amp; informations" />
</a>
</div>
122,7 → 137,7
<!-- Squelette du message de chargement des observations -->
<script id="tpl-chargement" type="text/x-jquery-tmpl">
<div id="chargement" style="height:300px;">
<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<img src="<?=$url_base?>modules/cartopoint/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p>Chargement des observations en cours...</p>
</div>
</script>
/trunk/widget/modules/cartopoint/squelettes/scripts/carto.js
2,9 → 2,12
// PARAMÊTRES et CONSTANTES
// Mettre à true pour afficher les messages de débogage
var DEBUG = false;
var communeImageUrl = 'http://www.tela-botanica.org/commun/icones/carto/commune.png';
var pointImageUrl = 'http://www.tela-botanica.org/commun/icones/carto/point2.png';
var groupeImageUrlTpl = 'http://localhost/cel-jrest/CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
/**
* Indication de certaines variables ajoutée par php
* var communeImageUrl ;
* var pointImageUrl ;
* var groupeImageUrlTpl ;
*/
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
45,6 → 48,7
var mgr = null;
var marqueursCache = new Array();
var zonesCache = new Array();
var requeteChargementPoints;
/*+--------------------------------------------------------------------------------------------------------+*/
// INITIALISATION DU CODE
 
62,7 → 66,8
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
rafraichirCarte();
attribuerListenerCarte();
programmerRafraichissementCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
70,15 → 75,18
 
function afficherTitreCarte() {
if (stations != null && taxonsCarte.length > 0) {
var obsNbre = stations.stats.observations.formaterNombre();
var plteNbre = taxonsCarte.length.formaterNombre();
var communeNbre = stations.stats.communes.formaterNombre();
var obsNbre = stations.stats.observations;
var obsNbreFormate = stations.stats.observations.formaterNombre();
var plteNbre = taxonsCarte.length;
var plteNbreFormate = taxonsCarte.length.formaterNombre();
var communeNbre = stations.stats.communes;
var communeNbreFormate = stations.stats.communes.formaterNombre();
var titre = obsNbre+' observation';
var titre = obsNbreFormate+' observation';
titre += (obsNbre > 1) ? 's' : '' ;
if (nt == '*') {
titre += ' de '+plteNbre+' plante';
titre += ' de '+plteNbreFormate+' plante';
titre += (plteNbre > 1) ? 's' : '' ;
} else {
if (taxonsCarte[0]) {
87,7 → 95,7
}
}
titre += ' sur '+communeNbre+' commune';
titre += ' sur '+communeNbreFormate+' commune';
titre += (communeNbre > 1) ? 's' : '' ;
$('#carte-titre-infos').text(titre);
133,79 → 141,95
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: true});
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: false});
ctaLayer.setMap(map);
}
}
}
 
var listener = null;
var timer = null;
function rafraichirCarte() {
function attribuerListenerCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', function(){
if(timer != null) {
window.clearTimeout(timer);
}
timer = window.setTimeout(function() {
var zoom = map.getZoom();
var NELatLng = map.getBounds().getNorthEast().lat()+'|'+map.getBounds().getNorthEast().lng();
var SWLatLng = map.getBounds().getSouthWest().lat()+'|'+map.getBounds().getSouthWest().lng();
chargerMarqueurs(zoom, NELatLng, SWLatLng);
}, 300);
programmerRafraichissementCarte();
});
listener = google.maps.event.addListener(map, 'zoom_changed', function(){
programmerRafraichissementCarte();
});
}
 
function collecterBorduresEtChargerMarqueurs() {
 
function programmerRafraichissementCarte() {
if(timer != null) {
window.clearTimeout(timer);
}
if(requeteChargementPoints != null) {
requeteChargementPoints.abort();
}
timer = window.setTimeout(function() {
var zoom = map.getZoom();
var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(map.getBounds().getNorthEast().lng());
var SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(map.getBounds().getSouthWest().lng());
chargerMarqueurs(zoom, NELatLng, SWLatLng);
}, 400);
}
 
var premierChargement = true;
var marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
google.maps.event.removeListener(listener);
var url = stationsUrl+
'&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
$.getJSON(url, function(data) {
$.each(marqueurs, function(index, marqueur) {
marqueur.setMap(null);
});
marqueurs = new Array();
stations = data;
afficherTitreCarte();
/*if(premierChargement) {
var bounds = new google.maps.LatLngBounds();
}*/
$.each(stations.points, function (index, station) {
/*if(premierChargement) {
var maLatLng = null;
maLatLng = new google.maps.LatLng(station['lat'], station['lng']);
bounds.extend(maLatLng);
}*/
if(station != null) {
marqueurs.push(creerMarqueur(station));
}
});
/*if(premierChargement) {
map.fitBounds(bounds);
premierChargement = false;
}*/
rafraichirCarte();
if(infoBulleOuverte) {
return;
}
if(requeteChargementPoints != null) {
requeteChargementPoints.abort();
cacherMessageChargementPoints();
}
afficherMessageChargementPoints();
requeteChargementPoints = $.getJSON(url, function(data) {
rafraichirMarqueurs(data);
cacherMessageChargementPoints();
});
}
 
function afficherMessageChargementPoints() {
$('#zone-chargement-point').css('display','block');
}
 
function cacherMessageChargementPoints() {
$('#zone-chargement-point').css('display','none');
}
 
function rafraichirMarqueurs(data) {
$.each(marqueurs, function(index, marqueur) {
marqueur.setMap(null);
});
marqueurs = new Array();
stations = data;
afficherTitreCarte();
$.each(stations.points, function (index, station) {
if(station != null) {
var nouveauMarqueur = creerMarqueur(station);
marqueurs.push(nouveauMarqueur);
}
});
}
 
function creerMarqueur(station) {
var titre = station['nbreMarqueur'];
var titre = '';
if(station.nbreMarqueur) {
titre = station.nbreMarqueur+' points renseignés';
} else {
if(station.nom) {
titre = station.nom;
}
}
//var titre = station['nbreMarqueur'];
var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']);
var latLng = new google.maps.LatLng(station['lat'], station['lng']);
var marqueur = new google.maps.Marker({
220,7 → 244,13
return marqueur;
}
 
function rafraichirCarteSauv() {
function rendrePointsVisibles(bounds) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
map.panToBounds(bounds);
}
 
function programmerRafraichissementCarteSauv() {
var points = [];
var bounds = new google.maps.LatLngBounds();
295,13 → 325,23
}
}
 
function surClickMarqueur() {
pointClique = this;
function surClickMarqueur(event) {
 
if(infoBulleOuverte) {
infoBulle.close();
}
pointClique = this;
infoBulle.open(map, this);
//centrerInfoBulle();
actualiserPagineur();
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
afficherInfoBulle();
chargerObs(0, 0);
}
 
function surClickGroupe() {
352,7 → 392,7
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
 
var infoBulleOuverte = false;
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
360,7 → 400,8
}
 
function surFermetureInfoBulle() {
//deplacerCarteSurPointClique();
infoBulleOuverte = false;
programmerRafraichissementCarte();
}
 
function centrerInfoBulle() {
376,6 → 417,8
var largeur = definirLargeurInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
infoBulle.setContent(obsHtml);
chargerObs(0, 0);
infoBulleOuverte = true;
}
 
function definirLargeurInfoBulle() {
397,6 → 440,10
}
}
 
function afficherMessageChargementTitreInfoBulle() {
$("#obs-station-titre").text("Chargement des observations");
}
 
function supprimerMessageChargement() {
$('#chargement').remove();
}
405,32 → 452,66
if (depart == 0 || depart < total) {
var limite = 300;
if (depart == 0) {
obsStation = new Array();
viderTableauObs();
}
//console.log("Chargement de "+depart+" à "+(depart+limite));
var urlObs = observationsUrl+'&start={start}&limit='+limite;
urlObs = urlObs.replace(/\{stationId\}/g, pointClique.stationInfos.id);
if (pointClique.stationInfos.type_emplacement == 'communes') {
urlObs = urlObs.replace(/commune=%2A/g, 'commune='+pointClique.stationInfos.nom);
}
urlObs = urlObs.replace(/\{nt\}/g, nt);
urlObs = urlObs.replace(/\{start\}/g, depart);
$.getJSON(urlObs, function(observations){
obsStation = obsStation.concat(observations.observations);
chargerObs(depart+limite, pointClique.stationInfos.nbre);
surRetourChargementObs(observations, depart, total);
chargerObs(depart+limite, observations.total);
});
}
}
 
function viderTableauObs() {
obsStation = new Array();
surClicPagePagination(0, null);
}
 
function surRetourChargementObs(observations, depart, total) {
obsStation = obsStation.concat(observations.observations);
if (depart == 0) {
actualiserInfosStation(observations);
creerTitreInfoBulle();
surClicPagePagination(0, null);
}
afficherPagination();
actualiserPagineur();
selectionnerOnglet("#obs-vue-"+pagineur.format);
}
 
function actualiserInfosStation(infos) {
pointClique.stationInfos.commune = infos.commune;
pointClique.stationInfos.obsNbre = infos.total;
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
var titre = '';
titre += pointClique.stationInfos.obsNbre+' observation';
titre += (pointClique.stationInfos.obsNbre > 1) ? 's': '' ;
titre += ' pour ';
if (etreMarqueurCommune(pointClique.stationInfos.id)) {
nomStation = 'la commune : ';
} else {
if (pagineur.limite < total) {
afficherPagination();
surClicPagePagination(0, null);
} else {
surClicPagePagination(0, null);
selectionnerOnglet("#obs-vue-"+pagineur.format);
}
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
}
 
function actualiserPagineur() {
pagineur.stationId = pointClique.stationInfos.id;
pagineur.total = pointClique.stationInfos.nbre;
pagineur.total = pointClique.stationInfos.obsNbre;
if (pagineur.total > 4) {
pagineur.format = 'tableau';
} else {
478,22 → 559,7
}
}
 
function afficherTitreInfoBulle() {
var titre = '';
titre += pointClique.stationInfos.nbre+' observation';
titre += (pointClique.stationInfos.nbre > 1) ? 's': '' ;
titre += ' pour ';
if (etreMarqueurCommune(pointClique.stationInfos.id)) {
nomStation = 'la commune : ';
} else {
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
}
 
function initialiserContenuInfoBulle() {
afficherTitreInfoBulle();
afficherMessageChargement('#observations');
cacherContenuOnglets();
afficherOnglets();
601,12 → 667,12
'<\/div>';
return tpl;
}
}).live('click', function(e) {
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
});
}).live('click', function(e) {
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
});
}
 
function ajouterFomulaireContact(element) {
811,17 → 877,26
function filtrerParTaxon() {
var ntAFiltrer = $('.nt', this).text();
infoBulle.close();
var zoom = map.getZoom();
var NELatLng = map.getBounds().getNorthEast().lat()+'|'+map.getBounds().getNorthEast().lng();
var SWLatLng = map.getBounds().getSouthWest().lat()+'|'+map.getBounds().getSouthWest().lng();
$('#taxon-'+nt).removeClass('taxon-actif');
if (nt == ntAFiltrer) {
nt = '*';
executerMarkerClusterer(pointsOrigine, boundsOrigine);
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+nt);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
} else {
var url = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer);
$.getJSON(url, function (stationsFiltrees) {
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer);
url = stationsUrl;
url += '&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
requeteChargementPoints = $.getJSON(url, function (stationsFiltrees) {
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirCarte();
rafraichirMarqueurs(stations);
});
}
};