Subversion Repositories eFlore/Applications.cel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 3856 → Rev 3857

/branches/v3.01-serpe/widget/modules/carto/config.defaut.ini
New file
0,0 → 1,5
[carto]
; Chemin vers le dossier contenant les fichiers kmz des limites communales
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 = "https://www.tela-botanica.org/eflore/cel2/widget/modules/carto/squelettes/kml/%s"
/branches/v3.01-serpe/widget/modules/carto/Carto.php
New file
0,0 → 1,203
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant une carte dynamique des obsertions publiques du CEL.
* 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=AideCELWidgetCarto
*
* Paramètres :
* ===> utilisateur = identifiant
* Affiche seulement les observations d'un utilisateur donné. L'identifiant correspond au courriel de
* l'utilisateur avec lequel il s'est inscrit sur Tela Botanica.
* ===> dept = code_du_département
* Affiche seulement les observations pour le département français métropolitain indiqué. Les codes de département utilisables
* sont : 01 à 19, 2A, 2B et 21 à 95.
* ===> projet = mot-clé
* Affiche seulement les observations pour le projet d'observations indiqué. Dans l'interface du CEL, vous pouvez taguer vos
* observations avec un mot-clé de projet. Si vous voulez regrouper des observations de plusieurs utilisateurs, communiquez un
* mot-clé de projet à vos amis et visualisez les informations ainsi regroupées.
* ===> num_taxon = num_taxon
* Affiche seulement les observations pour la plante indiquée. Le num_taxon correspond au numéro taxonomique de la plante.
* Ce numéro est disponible dans les fiches d'eFlore. Par exemple, pour "Poa bulbosa L." le numéro taxonomique vaut 7080.
*
* @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 Carto extends WidgetCommun {
const DS = DIRECTORY_SEPARATOR;
const SERVICE_CARTO_NOM = 'CelWidgetMap';
const SERVICE_CARTO_ACTION_DEFAUT = 'carte-defaut';
private $carte = null;
private $utilisateur = null;
private $projet = null;
private $dept = null;
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.
*/
public function executer() {
$retour = null;
$this->extraireParametres();
$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__).self::DS.'squelettes'.self::DS.$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->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 : '*');
$this->date = (isset($date) ? $date : '*');
$this->taxon = (isset($taxon) ? $taxon : '*');
$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);
}
 
/**
* Carte par défaut
*/
public function executerCarteDefaut() {
$widget = null;
$url_stations = $this->contruireUrlServiceCarto('stations');
$url_base = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
 
// Création des infos du widget
$widget['donnees']['url_cel_carto'] = $this->contruireUrlServiceCarto();
$widget['donnees']['url_stations'] = $url_stations;
$widget['donnees']['url_base'] = $url_base;
$widget['donnees']['utilisateur'] = $this->utilisateur;
$widget['donnees']['projet'] = $this->projet;
$widget['donnees']['tag'] = $this->tag;
$widget['donnees']['dept'] = $this->dept;
$widget['donnees']['commune'] = $this->commune;
$widget['donnees']['num_taxon'] = $this->num_taxon;
$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']['prod'] = ($this->config['parametres']['modeServeur'] == "prod");
$widget['donnees']['cleGoogleMaps'] = $this->config['api']['cleGoogleMapsCarto'];
$widget['squelette'] = 'carte_defaut';
return $widget;
}
private function contruireUrlServiceCarto($action = null) {
// Création url données json
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::SERVICE_CARTO_NOM);
if ($action) {
$url .= "/$action";
$parametres_retenus = array();
$parametres_a_tester = array('station', 'utilisateur', 'projet', 'tag', 'dept', 'commune',
'num_taxon', 'taxon', 'date', 'commentaire',
'start', 'limit', 'photos');
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->dept)) {
// 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->dept);// 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]+|)\.km[lz]$/", $element)) {
$fichiers[$element] = $nom_dossier;
$departements_trouves[$departement] = $nom_dossier;
}
}
}
}
}
closedir($dossier_ressource);
}
}
return $fichiers;
}
/**
* Afficher message d'avertissement.
*/
public function executerAvertissement() {
$widget = null;
 
// Création des infos du widget
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
$widget['donnees']['url_remarques'] = $this->config['chemins']['widgetRemarquesUrl'];
$widget['squelette'] = 'avertissement';
return $widget;
}
}
?>
/branches/v3.01-serpe/widget/modules/carto/squelettes/obs_tableau.tpl.html
New file
0,0 → 1,35
<div class="info-bulle-contenu">
<div class="onglets">
<ul>
<li class="actif"><span class="onglet">Tableau</span></li>
<li class="inactif"><a class="onglet" onclick="chargerFormatObs('<?=$station_id?>', 'liste');return false;" href="#">Liste</a></li>
</ul>
</div>
<div id="observations">
<table>
<caption><h2><?=count($observations)?> observations pour <?=(isset($commune) ? $commune : '?')?></h2></caption>
<thead>
<tr>
<th>Nom</th><th>Date</th><th>Lieu</th><th>Observateur</th>
</tr>
</thead>
<tbody>
<? foreach ($observations as $obs) : ?>
<tr>
<td>&nbsp;
<? if (isset($obs['nn']) && $obs['nn'] != '' && $obs['nn'] != 0) : ?>
<a href="http://www.tela-botanica.org/bdtfx-nn-<?=$obs['nn']?>" onclick="window.open(this.href); arreter(event); return false; "><?=$obs['nom']?></a>
<? else : ?>
<?=$obs['nom']?>
<? endif; ?>
</td>
<td>&nbsp;<?=$obs['date']?></td>
<td>&nbsp;<?=$obs['lieu']?></td>
<td>&nbsp;<?=$obs['observateur']?></td>
</tr>
<? endforeach; ?>
</tbody>
</table>
<? include(dirname(__FILE__).'/obs_msg_info.tpl.html') ?>
</div>
</div>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/obs_liste.tpl.html
New file
0,0 → 1,43
<div class="info-bulle-contenu">
<div class="onglets">
<ul>
<li class="inactif"><a class="onglet" onclick="chargerFormatObs('<?=$station_id?>', 'tableau');return false;" href="#">Tableau</a></li>
<li class="actif"><span class="onglet">Liste</span></li>
</ul>
</div>
<div id="observations">
<h2><?=count($observations)?> observations pour <?=(isset($commune) ? $commune : '?')?></h2>
<ol>
<? foreach ($observations as $obs) : ?>
<li>
<div>
<? if (isset($images[$obs['id']])) : ?>
<? foreach ($images[$obs['id']] as $num => $urls) : ?>
<div<?=($num == 0) ? ' class="cel-img-principale"': ' class="cel-img-secondaire"'?>>
<a class="cel-img" href="<?=$urls['normale']?>" rel="cel-obs-<?=$obs['id']?>">
<img src="<?=$urls['miniature']?>" alt="Image #<?=$urls['id']?> de l'osbervation #<?=$obs['id']?>" />
</a>
</div>
<? endforeach ?>
<? endif ?>
<dl>
<dt class="champ_nom_latin">Nom</dt>
<dd>&nbsp;
<? if (isset($obs['nn']) && $obs['nn'] != '' && $obs['nn'] != 0) : ?>
<a href="http://www.tela-botanica.org/bdtfx-nn-<?=$obs['nn']?>" onclick="window.open(this.href); arreter(event); return false; "><?=$obs['nom']?></a>
<? else : ?>
<?=$obs['nom']?>
<? endif; ?>
</dd>
<dt>Lieu</dt><dd>&nbsp;<?=$obs['lieu']?></dd>
<dt>Publié par</dt><dd>&nbsp;<?=$obs['observateur']?></dd>
<dt>Le</dt><dd>&nbsp;<?=$obs['date']?></dd>
</dl>
<hr class="nettoyage"/>
</div>
</li>
<? endforeach; ?>
</ol>
<? include(dirname(__FILE__).'/obs_msg_info.tpl.html') ?>
</div>
</div>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/fermeture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/fermeture.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/ouverture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/ouverture.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/trie_decroissant.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/trie_decroissant.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/trie.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/trie.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/information.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/information.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/trie_croissant.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v3.01-serpe/widget/modules/carto/squelettes/images/trie_croissant.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v3.01-serpe/widget/modules/carto/squelettes/obs_msg_info.tpl.html
New file
0,0 → 1,3
<p id="obs-msg-info">
Les observations de cette carte sont regroupées par commune.
</p>
/branches/v3.01-serpe/widget/modules/carto/squelettes/carte_defaut.tpl.html
New file
0,0 → 1,340
<!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>Observations publiques du CEL - Tela Botanica</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="Tela Botanica" />
<meta name="keywords" content="Tela Botanica, cartographie, CEL" />
<meta name="description" content="Widget de cartographie des observations publiques de plantes saisies dans le Carnet en Ligne (CEL)" />
 
<!-- OpenGraph pour Facebook, Pinterest, Google+ -->
<meta property="og:type" content="website" />
<meta property="og:title" content="Cartographie des observations publiques du CeL" />
<meta property="og:site_name" content="Tela Botanica" />
<meta property="og:description" content="Représentation cartographique des observations publiques du Carnet en Ligne, par commune" />
<meta property="og:image" content="https://resources.tela-botanica.org/tb/img/256x256/carre_englobant.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="256" />
<meta property="og:image:height" content="256" />
<meta property="og:locale" content="fr_FR" />
 
<!-- Spécial mobile -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- Favicones -->
<link rel="icon" type="image/png" href="https://resources.tela-botanica.org/tb/img/16x16/favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="https://resources.tela-botanica.org/tb/img/16x16/favicon.ico" />
<!-- Javascript : bibliothèques -->
<!-- <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> -->
<!-- Google Map v3 -->
<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=<?php echo $cleGoogleMaps; ?>&v=3.5&amp;sensor=true&amp;language=fr&amp;region=FR"></script>
<script type="text/javascript" src="https://www.tela-botanica.org/commun/google/map/3/markerclusterer/2.0.1/markerclusterer-2.0.1.pack.js"></script>
<!-- Jquery -->
<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/1.6.2/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="https://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="https://www.tela-botanica.org/commun/jquery/tablesorter/2.0.5/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/pagination/2.2/jquery.pagination.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://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[
var urlsLimitesCommunales = <?=$url_limites_communales?>;
var nt = '<?=$num_taxon?>';
var filtreCommun =
'&taxon=<?=$taxon?>'+
'&utilisateur=<?=$utilisateur?>'+
'&projet=<?=$projet?>'+
'&tag=<?=$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'+'?'+
'num_taxon='+nt+
filtreCommun;
var taxonsUrl = '<?=$url_cel_carto?>/taxons'+'?'+
'num_taxon='+nt+
filtreCommun;
var observationsUrl = '<?=$url_cel_carto?>/observations'+'?'+
'station={stationId}'+
'&num_taxon={nt}'+
filtreCommun;
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/carto/squelettes/scripts/carto.js"></script>
<!-- CSS -->
<link rel="stylesheet" href="https://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<link rel="stylesheet" href="https://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.15/css/smoothness/jquery-ui-1.8.15.custom.css" type="text/css" media="screen" />
<link href="<?=$url_base?>modules/carto/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
 
<!-- Google Analytics -->
<?php if($prod): ?>
<?php include "analytics.html"; ?>
<?php endif; ?>
</head>
 
<body>
<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;">
<img src="https://resources.tela-botanica.org/tb/img/16x16/favicon.png" alt="TB" />
</a>
</span>
<span id="aucune-obs">Aucune observation</span>
<span id="titre-decompte">
<span id="obs-nbre">&nbsp;</span> observations <?= ($photos != null && $photos == 1) ? 'avec photos' : ''; ?>
<span class="plante-titre">concernant <span class="plantes-nbre">&nbsp;</span> plantes</span> sur
<span id="commune-nbre">&nbsp;</span> communes
</span>
- <a href="http://www.tela-botanica.org/appli:cel" title="Carnet en Ligne" onclick="window.open(this.href); arreter(event); return false;">CEL</a> (<a href="http://www.tela-botanica.org/" onclick="window.open(this.href); arreter(event); return false;">Tela Botanica</a>)
</h1>
<div id="zone-info">
<a href="<?=$url_base?>carto?carte=avertissement" onClick="ouvrirPopUp('<?=$url_base?>carto?carte=avertissement', 'Avertissement'); arreter(event); return false;">
<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
alt="Avertissements" title="Avertissements &amp; informations" />
</a>
</div>
</div>
<? if ($num_taxon == '*') : ?>
<div id="panneau-lateral">
<div id="pl-ouverture" title="Ouvrir le panneau latéral"><span>Panneau >></span></div>
<div id="pl-fermeture" title="Fermer le panneau latéral"><span><< Fermer [x]</span></div>
<div id="pl-contenu">
<div id="pl-entete">
<h2>Filtre sur <span class="plantes-nbre">&nbsp;</span> plantes</h2>
<p>
Cliquez sur un nom de plante pour filtrer les observations sur la carte.<br />
Pour revenir à l'état initial, cliquez à nouveau sur le nom sélectionné.
</p>
</div>
<div id="pl-corps" onMouseOver="map.setOptions({'scrollwheel':false});" onMouseOut="map.setOptions({'scrollwheel':true});">
<!-- Insertion des lignes à partir du squelette tpl-taxons-liste -->
</div>
</div>
</div>
<? endif ?>
<div id="carte">
</div>
<div id="origine-donnees">
Observations du réseau <a href="http://www.tela-botanica.org/site:botanique"
onClick="ouvrirNouvelleFenetre(this, event)">
Tela Botanica
</a>
- Carte : <a href="http://www.openstreetmap.org/copyright" target="_blank">© les contributeurs d’OpenStreetMap</a>
- Tuiles : <a href="http://www.openstreetmap.fr" target="_blank">OsmFr</a>
</div>
<!-- +-------------------------------------------------------------------------------------------+ -->
<!-- Blocs chargés à la demande : par défaut avec un style display à none -->
<!-- Squelette du message de chargement des observations -->
<script id="tpl-chargement" type="text/x-jquery-tmpl">
<div id="chargement" style="height:500px;">
<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p>Chargement des observations en cours...</p>
</div>
</script>
<!-- Squelette du contenu d'une info-bulle observation -->
<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>
<div class="navigation">&nbsp;</div>
<div>
<ul>
<li><a href="#obs-vue-tableau">Tableau</a></li>
<li><a href="#obs-vue-liste">Liste</a></li>
</ul>
</div>
<div id="observations">
<div id="obs-vue-tableau" style="display:none;">
<table id="obs-tableau">
<thead>
<tr>
<th title="Nom scientifique défini par l'utilisateur.">Nom</th>
<th title="Date de l'observation">Date</th>
<th title="Lieu d'observation">Lieu</th>
<th title="Auteur de l'observation">Observateur</th>
</tr>
</thead>
<tbody id="obs-tableau-lignes" class="obs-conteneur">
<!-- Insertion des lignes à partir du squelette tpl-obs-tableau -->
</tbody>
</table>
</div>
<div id="obs-vue-liste" style="display:none;">
<ol id="obs-liste-lignes" class="obs-conteneur">
<!-- Insertion des lignes à partir du squelette tpl-obs-liste -->
</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>
</div>
</script>
<!-- Squelette du contenu du tableau des observation -->
<script id="tpl-obs-tableau" type="text/x-jquery-tmpl">
<tr class="cel-obs-${idObs}">
<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; ">
${nomSci}
</a>
{{else}}
${nomSci}
{{/if}}
</span>
</td>
<td class="date">{{if date}}${date}{{else}}&nbsp;{{/if}}</td>
<td class="lieu">{{if lieu}}${lieu}{{else}}&nbsp;{{/if}}</td>
<td>
{{if observateur}}
{{if observateurId}}
<a class="contact obs-${idObs} contributeur-${observateurId}"
href="#form-contact"
title="Contactez ce contributeur">
${observateur}
</a>
{{else}}
${observateur}
{{/if}}
{{else}}
&nbsp;
{{/if}}
</td>
</tr>
</script>
<!-- Squelette du contenu de la liste des observations -->
<script id="tpl-obs-liste" type="text/x-jquery-tmpl">
<li>
<div class="cel-obs-${idObs}">
{{if images}}
{{each(index, img) images}}
<div{{if index == 0}} class="cel-img-principale" {{else}} class="cel-img-secondaire"{{/if}}>
<a class="cel-img"
href="${img.normale}"
title="${nomSci} {{if nn}} [${nn}] {{/if}} par ${observateur} - Publiée le ${datePubli} - GUID : ${img.guid}"
rel="cel-obs-${idObs}">
<img src="${img.miniature}" alt="Image #${img.idImg} de l'osbervation #${nn}" />
</a>
<p id="cel-info-${img.idImg}" class="cel-infos">
<a class="cel-img-titre" href="${urlEflore}"
onclick="window.open(this.href);return false;"
title="Cliquez pour accéder à la fiche eFlore">
<strong>${nomSci} {{if nn}} [nn${nn}] {{/if}}</strong> par <em>${observateur}</em>
</a>
<br />
<span class="cel-img-date">Publiée le ${datePubli}</span>
</p>
</div>
{{/each}}
{{/if}}
<dl>
<dt class="champ-nom-sci">Nom</dt>
<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; ">
${nomSci}
</a>
{{else}}
${nomSci}
{{/if}}
</span>
</dd>
<dt title="Lieu d'observation">Lieu</dt><dd class="lieu">&nbsp;${lieu}</dd>
<dt title="Date d'observation">Le</dt><dd class="date">&nbsp;${date}</dd>
<dt title="Auteur de l'observation">Publié par</dt>
<dd>
{{if observateur}}
{{if observateurId}}
<a class="contact obs-${idObs} contributeur-${observateurId}"
href="#form-contact"
title="Contactez ce contributeur">
${observateur}
</a>
{{else}}
${observateur}
{{/if}}
{{else}}
&nbsp;
{{/if}}
</dd>
</dl>
<hr class="nettoyage"/>
</div>
</li>
</script>
<!-- Squelette de la liste des taxons -->
<script id="tpl-taxons-liste" type="text/x-jquery-tmpl">
<ol id="taxons">
{{each(index, taxon) taxons}}
<li id="taxon-${taxon.nt}">
<span class="taxon" title="Numéro taxonomique : ${taxon.nt} - Famille : ${taxon.famille}">
${taxon.nom} <span class="nt" title="Numéro taxonomique">${taxon.nt}</span>
</span>
</li>
{{/each}}
</ol>
</script>
<!-- Squelette du formulaire de contact -->
<div id="tpl-form-contact" style="display:none;">
<form id="form-contact" method="post" action="">
<div id="fc-zone-dialogue"></div>
<dl>
<dt><label for="fc_sujet">Sujet</label></dt>
<dd><input id="fc_sujet" name="fc_sujet"/></dd>
<dt><label for="fc_message">Message</label></dt>
<dd><textarea id="fc_message" name="fc_message"></textarea></dd>
<dt><label for="fc_utilisateur_courriel" title="Utilisez le courriel avec lequel vous êtes inscrit à Tela Botanica">Votre courriel</label></dt>
<dd><input id="fc_utilisateur_courriel" name="fc_utilisateur_courriel"/></dd>
</dl>
<p>
<input id="fc_destinataire_id" name="fc_destinataire_id" type="hidden" value="" />
<input id="fc_copies" name="fc_copies" type="hidden" value="eflore_remarques@tela-botanica.org" />
<button id="fc_annuler" type="button">Annuler</button>
&nbsp;
<button id="fc_effacer" type="reset">Effacer</button>
&nbsp;
<input id="fc_envoyer" type="submit" value="Envoyer" />
</p>
</form>
</div>
</body>
</html>
/branches/v3.01-serpe/widget/modules/carto/squelettes/scripts/carto.js
New file
0,0 → 1,767
/*+--------------------------------------------------------------------------------------------------------+*/
// 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';
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
var map = null;
var infoBulle = new google.maps.InfoWindow();
var pointClique = null;
var carteCentre = new google.maps.LatLng(46.4, 3.10);
var carteOptions = {
zoom: 6,
mapTypeId: 'OSM',
mapTypeControlOptions: {
mapTypeIds: ['OSM',
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.HYBRID,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.TERRAIN]
},
scaleControl: true,
center: carteCentre
};
var ctaLayer = null;
var osmMapType = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "https://osm.tela-botanica.org/tuiles/osmfr/" + // cache de tuiles avec nginx
zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
isPng: true,
alt: "OpenStreetMap",
name: "OSM",
maxZoom: 19
});
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();
/*+--------------------------------------------------------------------------------------------------------+*/
// INITIALISATION DU CODE
 
//Déclenchement d'actions quand JQuery et le document HTML sont OK
$(document).ready(function() {
initialiserWidget();
});
 
function initialiserWidget() {
afficherStats();
definirTailleTitre();
initialiserAffichageCarte();
initialiserAffichagePanneauLateral();
initialiserCarte();
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
rafraichirCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// AFFICHAGE GÉNÉRAL
 
function afficherStats() {
if (stations.stats.observations > 0) {
// 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());
// affichage du titre
$('#titre-decompte').show();
$('#aucune-obs').hide();
} else {
// masquage du titre
$('#titre-decompte').hide();
$('#aucune-obs').show();
}
}
 
function definirTailleTitre() {
var largeurViewPort = $(window).width();
var taille = null;
if (largeurViewPort < 400) {
taille = '0.8';
} else if (largeurViewPort >= 400 && largeurViewPort < 800) {
taille = '1.0';
} else if (largeurViewPort >= 800) {
taille = '1.6';
}
$("#carte-titre").css('font-size', taille+'em');
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// CARTE
 
function initialiserAffichageCarte() {
$('#carte').height($(window).height() - 35);
$('#carte').width($(window).width() - 24);
if (nt != '*') {
$('#carte').css('left', 0);
}
}
 
function initialiserCarte() {
map = new google.maps.Map(document.getElementById('carte'), carteOptions);
// Ajout de la couche OSM à la carte
map.mapTypes.set('OSM', osmMapType);
 
// écouteur sur changement de fond
google.maps.event.addListener( map, 'maptypeid_changed', function() {
// licence par défaut
var mention = 'Observations du réseau <a href="https://www.tela-botanica.org/site:botanique" ' +
'onClick="ouvrirNouvelleFenetre(this, event)">' +
'Tela Botanica' +
'</a> ';
if (map.getMapTypeId() == 'OSM') {
// ajout licence OSM
mention += ' - Carte : <a href="http://www.openstreetmap.org/copyright" target="_blank">© les contributeurs d’OpenStreetMap</a>' +
' - Tuiles : <a href="http://www.openstreetmap.fr" target="_blank">OsmFr</a>';
}
$('#origine-donnees').html(mention);
});
}
 
 
function chargerLimitesCommunales() {
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: true});
ctaLayer.setMap(map);
}
}
}
 
function rafraichirCarte() {
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));
var point = new google.maps.Marker({
position: maLatLng,
map: map,
icon: pointImage,
stationId: stations.points[i].id
});
 
bounds.extend(maLatLng);
google.maps.event.addListener(point, 'click', function() {
pointClique = this;
infoBulle.open(map, this);
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
afficherInfoBulle();
chargerObs(0, 0);
});
points.push(point);
}
 
if (pointsOrigine == null && boundsOrigine == null) {
pointsOrigine = points;
boundsOrigine = bounds;
}
executerMarkerClusterer(points, bounds);
}
 
function deplacerCartePointClique() {
map.panTo(pointClique.position);
}
 
function executerMarkerClusterer(points, bounds) {
if (points.length > 0) {
if (markerClusterer) {
markerClusterer.clearMarkers();
}
var options = {
imagePath: 'https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m'
};
markerClusterer = new MarkerClusterer(map, points, options);
map.fitBounds(bounds);
}
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
 
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', deplacerCartePointClique);
}
 
function afficherInfoBulle() {
var obsHtml = $("#tpl-obs").html();
var largeur = definirLargeurInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
infoBulle.setContent(obsHtml);
}
 
function definirLargeurInfoBulle() {
var largeurViewPort = $(window).width();
var lageurInfoBulle = null;
if (largeurViewPort < 800) {
largeurInfoBulle = 400;
} else if (largeurViewPort >= 800 && largeurViewPort < 1200) {
largeurInfoBulle = 500;
} else if (largeurViewPort >= 1200) {
largeurInfoBulle = 600;
}
return largeurInfoBulle;
}
 
function afficherMessageChargement(element) {
if ($('#chargement').get() == '') {
$('#tpl-chargement').tmpl().appendTo(element);
}
}
 
function supprimerMessageChargement() {
$('#chargement').remove();
}
 
function chargerObs(depart, total) {
if (depart == 0 || depart < total) {
var limite = 300;
if (depart == 0) {
obsStation = new Array();
}
//console.log("Chargement de "+depart+" à "+(depart+limite));
var urlObs = observationsUrl+'&start={start}&limit='+limite;
urlObs = urlObs.replace(/\{stationId\}/g, pointClique.stationId);
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);
});
} else {
if (pagineur.limite < total) {
afficherPagination();
} else {
surClicPagePagination(0, null);
selectionnerOnglet("#obs-vue-"+pagineur.format);
}
}
}
 
function actualiserInfosStation(infos) {
station.commune = infos.commune;
station.obsNbre = infos.total;
}
 
function actualiserPagineur() {
pagineur.stationId = pointClique.stationId;
pagineur.total = station.obsNbre;
//console.log("Total pagineur: "+pagineur.total);
if (pagineur.total > 4) {
pagineur.format = 'tableau';
} else {
pagineur.format = 'liste';
}
}
 
function afficherPagination(observations) {
$(".navigation").pagination(pagineur.total, {
items_per_page:pagineur.limite,
callback:surClicPagePagination,
next_text:'Suivant',
prev_text:'Précédent',
prev_show_always:false,
num_edge_entries:1,
num_display_entries:4,
load_first_page:true
});
}
 
function surClicPagePagination(pageIndex, paginationConteneur) {
var index = pageIndex * pagineur.limite;
var indexMax = index + pagineur.limite;
pagineur.depart = index;
obsPage = new Array();
for(index; index < indexMax; index++) {
obsPage.push(obsStation[index]);
}
supprimerMessageChargement();
mettreAJourObservations();
return false;
}
 
function mettreAJourObservations() {
$("#obs-"+pagineur.format+"-lignes").empty();
$("#obs-vue-"+pagineur.format).css('display', 'block');
$(".obs-conteneur").css('counter-reset', 'item '+pagineur.depart);
$("#tpl-obs-"+pagineur.format).tmpl(obsPage).appendTo("#obs-"+pagineur.format+"-lignes");
// Actualisation de Fancybox
ajouterFomulaireContact("a.contact");
if (pagineur.format == 'liste') {
ajouterGaleriePhoto("a.cel-img");
}
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
}
 
function initialiserContenuInfoBulle() {
afficherOnglets();
afficherMessageChargement('#observations');
ajouterTableauTriable("#obs-tableau");
afficherTextStationId();
corrigerLargeurInfoWindow();
}
 
function afficherOnglets() {
var $tabs = $('#obs').tabs();
$('#obs').bind('tabsselect', function(event, ui) {
if (ui.panel.id == 'obs-vue-tableau') {
surClicAffichageTableau();
} else if (ui.panel.id == 'obs-vue-liste') {
surClicAffichageListe();
}
});
$tabs.tabs('select', "#obs-vue-"+pagineur.format);
}
 
function selectionnerOnglet(onglet) {
$('#obs').tabs('select', onglet);
}
 
function afficherTextStationId() {
$('#obs-station-id').text(pointClique.stationId);
}
 
function corrigerLargeurInfoWindow() {
$("#info-bulle").width($("#info-bulle").width() - 17);
}
 
function surClicAffichageTableau(event) {
//console.log('tableau');
pagineur.format = 'tableau';
mettreAJourObservations();
mettreAJourTableauTriable("#obs-tableau");
}
 
function surClicAffichageListe(event) {
//console.log('liste');
pagineur.format = 'liste';
mettreAJourObservations();
ajouterGaleriePhoto("a.cel-img");
}
 
function ajouterTableauTriable(element) {
// add parser through the tablesorter addParser method
$.tablesorter.addParser({
// Définition d'un id unique pour ce parsseur
id: 'date_cel',
is: function(s) {
// doit retourner false si le parsseur n'est pas autodétecté
return /^\s*\d{2}[\/-]\d{2}[\/-]\d{4}\s*$/.test(s);
},
format: function(date) {
// Transformation date jj/mm/aaaa en aaaa/mm/jj
date = date.replace(/^\s*(\d{2})[\/-](\d{2})[\/-](\d{4})\s*$/, "$3/$2/$1");
// Remplace la date par un nombre de millisecondes pour trier numériquement
return $.tablesorter.formatFloat(new Date(date).getTime());
},
// set type, either numeric or text
type: 'numeric'
});
$(element).tablesorter({
headers: {
1: {
sorter:'date_cel'
}
}
});
}
 
function mettreAJourTableauTriable(element) {
$(element).trigger('update');
}
 
function ajouterGaleriePhoto(element) {
$(element).fancybox({
transitionIn:'elastic',
transitionOut:'elastic',
speedIn :600,
speedOut:200,
overlayShow:true,
titleShow:true,
titlePosition:'inside',
titleFormat:function (titre, currentArray, currentIndex, currentOpts) {
var motif = /urn:lsid:tela-botanica[.]org:cel:img([0-9]+)$/;
motif.exec(titre);
var id = RegExp.$1;
var info = $('#cel-info-'+id).clone().html();
var tpl =
'<div class="cel-legende">'+
'<p class="cel-legende-vei">'+'Image n°' + (currentIndex + 1) + ' sur ' + currentArray.length +'<\/p>'+
(titre && titre.length ? '<p>'+info+'<\/p>' : '' )+
'<\/div>';
return tpl;
}
}).live('click', function(e) {
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
});
}
 
function ajouterFomulaireContact(element) {
$(element).fancybox({
transitionIn:'elastic',
transitionOut:'elastic',
speedIn :600,
speedOut:200,
scrolling: 'no',
titleShow: false,
onStart: function(selectedArray, selectedIndex, selectedOpts) {
var element = selectedArray[selectedIndex];
 
var motif = / contributeur-([0-9]+)$/;
motif.exec($(element).attr('class'));
var id = RegExp.$1;
//console.log('Destinataire id : '+id);
$("#fc_destinataire_id").attr('value', id);
var motif = / obs-([0-9]+) /;
motif.exec($(element).attr('class'));
var id = RegExp.$1;
//console.log('Obs id : '+id);
chargerInfoObsPourMessage(id);
},
onCleanup: function() {
//console.log('Avant fermeture fancybox');
$("#fc_destinataire_id").attr('value', '');
$("#fc_sujet").attr('value', '');
$("#fc_message").text('');
},
onClosed: function(e) {
//console.log('Fermeture fancybox');
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
}
});
}
 
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 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);
$("#fc_message").text(message);
}
 
function initialiserFormulaireContact() {
//console.log('Initialisation du form contact');
$("#form-contact").validate({
rules: {
fc_sujet : "required",
fc_message : "required",
fc_utilisateur_courriel : {
required : true,
email : true}
}
});
$("#form-contact").bind("submit", envoyerCourriel);
$("#fc_annuler").bind("click", function() {$.fancybox.close();});
}
 
function envoyerCourriel() {
//console.log('Formulaire soumis');
if ($("#form-contact").valid()) {
//console.log('Formulaire valide');
//$.fancybox.showActivity();
var destinataireId = $("#fc_destinataire_id").attr('value');
var urlMessage = "https://www.tela-botanica.org/service:annuaire:Utilisateur/"+destinataireId+"/message"
var erreurMsg = "";
var donnees = new Array();
$.each($(this).serializeArray(), function (index, champ) {
var cle = champ.name;
cle = cle.replace(/^fc_/, '');
if (cle == 'sujet') {
champ.value += " - Carnet en ligne - Tela Botanica";
}
if (cle == 'message') {
champ.value += "\n--\n"+
"Ce message vous est envoyé par l'intermédiaire du widget Cartographique "+
"du Carnet en Ligne du réseau Tela Botanica.\n"+
"https://api.tela-botanica.org/widget:cel:carto";
}
donnees[index] = {'name':cle,'value':champ.value};
});
$.ajax({
type : "POST",
cache : false,
url : urlMessage,
data : donnees,
beforeSend : function() {
$(".msg").remove();
},
success : function(data) {
$("#fc-zone-dialogue").append('<pre class="msg info">'+data.message+'</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";
});
}
},
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 != '') {
$("#fc-zone-dialogue").append('<p class="msg">'+
'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'+
"&body="+erreurMsg+"\nDébogage :\n"+debugMsg+
'">cel@tela-botanica.org</a>.'+
'</p>');
}
if (DEBUG) {
console.log('Débogage : '+debugMsg);
}
//console.log('Débogage : '+debugMsg);
//console.log('Erreur : '+erreurMsg);
}
});
}
return false;
}
/*+--------------------------------------------------------------------------------------------------------+*/
// PANNEAU LATÉRAL
 
function initialiserAffichagePanneauLateral() {
$('#panneau-lateral').height($(window).height() - 35);
if (nt == '*') {
$('#pl-ouverture').bind('click', afficherPanneauLateral);
$('#pl-fermeture').bind('click', cacherPanneauLateral);
}
chargerTaxons(0, 0);
}
 
function chargerTaxons(depart, total) {
if (depart == 0 || depart < total) {
var limite = 7000;
//console.log("Chargement des taxons de "+depart+" à "+(depart+limite));
var urlTax = taxonsUrl+'&start={start}&limit='+limite;
urlTax = urlTax.replace(/\{start\}/g, depart);
$.getJSON(urlTax, function(infos) {
taxonsCarte = taxonsCarte.concat(infos.taxons);
//console.log("Nbre taxons :"+taxonsCarte.length);
chargerTaxons(depart+limite, infos.total);
});
} else {
if (nt == '*') {
afficherTaxons();
} else {
afficherNomPlante();
}
}
}
 
function afficherTaxons() {
// Ajout du nombre de plantes au titre
$('.plantes-nbre').text(taxonsCarte.length.formaterNombre());
$("#tpl-taxons-liste").tmpl({'taxons':taxonsCarte}).appendTo("#pl-corps");
$('.taxon').live('click', filtrerParTaxon);
}
 
function afficherNomPlante() {
if (nt != '*') {
var taxon = taxonsCarte[0];
$('.plante-titre').text('pour '+taxon.nom);
}
}
 
function afficherPanneauLateral() {
$('#panneau-lateral').width(300);
$('#pl-contenu').css('display', 'block');
$('#pl-ouverture').css('display', 'none');
$('#pl-fermeture').css('display', 'block');
$('#carte').css('left', '300px');
 
google.maps.event.trigger(map, 'resize');
};
 
function cacherPanneauLateral() {
$('#panneau-lateral').width(24);
$('#pl-contenu').css('display', 'none');
$('#pl-ouverture').css('display', 'block');
$('#pl-fermeture').css('display', 'none');
$('#carte').css('left', '24px');
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();
$('#taxon-'+nt).removeClass('taxon-actif');
if (nt == ntAFiltrer) {
nt = '*';
executerMarkerClusterer(pointsOrigine, boundsOrigine);
} else {
var url = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer)+
'&formatRetour=jsonP'+
'&callback=?';
$.getJSON(url, function (stationsFiltrees) {
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirCarte();
});
}
};
 
/*+--------------------------------------------------------------------------------------------------------+*/
// FONCTIONS UTILITAIRES
 
function arreter(event) {
if (event.stopPropagation) {
event.stopPropagation();
} else if (window.event) {
window.event.cancelBubble = true;
}
return false;
}
 
/**
* +-------------------------------------+
* Number.prototype.formaterNombre
* +-------------------------------------+
* Params (facultatifs):
* - Int decimales: nombre de decimales (exemple: 2)
* - String signe: le signe precedent les decimales (exemple: "," ou ".")
* - String separateurMilliers: comme son nom l'indique
* Returns:
* - String chaine formatee
* @author ::mastahbenus::
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> : ajout détection auto entier/flotant
* @souce http://www.javascriptfr.com/codes/FORMATER-NOMBRE-FACON-NUMBER-FORMAT-PHP_40060.aspx
*/
Number.prototype.formaterNombre = function (decimales, signe, separateurMilliers) {
var _sNombre = String(this), i, _sRetour = "", _sDecimales = "";
function is_int(nbre) {
nbre = nbre.replace(',', '.');
return !(parseFloat(nbre)-parseInt(nbre) > 0);
}
 
if (decimales == undefined) {
if (is_int(_sNombre)) {
decimales = 0;
} else {
decimales = 2;
}
}
if (signe == undefined) {
if (is_int(_sNombre)) {
signe = '';
} else {
signe = '.';
}
}
if (separateurMilliers == undefined) {
separateurMilliers = ' ';
}
function separeMilliers (sNombre) {
var sRetour = "";
while (sNombre.length % 3 != 0) {
sNombre = "0"+sNombre;
}
for (i = 0; i < sNombre.length; i += 3) {
if (i == sNombre.length-1) separateurMilliers = '';
sRetour += sNombre.substr(i, 3) + separateurMilliers;
}
while (sRetour.substr(0, 1) == "0") {
sRetour = sRetour.substr(1);
}
return sRetour.substr(0, sRetour.lastIndexOf(separateurMilliers));
}
if (_sNombre.indexOf('.') == -1) {
for (i = 0; i < decimales; i++) {
_sDecimales += "0";
}
_sRetour = separeMilliers(_sNombre) + signe + _sDecimales;
} else {
var sDecimalesTmp = (_sNombre.substr(_sNombre.indexOf('.')+1));
if (sDecimalesTmp.length > decimales) {
var nDecimalesManquantes = sDecimalesTmp.length - decimales;
var nDiv = 1;
for (i = 0; i < nDecimalesManquantes; i++) {
nDiv *= 10;
}
_sDecimales = Math.round(Number(sDecimalesTmp) / nDiv);
}
_sRetour = separeMilliers(_sNombre.substr(0, _sNombre.indexOf('.')))+String(signe)+_sDecimales;
}
return _sRetour;
}
 
function debug(objet) {
var msg = '';
if (objet != null) {
$.each(objet, function (cle, valeur) {
msg += cle+":"+valeur + "\n";
});
} else {
msg = "La variable vaut null.";
}
console.log(msg);
}
 
function trim (chaine) {
return chaine.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
/branches/v3.01-serpe/widget/modules/carto/squelettes/css/carto.css
New file
0,0 → 1,461
@charset "UTF-8";
html {
overflow:hidden;
}
body {
overflow:hidden;
padding:0;
margin:0;
width:100%;
height:100%;
font-family:Arial;
font-size:12px;
}
h1 {
font-size:1.6em;
}
h2 {
font-size:1.4em;
}
a, a:active, a:visited {
border-bottom:1px dotted #666;
color: #AAAAAA;
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%;
margin:0;
}
dt {
float:left;
font-weight:bold;
text-align:top left;
margin-right:0.3em;
line-height:0.8em;
}
dd {
width:auto;
margin:0.5em 0;
line-height:0.8em;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Tableau : */
table {
border:1px solid gray;
border-collapse:collapse;
width:100%;
}
table thead, table tfoot, table tbody {
background-color:Gainsboro;
border:1px solid gray;
}
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;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Tableau : tablesorter */
th.header {
background:url(../images/trie.png) no-repeat center right;
padding-right:20px;
}
th.headerSortUp {
background:url(../images/trie_croissant.png) no-repeat center right #56B80E;
color:white;
}
th.headerSortDown {
background:url(../images/trie_decroissant.png) no-repeat center right #56B80E;
color:white;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Générique */
.nettoyage{
clear:both;
}
hr.nettoyage{
visibility:hidden;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Carte */
#carte {
padding:0;
margin:0;
position:absolute;
top:35px;
left:24px;
right:0;
bottom:0;
overflow:auto;
}
.bouton {
background-color:white;
border:2px solid black;
cursor:pointer;
text-align:center;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Message de chargement */
#chargement {
margin:25px;
text-align:center;
}
#chargement img{
display:block;
margin:auto;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Avertissement */
#zone-avertissement {
background-color:#4A4B4C;
color:#CCC;
padding:12px;
text-align:justify;
line-height:16px;
}
#zone-avertissement h1{
margin:0;
}
#zone-avertissement a {
border-bottom:1px dotted gainsboro;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Carte titre */
#zone-titre {
padding:0;
margin:0;
position:absolute;
top:0;
left:0;
width:100%;
height:35px;
overflow:hidden;
background-color: #DDDDDD;
border-bottom: 1px solid grey;
z-index: 9;
}
#zone-info {
position:absolute;
top:0;
right:8px;
width:48px;
text-align:right;
}
#zone-info img {
display:inline;
padding:4px;
margin:0;
border:none;
}
#carte-titre {
display:inline-block;
margin:0;
padding:0.2em;
color: black;
}
#carte-titre {/*Hack CSS fonctionne seulement dans ie6, 7 & 8 */
display:inline !hackCssIe6Et7;/*Hack CSS pour ie6 & ie7 */
display /*\**/:inline\9;/*Hack CSS pour ie8 */
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Panneau latéral */
#panneau-lateral {
padding:0;
margin:0;
position:absolute;
top:35px;
left:0;
bottom:0;
width:24px;
overflow:hidden;
background-color: #DDDDDD;
border-right: 1px solid grey;
z-index: 10;
}
#pl-contenu {
display:none;
}
#pl-entete {
height:95px;
}
#pl-corps {
position:absolute;
top:105px;
bottom:0;
overflow:auto;
padding:5px;
width:290px;
}
#pl-ouverture, #pl-fermeture {
position:absolute;
top:0;
height:24px;
width:24px;
text-align:center;
cursor:pointer;
}
#pl-ouverture {
left:0;
background:url(../images/ouverture.png) no-repeat top left #DDDDDD;
height:100%;
}
#pl-fermeture {
display:none;
left:276px;
background:url(../images/fermeture.png) no-repeat top right #DDDDDD;
}
#pl-ouverture span, #pl-fermeture span{
display:none;
}
/* Panneau latéral : balises */
#panneau-lateral h2, #panneau-lateral p {
color:black;}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Liste des taxons de la carte */
#taxons {
color:black;
}
#taxons .taxon-actif, #taxons .taxon-actif span {
color:#56B80E;
}
#taxons li span {
border-bottom:1px dotted #666;
color:black;
}
#taxons li span:focus {
outline:thin dotted;
}
#taxons li span:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
cursor:pointer;
}
.nt {
display:none;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Pop-up observations */
#info-bulle{
min-height:300px;
/*width:géstion via le Javascript;*/
}
#observations {
overflow:none;
margin:-1px 0 0 0;
border: 1px solid #AAA;
border-radius:0 0 4px 4px;
}
#obs-pieds-page {
font-size:10px;
color:#CCC;
clear:both;
}
.ui-tabs {
padding:0;
}
.ui-widget-content {
border:0;
}
.ui-widget-header {
background:none;
border:0;
border-bottom:1px solid #AAA;
border-radius:0;
}
.ui-tabs-selected a {
border-bottom:1px solid white;
}
.ui-tabs-selected a:focus {
outline:0;
}
.ui-tabs .ui-tabs-panel {
padding:0.2em;
}
.ui-tabs .ui-tabs-nav li a {
padding: 0.5em 0.6em;
}
#obs h2 {
margin:0;
text-align:center;
}
#observations a {
color:#333;
border-bottom:1px dotted gainsboro;
}
#observations a:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
}
.nom-sci{
color:#454341;
font-weight:bold;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Pop-up observations : liste */
.cel-img-principale {
height:0;/*Pour IE*/
}
.cel-img-principale img{
float:right;
height:75px;
width:75px;
padding:1px;
border:1px solid white;
}
#observations .cel-img:hover img{
border: 1px dotted #56B80E;
}
.cel-img-secondaire, .cel-infos{
display: none;
}
ol#obs-liste-lignes {
padding:5px;
margin:0;
}
.champ-nom-sci {
display:none;
}
#obs-liste-lignes li dl {/*Pour IE*/
width:350px;
}
.obs-conteneur{
counter-reset: item;
}
.obs-conteneur .nom-sci:before {
content: counter(item) ". ";
counter-increment: item;
display:block;
float:left;
}
.obs-conteneur li {
display: block;
margin-bottom:1em;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Diaporama */
.cel-legende{
text-align:left;
}
.cel-legende-vei{
float:right;
}
.cel-legende p{
color: black;
font-size: 12px;
line-height: 18px;
margin: 0;
}
.cel-legende a, .cel-legende a:active, .cel-legende a:visited {
border-bottom:1px dotted gainsboro;
color:#333;
text-decoration:none;
background-image:none;
}
.cel-legende a:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Plugin Jquery Pagination */
.navigation {
padding:5px;
float:right;
}
.pagination {
font-size: 80%;
}
.pagination a {
text-decoration: none;
border: solid 1px #666;
color: #666;
background:gainsboro;
}
.pagination a:hover {
color: white;
background: #56B80E;
}
.pagination a, .pagination span {
display: block;
float: left;
padding: 0.3em 0.5em;
margin-right: 5px;
margin-bottom: 5px;
min-width:1em;
text-align:center;
}
.pagination .current {
background: #4A4B4C;
color: white;
border: solid 1px gainsboro;
}
.pagination .current.prev, .pagination .current.next{
color: #999;
border-color: #999;
background: gainsboro;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Formulaire de contact */
#form-contact input{
width:300px;
}
#form-contact textarea{
width:300px;
height:200px;
}
#form-contact #fc_envoyer, #fc_annuler, #fc_effacer{
width:75px;
}
#fc_envoyer{
float:right;
}
#fc_annuler{
float:left;
}
#form-contact label.error {
color:red;
font-weight:bold;
}
#form-contact .info {
padding:5px;
background-color: #4A4B4C;
border: solid 1px #666;
color: white;
white-space: pre-wrap;
width: 300px;
}
 
#origine-donnees {
bottom: 5px;
margin-left: 35px;
position: absolute;
}
#origine-donnees a, #origine-donnees a:active, #origine-donnees a:visited {
color: black;
}
/branches/v3.01-serpe/widget/modules/carto/squelettes/avertissement.tpl.html
New file
0,0 → 1,108
<!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>Avertissements - CEL widget cartographie</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="Avertissement, Tela Botanica, cartographie, CEL" />
<meta name="description" content="Avertissement du widget de cartographie des observations publiques de plantes saisies dans le Carnet en Ligne (CEL)" />
 
<!-- Spécial mobile -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- Favicones -->
<link rel="icon" type="image/png" href="https://resources.tela-botanica.org/tb/img/16x16/favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="https://resources.tela-botanica.org/tb/img/16x16/favicon.ico" />
<!-- CSS -->
<link href="<?=$url_base?>modules/carto/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
<style>
html {
overflow:auto;
}
body {
overflow:auto;
}
</style>
<!-- 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>
</head>
<body>
<div id="zone-avertissement">
<h1>Avertissements &amp; informations</h1>
<h2>C'est quoi ces chiffres sur la carte ?</h2>
<p>
Afin de ne pas divulguer la localisation des stations d'espèces rares ou protégées, l'ensemble des observations
a été regroupé par commune.<br />
Ainsi les nombres apparaissant sur la carte représentent le nombre de communes où des observations ont été
réalisées.<br />
Ce nombre varie en fonction du niveau de zoom auquel vous vous trouvez, jusqu'à faire apparaître l'icône
<img src="https://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png" alt="Icône de regroupement des observations" />.
Il indique le centre d'une commune et permet en cliquant dessus d'afficher l'ensemble des observations que l'on
peut y trouver.
</p>
<h2>Avertissements</h2>
<p>
Les observations affichées sur cette carte proviennent des saisies des membres du réseau Tela Botanica réalisées à l'aide
de l'application <a href="http://www.tela-botanica.org/appli:cel" onclick="window.open(this.href); return false;">Carnet en Ligne (CEL)</a>.<br />
Bien que la plupart des botanistes cherchent à déterminer avec un maximum de rigueur les espèces qu'ils observent, il arrive que des erreurs soient faites.<br />
Il est donc important de garder un esprit critique vis à vis des observations diffusées sur cette carte.<br />
Nous souhaitons prochainement ajouter à cette application cartographique un moyen de contacter les auteurs des observations.
Cette fonctionnalité permettra de faciliter la correction d'eventuelles erreurs.<br />
Pour l'instant, si vous constatez des problèmes,
<a href="<?= $url_remarques ?>?service=cel&pageSource=http%3A%2F%2Fwww.tela-botanica.org%2Fwidget%3Acel%3Acarto">contactez-nous</a>
</p>
<h2>Le <a href="http://www.tela-botanica.org/appli:cel" onclick="window.open(this.href); return false;">Carnet en Ligne (CEL)</a>, c'est quoi ?</h2>
<h3>Un outil pour gérer mes relevés de terrain</h3>
<p>
Le Carnet en ligne est <a href="http://www.tela-botanica.org/appli:cel" onclick="window.open(this.href); return false;">accessible en ligne sur le site de Tela Botanica</a>.
Vous pouvez y déposer vos observations de plantes de manière simple et efficace
(aide à la saisie, visualisation de la chorologie d’une plante, utilisation de Google Map),
les trier et les rechercher.
</p>
<h3>Des fonctionnalités à la demande</h3>
<ul>
<li>Un module cartographique vous permet de géolocaliser vos observations grâce aux coordonnées ou bien par pointage sur une carte (en France métropolitaine).</li>
<li>Un module image vous permet d’ajouter des images et des les associer à vos observations.</li>
<li>Un module projet vous permet de créer des projets et d’y associer des observations.</li>
<li>Un module import/export au format tableur pour traiter ses données.</li>
</ul>
<h3>Partage des données</h3>
<p>
Partager vos observations permet d’alimenter la base de données eFlore, de compléter automatiquement la carte
de répartition des espèces du site de Tela Botanica, de servir de source de données pour des projets externes...<br />
Les données sont publiées sous licence libre <a href="http://www.tela-botanica.org/page:licence" onclick="window.open(this.href); return false;">Creative commons</a>
afin d'en faciliter la divulgation.
</p>
<h3>Vous souhaitez participer ?</h3>
<p>Consulter le mode d'emploi ci-dessous pour facilement prendre en main cet outil.</p>
<div>
<object style="width: 600px; height: 282px;">
<param value="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf?mode=embed&amp;viewMode=presentation&amp;layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&amp;showFlipBtn=true&amp;autoFlip=true&amp;autoFlipTime=6000&amp;documentId=100624090135-b3beeea0f20641bf8f277c49ebc5bbee&amp;docName=cel&amp;username=marietela&amp;loadingInfoText=Carnet%20en%20ligne&amp;et=1277375679622&amp;er=55" name="movie">
<param value="true" name="allowfullscreen">
<param value="false" name="menu"><embed flashvars="mode=embed&amp;viewMode=presentation&amp;layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&amp;showFlipBtn=true&amp;autoFlip=true&amp;autoFlipTime=6000&amp;documentId=100624090135-b3beeea0f20641bf8f277c49ebc5bbee&amp;docName=cel&amp;username=marietela&amp;loadingInfoText=Carnet%20en%20ligne&amp;et=1277375679622&amp;er=55" style="width: 600px; height: 282px;" menu="false" allowfullscreen="true" type="application/x-shockwave-flash" src="https://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf">
</object>
<p style="width: 600px; text-align: left;"><a target="_blank" href="http://issuu.com/marietela/docs/cel?mode=embed&amp;viewMode=presentation&amp;layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&amp;showFlipBtn=true&amp;autoFlip=true&amp;autoFlipTime=6000">Open publication</a> - Free <a target="_blank" href="http://issuu.com">publishing</a> - <a target="_blank" href="http://issuu.com/search?q=terrain">More terrain</a></p>
</div>
</div>
</body>
</html>
/branches/v3.01-serpe/widget/modules/carto/.
New file
Property changes:
Added: svn:ignore
+config.ini