/trunk/widget/widget.ini.defaut.php |
---|
21,12 → 21,13 |
; Dossier contenant les fichiers des bibliothèques tierces |
bibliothequeDossier = "bibliotheque/" |
; Base de l'url servant à appeler les widgets |
baseURL = "/widget:cel:" |
baseURL = "/widget:coel:" |
; URL de base absolue des Widgets du CEL construit dynamiquement dans le fichier WidgetCommun.php |
; eg: http://localhost/coel/widget/" |
baseURLAbsoluDyn = "" |
; URL des services web sous forme de template à utiliser avec sprintf |
baseURLServicesTpl = "http://www.tela-botanica.org/service:coel:" |
;;; baseURLServicesTpl = "http://www.tela-botanica.org/service:coel:" |
baseURLServicesTpl = "http://www.tela-botanica.org/eflore/coel/jrest/" |
; URL des services web du CEL sous forme de template à utiliser avec sprintf |
baseURLServicesAnnuaireTpl = "http://www.tela-botanica.org/service:annuaire:%s" |
; Squelette d'Url permettant d'afficher une image du CEL (remplace %s par l'id de l'image sans underscore) |
40,7 → 41,7 |
; Url du service fournissant des infos sur les noms à partir d'un num tax |
infosTaxonUrl = "http://www.tela-botanica.org/service:eflore:0.1/bdtfx/noms/%s" |
; Url du service wiki fournissant les pages d'aide |
aideWikiniUrl = 'http://www.tela-botanica.org/wikini/eflore/api/rest/0.5/pages/{page}?txt.format=text/html'; |
aideWikiniUrl = "http://www.tela-botanica.org/wikini/eflore/api/rest/0.5/pages/{page}?txt.format=text/html"; |
[authentification] |
serviceUrlTpl = "http://www.tela-botanica.org/service:annuaire:TestLoginMdp/%s/%s" |
/trunk/widget/modules/cartodepartement/config.defaut.ini |
---|
File deleted |
\ No newline at end of file |
/trunk/widget/modules/cartodepartement/squelettes/images/petitCarreContour.jpg |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
/trunk/widget/modules/cartodepartement/squelettes/scripts/carto.js |
---|
File deleted |
/trunk/widget/modules/cartodepartement/squelettes/css/carto.css |
---|
File deleted |
/trunk/widget/modules/cartodepartement/squelettes/carto_departement.tpl.html |
---|
File deleted |
/trunk/widget/modules/cartodepartement/config.ini |
---|
File deleted |
\ No newline at end of file |
/trunk/widget/modules/cartodepartement/CartoDepartement.php |
---|
File deleted |
\ No newline at end of file |
/trunk/widget/modules/carto/config.defaut.ini |
---|
New file |
0,0 → 1,3 |
[carto] |
urlPageFiche = "http://www.tela-botanica.org/page:herbiers_carto" |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/trunk/widget/modules/carto/Carto.php |
---|
New file |
0,0 → 1,133 |
<?php |
class Carto extends WidgetCommun { |
const SERVICE_CARTO_NOM = 'carto'; |
const SERVICE_CARTO_ACTION_DEFAUT = 'carto'; |
private $carte = ''; |
private $departement = ''; |
/** |
* Methode appelee par defaut pour executer ce widget |
*/ |
public function executer() { |
$retour = null; |
// recuperer les parametres de l'URL |
$this->extraireParametres(); |
// verifier la disponibilite des services et ressources demandees |
$methode = $this->traiterNomMethodeExecuter($this->carte); |
if (method_exists($this, $methode)) { |
$retour = $this->$methode(); |
} else { |
$this->messages[] = "Ce type de service '$methode' n'est pas disponible."; |
} |
if (is_null($retour)) { |
$info = 'Un problème est survenu : '.print_r($this->messages, true); |
$this->envoyer($info); |
} else { |
$squelette = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'squelettes' . DIRECTORY_SEPARATOR |
. $retour['squelette'] . '.tpl.html'; |
$html = $this->traiterSquelettePhp($squelette, $retour['donnees']); |
$this->envoyer($html); |
} |
} |
public function extraireParametres() { |
extract($this->parametres); |
$this->carte = (isset($carte) ? $carte : self::SERVICE_CARTO_ACTION_DEFAUT); |
$this->departement = (isset($dept) ? $dept : '*'); |
$this->regions = (isset($regions) ? $regions : '*'); |
$this->pays = (isset($pays) ? $pays : '*'); |
} |
/** |
* Carte par défaut |
*/ |
public function executerCarto() { |
$widget = null; |
// Création des infos du widget |
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], ''); |
$widget['donnees']['url_web_service'] = sprintf($this->config['chemins']['baseURLServicesTpl'], ''); |
$widget['donnees']['url_page_fiche'] = $this->config['carto']["urlPageFiche"]; |
$widget['donnees']['departement'] = $this->departement; |
$widget['donnees']['regions'] = $this->regions; |
$widget['donnees']['pays'] = $this->pays; |
$widget['squelette'] = 'carto'; |
return $widget; |
} |
// utilisée ? |
private function contruireUrlService() { |
// Création url données json |
$url = sprintf($this->config['chemins']['baseURLServicesTpl'], ''); |
if ($action) { |
$url .= "/$action"; |
$parametres_retenus = array(); |
$parametres_a_tester = array('dept'); |
foreach ($parametres_a_tester as $param) { |
if (isset($this->$param) && $this->$param != '*') { |
$parametres_retenus[$param] = $this->$param; |
} |
} |
if (count($parametres_retenus) > 0) { |
$parametres_url = array(); |
foreach ($parametres_retenus as $cle => $valeur) { |
$parametres_url[] = $cle.'='.$valeur; |
} |
$url .= '?'.implode('&', $parametres_url); |
} |
} |
return $url; |
} |
private function obtenirUrlsLimitesCommunales() { |
$urls = null; |
if (isset($this->departement)) { |
// si on veut afficher les limites départementales on va compter et chercher les noms de fichiers |
$fichiersKml = $this->chercherFichierKml(); |
if (count($fichiersKml) > 0) { |
foreach ($fichiersKml as $kml => $dossier){ |
$url_limites_communales = sprintf($this->config['carto']['limitesCommunaleUrlTpl'], $dossier, $kml); |
$urls[] = $url_limites_communales; |
} |
} |
} |
$urls = json_encode($urls); |
return $urls; |
} |
private function chercherFichierKml(){ |
$fichiers = array(); |
$chemins = explode(',', $this->config['carto']['communesKmzChemin']); |
$departements = explode(',', $this->departement);// plrs code de départements peuvent être demandés séparés par des virgules |
$departements_trouves = array(); |
foreach ($chemins as $dossier_chemin) { |
if ($dossier_ressource = opendir($dossier_chemin)) { |
while ($element = readdir($dossier_ressource)) { |
if ($element != '.' && $element != '..') { |
foreach ($departements as $departement) { |
$nom_dossier = basename($dossier_chemin); |
if (!isset($departements_trouves[$departement]) || $departements_trouves[$departement] == $nom_dossier) { |
$dept_protege = preg_quote($departement); |
if (!is_dir($dossier_chemin.'/'.$element) && preg_match("/^$dept_protege(?:_[0-9]+|)\.kml$/", $element)) { |
$fichiers[$element] = $nom_dossier; |
$departements_trouves[$departement] = $nom_dossier; |
} |
} |
} |
} |
} |
closedir($dossier_ressource); |
} |
} |
return $fichiers; |
} |
} |
?> |
/trunk/widget/modules/carto/squelettes/carto.tpl.html |
---|
New file |
0,0 → 1,63 |
<!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> |
<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" /> |
<title>Localisation des collections d'herbiers</title> |
<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" /> |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" /> |
<!--[if lte IE 8]> |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" /> |
<![endif]--> |
<link rel="stylesheet" href="<?=$url_base?>modules/carto/squelettes/css/carto.css" /> |
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script> |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&sensor=true&language=fr&region=FR"></script> |
<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> |
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script> |
<script type="text/javascript" src="<?=$url_base?>modules/carto/squelettes/scripts/carto.js"></script> |
<script type="text/javascript"> |
//<![CDATA[ |
var departement = '<?= $departement ?>'; |
var regions = '<?= $regions ?>'; // parmi les codes de http://download.geonames.org/export/dump/admin1CodesASCII.txt |
var pays = '<?= $pays ?>'; |
var urlWebService = '<?= $url_web_service ?>'; |
//]]> |
</script> |
</head> |
<body> |
<div id="map"></div> |
<!-- Squelette du contenu de la popup --> |
<script id="tpl-structure" type="text/x-jquery-tmpl"> |
<div id="description-structure"> |
<h3 align="center"> |
<a href="<?=$url_page_fiche?>?module=FicheStructure&id=${id}">${nom}</a> |
</h3> |
<div class="popup-simple-text">Situé dans ${ville} (${code_postal})</div> |
<hr /> |
<div id="collections"> |
{{if collections.length > 0}} |
<div class="popup-simple-text">Collections présentes :</div> |
<ul> |
{{each(index, collection) collections}} |
<li> |
<a href="<?=$url_page_fiche?>?module=FicheCollection&id=${collection.id}">${collection.nom}</a> |
</li> |
{{/each}} |
</ul> |
{{else}} |
<div class="popup-simple-text">Aucune Collection d'herbiers recensée à ce jour</div> |
{{/if}} |
</div> |
</div> |
</script> |
<div id="structure" style="display:none"></div> |
</body> |
</html> |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/trunk/widget/modules/carto/squelettes/images/petitCarreContour.jpg |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
/trunk/widget/modules/carto/squelettes/images/petitCarreContour.jpg |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/jpeg |
\ No newline at end of property |
/trunk/widget/modules/carto/squelettes/scripts/carto.js |
---|
New file |
0,0 → 1,233 |
var map = null, |
optionsCoucheOSM = { |
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors,' |
+ ' <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>', |
maxZoom: 18 |
}, |
optionsCoucheGoogle = { |
attribution: 'Map data ©'+new Date().getFullYear()+' <a href="http://maps.google.com">Google</a>', |
maxZoom: 18 |
}, |
coucheOSM = new L.TileLayer("http://a.tile.openstreetmap.org/{z}/{x}/{y}.png", |
optionsCoucheOSM), |
coucheSatellite = new L.TileLayer("http://mt1.google.com/vt/lyrs=y@218131653&hl=fr&src=app&x={x}&y={y}&z={z}", |
optionsCoucheGoogle), |
optionsCarte = { |
center : new L.LatLng(46, 2), |
zoom : 6, |
layers : [coucheSatellite] |
}; |
var xmlHttpRequest = null, |
nombreCollections = 0, |
collections = new Array(), |
structures = new Array(), |
coucheStructures = new L.FeatureGroup(), |
infoBulle = null, |
chargementEnCours = false; |
$(document).ready(function() { |
dimensionnerCarte(); |
initialiserCarte(); |
initialiserPanneauControle(); |
// obtenirNombreCollections |
// $.getJSON(urlWebService + "CoelRecherche/Nombre/*/*/*/*/*/*/" + departement + "/*/*/", {async:false}).complete(function() { recupererValeurNombreCollections(); }); |
$.ajax({ |
dataType: "json", |
url: urlWebService + "CoelRecherche/Nombre/*/*/*/*/*/*/" + departement + "/*/*/", |
data: { formatRetour: "text/plain", pays: pays, regions: regions }, |
async: false |
}).complete(function(msg) { |
if (! estStatutRequeteOK(msg.status)) { |
alert(msg.responseText); |
return; |
} |
nombreCollections = parseInt(msg.responseText); |
}); |
chargerStructures(); |
}); |
$(window).resize(function() { |
dimensionnerCarte(); |
}); |
function dimensionnerCarte() { |
$("#map").width($(window).width()); |
$("#map").height($(window).height()); |
} |
function initialiserCarte() { |
map = L.map('map', optionsCarte); |
coucheSatellite.addTo(map); |
coucheStructures.addTo(map); |
map.on('zoomend', function() { |
// controle sur le niveau de zoom uniquement a la fin du placement des structures sur la carte |
if (chargementEnCours) { |
chargementEnCours = false; |
verifierZoom(); |
} |
}); |
} |
function initialiserPanneauControle() { |
var baseMaps = { |
"Plan" : coucheOSM, |
"Satellite" : coucheSatellite |
}; |
var overlayMaps = { |
"Structures" : coucheStructures |
}; |
L.control.layers(baseMaps, overlayMaps).addTo(map); |
} |
function recupererValeurNombreCollections() { |
} |
function chargerStructures() { |
if (requeteEnCours()) { |
window.setTimeout('chargerStructures()', 400); |
return; |
} |
chargementEnCours = true; |
$.ajax({ |
dataType: "json", |
url: urlWebService + "CoelRecherche/ParDefaut/*/*/*/*/*/*/" + departement + "/*/*/", |
data: { limit: nombreCollections, pays: pays, regions: regions }, |
async: true |
}).complete(function(msg) { |
if (!estStatutRequeteOK(msg.status)) { |
alert(msg.responseText); |
return; |
} |
collections = eval("(function(){return " + msg.responseText + ";})()"); |
ordonnerCollectionsParStructures(); |
chargerLocalisations(); |
}); |
} |
function requeteEnCours() { |
return (xmlHttpRequest != null && xmlHttpRequest.readyState != 4); |
} |
function estStatutRequeteOK(x_status) { |
return (x_status == 200 || x_status == 304 || x_status == 0); |
} |
function ordonnerCollectionsParStructures() { |
for (var index = 0; index < collections.length; index ++) { |
var indexStructure = 0; |
while (indexStructure < structures.length && structures[indexStructure].id != collections[index].cs_id_structure) { |
indexStructure ++; |
} |
if (indexStructure == structures.length) { |
var structure = { |
"id" : collections[index].cs_id_structure, |
"nom" : collections[index].cs_nom, |
"ville" : collections[index].cs_ville, |
"code_postal" : collections[index].cs_code_postal, |
"longitude" : collections[index].cs_longitude, |
"latitude" : collections[index].cs_latitude, |
"collections" : new Array() |
}; |
structures.push(structure); |
} |
var collection = { |
"id" : collections[index].cc_id_collection, |
"nom" : collections[index].cc_nom |
}; |
structures[indexStructure].collections.push(collection); |
} |
} |
function chargerLocalisations() { |
var nombreStructuresAffichees = 0; |
for (var index = 0; index < structures.length; index ++) { |
if ((structures[index].longitude != null && structures[index].longitude != "") |
&& (structures[index].latitude != null && structures[index].latitude != "")) { |
var existeMarqueur = rechercherExistenceMarqueur(structures[index].longitude, structures[index].latitude); |
if (!existeMarqueur) { |
creerMarqueur(structures[index]); |
nombreStructuresAffichees ++; |
} |
} |
} |
if (nombreStructuresAffichees > 0) { |
map.fitBounds(coucheStructures.getBounds()); |
} |
} |
function rechercherExistenceMarqueur(longitude, latitude) { |
var existeMarqueur = false; |
coucheStructures.eachLayer(function(layer) { |
if (layer.getLatLng().lat == latitude && layer.getLatLng().lng == longitude) { |
existeMarqueur = true; |
} |
}); |
return existeMarqueur; |
} |
function creerMarqueur(structure) { |
var latlng = new L.LatLng(structure.latitude, structure.longitude); |
var marqueur = new L.Marker(latlng, { |
title : structure.nom |
}); |
marqueur.on('click', surClickMarqueur); |
coucheStructures.addLayer(marqueur); |
} |
function surClickMarqueur(event) { |
var latlng = event.target.getLatLng(); |
var collections = new Array(); |
var structure = null; |
for (var index = 0; index < structures.length; index ++) { |
if (structures[index].latitude == latlng.lat && structures[index].longitude == latlng.lng) { |
collections = collections.concat(structures[index].collections); |
structure = structures[index]; |
afficherCollections(structure, collections); |
break; |
} |
} |
} |
function afficherCollections(structure, collections) { |
masquerInfoBulle(); |
infoBulle = new L.Popup({maxWidth : 0.25*$(window).width(), maxHeight : 0.35*$(window).height()}); |
var latlng = new L.LatLng(structure.latitude, structure.longitude); |
infoBulle.setLatLng(latlng); |
infoBulle.openOn(map); |
remplirContenuPopup(structure, collections); |
$("a").css("color", "#598000"); |
map.setView(latlng, map.getZoom()); |
} |
function masquerInfoBulle() { |
if (infoBulle != null && map.hasLayer(infoBulle)) { |
map.removeLayer(infoBulle); |
} |
infoBulle = null; |
} |
function remplirContenuPopup(structure, collections) { |
$("#structure").empty(); |
var structureAjout = { |
"id" : structure.id, |
"nom" : structure.nom, |
"ville" : structure.ville, |
"code_postal" : structure.code_postal, |
"collections" : collections |
}; |
$("#tpl-structure").tmpl(structureAjout).appendTo($("#structure")); |
infoBulle.setContent($("#structure").html()); |
} |
function verifierZoom() { |
if(map.getZoom() > 13) { |
map.setZoom(13); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/trunk/widget/modules/carto/squelettes/css/carto.css |
---|
New file |
0,0 → 1,34 |
@CHARSET "UTF-8"; |
body { |
margin: 0px; |
padding: 0px; |
} |
#map { |
position: relative; |
} |
ul { |
padding-left: 10px; |
margin-top: 5px; |
margin-bottom: 5px; |
} |
ul li { |
background: url("../images/petitCarreContour.jpg") no-repeat scroll 10px 6px transparent; |
line-height: 18px; |
list-style: none outside none; |
padding-left: 25px; |
} |
a { |
text-decoration : none; |
border-bottom: 1px dotted #95AE5D; |
color: #598000; |
margin: 0; |
} |
.popup-simple-text { |
font-size: 1.15em; |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/trunk/widget/modules/carto/config.ini |
---|
New file |
0,0 → 1,3 |
[carto] |
urlPageFiche = "http://www.tela-botanica.org/page:herbiers_carto" |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |