/tags/celw-v1.1/widget/modules/saisie/squelettes/biodiversite34/js/biodiversite34.js |
---|
New file |
0,0 → 1,437 |
//+---------------------------------------------------------------------------------------------------------+ |
// GÉNÉRAL |
// Mettre à true pour afficher les messages de débogage |
var DEBUG = false; |
// URL du web service réalisant l'insertion des données dans la base du CEL. |
var URL_SERVICE_CEL = "http://www.tela-botanica.org/service:cel:CelWidgetSaisie"; |
// Squelette d'URL du web service d'eFlore fournissant les noms de communes. |
var URL_SERVICE_NOM_COMMUNE = "http://www.tela-botanica.org/service:eflore:osm/0.1/nom-commune?lon={lon}&lat={lat}"; |
/** |
* Stope l'évènement courrant quand on clique sur un lien. |
* Utile pour Chrome, Safari... |
* @param evenement |
* @return |
*/ |
function arreter(evenement) { |
if (evenement.stopPropagation) { |
evenement.stopPropagation(); |
} |
return false; |
} |
//+---------------------------------------------------------------------------------------------------------+ |
// FORMULAIRE |
$(function() { |
$("#saisie-obs").validate({ |
rules: { |
prenom : "required", |
nom : "required", |
courriel : { |
required : true, |
email : true}, |
courriel_confirmation : { |
required : true, |
equalTo: "#courriel" |
}, |
milieu : "required", |
latitude : { |
required: true, |
range: [-90, 90]}, |
longitude : { |
required: true, |
range: [-180, 180]}, |
date : { |
required: true, |
date: true}, |
taxon : "required" |
} |
}); |
$("#date").datepicker({ |
onClose: function(dateText, inst) {$("#saisie-obs").valid();} |
}); |
$("#courriel_confirmation").bind('paste', function(e) { |
$("#dialogue-bloquer-copier-coller").dialog(); |
return false; |
}); |
$("#localiser-gg-map").fancybox({ |
'modal' : true, |
'autoDimensions' : true, |
'titleShow' : false, |
'onClosed' : function() { |
$("#gg-map").hide(); |
}, |
'onStart' : function(e) { |
arreter(e); |
$("#gg-map-localisation").height($(window).height() - 100); |
$("#gg-map-carte").height($(window).height() - 200); |
$("#gg-map-localisation").width($(window).width() - 100); |
}, |
'onComplete' : function() { |
initialiserCarte(); |
} |
}); |
$("#valider-coordonnees").click(function(e) { |
var coordonnees = $("#marqueur-coordonnees").data('latLon'); |
if (coordonnees != undefined) { |
$("#latitude").val(coordonnees.lat); |
$("#longitude").val(coordonnees.lon); |
} |
var commune = $("#marqueur-commune").data('commune'); |
if (commune != undefined) { |
$("#commune_nom").val(commune.nom); |
$("#commune_code_insee").val(commune.codeInsee); |
} |
$.fancybox.close(); |
$("#saisie-obs").valid(); |
}); |
$("#annuler-coordonnees").bind('click', function(e) { |
$.fancybox.close(); |
$("#saisie-obs").valid() |
}); |
var obsNumero = 0; |
$("#ajouter-obs").bind('click', function(e) { |
if ($("#saisie-obs").valid() == false) { |
$("#dialogue-form-invalide").dialog(); |
} else { |
obsNumero = obsNumero + 1; |
$("#liste-obs tbody").append( |
'<tr id="obs'+obsNumero+'" class="obs">'+ |
'<td>'+obsNumero+'</td>'+ |
'<td>'+$("#date").val()+'</td>'+ |
'<td>'+$("#taxon option:selected").text()+'</td>'+ |
'<td>'+$("#milieu option:selected").text()+'</td>'+ |
'<td>'+$("#latitude").val()+'</td>'+ |
'<td>'+$("#longitude").val()+'</td>'+ |
'<td>'+$("#notes").val()+'</td>'+ |
'<td><button class="supprimer-obs" value="'+obsNumero+'" title="'+obsNumero+'">Supprimer</button></td>'+ |
'</tr>'); |
var numNomSel = $("#taxon").val(); |
$("#liste-obs").data('obsId'+obsNumero, { |
'date' : $("#date").val(), |
'num_nom_sel' : numNomSel, |
'nom_sel' : taxons[numNomSel]['nom_sel'], |
'nom_ret' : taxons[numNomSel]['nom_ret'], |
'num_nom_ret' : taxons[numNomSel]['num_nom_ret'], |
'num_taxon' : taxons[numNomSel]['num_taxon'], |
'famille' : taxons[numNomSel]['famille'], |
'nom_fr' : taxons[numNomSel]['nom_fr'], |
'milieu' : $("#milieu option:selected").val(), |
'latitude' : $("#latitude").val(), |
'longitude' : $("#longitude").val(), |
'commune_nom' : $("#commune_nom").val(), |
'commune_code_insee' : $("#commune_code_insee").val(), |
'notes' : $("#notes").val()}); |
} |
}); |
$(".supprimer-obs").live('click', function() { |
var obsId = $(this).val(); |
// Problème avec IE 6 et 7 |
if (obsId == "Supprimer") { |
obsId = $(this).attr("title"); |
} |
$('#obs'+obsId).remove(); |
$("#liste-obs").removeData('obsId'+obsId) |
}); |
$("#tramsmettre-obs").click(function(e) { |
var observations = $("#liste-obs").data(); |
if (observations == undefined || jQuery.isEmptyObject(observations)) { |
$("#dialogue-zero-obs").dialog(); |
} else if ($("#saisie-obs").valid() == false) { |
$("#dialogue-form-invalide").dialog(); |
} else { |
observations['projet'] = 'Biodiversite34'; |
var utilisateur = new Object(); |
utilisateur.prenom = $("#prenom").val(); |
utilisateur.nom = $("#nom").val(); |
utilisateur.courriel = $("#courriel").val(); |
observations['utilisateur'] = utilisateur; |
var erreurMsg = ""; |
$.ajax({ |
url : URL_SERVICE_CEL, |
type : "POST", |
data : observations, |
dataType : "json", |
beforeSend : function() { |
$(".msg").remove(); |
$(".msg-erreur").remove(); |
$(".msg-debug").remove(); |
}, |
success : function(data, textStatus, jqXHR) { |
$("#dialogue-obs-transaction").append('<p class="msg">Vos observations ont bien été transmises.</p>'); |
}, |
statusCode : { |
500 : function(jqXHR, textStatus, errorThrown) { |
erreurMsg += "Erreur 500 :\ntype : "+textStatus+' '+errorThrown+"\n"; |
reponse = jQuery.parseJSON(jqXHR.responseText); |
if (reponse != null) { |
$.each(reponse, function (cle, valeur) { |
erreurMsg += valeur + "\n"; |
}); |
} |
if (DEBUG) { |
$("#dialogue-obs-transaction").append('<pre class="msg-erreur">'+erreurMsg+'</pre>'); |
} |
} |
}, |
error : function(jqXHR, textStatus, errorThrown) { |
erreurMsg += "Erreur Ajax :\ntype : "+textStatus+' '+errorThrown+"\n"; |
reponse = jQuery.parseJSON(jqXHR.responseText); |
if (reponse != null) { |
$.each(reponse, function (cle, valeur) { |
erreurMsg += valeur + "\n"; |
}); |
} |
if (DEBUG) { |
$("#dialogue-obs-transaction").append('<pre class="msg-erreur">'+erreurMsg+'</pre>'); |
} |
}, |
complete : function(jqXHR, textStatus) { |
var debugMsg = ''; |
if (jqXHR.getResponseHeader("X-DebugJrest-Data") != '') { |
debugInfos = jQuery.parseJSON(jqXHR.getResponseHeader("X-DebugJrest-Data")); |
if (debugInfos != null) { |
$.each(debugInfos, function (cle, valeur) { |
debugMsg += valeur + "\n"; |
}); |
} |
} |
if (erreurMsg != '') { |
$("#dialogue-obs-transaction").append('<p class="msg">'+ |
'Une erreur est survenue lors de la transmission de vos observations.'+'<br />'+ |
'Vous pouvez signaler le disfonctionnement à <a href="'+ |
'mailto:cel@tela-botanica.org'+'?'+ |
'subject=Disfonctionnement du widget de saisie Biodiversite34'+ |
"&body="+erreurMsg+"\nDébogage :\n"+debugMsg+ |
'">cel@tela-botanica.org</a>.'+ |
'</p>'); |
} |
if (DEBUG) { |
$("#dialogue-obs-transaction").append('<pre class="msg-debug">Débogage : '+debugMsg+'</pre>'); |
} |
$("#dialogue-obs-transaction").dialog(); |
$("#liste-obs").removeData(); |
$('.obs').remove(); |
obsNumero = 0; |
} |
}); |
} |
return false; |
}); |
}); |
//+---------------------------------------------------------------------------------------------------------+ |
// GOOGLE MAP |
var geocoder; |
var latLng; |
var map; |
var marker; |
var osmMapType; |
function initialiserCarte() { |
geocoder = new google.maps.Geocoder(); |
latLng = new google.maps.LatLng(43.577, 3.455); |
map = new google.maps.Map(document.getElementById('gg-map-carte'), { |
zoom: 9, |
mapTypeId: google.maps.MapTypeId.HYBRID, |
mapTypeControlOptions: { |
mapTypeIds: ['OSM', google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.TERRAIN]} |
}); |
// Ajout de la couche OSM à la carte |
osmMapType = new google.maps.ImageMapType({ |
getTileUrl: function(coord, zoom) { |
return "http://tile.openstreetmap.org/" + |
zoom + "/" + coord.x + "/" + coord.y + ".png"; |
}, |
tileSize: new google.maps.Size(256, 256), |
isPng: true, |
alt: "OpenStreetMap", |
name: "OSM", |
maxZoom: 19 |
}); |
map.mapTypes.set('OSM', osmMapType); |
// Ajout des limites de communes |
ctaLayer = new google.maps.KmlLayer('http://www.tela-botanica.org/commun/google/map/3/kmz/communes/34.kmz', {preserveViewport: true}); |
ctaLayer.setMap(map); |
// Définition du marqueur |
marker = new google.maps.Marker({ |
position: latLng, |
title: 'Ma station', |
map: map, |
draggable: true |
}); |
deplacerMarker(latLng); |
// Tentative de géolocalisation |
if(navigator.geolocation) { // Try W3C Geolocation (Preferred) |
navigator.geolocation.getCurrentPosition(function(position) { |
(DEBUG) ? console.log("Géolocalisation OK.") : ''; |
latLng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); |
deplacerMarker(latLng); |
map.setCenter(latLng); |
}, function(erreur) { |
(DEBUG) ? console.log("Géolocalisation échouée : "+erreur.code+" = "+erreur.message) : ''; |
}); |
} else { //Browser doesn't support Geolocation |
(DEBUG) ? console.log("Navigateur ne supportant pas la géolocalisation. Localisation par défaut.") : ''; |
} |
deplacerMarker(latLng); |
map.setCenter(latLng); |
// Add des évènements concernant le marqueur |
google.maps.event.addListener(marker, 'dragstart', function() { |
mettreAJourMarkerAdresse('Marqueur de station début du déplacement...'); |
}); |
google.maps.event.addListener(marker, 'drag', function() { |
mettreAJourMarkerStatut('Marqueur de station en cours de déplacement...'); |
mettreAJourMarkerPosition(marker.getPosition()); |
}); |
google.maps.event.addListener(marker, 'dragend', function() { |
mettreAJourMarkerStatut('Marqueur de station déplacé (glisser/déposer).'); |
mettreAJourMarkerPosition(marker.getPosition()); |
geocoderPosition(marker.getPosition()); |
trouverCommune(marker.getPosition()); |
}); |
google.maps.event.addListener(map, 'click', function(event) { |
deplacerMarker(event.latLng); |
}); |
} |
function deplacerMarker(latLon) { |
if (marker != undefined) { |
marker.setPosition(latLon); |
mettreAJourMarkerStatut('Marqueur de station déplacé (clic).'); |
mettreAJourMarkerPosition(marker.getPosition()); |
geocoderPosition(marker.getPosition()); |
trouverCommune(marker.getPosition()); |
} |
} |
function geocoderPosition(pos) { |
if (geocoder != undefined) { |
geocoder.geocode({ |
latLng: pos |
}, function(responses, status) { |
if (status == google.maps.GeocoderStatus.OK) { |
if (responses && responses.length > 0) { |
mettreAJourMarkerAdresse(responses[0].formatted_address); |
} else { |
mettreAJourMarkerAdresse("Impossible de trouver d'adresse pour cette position."); |
} |
} else { |
mettreAJourMarkerAdresse("Un problème de géolocalisation est survenu : "+status+"."); |
} |
}); |
} |
} |
function trouverCommune(pos) { |
$(function() { |
var urlNomCommuneFormatee = URL_SERVICE_NOM_COMMUNE.replace('{lat}', pos.lat()).replace('{lon}', pos.lng()); |
$.ajax({ |
url : urlNomCommuneFormatee, |
type : "GET", |
dataType : "json", |
beforeSend : function() { |
$(".commune-info").empty(); |
$("#dialogue-erreur").empty(); |
}, |
success : function(data, textStatus, jqXHR) { |
$(".commune-info").empty(); |
$("#commune-nom").append(data.nom); |
$("#commune-code-insee").append(data.codeINSEE); |
$("#marqueur-commune").data('commune', {'nom' : data.nom, 'codeInsee' : data.codeINSEE}); |
}, |
statusCode : { |
500 : function(jqXHR, textStatus, errorThrown) { |
if (DEBUG) { |
$("#dialogue-erreur").append('<p id="msg">Un problème est survenu lors de l\'appel au service fournissante le nom des communes.</p>'); |
reponse = jQuery.parseJSON(jqXHR.responseText); |
var erreurMsg = ""; |
if (reponse != null) { |
$.each(reponse, function (cle, valeur) { |
erreurMsg += valeur + "<br />"; |
}); |
} |
$("#dialogue-erreur").append('<p class="msg-erreur">Erreur 500 : '+errorThrown+"<br />"+erreurMsg+'</p>'); |
} |
} |
}, |
error : function(jqXHR, textStatus, errorThrown) { |
if (DEBUG) { |
$("#dialogue-erreur").append('<p class="msg">Une erreur Ajax est survenue lors de la transmission de vos observations.</p>'); |
reponse = jQuery.parseJSON(jqXHR.responseText); |
var erreurMsg = ""; |
if (reponse != null) { |
$.each(reponse, function (cle, valeur) { |
erreurMsg += valeur + "<br />"; |
}); |
} |
$("#dialogue-erreur").append('<p class="msg-erreur">Erreur Ajax : '+errorThrown+' (type : '+textStatus+') <br />'+erreurMsg+'</p>'); |
} |
}, |
complete : function(jqXHR, textStatus) { |
if (DEBUG && jqXHR.getResponseHeader("X-DebugJrest-Data") != '') { |
var debugMsg = ""; |
debugInfos = jQuery.parseJSON(jqXHR.getResponseHeader("X-DebugJrest-Data")); |
if (debugInfos != null) { |
$.each(debugInfos, function (cle, valeur) { |
debugMsg += valeur + "<br />"; |
}); |
$("#dialogue-erreur").append('<pre class="msg-debug msg">Débogage : '+debugMsg+'</pre>'); |
} |
} |
if ($("#dialogue-erreur .msg").length > 0) { |
$("#dialogue-erreur").dialog(); |
} |
} |
}); |
}); |
} |
function mettreAJourMarkerStatut(str) { |
document.getElementById('marqueur-statut').innerHTML = str; |
} |
function mettreAJourMarkerPosition(latLng) { |
var lat = latLng.lat().toFixed(5); |
var lon = latLng.lng().toFixed(5); |
document.getElementById('marqueur-wgs84').innerHTML = [lat, lon].join(', '); |
$("#marqueur-coordonnees").data('latLon', {'lat' : lat, 'lon' : lon}); |
Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"; |
Proj4js.defs["EPSG:2154"]="+title=RGF93 / Lambert-93 +proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "; |
var source = new Proj4js.Proj('EPSG:4326');// Coordonnées source : WGS 84 |
var dest = new Proj4js.Proj('EPSG:2154');// Coordonnées destination : Lambert 93 |
var p = new Proj4js.Point(lon+','+lat);//lon+','+lat any object will do as long as it has 'x' and 'y' properties |
Proj4js.transform(source, dest, p); |
//Proj4js.reportError = function(msg) {alert(msg);} |
//console.log(p.toString()); |
document.getElementById('marqueur-lambert93').innerHTML = [p.x.toFixed(0)+' '+dest.units, p.y.toFixed(0)+' '+dest.units].join(', '); |
} |
function mettreAJourMarkerAdresse(str) { |
document.getElementById('marqueur-adresse').innerHTML = str; |
} |
/tags/celw-v1.1/widget/modules/saisie/squelettes/biodiversite34/biodiversite34.tpl.html |
---|
New file |
0,0 → 1,196 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head> |
<title>Biodiversité 34</title> |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> |
<meta http-equiv="Content-style-type" content="text/css" /> |
<meta http-equiv="Content-script-type" content="text/javascript" /> |
<meta http-equiv="Content-language" content="fr" /> |
<meta name="revisit-after" content="15 days" /> |
<meta name="robots" content="index,follow" /> |
<meta name="author" content="Delphine CAUQUIL, Jean-Pascal MILCENT" /> |
<meta name="keywords" content="Tela Botanica, Biodiversité34, CG34, CEL" /> |
<meta name="description" content="Widget de saisie simplifié pour le projet Biodiversité 34" /> |
<!-- Favicones --> |
<link rel="icon" type="image/png" href="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.png" /> |
<link rel="shortcut icon" type="image/x-icon" href="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.ico" /> |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> |
<!-- Javascript : bibliothèques --> |
<!-- Google Map v3 --> |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&sensor=true&language=fr&region=FR"></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.13/js/jquery-ui-1.8.13.custom.min.js"></script> |
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.13/js/jquery.ui.datepicker-fr.js"></script> |
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.pack.js"></script> |
<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> |
<script type="text/javascript" src="http://www.tela-botanica.org/commun/proj4js/1.0.1/proj4js-compressed.js"></script> |
<script src="<?=$url_base?>saisie?projet=biodiversite34&service=taxons" type="text/javascript"></script> |
<script type="text/javascript" src="<?=$url_base?>modules/saisie/squelettes/biodiversite34/js/biodiversite34.js"></script> |
<!-- CSS --> |
<link href="<?=$url_base?>modules/saisie/squelettes/biodiversite34/css/biodiversite34.css" rel="stylesheet" type="text/css" media="screen" /> |
<link rel="stylesheet" href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.13/css/ui-darkness/jquery-ui-1.8.13.custom.css" type="text/css" media="screen" /> |
<link rel="stylesheet" href="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css" type="text/css" media="screen" /> |
</head> |
<body> |
<h1>Biodiversité 34</h1> |
<h2>Saisie des observations</h2> |
<form id="saisie-obs" action="#"> |
<fieldset id="partie-identification"> |
<legend>1. Identification</legend> |
<ul> |
<li> |
<label for="prenom"><span class="obligatoire" title="Champ obligatoire">*</span> Prénom</label> |
<input id="prenom" name="prenom" type="text" value=""/> |
</li> |
<li> |
<label for="nom"><span class="obligatoire" title="Champ obligatoire">*</span> NOM</label> |
<input id="nom" name="nom" type="text" value=""/> |
</li> |
<li> |
<label for="courriel"><span class="obligatoire" title="Champ obligatoire">*</span> Courriel</label> |
<input id="courriel" name="courriel" type="text" value=""/> |
</li> |
<li> |
<label for="courriel_confirmation"><span class="obligatoire" title="Champ obligatoire">*</span> Courriel (confirmation)</label> |
<input id="courriel_confirmation" name="courriel_confirmation" type="text" value=""/> |
</li> |
</ul> |
</fieldset> |
<fieldset id="partie-station"> |
<legend>2. Station / Localisation</legend> |
<input id="commune_nom" name="commune_nom" type="hidden" value="" /> |
<input id="commune_code_insee" name="commune_code_insee" type="hidden" value="" /> |
<ul> |
<li> |
<label for="milieu"><span class="obligatoire" title="Champ obligatoire">*</span> Milieu</label> |
<select id="milieu" name="milieu"> |
<option value="">Sélectionner un milieu</option> |
<?php foreach ($milieux as $milieu => $description) : ?> |
<option value="<?=$milieu?>" <?=($description != '') ? 'title="'.$description.'"': '' ?>><?=$milieu?></option> |
<?php endforeach; ?> |
</select> |
</li> |
<li><a id="localiser-gg-map" href="#gg-map-localisation">Localiser votre station sur une carte Google Map</a></li> |
<li id="partie-lat-lon"> |
<label for="latitude"><span class="obligatoire" title="Champ obligatoire">*</span> Latitude</label> |
<input id="latitude" name="latitude" type="text" value=""/> |
<label for="longitude"><span class="obligatoire" title="Champ obligatoire">*</span> Longitude</label> |
<input id="longitude" name="longitude" type="text" value=""/> |
<span id="lat-lon-info" class="info">(WGS84)</span> |
</li> |
</ul> |
</fieldset> |
<fieldset id="partie-observation"> |
<legend>3. Observation</legend> |
<ul> |
<li> |
<label for="date"><span class="obligatoire" title="Champ obligatoire">*</span> Date</label> |
<input id="date" name="date" type="text" value="" /> |
</li> |
<li> |
<label for="taxon"><span class="obligatoire" title="Champ obligatoire">*</span> Espèce</label> |
<select id="taxon" name="taxon"> |
<option value="">Sélectionner un taxon</option> |
<?php foreach ($taxons as $taxon) : ?> |
<option value="<?=$taxon['num_nom_sel']?>" title="<?=$taxon['nom_sel'].($taxon['nom_fr_autre'] != '' ? ' - '.$taxon['nom_fr_autre'] : '' )?>"><?=$taxon['nom_fr']?></option> |
<?php endforeach; ?> |
</select> |
</li> |
<li> |
<label for="notes">Notes</label> |
<textarea id="notes" name="notes"></textarea> |
</li> |
</ul> |
<button id="ajouter-obs" type="button">Ajouter</button> |
</fieldset> |
</form> |
<h2>Liste des observations à transmettre</h2> |
<form action="#"> |
<table id="liste-obs"> |
<thead><tr><th>Numéro</th><th>Date</th><th>Nom</th><th>Milieu</th><th>Latitude</th><th>Longitude</th><th>Notes</th><th>Suppression</th></tr></thead> |
<tbody></tbody> |
</table> |
<button id="tramsmettre-obs" type="button">Transmettre</button> |
</form> |
<div id="gg-map" style="display: none;"> |
<div id="gg-map-localisation"> |
<div id="gg-map-carte">Carte en cours de chargement...</div> |
<ul id="gg-map-info"> |
<li> |
<span class="champ">Marqueur de station</span> |
<span id="marqueur-statut">Déplacer le marqueur sur le centre de votre station.</span> |
</li> |
<li> |
<span class="champ">Coordonnées du marqueur</span> |
<span id="marqueur-coordonnees"><span title="Système géodésique mondial, révision de 1984 - Coordonnées non projetées">WGS84 : <span id="marqueur-wgs84"> </span></span> / <span title="Système géodésique RGF93 - Coordonnées en projection Lambert 93">Lambert 93 : <span id="marqueur-lambert93"> </span></span></span> |
</li> |
<li> |
<span class="champ">Commune</span> |
<span id="marqueur-commune"> |
<span id="commune-nom" class="commune-info"> </span> |
(<span id="commune-code-insee" class="commune-info" title="Code INSEE de la commune"> </span>) |
</span> |
<span class="champ">Adresse</span> |
<span id="marqueur-adresse"> </span> |
</li> |
</ul> |
<form id="gg-map-form"> |
<button id="valider-coordonnees" type="button">Valider</button> |
<button id="annuler-coordonnees" type="button">Annuler</button> |
</form> |
</div> |
</div> |
</div> |
<div id="dialogue-bloquer-copier-coller" style="display: none;" title="Information copier/coller"> |
<p> |
Merci de ne pas copier/coller votre courriel.<br/> |
La double saisie permet de vérifier l'absence d'erreurs. |
</p> |
</div> |
<div id="dialogue-zero-obs" style="display: none;" title="Information aucune observation"> |
<p> |
Veuillez saisir des observations pour les transmettres. |
</p> |
</div> |
<div id="dialogue-form-invalide" style="display: none;" title="Validation du formulaire"> |
<p>Certains champs n'ont pas été saisis correctement, veuillez vérifier les champs saisis.</p> |
</div> |
<div id="dialogue-obs-transaction" style="display: none;" title="Transmission des observations"> |
</div> |
<div id="dialogue-erreur" style="display: none;" title="Erreur"> |
</div> |
<!-- Stats : Google Analytics --> |
<script type="text/javascript"> |
//<![CDATA[ |
var _gaq = _gaq || []; |
_gaq.push(['_setAccount', 'UA-20092557-1']); |
_gaq.push(['_trackPageview']); |
(function() { |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
})(); |
//]]> |
</script> |
</body> |
</html> |
/tags/celw-v1.1/widget/modules/saisie/squelettes/biodiversite34/biodiversite34_taxons.tpl.js |
---|
New file |
0,0 → 1,0 |
var taxons = <?=$taxons?>; |
/tags/celw-v1.1/widget/modules/saisie/squelettes/biodiversite34/css/biodiversite34.css |
---|
New file |
0,0 → 1,167 |
@CHARSET "UTF-8"; |
body { |
padding:0; |
margin:0; |
width:100%; |
height:100%; |
font-family:Arial; |
font-size:12px; |
background-color:#4A4B4C; |
color:#CCC; |
} |
h1 { |
font-size:1.6em; |
} |
h2 { |
font-size:1.4em; |
} |
a, a:active, a:visited { |
border-bottom:1px dotted #666; |
color:#CCC; |
text-decoration:none; |
} |
a:active { |
outline:none; |
} |
a:focus { |
outline:thin dotted; |
} |
a:hover { |
color:#56B80E; |
border-bottom:1px dotted #56B80E; |
} |
/*+-----------------------------------------------------------------------------------------------------------------+*/ |
/* Présentation des listes de définitions */ |
dl { |
width:100%; |
} |
dt { |
float:left; |
font-weight:bold; |
text-align:top left; |
margin-right:0.3em; |
} |
dd { |
width:auto; |
margin:0.5em 0; |
} |
/*+-----------------------------------------------------------------------------------------------------------------+*/ |
/* Tableau : */ |
table { |
border:1px solid gray; |
border-collapse:collapse; |
} |
table thead, table tfoot, table tbody { |
background-color:Gainsboro; |
border:1px solid gray; |
color:black; |
} |
table tbody { |
background-color:#FFF; |
} |
table th { |
font-family:monospace; |
border:1px dotted gray; |
padding:5px; |
background-color:Gainsboro; |
} |
table td { |
font-family:arial; |
border:1px dotted gray; |
padding:5px; |
text-align:left; |
} |
table caption { |
font-family:sans-serif; |
} |
legend { |
font-size:1.2em; |
color:#CCC; |
} |
/*+-----------------------------------------------------------------------------------------------------------------+*/ |
/* Générique */ |
.nettoyage{ |
clear:both; |
} |
hr.nettoyage{ |
visibility:hidden; |
} |
/*+-----------------------------------------------------------------------------------------------------------------+*/ |
/* Formulaire */ |
fieldset { |
width:800px; |
} |
label{ |
width:140px; |
display:block; |
float:left; |
} |
input, select, textarea { |
width:240px; |
} |
#saisie-obs fieldset{ |
margin-top:10px; |
border:0; |
display:block; |
} |
#saisie-obs ul { |
list-style-type:none; |
margin:0; |
padding:0; |
} |
#saisie-obs li { |
margin:5px; |
} |
#partie-station label { |
width:70px; |
display:block; |
float:left; |
} |
#latitude, #longitude { |
width:70px; |
float:left; |
} |
#latitude { |
margin-right:5px; |
} |
#lat-lon-info { |
margin-left:5px; |
} |
.obligatoire { |
color:red; |
} |
label.error { |
display:inline; |
float:none; |
color:red; |
padding-left:.5em; |
} |
/*+-----------------------------------------------------------------------------------------------------------------+*/ |
/* Carte Google Map */ |
#gg-map-localisation { |
background-color:#4A4B4C; |
color:#CCC; |
} |
#gg-map-carte { |
width:100%; |
} |
#gg-map-info { |
list-style-type:none; |
padding: 5px 0; |
margin:0; |
} |
#gg-map-info li { |
margin:0 0 0 5px; |
} |
#gg-map-form { |
padding:0; |
margin:0 5px; |
} |
#gg-map-form button { |
margin:5px; |
} |
.champ { |
color:#56B80E; |
font-weight:bold; |
} |
/tags/celw-v1.1/widget/modules/saisie/Saisie.php |
---|
New file |
0,0 → 1,137 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Widget fournissant des interfaces de saisies simplifiée pour différent projets. |
* Encodage en entrée : utf8 |
* Encodage en sortie : utf8 |
* |
* Cas d'utilisation et documentation : |
* @link http://www.tela-botanica.org/wikini/eflore/wakka.php?wiki=AideCELWidgetSaisie |
* |
* Paramètres : |
* ===> projet = chaine [par défaut : Biodiversite34] |
* Indique quel projet nous voulons charger |
* |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt> |
* @version $Id$ |
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
*/ |
class Saisie extends WidgetCommun { |
const DS = DIRECTORY_SEPARATOR; |
const PROJET_DEFAUT = 'biodiversite34'; |
private $projet = null; |
private $configProjet = null; |
/** |
* Méthode appelée par défaut pour charger ce widget. |
*/ |
public function executer() { |
$retour = null; |
extract($this->parametres); |
if (!isset($projet)) { |
$this->projet = self::PROJET_DEFAUT; |
} else { |
$this->projet = $projet; |
} |
$this->chargerConfigProjet(); |
$service = (isset($service)) ? $service : $this->projet; |
$methode = $this->traiterNomMethodeExecuter($service); |
if (method_exists($this, $methode)) { |
$retour = $this->$methode(); |
} else { |
$this->messages[] = "Ce type de service '$methode' n'est pas disponible."; |
} |
if (is_null($retour)) { |
$contenu = 'Un problème est survenu : '.print_r($this->messages, true); |
} else { |
$ext = (isset($retour['squelette_ext'])) ? $retour['squelette_ext'] : '.tpl.html'; |
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$this->projet.self::DS.$retour['squelette'].$ext; |
$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']); |
} |
$this->envoyer($contenu); |
} |
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)) { |
$this->messages[] = "Le fichier ini '$fichier_config' du projet n'a pu être chargé."; |
} |
} else { |
$this->messages[] = "Le fichier ini '$fichier_config' du projet n'existe pas."; |
} |
} |
public function executerBiodiversite34() { |
$widget['squelette'] = $this->projet; |
$widget['donnees'] = array(); |
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], ''); |
$widget['donnees']['taxons'] = $this->recupererListeTaxonBiodiversite34(); |
$widget['donnees']['milieux'] = $this->parserMilieuxBiodiversite34(); |
return $widget; |
} |
public function executerTaxons() { |
$widget['squelette'] = $this->projet.'_taxons'; |
$widget['squelette_ext'] = '.tpl.js'; |
$widget['donnees'] = array(); |
$methode = 'recupererListeTaxon'.str_replace(' ', '', ucwords(str_replace('-', ' ', strtolower($this->projet)))); |
$taxons = $this->$methode(); |
$taxons_tries = array(); |
foreach ($taxons as $taxon) { |
$taxons_tries[$taxon['num_nom_sel']] = $taxon; |
} |
$widget['donnees']['taxons'] = json_encode($taxons_tries); |
return $widget; |
} |
private function parserMilieuxBiodiversite34() { |
$infosMilieux = array(); |
$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); |
return $infosMilieux; |
} |
private function recupererListeTaxonBiodiversite34() { |
$taxons = null; |
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.'biodiversite34_taxons.tsv'; |
if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) { |
$taxons = $this->decomposerFichierTsv($fichier_tsv); |
} else { |
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'."; |
} |
$taxons_tries = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC)); |
return $taxons_tries; |
} |
private function decomposerFichierTsv($fichier, $delimiter = "\t"){ |
$header = NULL; |
$data = array(); |
if (($handle = fopen($fichier, 'r')) !== FALSE) { |
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) { |
if (!$header) { |
$header = $row; |
} else { |
$data[] = array_combine($header, $row); |
} |
} |
fclose($handle); |
} |
return $data; |
} |
} |
/tags/celw-v1.1/widget/modules/saisie/configurations/biodiversite34_taxons.tsv |
---|
New file |
0,0 → 1,44 |
nom_sel num_nom_sel nom_ret num_nom_ret num_taxon famille nom_fr nom_fr_autre |
Pancratium maritimum L. 47379 Pancratium maritimum L. 47379 5834 Amaryllidaceae Lis de mer |
Echinophora spinosa L. 23444 Echinophora spinosa L. 23444 166 Apiaceae Panais épineux |
Calystegia soldanella (L.) Roem. & Schult. 12352 Calystegia soldanella (L.) Roem. & Schult. 12352 2450 Convolvulaceae Liseron de mer |
Eryngium maritimum L. 25390 Eryngium maritimum L. 25390 173 Apiaceae Panicaut |
Althaea officinalis L. 3752 Althaea officinalis L. 3752 3806 Malvaceae Guimauve |
Narcissus tazetta L. 43691 Narcissus tazetta L. 43691 5824 Amaryllidaceae Narcisse à bouquet |
Anacamptis palustris (Jacq.) Bateman, Pridgeon & Chase 4317 Anacamptis palustris (Jacq.) Bateman, Pridgeon & Chase 4317 6542 Orchidaceae Orchis des marais |
Legousia speculum-veneris (L.) Chaix 38202 Legousia speculum-veneris (L.) Chaix 38202 1920 Campanulaceae Miroir de Vénus |
Centaurea cyanus L. 15139 Centaurea cyanus L. 15139 576 Asteraceae Bleuet |
Nigella damascena L. 44101 Nigella damascena L. 44101 4465 Ranunculaceae Nigelle de Damas |
Echinops ritro L. 75102 Echinops ritro L. 75102 30094 Asteraceae Oursin bleu |
Ecballium elaterium (L.) A.Rich. 75101 Ecballium elaterium (L.) 75101 30093 Cucurbitaceae Concombre d'âne |
Cortaderia selloana (Schult. & Schult.f.) Asch. & Graebn. 19053 Cortaderia selloana (Schult. & Schult.f.) Asch. & Graebn. 19053 6742 Poaceae Herbe de la pampa |
Convolvulus althaeoides L. 18732 Convolvulus althaeoides L. 18732 2452 Convolvulaceae Liseron de Provence Fausse guimauve |
Narcissus assoanus Dufour 43518 Narcissus assoanus Dufour 43518 5806 Amaryllidaceae Narcisse d'Asso |
Lavandula stoechas L. 75211 Lavandula stoechas L. 75211 30203 Lamiaceae Lavande stéchade |
Trifolium stellatum L. 69418 Trifolium stellatum L. 69418 14839 Fabaceae Trèfle étoilé |
Cneorum tricoccon L. 18308 Cneorum tricoccon L. 18308 2446 Cneoraceae Camélée Garoupe |
Amanita ovoidea Amanite ovoide |
Leuzea conifera (L.) DC. 38821 Leuzea conifera (L.) DC. 38821 1050 Asteraceae Leuzée conifère Pomme-de-pin |
Populus alba L. 51965 Populus alba L. 51965 5124 Salicaceae Peuplier blanc |
Iris pseudacorus L. 35960 Iris pseudacorus L. 35960 6103 Iridaceae Iris faux acore |
Robinia pseudoacacia L. 56245 Robinia pseudoacacia L. 56245 3124 Fabaceae Acacia Robinier faux acacia |
Parnassia palustris L. 47942 Parnassia palustris L. 47942 5203 Parnassiaceae Parnassie des marais |
Alisma plantago-aquatica L. 2871 Alisma plantago-aquatica L. 2871 5785 Alismataceae Plantain d'eau |
Quercus suber L. 54585 Quercus suber L. 54585 3297 Fagaceae Chêne-liège |
Buxus sempervirens L. 11691 Buxus sempervirens L. 11691 1842 Buxaceae Buis |
Sorbus torminalis (L.) Crantz 65340 Sorbus torminalis (L.) Crantz 65340 4996 Rosaceae Alisier torminal |
Smilax aspera L. 64818 Smilax aspera L. 64818 6383 Smilacaceae Salsepareille |
Ruscus aculeatus L. 58960 Ruscus aculeatus L. 58960 6367 Ruscaceae Fragon faux houx |
Quercus pubescens Willd. 54438 Quercus pubescens Willd. 54438 13623 Fagaceae Chêne pubescent |
Arbutus unedo L. 6055 Arbutus unedo L. 6055 2648 Ericaceae Arbousier |
Ailanthus altissima (Mill.) Swingle 2088 Ailanthus altissima (Mill.) Swingle 2088 5537 Simaroubaceae Faux Vernis du Japon |
Colchicum multiflorum Brot. 18564 Colchicum multiflorum Brot. 18564 6293 Colchicaceae Colchique d'automne Safran des prés |
Carlina acanthifolia All. 14560 Carlina acanthifolia All. 14560 548 Asteraceae Chardon du Larzac (baromêtre) Carline à feuilles d'acanthe |
Hormathophylla spinosa (L.) Küpfer 34932 Hormathophylla spinosa (L.) Küpfer 34932 1689 Brassicaceae Alysson épineux |
Dactylorhiza latifolia (L.) Baumann & Künkele 21395 Dactylorhiza latifolia (L.) Baumann & Künkele 21395 9693 Orchidaceae Orchis sureau |
Ilex aquifolium L. 35676 Ilex aquifolium L. 35676 326 Aquifoliaceae Houx |
Scilla lilio-hyacinthus L. 61487 Scilla lilio-hyacinthus L. 61487 6376 Hyacinthaceae Scille lis-jacinthe |
Lobaria pulmonaria Lichen pulmonaire |
Adiantum capillus-veneris L. 817 Adiantum capillus-veneris L. 817 7327 Adiantaceae Capillaire de Montpellier |
Acanthus mollis L. 74930 Acanthus mollis L. 74930 29922 Acanthaceae Acanthe molle |
Bothriochloa barbinodis (Lag.) Herter 9977 Bothriochloa barbinodis (Lag.) Herter 9977 6775 Poaceae Pied-de-poule |
/tags/celw-v1.1/widget/modules/saisie/configurations/biodiversite34.ini |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/tags/celw-v1.1/widget/modules/saisie/configurations/biodiversite34.ini |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |