Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1475 → Rev 3220

/branches/v1.6-croc/widget/modules/carto/config.defaut.ini
3,6 → 3,3
communesKmzChemin = "/home/telabotap/www/commun/google/map/3/kmz/communes/,/home/telabotap/www/commun/google/map/3/kmz/communes_incompletes/"
; Template de l'url où charger les fichiers kml des limites communales.
limitesCommunaleUrlTpl = "http://www.tela-botanica.org/eflore/cel2/widget/modules/carto/squelettes/kml/%s/%s"
communeImageUrl = "http://www.tela-botanica.org/commun/icones/carto/commune.png"
pointImageUrl = "http://www.tela-botanica.org/commun/icones/carto/point2.png"
groupeImageUrlTpl = "http://www.tela-botanica.org/service:cel:CelWidgetMapPoint/icone-groupe?type={type}&nbre={nbre}"
/branches/v1.6-croc/widget/modules/carto/Carto.php
41,6 → 41,7
private $num_taxon = null;
private $station = null;
private $format = null;// Format des obs pour les stations (tableau/liste)
private $photos = null; // Seulement les obs avec photos ou bien toutes
/**
* Méthode appelée par défaut pour charger ce widget.
70,6 → 71,7
$this->utilisateur = (isset($utilisateur) ? $utilisateur : '*');
$this->projet = (isset($projet) ? $projet : '*');
$this->tag = (isset($tag) ? $tag : '*');
$this->tag = (isset($motcle) ? $motcle : $this->tag);
$this->dept = (isset($dept) ? $dept : '*');
$this->commune = (isset($commune) ? $commune : '*');
$this->num_taxon = (isset($num_taxon) ? $num_taxon : '*');
78,6 → 80,7
$this->commentaire = (isset($commentaire) ? $commentaire : null);
$this->station = (isset($station) ? $station : null);
$this->format = (isset($format) ? $format : null);
$this->photos = (isset($photos) ? $photos : null);
$this->start = (isset($start) ? $start : null);
$this->limit = (isset($limit) ? $limit : null);
}
103,10 → 106,8
$widget['donnees']['date'] = $this->date;
$widget['donnees']['taxon'] = $this->taxon;
$widget['donnees']['commentaire'] = $this->commentaire;
$widget['donnees']['photos'] = $this->photos;
$widget['donnees']['url_limites_communales'] = $this->obtenirUrlsLimitesCommunales();
$widget['donnees']['communeImageUrl'] = $this->config['carto']['communeImageUrl'];
$widget['donnees']['pointImageUrl'] = $this->config['carto']['pointImageUrl'];
$widget['donnees']['groupeImageUrlTpl'] = $this->config['carto']['groupeImageUrlTpl'];
$widget['squelette'] = 'carte_defaut';
122,7 → 123,7
$parametres_retenus = array();
$parametres_a_tester = array('station', 'utilisateur', 'projet', 'tag', 'dept', 'commune',
'num_taxon', 'taxon', 'date', 'commentaire',
'start', 'limit');
'start', 'limit', 'photos');
foreach ($parametres_a_tester as $param) {
if (isset($this->$param) && $this->$param != '*') {
$parametres_retenus[$param] = $this->$param;
142,7 → 143,7
private function obtenirUrlsLimitesCommunales() {
$urls = null;
if (isset($this->dept)) {
// si on veut afficher les limites départemmentales on va compter et chercher les noms de fichiers
// si on veut afficher les limites départementales on va compter et chercher les noms de fichiers
$fichiersKml = $this->chercherFichierKml();
if (count($fichiersKml) > 0) {
foreach ($fichiersKml as $kml => $dossier){
195,4 → 196,5
return $widget;
}
}
}
?>
/branches/v1.6-croc/widget/modules/carto/squelettes/carte_defaut.tpl.html
25,7 → 25,7
<!-- <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> -->
<!-- Google Map v3 -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=true&amp;language=fr&amp;region=FR"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/google/map/3/markermanager/1.0/markermanager-1.0.pack.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/google/map/3/markerclusterer/2.0.1/markerclusterer-2.0.1.pack.js"></script>
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.6.2/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.15/js/jquery-ui-1.8.15.custom.min.js"></script>
36,6 → 36,9
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.8.1/messages_fr.js"></script>
<!-- Javascript : données -->
<script src="<?=$url_stations?>" type="text/javascript"></script>
<!-- Javascript : appli carto -->
<script type="text/javascript">
//<![CDATA[
42,15 → 45,19
var urlsLimitesCommunales = <?=$url_limites_communales?>;
var nt = '<?=$num_taxon?>';
var filtreCommun =
'&taxon=<?=rawurlencode($taxon)?>'+
'&taxon=<?=$taxon?>'+
'&utilisateur=<?=$utilisateur?>'+
'&projet=<?=rawurlencode($projet)?>'+
'&tag=<?=rawurlencode($tag)?>'+
'&projet=<?=$projet?>'+
'&tag=<?=$tag?>'+
'&date=<?=$date?>'+
'&dept=<?=$dept?>'+
'&commune=<?=rawurlencode($commune)?>'+
'&commentaire=<?=rawurlencode($commentaire)?>';
var stationsUrl = '<?=$url_cel_carto?>/tout'+'?'+
'&commune=<?=$commune?>'+
'&commentaire=<?=$commentaire?>';
var photos = '<?= ($photos != null) ? $photos : null; ?>';
if(photos != null) {
filtreCommun += '&photos=<?=rawurlencode($photos)?>';
}
var stationsUrl = '<?=$url_cel_carto?>/stations'+'?'+
'num_taxon='+nt+
filtreCommun;
var taxonsUrl = '<?=$url_cel_carto?>/taxons'+'?'+
60,9 → 67,6
'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>
74,38 → 78,22
</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/carto/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">
<a href="http://www.tela-botanica.org/site:accueil"
title="Aller à l'accueil de Tela Botanica"
onclick="ouvrirNouvelleFenetre(this, event)">
onclick="window.open(this.href); arreter(event); return false;">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.png" alt="TB" />
</a>
</span>
<span id="carte-titre-infos">Cartographie</span>
- <a href="http://www.tela-botanica.org/appli:cel"
title="Carnet en Ligne"
onclick="ouvrirNouvelleFenetre(this, event)">
CEL
</a>
(<a href="http://www.tela-botanica.org/" onclick="ouvrirNouvelleFenetre(this, event)">Tela Botanica</a>)
<span id="obs-nbre">&nbsp;</span> observations <?= ($photos != null && $photos == 1) ? 'avec photos' : ''; ?>
<span class="plante-titre">de <span class="plantes-nbre">&nbsp;</span> plantes</span> sur
<span id="commune-nbre">&nbsp;</span> communes
- <a href="http://www.tela-botanica.org/appli:cel" title="Carnet en Ligne" onclick="window.open(this.href); arreter(event); return false;">CEL</a> (<a href="http://www.tela-botanica.org/" onclick="window.open(this.href); arreter(event); return false;">Tela Botanica</a>)
</h1>
<div id="zone-info">
<a href="<?=$url_base?>carto?carte=avertissement"
onClick="ouvrirPopUp(this, 'Avertissement', event)">
<a href="<?=$url_base?>carto?carte=avertissement" onClick="ouvrirPopUp('<?=$url_base?>carto?carte=avertissement', 'Avertissement'); arreter(event); return false;">
<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
alt="Avertissements" title="Avertissements &amp; informations" />
</a>
136,7 → 124,7
<!-- Squelette du message de chargement des observations -->
<script id="tpl-chargement" type="text/x-jquery-tmpl">
<div id="chargement" style="height:300px;">
<div id="chargement" style="height:500px;">
<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p>Chargement des observations en cours...</p>
</div>
146,7 → 134,7
<script id="tpl-obs" type="text/x-jquery-tmpl">
<div id="info-bulle" style="width:{largeur}px;">
<div id="obs">
<h2 id="obs-station-titre">Station</h2>
<h2><span id="obs-total">&nbsp;</span> observations pour <span id="obs-commune">&nbsp;</span></h2>
<div class="navigation">&nbsp;</div>
<div>
<ul>
176,10 → 164,11
</ol>
</div>
</div>
<div class="navigation">&nbsp;</div>
<div id="obs-pieds-page">
<p id="obs-msg-info">Les observations de cette carte sont regroupées par commune.</p>
<p>Id : <span id="obs-station-id">&nbsp;</span></p>
</div>
<div class="navigation">&nbsp;</div>
</div>
</div>
</script>
190,8 → 179,8
<td>
<span class="nom-sci">&nbsp;
{{if nn != 0}}
<a href="http://www.tela-botanica.org/nn${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
<a href="http://www.tela-botanica.org/bdtfx-nn-${nn}"
onclick="window.open(this.href); arreter(event); return false; ">
${nomSci}
</a>
{{else}}
249,8 → 238,8
<dd title="Nom défini par l'utilisateur{{if nn != 0}}. Cliquez pour accéder à la fiche d'eFlore.{{/if}}">
<span class="nom-sci">&nbsp;
{{if nn != 0}}
<a href="http://www.tela-botanica.org/nn${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
<a href="http://www.tela-botanica.org/bdtfx-nn-${nn}"
onclick="window.open(this.href); arreter(event); return false; ">
${nomSci}
</a>
{{else}}
335,4 → 324,4
//]]>
</script>
</body>
</html>
</html>
/branches/v1.6-croc/widget/modules/carto/squelettes/scripts/carto.js
2,23 → 2,16
// 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 ;
* var pointImageUrl ;
* var groupeImageUrlTpl ;
*/
var pointImageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png';
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 carteCentre = new google.maps.LatLng(46.4, 3.10);
var carteOptions = {
zoom: 3,
center:carteCentre,
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
mapTypeIds: ['OSM',
28,6 → 21,7
google.maps.MapTypeId.TERRAIN]
}
};
var ctaLayer = null;
var osmMapType = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" +
39,16 → 33,11
name: "OSM",
maxZoom: 19
});
var ctaLayer = null;
var pagineur = {'limite':50, '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;
/*+--------------------------------------------------------------------------------------------------------+*/
// INITIALISATION DU CODE
 
58,48 → 47,26
});
 
function initialiserWidget() {
afficherStats();
definirTailleTitre();
initialiserAffichageCarte();
initialiserAffichagePanneauLateral();
initialiserCarte();
initialiserGestionnaireMarqueurs()
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
attribuerListenerCarte();
programmerRafraichissementCarte();
rafraichirCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// AFFICHAGE GÉNÉRAL
 
function afficherTitreCarte() {
if (stations != null && taxonsCarte.length > 0) {
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 = obsNbreFormate+' observation';
titre += (obsNbre > 1) ? 's' : '' ;
if (nt == '*') {
titre += ' de '+plteNbreFormate+' plante';
titre += (plteNbre > 1) ? 's' : '' ;
} else {
if (taxonsCarte[0]) {
var taxon = taxonsCarte[0];
titre += ' pour '+taxon.nom;
}
}
titre += ' sur '+communeNbreFormate+' commune';
titre += (communeNbre > 1) ? 's' : '' ;
$('#carte-titre-infos').text(titre);
}
function afficherStats() {
// Ajout du nombre de communes où des observations ont eu lieu
$('#commune-nbre').text(stations.stats.communes.formaterNombre());
// Ajout du nombre d'observations
$('#obs-nbre').text(stations.stats.observations.formaterNombre());
}
 
function definirTailleTitre() {
121,7 → 88,7
function initialiserAffichageCarte() {
$('#carte').height($(window).height() - 35);
$('#carte').width($(window).width() - 24);
 
if (nt != '*') {
$('#carte').css('left', 0);
}
133,139 → 100,48
map.mapTypes.set('OSM', osmMapType);
}
 
function initialiserGestionnaireMarqueurs() {
mgr = new MarkerManager(map);
}
 
function chargerLimitesCommunales() {
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: false});
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: true});
ctaLayer.setMap(map);
}
}
}
 
var listener = null;
var timer = null;
function attribuerListenerCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', function(){
programmerRafraichissementCarte();
});
listener = google.maps.event.addListener(map, 'zoom_changed', function(){
programmerRafraichissementCarte();
});
}
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 marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
var url = stationsUrl+
'&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
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 = '';
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({
position: latLng,
icon: icone,
title: ''+titre,
map: map,
stationInfos: station
});
attribuerListenerClick(marqueur, station['id']);
marqueur.setMap(map);
return marqueur;
}
 
function rendrePointsVisibles(bounds) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
map.panToBounds(bounds);
}
 
function programmerRafraichissementCarteSauv() {
var pointCentreAvantAffichageInfoBulle = null;
function rafraichirCarte() {
var points = [];
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < stations.points.length; ++i) {
var point = stations.points[i];
var maLatLng = new google.maps.LatLng(point.lat, point.lng);
var stationImage = attribuerImageMarqueur(point.id);
for (var i = 0; i < stations.stats.communes; ++i) {
var maLatLng = new google.maps.LatLng(stations.points[i].latitude, stations.points[i].longitude);
var pointImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(24, 32));
var point = new google.maps.Marker({
position: maLatLng,
map: map,
icon: stationImage,
stationInfos: point
icon: pointImage,
stationId: stations.points[i].id
});
 
bounds.extend(maLatLng);
google.maps.event.addListener(point, 'click', surClickMarqueur);
google.maps.event.addListener(point, 'click', function() {
pointCentreAvantAffichageInfoBulle = map.getCenter();
pointClique = this;
infoBulle.open(map, this);
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);
});
points.push(point);
}
 
277,148 → 153,31
executerMarkerClusterer(points, bounds);
}
 
function attribuerImageMarqueur(id, nbreMarqueur) {
var marqueurImage = null;
if (etreMarqueurCommune(id)) {
marqueurImage = new google.maps.MarkerImage(communeImageUrl, new google.maps.Size(24, 32));
} 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;
if (nbreMarqueur != null) {
if (nbreMarqueur >= 2 && nbreMarqueur < 100 ) {
type = '1';
largeur = 53;
hauteur = 52;
} else if (nbreMarqueur >= 100 && nbreMarqueur < 1000 ) {
type = '2';
largeur = 56;
hauteur = 55;
} else if (nbreMarqueur >= 1000 && nbreMarqueur < 10000 ) {
type = '3';
largeur = 66;
hauteur = 65;
} else if (nbreMarqueur >= 10000 && nbreMarqueur < 20000 ) {
type = '4';
largeur = 78;
hauteur = 77;
} else if (nbreMarqueur >= 20000) {
type = '5';
largeur = 66;
hauteur = 65;
}
}
groupeImageUrl = groupeImageUrlTpl.replace(/\{type\}/, type);
groupeImageUrl = groupeImageUrl.replace(/\{nbre\}/, nbreMarqueur);
marqueurImage = new google.maps.MarkerImage(groupeImageUrl, new google.maps.Size(largeur, hauteur));
}
return marqueurImage
function deplacerCartePointClique() {
map.panTo(pointCentreAvantAffichageInfoBulle);
}
 
function attribuerListenerClick(marqueur, id) {
if (etreMarqueurCommune(id) || etreMarqueurStation(id)) {
google.maps.event.addListener(marqueur, 'click', surClickMarqueur);
} else if (etreMarqueurGroupe(id)) {
google.maps.event.addListener(marqueur, 'click', surClickGroupe);
}
}
 
function surClickMarqueur(event) {
 
if(infoBulleOuverte) {
infoBulle.close();
}
pointClique = this;
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());
map.panTo(centreSudLatLng);
afficherInfoBulle();
}
 
function surClickGroupe() {
map.setCenter(this.getPosition());
var nouveauZoom = map.getZoom() + 2;
map.setZoom(nouveauZoom);
mgr.clearMarkers();
}
 
function etreMarqueurGroupe(id) {
var groupe = false;
var motif = /^GROUPE/;
if (motif.test(id)) {
groupe = true;
}
return groupe;
}
 
function etreMarqueurCommune(id) {
var commune = false;
var motif = /^COMMUNE:/;
if (motif.test(id)) {
commune = true;
}
return commune;
}
 
function etreMarqueurStation(id) {
var station = false;
var motif = /^STATION:/;
if (motif.test(id)) {
station = true;
}
return station;
}
 
function deplacerCarteSurPointClique() {
map.panTo(pointClique.position);
}
 
function executerMarkerClusterer(points, bounds) {
if (markerClusterer) {
markerClusterer.clearMarkers();
}
markerClusterer = new MarkerClusterer(map, points, {gridSize: 50, maxZoom: 18});
markerClusterer = new MarkerClusterer(map, points);
map.fitBounds(bounds);
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
var infoBulleOuverte = false;
 
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
google.maps.event.addListener(infoBulle, 'content_changed', definirLargeurInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', deplacerCartePointClique);
}
 
function surFermetureInfoBulle() {
infoBulleOuverte = false;
programmerRafraichissementCarte();
}
 
function centrerInfoBulle() {
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);
}
 
function afficherInfoBulle() {
var obsHtml = $("#tpl-obs").html();
var largeur = definirLargeurInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
infoBulle.setContent(obsHtml);
chargerObs(0, 0);
infoBulleOuverte = true;
}
 
function definirLargeurInfoBulle() {
440,10 → 199,6
}
}
 
function afficherMessageChargementTitreInfoBulle() {
$("#obs-station-titre").text("Chargement des observations");
}
 
function supprimerMessageChargement() {
$('#chargement').remove();
}
452,66 → 207,43
if (depart == 0 || depart < total) {
var limite = 300;
if (depart == 0) {
viderTableauObs();
obsStation = new Array();
}
//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(/\{stationId\}/g, pointClique.stationId);
urlObs = urlObs.replace(/\{nt\}/g, nt);
urlObs = urlObs.replace(/\{start\}/g, depart);
$.getJSON(urlObs, function(observations){
surRetourChargementObs(observations, depart, total);
chargerObs(depart+limite, observations.total);
obsStation = obsStation.concat(observations.observations);
if (depart == 0) {
actualiserInfosStation(observations);
actualiserPagineur();
creerTitreInfoBulle();
}
//console.log("Chargement ok");
chargerObs(depart+limite, station.obsNbre);
});
} else {
if (pagineur.limite < total) {
afficherPagination();
} else {
surClicPagePagination(0, null);
selectionnerOnglet("#obs-vue-"+pagineur.format);
}
}
}
 
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;
station.commune = infos.commune;
station.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 {
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
}
 
function actualiserPagineur() {
pagineur.stationId = pointClique.stationInfos.id;
pagineur.total = pointClique.stationInfos.obsNbre;
pagineur.stationId = pointClique.stationId;
pagineur.total = station.obsNbre;
//console.log("Total pagineur: "+pagineur.total);
if (pagineur.total > 4) {
pagineur.format = 'tableau';
} else {
559,20 → 291,19
}
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
}
 
function initialiserContenuInfoBulle() {
afficherOnglets();
afficherMessageChargement('#observations');
cacherContenuOnglets();
afficherOnglets();
ajouterTableauTriable("#obs-tableau");
afficherTextStationId();
corrigerLargeurInfoWindow();
}
 
function cacherContenuOnglets() {
$("#obs-vue-tableau").css("display", "none");
$("#obs-vue-liste").css("display", "none");
}
 
function afficherOnglets() {
var $tabs = $('#obs').tabs();
$('#obs').bind('tabsselect', function(event, ui) {
582,21 → 313,15
surClicAffichageListe();
}
});
if (pointClique.stationInfos.nbre > 4) {
$tabs.tabs('select', "#obs-vue-tableau");
} else {
$tabs.tabs('select', "#obs-vue-liste");
}
$tabs.tabs('select', "#obs-vue-"+pagineur.format);
}
 
function selectionnerOnglet(onglet) {
$(onglet).css('display', 'block');
$('#obs').tabs('select', onglet);
}
 
function afficherTextStationId() {
$('#obs-station-id').text(pointClique.stationInfos.id);
$('#obs-station-id').text(pointClique.stationId);
}
 
function corrigerLargeurInfoWindow() {
604,6 → 329,7
}
 
function surClicAffichageTableau(event) {
//console.log('tableau');
pagineur.format = 'tableau';
mettreAJourObservations();
mettreAJourTableauTriable("#obs-tableau");
610,6 → 336,7
}
 
function surClicAffichageListe(event) {
//console.log('liste');
pagineur.format = 'liste';
mettreAJourObservations();
ajouterGaleriePhoto("a.cel-img");
667,12 → 394,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) {
715,9 → 442,9
}
 
function chargerInfoObsPourMessage(idObs) {
var nomSci = jQuery.trim($(".cel-obs-"+idObs+" .nom-sci:eq(0)").text());
var date = jQuery.trim($(".cel-obs-"+idObs+" .date:eq(0)").text());
var lieu = jQuery.trim($(".cel-obs-"+idObs+" .lieu:eq(0)").text());
var nomSci = trim($(".cel-obs-"+idObs+" .nom-sci:eq(0)").text());
var date = trim($(".cel-obs-"+idObs+" .date:eq(0)").text());
var lieu = trim($(".cel-obs-"+idObs+" .lieu:eq(0)").text());
var sujet = "Observation #"+idObs+" de "+nomSci;
var message = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de \""+nomSci+'" du "'+date+'" au lieu "'+lieu+'".';
$("#fc_sujet").attr('value', sujet);
758,7 → 485,7
}
if (cle == 'message') {
champ.value += "\n--\n"+
"Ce message vous est envoyé par l'intermédiaire du widget carto "+
"Ce message vous est envoyé par l'intermédiaire du widget Cartographique "+
"du Carnet en Ligne du réseau Tela Botanica.\n"+
"http://www.tela-botanica.org/widget:cel:carto";
}
800,7 → 527,7
'Une erreur est survenue lors de la transmission de votre message.'+'<br />'+
'Vous pouvez signaler le disfonctionnement à <a href="'+
'mailto:cel@tela-botanica.org'+'?'+
'subject=Disfonctionnement du widget carto'+
'subject=Disfonctionnement du widget de Cartographie'+
"&body="+erreurMsg+"\nDébogage :\n"+debugMsg+
'">cel@tela-botanica.org</a>.'+
'</p>');
842,17 → 569,26
} else {
if (nt == '*') {
afficherTaxons();
} else {
afficherNomPlante();
}
afficherTitreCarte();
}
}
 
function afficherTaxons() {
$(".plantes-nbre").text(taxonsCarte.length);
// Ajout du nombre de plantes au titre
$('.plantes-nbre').text(taxonsCarte.length.formaterNombre());
$("#tpl-taxons-liste").tmpl({'taxons':taxonsCarte}).appendTo("#pl-corps");
$('.taxon').live('click', filtrerParTaxon);
}
 
function afficherNomPlante() {
if (nt != '*') {
var taxon = taxonsCarte[0];
$('.plante-titre').text('pour '+taxon.nom);
}
}
 
function afficherPanneauLateral() {
$('#panneau-lateral').width(300);
874,29 → 610,26
google.maps.event.trigger(map, 'resize');
};
 
function ouvrirPopUp(url, nom) {
window.open(url, nom, 'scrollbars=yes,width=650,height=600,directories=no,location=no,menubar=no,status=no,toolbar=no');
};
 
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 = '*';
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+nt);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
executerMarkerClusterer(pointsOrigine, boundsOrigine);
} else {
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer);
url = stationsUrl;
url += '&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
requeteChargementPoints = $.getJSON(url, function (stationsFiltrees) {
var url = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer)+
'&formatRetour=jsonP'+
'&callback=?';
$.getJSON(url, function (stationsFiltrees) {
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirMarqueurs(stations);
rafraichirCarte();
});
}
};
904,28 → 637,6
/*+--------------------------------------------------------------------------------------------------------+*/
// FONCTIONS UTILITAIRES
 
function ouvrirPopUp(element, nomPopUp, event) {
var options =
'width=650,'+
'height=600,'+
'scrollbars=yes,'+
'directories=no,'+
'location=no,'+
'menubar=no,'+
'status=no,'+
'toolbar=no';
var popUp = window.open(element.href, nomPopUp, options);
if (window.focus) {
popUp.focus();
}
return arreter(event);
};
 
function ouvrirNouvelleFenetre(element, event) {
window.open(element.href);
return arreter(event);
}
 
function arreter(event) {
if (event.stopPropagation) {
event.stopPropagation();
932,10 → 643,6
} else if (window.event) {
window.event.cancelBubble = true;
}
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
return false;
}
 
1024,4 → 731,8
msg = "La variable vaut null.";
}
console.log(msg);
}
}
 
function trim (chaine) {
return chaine.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
/branches/v1.6-croc/widget/modules/carto/squelettes/css/carto.css
19,7 → 19,7
}
a, a:active, a:visited {
border-bottom:1px dotted #666;
color:#CCC;
color: #AAAAAA;
text-decoration:none;
}
a:active {
101,6 → 101,7
hr.nettoyage{
visibility:hidden;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Carte */
#carte {
155,7 → 156,9
width:100%;
height:35px;
overflow:hidden;
background-color:#4A4B4C;
background-color: #DDDDDD;
border-bottom: 1px solid grey;
z-index: 9;
}
#zone-info {
position:absolute;
174,7 → 177,7
display:inline-block;
margin:0;
padding:0.2em;
color:#CCCCCC;
color: black;
}
#carte-titre {/*Hack CSS fonctionne seulement dans ie6, 7 & 8 */
display:inline !hackCssIe6Et7;/*Hack CSS pour ie6 & ie7 */
191,8 → 194,9
bottom:0;
width:24px;
overflow:hidden;
background-color:#4A4B4C;
border-right:1px solid grey;
background-color: #DDDDDD;
border-right: 1px solid grey;
z-index: 10;
}
#pl-contenu {
display:none;
218,13 → 222,13
}
#pl-ouverture {
left:0;
background:url(../images/ouverture.png) no-repeat top left #4A4B4C;
background:url(../images/ouverture.png) no-repeat top left #DDDDDD;
height:100%;
}
#pl-fermeture {
display:none;
left:276px;
background:url(../images/fermeture.png) no-repeat top right #4A4B4C;
background:url(../images/fermeture.png) no-repeat top right #DDDDDD;
}
#pl-ouverture span, #pl-fermeture span{
display:none;
231,11 → 235,11
}
/* Panneau latéral : balises */
#panneau-lateral h2, #panneau-lateral p {
color:#CCCCCC;}
color:black;}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Liste des taxons de la carte */
#taxons {
color:#999;
color:black;
}
#taxons .taxon-actif, #taxons .taxon-actif span {
color:#56B80E;
242,7 → 246,7
}
#taxons li span {
border-bottom:1px dotted #666;
color:#CCC;
color:black;
}
#taxons li span:focus {
outline:thin dotted;
258,8 → 262,8
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Pop-up observations */
#info-bulle{
min-height:500px;
width:500px;
min-height:300px;
/*width:géstion via le Javascript;*/
}
#observations {
overflow:none;
425,12 → 429,13
width:300px;
height:200px;
}
#form-contact #fc_envoyer{
width:50px;
#form-contact #fc_envoyer, #fc_annuler, #fc_effacer{
width:75px;
}
#fc_envoyer{
float:right;
}
#form-contact #fc_annuler{
width:50px;
#fc_annuler{
float:left;
}
#form-contact label.error {
444,4 → 449,4
color: white;
white-space: pre-wrap;
width: 300px;
}
}
/branches/v1.6-croc/widget/modules/carto/squelettes/obs_tableau.tpl.html
New file
0,0 → 1,35
<div class="info-bulle-contenu">
<div class="onglets">
<ul>
<li class="actif"><span class="onglet">Tableau</span></li>
<li class="inactif"><a class="onglet" onclick="chargerFormatObs('<?=$station_id?>', 'liste');return false;" href="#">Liste</a></li>
</ul>
</div>
<div id="observations">
<table>
<caption><h2><?=count($observations)?> observations pour <?=(isset($commune) ? $commune : '?')?></h2></caption>
<thead>
<tr>
<th>Nom</th><th>Date</th><th>Lieu</th><th>Observateur</th>
</tr>
</thead>
<tbody>
<? foreach ($observations as $obs) : ?>
<tr>
<td>&nbsp;
<? if (isset($obs['nn']) && $obs['nn'] != '' && $obs['nn'] != 0) : ?>
<a href="http://www.tela-botanica.org/bdtfx-nn-<?=$obs['nn']?>" onclick="window.open(this.href); arreter(event); return false; "><?=$obs['nom']?></a>
<? else : ?>
<?=$obs['nom']?>
<? endif; ?>
</td>
<td>&nbsp;<?=$obs['date']?></td>
<td>&nbsp;<?=$obs['lieu']?></td>
<td>&nbsp;<?=$obs['observateur']?></td>
</tr>
<? endforeach; ?>
</tbody>
</table>
<? include(dirname(__FILE__).'/obs_msg_info.tpl.html') ?>
</div>
</div>
/branches/v1.6-croc/widget/modules/carto/squelettes/obs_liste.tpl.html
New file
0,0 → 1,43
<div class="info-bulle-contenu">
<div class="onglets">
<ul>
<li class="inactif"><a class="onglet" onclick="chargerFormatObs('<?=$station_id?>', 'tableau');return false;" href="#">Tableau</a></li>
<li class="actif"><span class="onglet">Liste</span></li>
</ul>
</div>
<div id="observations">
<h2><?=count($observations)?> observations pour <?=(isset($commune) ? $commune : '?')?></h2>
<ol>
<? foreach ($observations as $obs) : ?>
<li>
<div>
<? if (isset($images[$obs['id']])) : ?>
<? foreach ($images[$obs['id']] as $num => $urls) : ?>
<div<?=($num == 0) ? ' class="cel-img-principale"': ' class="cel-img-secondaire"'?>>
<a class="cel-img" href="<?=$urls['normale']?>" rel="cel-obs-<?=$obs['id']?>">
<img src="<?=$urls['miniature']?>" alt="Image #<?=$urls['id']?> de l'osbervation #<?=$obs['id']?>" />
</a>
</div>
<? endforeach ?>
<? endif ?>
<dl>
<dt class="champ_nom_latin">Nom</dt>
<dd>&nbsp;
<? if (isset($obs['nn']) && $obs['nn'] != '' && $obs['nn'] != 0) : ?>
<a href="http://www.tela-botanica.org/bdtfx-nn-<?=$obs['nn']?>" onclick="window.open(this.href); arreter(event); return false; "><?=$obs['nom']?></a>
<? else : ?>
<?=$obs['nom']?>
<? endif; ?>
</dd>
<dt>Lieu</dt><dd>&nbsp;<?=$obs['lieu']?></dd>
<dt>Publié par</dt><dd>&nbsp;<?=$obs['observateur']?></dd>
<dt>Le</dt><dd>&nbsp;<?=$obs['date']?></dd>
</dl>
<hr class="nettoyage"/>
</div>
</li>
<? endforeach; ?>
</ol>
<? include(dirname(__FILE__).'/obs_msg_info.tpl.html') ?>
</div>
</div>