Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1547 → Rev 1516

/trunk/widget/modules/carto/config.defaut.ini
3,3 → 3,6
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}"
/trunk/widget/modules/carto/Carto.php
41,7 → 41,6
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.
71,7 → 70,6
$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 : '*');
80,7 → 78,6
$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);
}
106,8 → 103,10
$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';
123,7 → 122,7
$parametres_retenus = array();
$parametres_a_tester = array('station', 'utilisateur', 'projet', 'tag', 'dept', 'commune',
'num_taxon', 'taxon', 'date', 'commentaire',
'start', 'limit', 'photos');
'start', 'limit');
foreach ($parametres_a_tester as $param) {
if (isset($this->$param) && $this->$param != '*') {
$parametres_retenus[$param] = $this->$param;
143,7 → 142,7
private function obtenirUrlsLimitesCommunales() {
$urls = null;
if (isset($this->dept)) {
// si on veut afficher les limites départementales on va compter et chercher les noms de fichiers
// si on veut afficher les limites départemmentales on va compter et chercher les noms de fichiers
$fichiersKml = $this->chercherFichierKml();
if (count($fichiersKml) > 0) {
foreach ($fichiersKml as $kml => $dossier){
196,5 → 195,4
return $widget;
}
}
?>
}
/trunk/widget/modules/carto/squelettes/obs_liste.tpl.html
File deleted
\ No newline at end of file
/trunk/widget/modules/carto/squelettes/obs_tableau.tpl.html
File deleted
\ No newline at end of file
/trunk/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/markerclusterer/2.0.1/markerclusterer-2.0.1.pack.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/google/map/3/markermanager/1.0/markermanager-1.0.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,9 → 36,6
<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[
45,19 → 42,15
var urlsLimitesCommunales = <?=$url_limites_communales?>;
var nt = '<?=$num_taxon?>';
var filtreCommun =
'&taxon=<?=$taxon?>'+
'&taxon=<?=rawurlencode($taxon)?>'+
'&utilisateur=<?=$utilisateur?>'+
'&projet=<?=$projet?>'+
'&tag=<?=$tag?>'+
'&projet=<?=rawurlencode($projet)?>'+
'&tag=<?=rawurlencode($tag)?>'+
'&date=<?=$date?>'+
'&dept=<?=$dept?>'+
'&commune=<?=$commune?>'+
'&commentaire=<?=$commentaire?>';
var photos = '<?= ($photos != null) ? $photos : null; ?>';
if(photos != null) {
filtreCommun += '&photos=<?=rawurlencode($photos)?>';
}
var stationsUrl = '<?=$url_cel_carto?>/stations'+'?'+
'&commune=<?=rawurlencode($commune)?>'+
'&commentaire=<?=rawurlencode($commentaire)?>';
var stationsUrl = '<?=$url_cel_carto?>/tout'+'?'+
'num_taxon='+nt+
filtreCommun;
var taxonsUrl = '<?=$url_cel_carto?>/taxons'+'?'+
67,6 → 60,9
'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>
78,22 → 74,38
</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="window.open(this.href); arreter(event); return false;">
onclick="ouvrirNouvelleFenetre(this, event)">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.png" alt="TB" />
</a>
</span>
<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>)
<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>)
</h1>
<div id="zone-info">
<a href="<?=$url_base?>carto?carte=avertissement" onClick="ouvrirPopUp('<?=$url_base?>carto?carte=avertissement', 'Avertissement'); arreter(event); return false;">
<a href="<?=$url_base?>carto?carte=avertissement"
onClick="ouvrirPopUp(this, 'Avertissement', event)">
<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
alt="Avertissements" title="Avertissements &amp; informations" />
</a>
124,7 → 136,7
<!-- Squelette du message de chargement des observations -->
<script id="tpl-chargement" type="text/x-jquery-tmpl">
<div id="chargement" style="height:500px;">
<div id="chargement" style="height:300px;">
<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p>Chargement des observations en cours...</p>
</div>
134,7 → 146,7
<script id="tpl-obs" type="text/x-jquery-tmpl">
<div id="info-bulle" style="width:{largeur}px;">
<div id="obs">
<h2><span id="obs-total">&nbsp;</span> observations pour <span id="obs-commune">&nbsp;</span></h2>
<h2 id="obs-station-titre">Station</h2>
<div class="navigation">&nbsp;</div>
<div>
<ul>
164,11 → 176,10
</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>
179,8 → 190,8
<td>
<span class="nom-sci">&nbsp;
{{if nn != 0}}
<a href="http://www.tela-botanica.org/bdtfx-nn-${nn}"
onclick="window.open(this.href); arreter(event); return false; ">
<a href="http://www.tela-botanica.org/nn${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
${nomSci}
</a>
{{else}}
238,8 → 249,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/bdtfx-nn-${nn}"
onclick="window.open(this.href); arreter(event); return false; ">
<a href="http://www.tela-botanica.org/nn${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
${nomSci}
</a>
{{else}}
324,4 → 335,4
//]]>
</script>
</body>
</html>
</html>
/trunk/widget/modules/carto/squelettes/scripts/carto.js
2,16 → 2,23
// PARAMÊTRES et CONSTANTES
// Mettre à true pour afficher les messages de débogage
var DEBUG = false;
var pointImageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png';
/**
* Indication de certaines variables ajoutée par php
* var communeImageUrl ;
* 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(46.4, 3.10);
var carteCentre = new google.maps.LatLng(25, 10);
var carteOptions = {
zoom: 6,
zoom: 3,
center:carteCentre,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
mapTypeIds: ['OSM',
21,7 → 28,6
google.maps.MapTypeId.TERRAIN]
}
};
var ctaLayer = null;
var osmMapType = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" +
33,11 → 39,16
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
 
47,26 → 58,48
});
 
function initialiserWidget() {
afficherStats();
definirTailleTitre();
initialiserAffichageCarte();
initialiserAffichagePanneauLateral();
initialiserCarte();
initialiserGestionnaireMarqueurs()
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
rafraichirCarte();
attribuerListenerCarte();
programmerRafraichissementCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// AFFICHAGE GÉNÉRAL
 
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 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 definirTailleTitre() {
88,7 → 121,7
function initialiserAffichageCarte() {
$('#carte').height($(window).height() - 35);
$('#carte').width($(window).width() - 24);
 
if (nt != '*') {
$('#carte').css('left', 0);
}
100,48 → 133,139
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: true});
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: false});
ctaLayer.setMap(map);
}
}
}
 
var pointCentreAvantAffichageInfoBulle = null;
function rafraichirCarte() {
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 points = [];
var bounds = new google.maps.LatLngBounds();
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));
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);
var point = new google.maps.Marker({
position: maLatLng,
map: map,
icon: pointImage,
stationId: stations.points[i].id
icon: stationImage,
stationInfos: point
});
 
bounds.extend(maLatLng);
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);
});
google.maps.event.addListener(point, 'click', surClickMarqueur);
points.push(point);
}
 
153,31 → 277,148
executerMarkerClusterer(points, bounds);
}
 
function deplacerCartePointClique() {
map.panTo(pointCentreAvantAffichageInfoBulle);
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 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);
markerClusterer = new MarkerClusterer(map, points, {gridSize: 50, maxZoom: 18});
map.fitBounds(bounds);
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
 
var infoBulleOuverte = false;
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', deplacerCartePointClique);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
google.maps.event.addListener(infoBulle, 'content_changed', definirLargeurInfoBulle);
}
 
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() {
199,6 → 440,10
}
}
 
function afficherMessageChargementTitreInfoBulle() {
$("#obs-station-titre").text("Chargement des observations");
}
 
function supprimerMessageChargement() {
$('#chargement').remove();
}
207,43 → 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.stationId);
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);
if (depart == 0) {
actualiserInfosStation(observations);
actualiserPagineur();
creerTitreInfoBulle();
}
//console.log("Chargement ok");
chargerObs(depart+limite, station.obsNbre);
surRetourChargementObs(observations, depart, total);
chargerObs(depart+limite, observations.total);
});
} 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) {
station.commune = infos.commune;
station.obsNbre = infos.total;
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 {
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
}
 
function actualiserPagineur() {
pagineur.stationId = pointClique.stationId;
pagineur.total = station.obsNbre;
//console.log("Total pagineur: "+pagineur.total);
pagineur.stationId = pointClique.stationInfos.id;
pagineur.total = pointClique.stationInfos.obsNbre;
if (pagineur.total > 4) {
pagineur.format = 'tableau';
} else {
291,19 → 559,20
}
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
}
 
function initialiserContenuInfoBulle() {
afficherMessageChargement('#observations');
cacherContenuOnglets();
afficherOnglets();
afficherMessageChargement('#observations');
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) {
313,15 → 582,21
surClicAffichageListe();
}
});
$tabs.tabs('select', "#obs-vue-"+pagineur.format);
if (pointClique.stationInfos.nbre > 4) {
$tabs.tabs('select', "#obs-vue-tableau");
} else {
$tabs.tabs('select', "#obs-vue-liste");
}
}
 
function selectionnerOnglet(onglet) {
$(onglet).css('display', 'block');
$('#obs').tabs('select', onglet);
}
 
function afficherTextStationId() {
$('#obs-station-id').text(pointClique.stationId);
$('#obs-station-id').text(pointClique.stationInfos.id);
}
 
function corrigerLargeurInfoWindow() {
329,7 → 604,6
}
 
function surClicAffichageTableau(event) {
//console.log('tableau');
pagineur.format = 'tableau';
mettreAJourObservations();
mettreAJourTableauTriable("#obs-tableau");
336,7 → 610,6
}
 
function surClicAffichageListe(event) {
//console.log('liste');
pagineur.format = 'liste';
mettreAJourObservations();
ajouterGaleriePhoto("a.cel-img");
394,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) {
442,9 → 715,9
}
 
function chargerInfoObsPourMessage(idObs) {
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 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 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);
485,7 → 758,7
}
if (cle == 'message') {
champ.value += "\n--\n"+
"Ce message vous est envoyé par l'intermédiaire du widget Cartographique "+
"Ce message vous est envoyé par l'intermédiaire du widget carto "+
"du Carnet en Ligne du réseau Tela Botanica.\n"+
"http://www.tela-botanica.org/widget:cel:carto";
}
527,7 → 800,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 de Cartographie'+
'subject=Disfonctionnement du widget carto'+
"&body="+erreurMsg+"\nDébogage :\n"+debugMsg+
'">cel@tela-botanica.org</a>.'+
'</p>');
569,26 → 842,17
} else {
if (nt == '*') {
afficherTaxons();
} else {
afficherNomPlante();
}
afficherTitreCarte();
}
}
 
function afficherTaxons() {
// Ajout du nombre de plantes au titre
$('.plantes-nbre').text(taxonsCarte.length.formaterNombre());
$(".plantes-nbre").text(taxonsCarte.length);
$("#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);
610,26 → 874,29
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 = '*';
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)+
'&formatRetour=jsonP'+
'&callback=?';
$.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);
});
}
};
637,6 → 904,28
/*+--------------------------------------------------------------------------------------------------------+*/
// 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();
643,6 → 932,10
} else if (window.event) {
window.event.cancelBubble = true;
}
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
return false;
}
 
731,8 → 1024,4
msg = "La variable vaut null.";
}
console.log(msg);
}
 
function trim (chaine) {
return chaine.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
}
/trunk/widget/modules/carto/squelettes/css/carto.css
19,7 → 19,7
}
a, a:active, a:visited {
border-bottom:1px dotted #666;
color: #AAAAAA;
color:#CCC;
text-decoration:none;
}
a:active {
101,7 → 101,6
hr.nettoyage{
visibility:hidden;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Carte */
#carte {
156,9 → 155,7
width:100%;
height:35px;
overflow:hidden;
background-color: #DDDDDD;
border-bottom: 1px solid grey;
z-index: 9;
background-color:#4A4B4C;
}
#zone-info {
position:absolute;
177,7 → 174,7
display:inline-block;
margin:0;
padding:0.2em;
color: black;
color:#CCCCCC;
}
#carte-titre {/*Hack CSS fonctionne seulement dans ie6, 7 & 8 */
display:inline !hackCssIe6Et7;/*Hack CSS pour ie6 & ie7 */
194,9 → 191,8
bottom:0;
width:24px;
overflow:hidden;
background-color: #DDDDDD;
border-right: 1px solid grey;
z-index: 10;
background-color:#4A4B4C;
border-right:1px solid grey;
}
#pl-contenu {
display:none;
222,13 → 218,13
}
#pl-ouverture {
left:0;
background:url(../images/ouverture.png) no-repeat top left #DDDDDD;
background:url(../images/ouverture.png) no-repeat top left #4A4B4C;
height:100%;
}
#pl-fermeture {
display:none;
left:276px;
background:url(../images/fermeture.png) no-repeat top right #DDDDDD;
background:url(../images/fermeture.png) no-repeat top right #4A4B4C;
}
#pl-ouverture span, #pl-fermeture span{
display:none;
235,11 → 231,11
}
/* Panneau latéral : balises */
#panneau-lateral h2, #panneau-lateral p {
color:black;}
color:#CCCCCC;}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Liste des taxons de la carte */
#taxons {
color:black;
color:#999;
}
#taxons .taxon-actif, #taxons .taxon-actif span {
color:#56B80E;
246,7 → 242,7
}
#taxons li span {
border-bottom:1px dotted #666;
color:black;
color:#CCC;
}
#taxons li span:focus {
outline:thin dotted;
262,8 → 258,8
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Pop-up observations */
#info-bulle{
min-height:300px;
/*width:géstion via le Javascript;*/
min-height:500px;
width:500px;
}
#observations {
overflow:none;
429,13 → 425,12
width:300px;
height:200px;
}
#form-contact #fc_envoyer, #fc_annuler, #fc_effacer{
width:75px;
}
#fc_envoyer{
#form-contact #fc_envoyer{
width:50px;
float:right;
}
#fc_annuler{
#form-contact #fc_annuler{
width:50px;
float:left;
}
#form-contact label.error {
449,4 → 444,4
color: white;
white-space: pre-wrap;
width: 300px;
}
}
/trunk/widget/modules/saisie/configurations/florileges_taxons.tsv
File deleted
\ No newline at end of file
/trunk/widget/modules/saisie/configurations/florileges.ini
File deleted
\ No newline at end of file
/trunk/widget/modules/saisie/configurations/sauvages_taxons.tsv
469,20 → 469,10
Lolium perenne L. 39692 Lolium perenne L. 39692 6983 Poaceae Lolium perenne L. Graminées
Rostraria cristata (L.) Tzvelev 57834 Rostraria cristata (L.) Tzvelev 57834 7117 Poaceae Rostraria cristata (L.) Tzvelev Graminées
Setaria verticillata (L.) P.Beauv. 63668 Setaria verticillata (L.) P.Beauv. 63668 7137 Poaceae Setaria verticillata (L.) P.Beauv. Graminées
Phyllitis scolopendrium L. 49132 Asplenium scolopendrium L. 74981 29973 Aspleniaceae Scolopendre officinale
Scolopendre officinale 49132 Asplenium scolopendrium L. 74981 29973 Aspleniaceae Scolopendre officinale
Dryopteris filix-mas (L.) Schott 23262 Dryopteris filix-mas (L.) Schott 23262 7379 Dryopteridaceae Fougère mâle
Fougère mâle 23262 Dryopteris filix-mas (L.) Schott 23262 7379 Dryopteridaceae Fougère mâle
Geranium pusillum L. 30036 Geranium pusillum L. 30036 3432 Geraniaceae Géranium fluet
Géranium fluet 30036 Geranium pusillum L. 30036 3432 Geraniaceae Géranium fluet
Lepidium ruderale L. 38554 Lepidium ruderale L. 38554 1740 Brassicaceae Passerage des décombres
Passerage des décombres 38554 Lepidium ruderale L. 38554 1740 Brassicaceae Passerage des décombres
Lepidium squamatum Forssk. 38565 Lepidium squamatum Forssk. 38565 1625 Brassicaceae Corne-de-cerf écailleuse
Corne-de-cerf écailleuse 38565 Lepidium squamatum Forssk. 38565 1625 Brassicaceae Corne-de-cerf écailleuse
Coquelicot 75277 Papaver rhoeas L. 75277 30269 Papaveraceae Coquelicot plantes à fleurs rouges
Coquelicot 75277 Papaver rhoeas L. 75277 30269 Papaveraceae Coquelicot plantes à fleurs rouges
Plante de type pissenlit (capitules jaunes non déterminée) 100897 Asteracea 100897 36470 Asteraceae Plante de type pissenlit (capitules jaunes non déterminée) plantes à capitules jaunes
Plante de type carotte (ombelle blanche ou jaune non déterminée) 100948 Apiaceae 100948 36521 Apiaceae Plante de type carotte (ombelle blanche ou jaune non déterminée)
Graminée non déterminée 100898 Poaceae 100898 36471 Poaceae Graminée non déterminée Graminées
Autre(s) espèce(s) (écrire le/les nom(s) dans les notes) 87491 Tracheophytes 87491 36446 Autre(s) espèce(s) (écrire le/les nom(s) dans les notes)
Crucifère non déterminée (4 pétales jaunes ou blancs, disposés en croix) 100902 Brassicaceae 100902 36475 Brassicaceae Crucifère non déterminée (4 pétales jaunes ou blancs, disposés en croix)
Colza 10308 Brassica napus L. 10308 1556 Brassicaceae Colza plantes à fleurs jaunes
Autre(s) espèce(s) (écrire le/les nom(s) dans les notes) 87491 Tracheophytes 87491 36446 Autre(s) espèce(s) (écrire le/les nom(s) dans les notes)
Colza 10308 Brassica napus L. 10308 1556 Brassicaceae Colza plantes à fleurs jaunes
/trunk/widget/modules/saisie/squelettes/florileges/css/florileges.css
File deleted
\ No newline at end of file
/trunk/widget/modules/saisie/squelettes/florileges/css/fonts/caflisch_scriptw_web.ttf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/florileges/css/fonts/caflisch_scriptw_web.woff
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/florileges/florileges.tpl.html
File deleted
\ No newline at end of file
/trunk/widget/modules/saisie/squelettes/florileges/img/favicon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/florileges/img/background/noise.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/florileges/img/icones/chargement-image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/florileges/img/icones/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/florileges/img/icones/epingle.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/florileges/img/icones/pas_de_photo.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/florileges/img/icones/calendrier.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/florileges/img/icones/selecteur.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/florileges/js/florileges.js
File deleted
\ No newline at end of file
/trunk/widget/modules/saisie/squelettes/sauvages/js/sauvages.js
563,8 → 563,6
'image_nom' : $("#miniature-img").attr('alt'),
'image_b64' : getB64ImgOriginal()
});
// retour à une sélection vide pour le taxon
$('#taxon option[value=""]').attr("selected", "selected");
}
});
/trunk/widget/modules/saisie/squelettes/defaut/css/defaut.css
67,58 → 67,14
.obs-action{
opacity:1;
}
 
#miniatures {
padding-top: 5px;
}
 
.miniature{
float: left;
height: 130px;
padding-left: 15px;
padding-right: 15px;
max-width:100px;
}
 
.miniature-img {
height: 100px;
}
 
.miniature img {
display: block;
}
 
.miniature-chargement {
height:100px;
width: 100px;
}
 
.defilement-miniatures-gauche, .defilement-miniatures-droite {
float: left;
font-size: 1.2em;
font-weight: bold;
height: 62px;
margin: 5px;
padding-top: 30px;
width: 12px;
}
 
.defilement-miniatures {
width: 210px;
}
 
.defilement-miniatures-cache {
visibility: hidden;
}
 
.miniature-cachee {
display: none;
}
 
.miniature-selectionnee {
display: block;
width: 90px;
}
 
.referentiel-obs {
color:#3B9D3B;
}
130,36 → 86,6
position: relative;
top: -8px;
}
 
#photos-conteneur {
height: 120px;
}
 
#photo-placeholder {
background: url("../img/icones/icone-photo.png");
background-size: 89px;
cursor: pointer;
margin-bottom: 15px;
margin-right: 15px;
float:left;
border: 5px dashed #CCCCCC;
border-radius: 8px 8px 8px 8px;
height: 100px;
margin: 2px 0 2px 2px;
text-align: center;
width: 98px;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
 
#photo-placeholder:hover {
background: url("../img/icones/icone-photo-hover.png");
background-size: 89px;
border: 5px dashed #111;
border-radius: 8px;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Correction style CSS Bootstrap */
.well {
/trunk/widget/modules/saisie/squelettes/defaut/defaut.tpl.html
51,12 → 51,10
var TAG_PROJET = "WidgetSaisie";
// Mots-clés à ajouter aux images
var TAG_IMG = "<?=isset($_GET['tag-img']) ? $_GET['tag-img'] : ''?>";
var SEPARATION_TAG_IMG = '<?= isset($_GET['motcle']) && isset($_GET['tag-img']) ? ',' : '' ?>';
TAG_IMG = <?=isset($_GET['motcle']) ? "'".$_GET['motcle']."'+SEPARATION_TAG_IMG+TAG_IMG" : 'TAG_IMG' ?>;
TAG_IMG = <?=isset($_GET['motcle']) ? "'".$_GET['motcle']."'" : 'TAG_IMG' ?>;
// Mots-clés à ajouter aux observations
var TAG_OBS = "<?=isset($_GET['tag-obs']) ? $_GET['tag-obs'] : ''?>";
var SEPARATION_TAG_OBS = '<?= isset($_GET['projet']) && isset($_GET['tag-obs']) ? ',' : '' ?>';
TAG_OBS = <?=isset($_GET['projet']) ? "'".$_GET['projet']."'+SEPARATION_TAG_OBS+TAG_OBS" : 'TAG_OBS' ?>;
TAG_OBS = <?=isset($_GET['projet']) ? "'".$_GET['projet']."'" : 'TAG_OBS' ?>;
// URL du web service réalisant l'insertion des données dans la base du CEL.
var SERVICE_SAISIE_URL = "<?=$url_ws_saisie?>";
// Code du référentiel utilisé pour les nom scientifiques (de la forme nom:code).
349,7 → 347,7
</div>
<div class="span6">
<form id="form-obs" action="#" autocomplete="on">
<h2>Observation</h2>
<h2>Observations</h2>
<?php if(!$referentiel_impose) : ?>
<div class="row-fluid">
<div rel="tooltip"
408,15 → 406,16
</form>
<form id="form-upload" class="form-horizontal" action="<?=$url_base?>saisie?projet=sauvages&amp;service=upload-image"
method="post" enctype="multipart/form-data">
<h2>Image(s) de cette plante</h2>
<strong>Ajouter une image</strong>
<p class="miniature-info" class="discretion help-inline">Les photos doivent être au format JPEG et ne doivent pas excéder 5Mo chacunes.</p>
<div id ="photos-conteneur">
<div rel="tooltip"
title="Ajouter une photo de votre observation. Elle doit être au
format JPEG et ne doit pas excéder 5Mo.">
<label>Photo</label>
<input type="file" id="fichier" name="fichier" accept="image/jpeg" />
<input type="hidden" name="MAX_FILE_SIZE" value="5242880"/>
<div id="miniatures">
</div>
<p class="miniature-msg" class="span12">&nbsp;</p>
<p id="miniature-info" class="discretion help-inline">La photo doit être au format JPEG et ne doit pas excéder 5Mo.</p>
<div id="miniature"></div>
<button id="effacer-miniature" type="button" style="display:none;">Effacer</button>
<p id="miniature-msg" class="span12">&nbsp;</p>
</div>
</form>
</div>
/trunk/widget/modules/saisie/squelettes/defaut/img/icones/plus.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/defaut/img/icones/icone-photo.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/defaut/img/icones/icone-photo-hover.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/defaut/js/defaut.js
44,26 → 44,31
//UPLOAD PHOTO : Traitement de l'image
$(document).ready(function() {
$(".effacer-miniature").click(function () {
supprimerMiniatures($(this));
$("#effacer-miniature").click(function () {
supprimerMiniature();
});
$("#fichier").bind('change', function (e) {
arreter(e);
var options = {
success: afficherMiniature, // post-submit callback
dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
resetForm: true // reset the form after successful submit
};
$("#miniature").append('<img id="miniature-chargement" class="miniature" alt="chargement" src="'+CHARGEMENT_IMAGE_URL+'"/>');
$("#ajouter-obs").attr('disabled', 'disabled');
if(verifierFormat($("#fichier").val())) {
if (HTML5 && window.File && window.FileReader && isCanvasSupported()) {
if (DEBUG) {
console.log("Support OK pour : API File et Canvas.");
}
$('#fichier').bind('change', function(e) {
afficherMiniatureHtml5(e);
});
} else {
$("#fichier").bind('change', function (e) {
arreter(e);
var options = {
success: afficherMiniature, // post-submit callback
dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
resetForm: true // reset the form after successful submit
};
$("#miniature").append('<img id="miniature-chargement" class="miniature" alt="chargement" src="'+CHARGEMENT_IMAGE_URL+'"/>');
$("#ajouter-obs").attr('disabled', 'disabled');
$("#form-upload").ajaxSubmit(options);
} else {
window.alert("Le format de fichier n'est pas supporté, les formats acceptés sont "+ $("#fichier").attr("accept"));
}
return false;
});
return false;
});
}
if(ESPECE_IMPOSEE) {
$("#taxon").attr("disabled", "disabled");
81,19 → 86,98
infosAssociee.retenu = (INFOS_ESPECE_IMPOSEE.retenu == 'false') ? false : true;
$("#taxon").data(infosAssociee);
}
$('.effacer-miniature').live('click', function() {
$(this).parent().remove();
});
});
 
function verifierFormat(nom) {
var parts = nom.split('.');
extension = parts[parts.length - 1];
return (extension.toLowerCase() == 'jpeg' || extension.toLowerCase() == 'jpg');
function isCanvasSupported(){
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
}
 
function afficherMiniatureHtml5(evt) {
supprimerMiniature();
var selectedfiles = evt.target.files;
var f = selectedfiles[0];// Nous récupérons seulement le premier fichier.
if (f.type != 'image/jpeg') {
var message = "Seule les images JPEG sont supportées.";
$("#miniature-msg").append(message);
} else if (f.size > 5242880) {
var message = "Votre image à un poids supérieur à 5Mo.";
$("#miniature-msg").append(message);
} else {
var reader = new FileReader();
// Lit le fichier image commune url de données
reader.readAsDataURL(f);
var imgNom = f.name;
// Closure pour capturer les infos du fichier
reader.onload = (function(theFile) {
return function(e) {
// Rendre la miniature
var imageBase64 = e.target.result;
//$("#miniature").append('<img id="miniature-img" class="miniature b64" src="'+imageBase64+'" alt="'+imgNom+'"/>');
// HTML5 Canvas
var img = new Image();
img.src = imageBase64;
img.alt = imgNom;
img.onload = function() {
transformerImgEnCanvas(this, 100, 100, false, 'white');
};
};
})(f);
}
$("#effacer-miniature").show();
}
 
function transformerImgEnCanvas(img, thumbwidth, thumbheight, crop, background) {
var canvas = document.createElement('canvas');
canvas.width = thumbwidth;
canvas.height = thumbheight;
var dimensions = calculerDimenssions(img.width, img.height, thumbwidth, thumbheight);
if (crop) {
canvas.width = dimensions.w;
canvas.height = dimensions.h;
dimensions.x = 0;
dimensions.y = 0;
}
cx = canvas.getContext('2d');
if (background !== 'transparent') {
cx.fillStyle = background;
cx.fillRect(0, 0, thumbwidth, thumbheight);
}
cx.drawImage(img, dimensions.x, dimensions.y, dimensions.w, dimensions.h);
afficherMiniatureCanvas(img, canvas);
}
 
function calculerDimenssions(imagewidth, imageheight, thumbwidth, thumbheight) {
var w = 0, h = 0, x = 0, y = 0,
widthratio = imagewidth / thumbwidth,
heightratio = imageheight / thumbheight,
maxratio = Math.max(widthratio, heightratio);
if (maxratio > 1) {
w = imagewidth / maxratio;
h = imageheight / maxratio;
} else {
w = imagewidth;
h = imageheight;
}
x = (thumbwidth - w) / 2;
y = (thumbheight - h) / 2;
return {w:w, h:h, x:x, y:y};
}
 
function afficherMiniatureCanvas(imgB64, canvas) {
var url = canvas.toDataURL('image/jpeg' , 0.8);
var alt = imgB64.alt;
var title = Math.round(url.length / 1000 * 100) / 100 + ' KB';
var miniature = '<img id="miniature-img" class="miniature b64-canvas" src="'+url+'" alt="'+alt+'" title="'+title+'" />';
$("#miniature").append(miniature);
$("#miniature-img").data('b64', imgB64.src);
}
 
function afficherMiniature(reponse) {
supprimerMiniature();
if (DEBUG) {
var debogage = $("debogage", reponse).text();
console.log("Débogage upload : "+debogage);
102,25 → 186,18
if (message != '') {
$("#miniature-msg").append(message);
} else {
$("#miniatures").append(creerWidgetMiniature(reponse));
var miniatureUrl = $("miniature-url", reponse).text();
var imgNom = $("image-nom", reponse).text();
$("#miniature").append('<img id="miniature-img" class="miniature" alt="'+imgNom+'" src="'+miniatureUrl+'"/>');
}
$('#ajouter-obs').removeAttr('disabled');
$('#ajouter-obs').removeAttr('disabled');
$("#effacer-miniature").show();
}
 
function creerWidgetMiniature(reponse) {
var miniatureUrl = $("miniature-url", reponse).text();
var imgNom = $("image-nom", reponse).text();
var html =
'<div class="miniature">'+
'<img class="miniature-img" class="miniature" alt="'+imgNom+'" src="'+miniatureUrl+'"/>'+
'<button class="effacer-miniature" type="button">Effacer</button>'+
'</div>'
return html;
}
 
function supprimerMiniatures() {
$("#miniatures").empty();
function supprimerMiniature() {
$("#miniature").empty();
$("#miniature-msg").empty();
$("#effacer-miniature").hide();
}
 
//+----------------------------------------------------------------------------------------------------------+
140,13 → 217,6
$("#carte-recherche").on('mouseup', function(event) {// Pour Safari...
event.preventDefault();
});
$("#carte-recherche").keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
}
});
$("#carte-recherche").autocomplete({
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
source: function(request, response) {
295,6 → 365,11
$(function() {
var url_service = SERVICE_NOM_COMMUNE_URL;
/*if(NOM_SCI_PROJET != "bdtfx") {
// Dans le cas d'autres référentiels comme les Antilles, on utilise
// une localisation mondiale mais approximative (c'est mieux que rien)
url_service = SERVICE_NOM_COMMUNE_URL_ALT
}*/
var urlNomCommuneFormatee = url_service.replace('{lat}', pos.lat()).replace('{lon}', pos.lng());
$.ajax({
448,16 → 523,6
$("#transmettre-obs").on('click', transmettreObs);
$("#referentiel").on('change', surChangementReferentiel);
$("body").on('click', ".defilement-miniatures-gauche", function(event) {
event.preventDefault();
defilerMiniatures($(this));
});
$("body").on('click', ".defilement-miniatures-droite", function(event) {
event.preventDefault();
defilerMiniatures($(this));
});
});
 
function configurerFormValidator() {
605,9 → 670,7
$(".obs-nbre").triggerHandler('changement');
afficherObs();
stockerObsData();
supprimerMiniatures();
$("#taxon").val("");
$("#taxon").data("numNomSel",undefined);
supprimerMiniature();
} else {
afficherPanneau('#dialogue-form-invalide');
}
678,8 → 741,8
'milieu' : $("#milieu").val(),
//Ajout des champs images
'image_nom' : getNomsImgsOriginales(),
'image_b64' : getB64ImgsOriginales()
'image_nom' : $("#miniature-img").attr('alt'),
'image_b64' : getB64ImgOriginal()
});
}
 
704,7 → 767,6
 
function transmettreObs() {
var observations = $("#liste-obs").data();
console.log(observations);
if (observations == undefined || jQuery.isEmptyObject(observations)) {
afficherPanneau("#dialogue-zero-obs");
741,7 → 803,7
},
success : function(data, textStatus, jqXHR) {
$('#dialogue-obs-transaction-ok .alert-txt').append($("#tpl-transmission-ok").clone().html());
supprimerMiniatures();
supprimerMiniature();
},
statusCode : {
500 : function(jqXHR, textStatus, errorThrown) {
798,24 → 860,13
return ($observateur == true && $station == true && $obs == true) ? true : false;
}
 
function getNomsImgsOriginales() {
var noms = new Array();
$(".miniature-img").each(function() {
noms.push($(this).attr('alt'));
});
return noms;
}
 
function getB64ImgsOriginales() {
var b64 = new Array();
$(".miniature-img").each(function() {
if ($(this).hasClass('b64')) {
b64.push($(this).attr('src'));
} else if ($(this).hasClass('b64-canvas')) {
b64.push($(this).data('b64'));
}
});
 
function getB64ImgOriginal() {
var b64 = '';
if ($("#miniature-img").hasClass('b64')) {
b64 = $("#miniature-img").attr('src');
} else if ($("#miniature-img").hasClass('b64-canvas')) {
b64 = $("#miniature-img").data('b64');
}
return b64;
}
 
843,57 → 894,18
}
 
function ajouterImgMiniatureAuTransfert() {
var html = '';
var miniatures = '';
var premiere = true;
if ($("#miniatures img").length >= 1) {
$("#miniatures img").each(function() {
var visible = premiere ? 'miniature-selectionnee' : 'miniature-cachee';
premiere = false;
var css = $(this).hasClass('b64') ? 'miniature b64' : 'miniature';
var src = $(this).attr("src");
var alt = $(this).attr("alt");
miniature = '<img class="'+css+' '+visible+'" alt="'+alt+'"src="'+src+'" />';
miniatures += miniature;
});
visible = ($("#miniatures img").length > 1) ? '' : 'defilement-miniatures-cache';
var html =
'<div class="defilement-miniatures">'+
'<a href="#" class="defilement-miniatures-gauche '+visible+'">&#60;</a>'+
miniatures+
'<a href="#" class="defilement-miniatures-droite '+visible+'">&#62;</a>'+
'</div>';
var miniature = '';
if ($("#miniature img").length == 1) {
var css = $("#miniature-img").hasClass('b64') ? 'miniature b64' : 'miniature';
var src = $("#miniature-img").attr("src");
var alt = $("#miniature-img").attr("alt");
miniature = '<img class="'+css+' " alt="'+alt+'"src="'+src+'" />';
} else {
html = '<img class="miniature" alt="Aucune photo"src="'+PAS_DE_PHOTO_ICONE_URL+'" />';
miniature = '<img class="miniature" alt="Aucune photo"src="'+PAS_DE_PHOTO_ICONE_URL+'" />';
}
return html;
return miniature;
}
 
function defilerMiniatures(element) {
var miniatureSelectionne = element.siblings("img.miniature-selectionnee");
miniatureSelectionne.removeClass('miniature-selectionnee');
miniatureSelectionne.addClass('miniature-cachee');
var miniatureAffichee = miniatureSelectionne;
if(element.hasClass('defilement-miniatures-gauche')) {
if(miniatureSelectionne.prev('.miniature').length != 0) {
miniatureAffichee = miniatureSelectionne.prev('.miniature');
} else {
miniatureAffichee = miniatureSelectionne.siblings(".miniature").last();
}
} else {
if(miniatureSelectionne.next('.miniature').length != 0) {
miniatureAffichee = miniatureSelectionne.next('.miniature');
} else {
miniatureAffichee = miniatureSelectionne.siblings(".miniature").first();
}
}
console.log(miniatureAffichee);
miniatureAffichee.addClass('miniature-selectionnee');
miniatureAffichee.removeClass('miniature-cachee');
}
 
function ajouterNumNomSel() {
var nn = '';
if ($("#taxon").data("numNomSel") == undefined) {
/trunk/widget/modules/saisie/Saisie.php
75,7 → 75,7
private function chargerConfigProjet() {
$fichier_config = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'.ini';
if (file_exists($fichier_config)) {
if (!$this->configProjet = parse_ini_file($fichier_config)) {
if (!$this->configProjet = parse_ini_file($fichier_config)) {
$this->messages[] = "Le fichier ini '$fichier_config' du projet n'a pu être chargé.";
}
} else {
82,13 → 82,11
$this->debug[] = "Le fichier ini '$fichier_config' du projet n'existe pas.";
}
}
 
private function chargerProjetsVersion() {
if (isset($this->configProjet)) {
foreach ($this->configProjet as $config => $valeur) {
if(strstr($config,'.version')) {
$this->projetsVersions[str_replace('.version', '', $config)] = $valeur;
}
foreach ($this->configProjet as $config => $valeur) {
if(strstr($config,'.version')) {
$this->projetsVersions[str_replace('.version', '', $config)] = $valeur;
}
}
}
95,25 → 93,23
 
public function executerWidget() {
$referentiel_impose = false;
if (isset($_GET['referentiel']) && $_GET['referentiel'] != '') {
if(isset($_GET['referentiel']) && $_GET['referentiel'] != '') {
$this->NS_PROJET = isset($_GET['referentiel']) && $_GET['referentiel'] != '' ? $_GET['referentiel'] : $this->NS_PROJET;
$this->NS_PROJET_VERSION = $this->projetsVersions[$this->NS_PROJET];
$referentiel_impose = true;
}
 
$widget['squelette'] = $this->projet;
$widget['donnees'] = array();
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
$widget['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
$widget['donnees']['url_ws_annuaire'] = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], 'utilisateur/identite-par-courriel/');
 
 
$widget['donnees']['logo'] = isset($_GET['logo']) ? $_GET['logo'] : 'defaut';
$widget['donnees']['titre'] = isset($_GET['titre']) ? $_GET['titre'] : 'defaut';
$widget['donnees']['titre'] = ($widget['donnees']['titre'] == '0') ? '' : $widget['donnees']['titre'];
 
// cas du projet par défaut ou bien d'un projet n'ayant pas de squelette spécifique
if ($this->projet == 'defaut' || $this->projet == 'florileges' || !$this->projetASquelette()) {
if ($this->projet == 'defaut' || !$this->projetASquelette()) {
$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
$urlWsNs = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, $this->NS_PROJET, self::WS_NOM);
$urlWsNsSansRef = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, '{referentiel}', self::WS_NOM);
124,28 → 120,27
$widget['donnees']['ns_version'] = $this->NS_PROJET_VERSION;
$widget['donnees']['referentiel_impose'] = $referentiel_impose;
$widget['donnees']['projets_versions'] = $this->projetsVersions;
$widget['donnees']['espece_imposee'] = false;
$widget['donnees']['nn_espece_defaut'] = '';
$widget['donnees']['nom_sci_espece_defaut'] = '';
$widget['donnees']['infos_espece'] = '{}';
 
if ($this->especeEstImposee()) {
$nom = $this->executerChargementInfosTaxon($_GET['num_nom']);
if(self::especeEstImposee()) {
$nom = self::executerChargementInfosTaxon($_GET['num_nom']);
$widget['donnees']['espece_imposee'] = true;
$widget['donnees']['nn_espece_defaut'] = $_GET['num_nom'];
$widget['donnees']['nom_sci_espece_defaut'] = $nom['nom_sci'];
$widget['donnees']['infos_espece'] = $this->array2js($nom, true);
} else {
$widget['donnees']['espece_imposee'] = false;
$widget['donnees']['nn_espece_defaut'] = '';
$widget['donnees']['nom_sci_espece_defaut'] = '';
$widget['donnees']['infos_espece'] = array();
}
}
if ($this->projet != 'defaut' || $this->projetASquelette()) {
} else {
$widget['donnees']['taxons'] = $this->recupererListeTaxon();
$widget['donnees']['milieux'] = $this->parserMilieux();
}
return $widget;
}
 
private function projetASquelette() {
// fonction très simple qui ne teste que si le dossier du projet courant
// fonction très simple qui ne teste que si le dossier du projet courant
// existe, mais elle suffit pour le moment.
return file_exists(dirname(__FILE__).self::DS.'squelettes'.self::DS.$this->projet);
}
168,7 → 163,7
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
$taxons = $this->decomposerFichierTsv($fichier_tsv);
$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
} else {
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
}
176,7 → 171,7
}
 
private function decomposerFichierTsv($fichier, $delimiter = "\t"){
$header = null;
$header = NULL;
$data = array();
if (($handle = fopen($fichier, 'r')) !== FALSE) {
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
193,30 → 188,28
 
private function parserMilieux() {
$infosMilieux = array();
if (isset($this->configProjet['milieux'])) {
$milieux = explode('|', $this->configProjet['milieux']);
foreach ($milieux as $milieu) {
$details = explode(';', $milieu);
if (isset($details[1])) {
$infosMilieux[$details[0]] = $details[1];
} else {
$infosMilieux[$details[0]] = '';
}
$milieux = explode('|', $this->configProjet['milieux']);
foreach ($milieux as $milieu) {
$details = explode(';', $milieu);
if (isset($details[1])) {
$infosMilieux[$details[0]] = $details[1];
} else {
$infosMilieux[$details[0]] = '';
}
ksort($infosMilieux);
}
ksort($infosMilieux);
return $infosMilieux;
}
 
private function especeEstImposee() {
return (isset($_GET['num_nom']) && $_GET['num_nom'] != '');
return isset($_GET['num_nom']) && $_GET['num_nom'] != '';
}
 
private function executerChargementInfosTaxon($num_nom) {
$url_service_infos = sprintf($this->config['chemins']['infosTaxonUrl'], $this->NS_PROJET, $num_nom);
$infos = json_decode(file_get_contents($url_service_infos));
$resultat = array();
if (isset($infos) && !empty($infos)) {
if(isset($infos) && !empty($infos)) {
$infos = (array)$infos;
$resultat = (isset($infos['nom_sci']) && $infos['nom_sci'] != '') ? $infos : array();
}
303,45 → 296,36
$retour['donnees']['debogage'] = $debogage;
return $retour;
}
 
// Il ne faut pas utiliser l'index type du tableau files pour tester
// Il ne faut pas utiliser l'index type du tableau files pour tester
// si une image est en jpeg car le type renvoyé par les navigateurs
// peut varier (ex. sous ie qui renvoie image/pjpeg
// peut varier (ex. sous ie qui renvoie image/pjpeg
private function verifierFormatJpeg($chemin) {
// get imagesize renvoie un résultat consistant par contre
$infos = getimagesize($chemin, $infos);
return (isset($infos['mime']) && $infos['mime'] == 'image/jpeg');
return (isset($infos["mime"]) && $infos["mime"] == "image/jpeg");
}
 
private function array2js($array,$show_keys) {
$tableauJs = '{}';
if (!empty($array)) {
$total = count($array) - 1;
$i = 0;
$dimensions = array();
foreach ($array as $key => $value) {
if (is_array($value)) {
$dimensions[$i] = array2js($value,$show_keys);
if ($show_keys) {
$dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
}
} else {
$dimensions[$i] = '"'.addslashes($value).'"';
if ($show_keys) {
$dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
}
}
if ($i == 0) {
$dimensions[$i] = '{'.$dimensions[$i];
}
if ($i == $total) {
$dimensions[$i].= '}';
}
$i++;
}
$tableauJs = implode(',', $dimensions);
}
return $tableauJs;
}
private function array2js($array,$show_keys)
{
$dimensions = array();
$valeurs = array();
$total = count ($array)-1;
$i=0;
foreach($array as $key=>$value){
if (is_array($value)) {
$dimensions[$i] = array2js($value,$show_keys);
if ($show_keys) $dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
} else {
$dimensions[$i] = '"'.addslashes($value).'"';
if ($show_keys) $dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
}
if ($i==0) $dimensions[$i] = '{'.$dimensions[$i];
if ($i==$total) $dimensions[$i].= '}';
$i++;
}
return implode(',',$dimensions);
}
}
?>