Subversion Repositories eFlore/Applications.cel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1532 → Rev 1533

/tags/widget-origin-mobile/modules/rss2.tpl.xml
New file
0,0 → 1,25
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><?=$titre?></title>
<link><?=$lien_cel?></link>
<atom:link href="<?=$lien_service?>" rel="self" type="application/rss+xml" />
<description><?=$description?></description>
<?php if (isset($items)) : ?>
<?php foreach ($items as $item) : ?>
<item>
<guid><?=$item['guid']?></guid>
<title><?=$item['titre']?></title>
<? if (isset($item['lien'])) : ?>
<link><?=$item['lien']?></link>
<? endif; ?>
<description><?=$item['description_encodee']?></description>
<category><?= $item['categorie'] ?></category>
<pubDate><?=$item['date_maj_RSS']?></pubDate>
</item>
<?php endforeach; ?>
<?php endif; ?>
</channel>
</rss>
/tags/widget-origin-mobile/modules/carto/config.defaut.ini
New file
0,0 → 1,8
[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 = "http://www.tela-botanica.org/eflore/cel2/widget/modules/carto/squelettes/kml/%s/%s"
communeImageUrl = "http://www.tela-botanica.org/commun/icones/carto/commune.png"
pointImageUrl = "http://www.tela-botanica.org/commun/icones/carto/point2.png"
groupeImageUrlTpl = "http://www.tela-botanica.org/service:cel:CelWidgetMapPoint/icone-groupe?type={type}&nbre={nbre}"
/tags/widget-origin-mobile/modules/carto/Carto.php
New file
0,0 → 1,198
<?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)
/**
* 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->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->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']['url_limites_communales'] = $this->obtenirUrlsLimitesCommunales();
$widget['donnees']['communeImageUrl'] = $this->config['carto']['communeImageUrl'];
$widget['donnees']['pointImageUrl'] = $this->config['carto']['pointImageUrl'];
$widget['donnees']['groupeImageUrlTpl'] = $this->config['carto']['groupeImageUrlTpl'];
$widget['squelette'] = 'carte_defaut';
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');
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épartemmentales 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['squelette'] = 'avertissement';
return $widget;
}
}
/tags/widget-origin-mobile/modules/carto/squelettes/images/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/carto/squelettes/images/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/carto/squelettes/images/fermeture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/carto/squelettes/images/fermeture.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/carto/squelettes/images/ouverture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/carto/squelettes/images/ouverture.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/carto/squelettes/images/trie_decroissant.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/carto/squelettes/images/trie_decroissant.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/carto/squelettes/images/trie.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/carto/squelettes/images/trie.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/carto/squelettes/images/information.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/carto/squelettes/images/information.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/carto/squelettes/images/trie_croissant.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/carto/squelettes/images/trie_croissant.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/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>
/tags/widget-origin-mobile/modules/carto/squelettes/carte_defaut.tpl.html
New file
0,0 → 1,338
<!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="Delphine CAUQUIL, Jean-Pascal MILCENT" />
<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)" />
 
<!-- Spécial mobile -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- 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" />
<!-- Javascript : bibliothèques -->
<!-- <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> -->
<!-- Google Map v3 -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=true&amp;language=fr&amp;region=FR"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/google/map/3/markermanager/1.0/markermanager-1.0.pack.js"></script>
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.6.2/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.15/js/jquery-ui-1.8.15.custom.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/tablesorter/2.0.5/jquery.tablesorter.min.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/pagination/2.2/jquery.pagination.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="http://www.tela-botanica.org/commun/jquery/validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.8.1/messages_fr.js"></script>
<!-- Javascript : appli carto -->
<script type="text/javascript">
//<![CDATA[
var urlsLimitesCommunales = <?=$url_limites_communales?>;
var nt = '<?=$num_taxon?>';
var filtreCommun =
'&taxon=<?=rawurlencode($taxon)?>'+
'&utilisateur=<?=$utilisateur?>'+
'&projet=<?=rawurlencode($projet)?>'+
'&tag=<?=rawurlencode($tag)?>'+
'&date=<?=$date?>'+
'&dept=<?=$dept?>'+
'&commune=<?=rawurlencode($commune)?>'+
'&commentaire=<?=rawurlencode($commentaire)?>';
var stationsUrl = '<?=$url_cel_carto?>/tout'+'?'+
'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;
var communeImageUrl = '<?= $communeImageUrl ?>';
var pointImageUrl = '<?= $pointImageUrl ?>';
var groupeImageUrlTpl = '<?= $groupeImageUrlTpl ?>';
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/carto/squelettes/scripts/carto.js"></script>
<!-- CSS -->
<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" />
<link rel="stylesheet" href="http://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" />
</head>
 
<body>
<div id="zone-chargement-point" style="background-color: white;border: 5px solid #D7DBEA;display: none;
height: 70px;
left: 40%;
padding: 10px;
position: fixed;
text-align: center;
top: 35px;
width: 230px;
z-index: 3000;">
<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p> Chargement des points en cours... </p>
</div>
<div id="zone-titre">
<h1 id="carte-titre">
<span id="logo">
<a href="http://www.tela-botanica.org/site:accueil"
title="Aller à l'accueil de Tela Botanica"
onclick="ouvrirNouvelleFenetre(this, event)">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.png" alt="TB" />
</a>
</span>
<span id="carte-titre-infos">Cartographie</span>
- <a href="http://www.tela-botanica.org/appli:cel"
title="Carnet en Ligne"
onclick="ouvrirNouvelleFenetre(this, event)">
CEL
</a>
(<a href="http://www.tela-botanica.org/" onclick="ouvrirNouvelleFenetre(this, event)">Tela Botanica</a>)
</h1>
<div id="zone-info">
<a href="<?=$url_base?>carto?carte=avertissement"
onClick="ouvrirPopUp(this, 'Avertissement', event)">
<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
alt="Avertissements" title="Avertissements &amp; informations" />
</a>
</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>
<!-- +-------------------------------------------------------------------------------------------+ -->
<!-- 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:300px;">
<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 id="obs-station-titre">Station</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 id="obs-pieds-page">
<p>Id : <span id="obs-station-id">&nbsp;</span></p>
</div>
<div class="navigation">&nbsp;</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/nn${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
${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/nn${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
${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>
<!-- 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/widget-origin-mobile/modules/carto/squelettes/scripts/carto.js
New file
0,0 → 1,1027
/*+--------------------------------------------------------------------------------------------------------+*/
// PARAMÊTRES et CONSTANTES
// Mettre à true pour afficher les messages de débogage
var DEBUG = false;
/**
* Indication de certaines variables ajoutée par php
* var communeImageUrl ;
* var pointImageUrl ;
* var groupeImageUrlTpl ;
*/
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
var map = null;
var infoBulle = new google.maps.InfoWindow();
var stations = null;
var pointClique = null;
var carteCentre = new google.maps.LatLng(25, 10);
var carteOptions = {
zoom: 3,
center:carteCentre,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
mapTypeIds: ['OSM',
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.HYBRID,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.TERRAIN]
}
};
var 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
});
var ctaLayer = null;
var pagineur = {'limite':50, 'start':0, 'total':0, 'stationId':null, 'format':'tableau'};
var station = {'commune':'', 'obsNbre':0};
var obsStation = new Array();
var obsPage = new Array();
var taxonsCarte = new Array();
var mgr = null;
var marqueursCache = new Array();
var zonesCache = new Array();
var requeteChargementPoints;
/*+--------------------------------------------------------------------------------------------------------+*/
// INITIALISATION DU CODE
 
//Déclenchement d'actions quand JQuery et le document HTML sont OK
$(document).ready(function() {
initialiserWidget();
});
 
function initialiserWidget() {
definirTailleTitre();
initialiserAffichageCarte();
initialiserAffichagePanneauLateral();
initialiserCarte();
initialiserGestionnaireMarqueurs()
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
attribuerListenerCarte();
programmerRafraichissementCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// AFFICHAGE GÉNÉRAL
 
function afficherTitreCarte() {
if (stations != null && taxonsCarte.length > 0) {
var obsNbre = stations.stats.observations;
var obsNbreFormate = stations.stats.observations.formaterNombre();
var plteNbre = taxonsCarte.length;
var plteNbreFormate = taxonsCarte.length.formaterNombre();
var communeNbre = stations.stats.communes;
var communeNbreFormate = stations.stats.communes.formaterNombre();
var titre = obsNbreFormate+' observation';
titre += (obsNbre > 1) ? 's' : '' ;
if (nt == '*') {
titre += ' de '+plteNbreFormate+' plante';
titre += (plteNbre > 1) ? 's' : '' ;
} else {
if (taxonsCarte[0]) {
var taxon = taxonsCarte[0];
titre += ' pour '+taxon.nom;
}
}
titre += ' sur '+communeNbreFormate+' commune';
titre += (communeNbre > 1) ? 's' : '' ;
$('#carte-titre-infos').text(titre);
}
}
 
function 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);
}
 
function initialiserGestionnaireMarqueurs() {
mgr = new MarkerManager(map);
}
 
function chargerLimitesCommunales() {
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: false});
ctaLayer.setMap(map);
}
}
}
 
var listener = null;
var timer = null;
function attribuerListenerCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', function(){
programmerRafraichissementCarte();
});
listener = google.maps.event.addListener(map, 'zoom_changed', function(){
programmerRafraichissementCarte();
});
}
function programmerRafraichissementCarte() {
if(timer != null) {
window.clearTimeout(timer);
}
if(requeteChargementPoints != null) {
requeteChargementPoints.abort();
}
timer = window.setTimeout(function() {
var zoom = map.getZoom();
var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(map.getBounds().getNorthEast().lng());
var SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(map.getBounds().getSouthWest().lng());
chargerMarqueurs(zoom, NELatLng, SWLatLng);
}, 400);
}
 
var marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
var url = stationsUrl+
'&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
if(infoBulleOuverte) {
return;
}
if(requeteChargementPoints != null) {
requeteChargementPoints.abort();
cacherMessageChargementPoints();
}
afficherMessageChargementPoints();
requeteChargementPoints = $.getJSON(url, function(data) {
rafraichirMarqueurs(data);
cacherMessageChargementPoints();
});
}
 
function afficherMessageChargementPoints() {
$('#zone-chargement-point').css('display','block');
}
 
function cacherMessageChargementPoints() {
$('#zone-chargement-point').css('display','none');
}
 
function rafraichirMarqueurs(data) {
$.each(marqueurs, function(index, marqueur) {
marqueur.setMap(null);
});
marqueurs = new Array();
stations = data;
afficherTitreCarte();
$.each(stations.points, function (index, station) {
if(station != null) {
var nouveauMarqueur = creerMarqueur(station);
marqueurs.push(nouveauMarqueur);
}
});
}
 
function creerMarqueur(station) {
var titre = '';
if(station.nbreMarqueur) {
titre = station.nbreMarqueur+' points renseignés';
} else {
if(station.nom) {
titre = station.nom;
}
}
//var titre = station['nbreMarqueur'];
var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']);
var latLng = new google.maps.LatLng(station['lat'], station['lng']);
var marqueur = new google.maps.Marker({
position: latLng,
icon: icone,
title: ''+titre,
map: map,
stationInfos: station
});
attribuerListenerClick(marqueur, station['id']);
marqueur.setMap(map);
return marqueur;
}
 
function rendrePointsVisibles(bounds) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
map.panToBounds(bounds);
}
 
function programmerRafraichissementCarteSauv() {
var points = [];
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < stations.points.length; ++i) {
var point = stations.points[i];
var maLatLng = new google.maps.LatLng(point.lat, point.lng);
var stationImage = attribuerImageMarqueur(point.id);
var point = new google.maps.Marker({
position: maLatLng,
map: map,
icon: stationImage,
stationInfos: point
});
bounds.extend(maLatLng);
google.maps.event.addListener(point, 'click', surClickMarqueur);
points.push(point);
}
 
if (pointsOrigine == null && boundsOrigine == null) {
pointsOrigine = points;
boundsOrigine = bounds;
}
executerMarkerClusterer(points, bounds);
}
 
function attribuerImageMarqueur(id, nbreMarqueur) {
var marqueurImage = null;
if (etreMarqueurCommune(id)) {
marqueurImage = new google.maps.MarkerImage(communeImageUrl, new google.maps.Size(24, 32));
} else if (etreMarqueurStation(id)) {
marqueurImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(16, 16));
} else if (etreMarqueurGroupe(id)) {
var type = 0;
var largeur = 0;
var hauteur = 0;
if (nbreMarqueur != null) {
if (nbreMarqueur >= 2 && nbreMarqueur < 100 ) {
type = '1';
largeur = 53;
hauteur = 52;
} else if (nbreMarqueur >= 100 && nbreMarqueur < 1000 ) {
type = '2';
largeur = 56;
hauteur = 55;
} else if (nbreMarqueur >= 1000 && nbreMarqueur < 10000 ) {
type = '3';
largeur = 66;
hauteur = 65;
} else if (nbreMarqueur >= 10000 && nbreMarqueur < 20000 ) {
type = '4';
largeur = 78;
hauteur = 77;
} else if (nbreMarqueur >= 20000) {
type = '5';
largeur = 66;
hauteur = 65;
}
}
groupeImageUrl = groupeImageUrlTpl.replace(/\{type\}/, type);
groupeImageUrl = groupeImageUrl.replace(/\{nbre\}/, nbreMarqueur);
marqueurImage = new google.maps.MarkerImage(groupeImageUrl, new google.maps.Size(largeur, hauteur));
}
return marqueurImage
}
 
function attribuerListenerClick(marqueur, id) {
if (etreMarqueurCommune(id) || etreMarqueurStation(id)) {
google.maps.event.addListener(marqueur, 'click', surClickMarqueur);
} else if (etreMarqueurGroupe(id)) {
google.maps.event.addListener(marqueur, 'click', surClickGroupe);
}
}
 
function surClickMarqueur(event) {
 
if(infoBulleOuverte) {
infoBulle.close();
}
pointClique = this;
infoBulle.open(map, this);
actualiserPagineur();
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
afficherInfoBulle();
}
 
function surClickGroupe() {
map.setCenter(this.getPosition());
var nouveauZoom = map.getZoom() + 2;
map.setZoom(nouveauZoom);
mgr.clearMarkers();
}
 
function etreMarqueurGroupe(id) {
var groupe = false;
var motif = /^GROUPE/;
if (motif.test(id)) {
groupe = true;
}
return groupe;
}
 
function etreMarqueurCommune(id) {
var commune = false;
var motif = /^COMMUNE:/;
if (motif.test(id)) {
commune = true;
}
return commune;
}
 
function etreMarqueurStation(id) {
var station = false;
var motif = /^STATION:/;
if (motif.test(id)) {
station = true;
}
return station;
}
 
function deplacerCarteSurPointClique() {
map.panTo(pointClique.position);
}
 
function executerMarkerClusterer(points, bounds) {
if (markerClusterer) {
markerClusterer.clearMarkers();
}
markerClusterer = new MarkerClusterer(map, points, {gridSize: 50, maxZoom: 18});
map.fitBounds(bounds);
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
var infoBulleOuverte = false;
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
google.maps.event.addListener(infoBulle, 'content_changed', definirLargeurInfoBulle);
}
 
function surFermetureInfoBulle() {
infoBulleOuverte = false;
programmerRafraichissementCarte();
}
 
function centrerInfoBulle() {
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
}
 
function afficherInfoBulle() {
var obsHtml = $("#tpl-obs").html();
var largeur = definirLargeurInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
infoBulle.setContent(obsHtml);
chargerObs(0, 0);
infoBulleOuverte = true;
}
 
function definirLargeurInfoBulle() {
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 afficherMessageChargementTitreInfoBulle() {
$("#obs-station-titre").text("Chargement des observations");
}
 
function supprimerMessageChargement() {
$('#chargement').remove();
}
 
function chargerObs(depart, total) {
if (depart == 0 || depart < total) {
var limite = 300;
if (depart == 0) {
viderTableauObs();
}
var urlObs = observationsUrl+'&start={start}&limit='+limite;
urlObs = urlObs.replace(/\{stationId\}/g, pointClique.stationInfos.id);
if (pointClique.stationInfos.type_emplacement == 'communes') {
urlObs = urlObs.replace(/commune=%2A/g, 'commune='+pointClique.stationInfos.nom);
}
urlObs = urlObs.replace(/\{nt\}/g, nt);
urlObs = urlObs.replace(/\{start\}/g, depart);
$.getJSON(urlObs, function(observations){
surRetourChargementObs(observations, depart, total);
chargerObs(depart+limite, observations.total);
});
}
}
 
function viderTableauObs() {
obsStation = new Array();
surClicPagePagination(0, null);
}
 
function surRetourChargementObs(observations, depart, total) {
obsStation = obsStation.concat(observations.observations);
if (depart == 0) {
actualiserInfosStation(observations);
creerTitreInfoBulle();
surClicPagePagination(0, null);
}
afficherPagination();
actualiserPagineur();
selectionnerOnglet("#obs-vue-"+pagineur.format);
}
 
function actualiserInfosStation(infos) {
pointClique.stationInfos.commune = infos.commune;
pointClique.stationInfos.obsNbre = infos.total;
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
var titre = '';
titre += pointClique.stationInfos.obsNbre+' observation';
titre += (pointClique.stationInfos.obsNbre > 1) ? 's': '' ;
titre += ' pour ';
if (etreMarqueurCommune(pointClique.stationInfos.id)) {
nomStation = 'la commune : ';
} else {
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
}
 
function actualiserPagineur() {
pagineur.stationId = pointClique.stationInfos.id;
pagineur.total = pointClique.stationInfos.obsNbre;
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 initialiserContenuInfoBulle() {
afficherMessageChargement('#observations');
cacherContenuOnglets();
afficherOnglets();
ajouterTableauTriable("#obs-tableau");
afficherTextStationId();
corrigerLargeurInfoWindow();
}
 
function cacherContenuOnglets() {
$("#obs-vue-tableau").css("display", "none");
$("#obs-vue-liste").css("display", "none");
}
 
function afficherOnglets() {
var $tabs = $('#obs').tabs();
$('#obs').bind('tabsselect', function(event, ui) {
if (ui.panel.id == 'obs-vue-tableau') {
surClicAffichageTableau();
} else if (ui.panel.id == 'obs-vue-liste') {
surClicAffichageListe();
}
});
if (pointClique.stationInfos.nbre > 4) {
$tabs.tabs('select', "#obs-vue-tableau");
} else {
$tabs.tabs('select', "#obs-vue-liste");
}
}
 
function selectionnerOnglet(onglet) {
$(onglet).css('display', 'block');
$('#obs').tabs('select', onglet);
}
 
function afficherTextStationId() {
$('#obs-station-id').text(pointClique.stationInfos.id);
}
 
function corrigerLargeurInfoWindow() {
$("#info-bulle").width($("#info-bulle").width() - 17);
}
 
function surClicAffichageTableau(event) {
pagineur.format = 'tableau';
mettreAJourObservations();
mettreAJourTableauTriable("#obs-tableau");
}
 
function surClicAffichageListe(event) {
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 = jQuery.trim($(".cel-obs-"+idObs+" .nom-sci:eq(0)").text());
var date = jQuery.trim($(".cel-obs-"+idObs+" .date:eq(0)").text());
var lieu = jQuery.trim($(".cel-obs-"+idObs+" .lieu:eq(0)").text());
var sujet = "Observation #"+idObs+" de "+nomSci;
var message = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de \""+nomSci+'" du "'+date+'" au lieu "'+lieu+'".';
$("#fc_sujet").attr('value', sujet);
$("#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 = "http://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 carto "+
"du Carnet en Ligne du réseau Tela Botanica.\n"+
"http://www.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 carto'+
"&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();
}
afficherTitreCarte();
}
}
 
function afficherTaxons() {
$(".plantes-nbre").text(taxonsCarte.length);
$("#tpl-taxons-liste").tmpl({'taxons':taxonsCarte}).appendTo("#pl-corps");
$('.taxon').live('click', filtrerParTaxon);
}
 
 
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 filtrerParTaxon() {
var ntAFiltrer = $('.nt', this).text();
infoBulle.close();
var zoom = map.getZoom();
var NELatLng = map.getBounds().getNorthEast().lat()+'|'+map.getBounds().getNorthEast().lng();
var SWLatLng = map.getBounds().getSouthWest().lat()+'|'+map.getBounds().getSouthWest().lng();
$('#taxon-'+nt).removeClass('taxon-actif');
if (nt == ntAFiltrer) {
nt = '*';
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+nt);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
} else {
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer);
url = stationsUrl;
url += '&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
requeteChargementPoints = $.getJSON(url, function (stationsFiltrees) {
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirMarqueurs(stations);
});
}
};
 
/*+--------------------------------------------------------------------------------------------------------+*/
// FONCTIONS UTILITAIRES
 
function ouvrirPopUp(element, nomPopUp, event) {
var options =
'width=650,'+
'height=600,'+
'scrollbars=yes,'+
'directories=no,'+
'location=no,'+
'menubar=no,'+
'status=no,'+
'toolbar=no';
var popUp = window.open(element.href, nomPopUp, options);
if (window.focus) {
popUp.focus();
}
return arreter(event);
};
 
function ouvrirNouvelleFenetre(element, event) {
window.open(element.href);
return arreter(event);
}
 
function arreter(event) {
if (event.stopPropagation) {
event.stopPropagation();
} else if (window.event) {
window.event.cancelBubble = true;
}
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
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);
}
/tags/widget-origin-mobile/modules/carto/squelettes/css/carto.css
New file
0,0 → 1,447
@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:#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%;
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:#4A4B4C;
}
#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:#CCCCCC;
}
#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:#4A4B4C;
border-right:1px solid grey;
}
#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 #4A4B4C;
height:100%;
}
#pl-fermeture {
display:none;
left:276px;
background:url(../images/fermeture.png) no-repeat top right #4A4B4C;
}
#pl-ouverture span, #pl-fermeture span{
display:none;
}
/* Panneau latéral : balises */
#panneau-lateral h2, #panneau-lateral p {
color:#CCCCCC;}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Liste des taxons de la carte */
#taxons {
color:#999;
}
#taxons .taxon-actif, #taxons .taxon-actif span {
color:#56B80E;
}
#taxons li span {
border-bottom:1px dotted #666;
color:#CCC;
}
#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:500px;
width:500px;
}
#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{
width:50px;
float:right;
}
#form-contact #fc_annuler{
width:50px;
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;
}
/tags/widget-origin-mobile/modules/carto/squelettes/avertissement.tpl.html
New file
0,0 → 1,107
<!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="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" />
<!-- 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="http://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, veuillez contacter : <a href="mailto:eflore_remarques@tela-botanica.org">eflore_remarques@tela-botanica.org</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="http://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>
/tags/widget-origin-mobile/modules/carto
New file
Property changes:
Added: svn:ignore
+config.ini
/tags/widget-origin-mobile/modules/photo/Photo.php
New file
0,0 → 1,232
<?php
// declare(encoding='UTF-8');
/**
* Service affichant les dernières photo publiques du CEL ouvrable sous forme de diaporama.
* 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=AideCELWidgetPhoto
*
* Paramètres :
* ===> extra = booléen (1 ou 0) [par défaut : 1]
* Affiche / Cache la vignette en taille plus importante au bas du widget.
* ===> vignette = [0-9]+,[0-9]+ [par défaut : 4,3]
* Indique le nombre de vignette par ligne et le nombre de ligne.
*
* @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 Photo extends WidgetCommun {
const DS = DIRECTORY_SEPARATOR;
const SERVICE_DEFAUT = 'photo';
private $flux_rss_url = null;
private $eflore_url_tpl = null;
/**
* Méthode appelée par défaut pour charger ce widget.
*/
public function executer() {
$retour = null;
// Pour la création de l'id du cache nous ne tenons pas compte du paramètre de l'url callback
unset($this->parametres['callback']);
extract($this->parametres);
 
if (!isset($mode)) {
$mode = self::SERVICE_DEFAUT;
}
$this->eflore_url_tpl = $this->config['photo']['efloreUrlTpl'];
$this->flux_rss_url = $this->config['photo']['fluxRssUrl'];
$cache_activation = $this->config['photo.cache']['activation'];
$cache_stockage = $this->config['photo.cache']['stockageDossier'];
$ddv = $this->config['photo.cache']['dureeDeVie'];
$cache = new Cache($cache_stockage, $ddv, $cache_activation);
$id_cache = 'photo-'.hash('adler32', print_r($this->parametres, true));
if (! $contenu = $cache->charger($id_cache)) {
$methode = $this->traiterNomMethodeExecuter($mode);
if (method_exists($this, $methode)) {
$retour = $this->$methode();
} else {
$this->messages[] = "Ce type de service '$methode' n'est pas disponible.";
}
$contenu = '';
if (is_null($retour)) {
$this->messages[] = 'La ressource demandée a retourné une valeur nulle.';
} else {
if (isset($retour['donnees'])) {
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].'.tpl.html';
$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
$cache->sauver($id_cache, $contenu);
} else {
$this->messages[] = 'Les données à transmettre au squelette sont nulles.';
}
}
}
if (isset($_GET['callback'])) {
$this->envoyerJsonp(array('contenu' => $contenu));
} else {
$this->envoyer($contenu);
}
}
private function executerAjax() {
$widget = $this->executerPhoto();
$widget['squelette'] = 'photo_ajax';
return $widget;
}
private function executerPopup() {
session_start();
$galerie_id = $_GET['galerie_id'];
$widget['donnees']['url_image'] = $_GET['url_image'];
$widget['donnees']['infos_images'] = $_SESSION[$galerie_id]['infos_images'];
$widget['donnees']['urls'] = $_SESSION[$galerie_id]['urls'];
$widget['donnees']['url_widget'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'photo');
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/css/');
$widget['donnees']['url_js'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/js/');
$widget['squelette'] = 'popup';
return $widget;
}
private function executerContact() {
session_start();
$widget['donnees']['id_image'] = $_GET['id_image'];
$widget['donnees']['nom_sci'] = $_GET['nom_sci'];
$widget['donnees']['nn'] = $_GET['nn'];
$widget['donnees']['date'] = $_GET['date'];
$widget['donnees']['sujet'] = "Image #".$_GET['id_image']." de ".$_GET['nom_sci'];
$widget['donnees']['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'image de \"".$_GET['nom_sci'].'" du "'.$_GET['date'];
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/css/');
$widget['donnees']['url_js'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/js/');
$widget['squelette'] = 'contact';
return $widget;
}
private function decouperTitre($titre) {
$tab_titre = explode('[nn', $titre);
$nom_sci = $tab_titre[0];
$tab_titre_suite = explode(' par ', $tab_titre[1]);
$nn = '[nn'.$tab_titre_suite[0];
$tab_titre_fin = explode(' le ', $tab_titre_suite[1]);
$utilisateur = $tab_titre_fin[0];
$date = $tab_titre_fin[1];
$titre_decoupe = array('nom_sci' => $nom_sci, 'nn' => $nn, 'date' => $date, 'auteur' => $utilisateur);
return $titre_decoupe;
}
private function executerPhoto() {
session_start();
$_SESSION['urls'] = array();
$widget = null;
extract($this->parametres);
$extra = (isset($extra) && $extra == 0) ? false : ($this->config['photo']['extraActif'] ? true : false);
$vignette = (isset($vignette) && preg_match('/^[0-9]+,[0-9]+$/', $vignette)) ? $vignette : '4,3';
$id = '-'.(isset($id) ? $id : '1');
$titre = isset($titre) ? htmlentities(rawurldecode($titre)) : '';
$icone_rss = (isset($_GET['rss']) && $_GET['rss'] != 1) ? false : true;
$utilise_fancybox = (isset($_GET['mode_zoom']) && $_GET['mode_zoom'] != 'fancybox') ? false : true;
list($colonne, $ligne) = explode(',', $vignette);
$this->flux_rss_url .= $this->traiterParametres();
if (@file_get_contents($this->flux_rss_url, false) != false) {
$xml = file_get_contents($this->flux_rss_url);
if ($xml) {
try {
$flux = new XmlFeedParser($xml);
$widget['donnees']['id'] = $id;
$widget['donnees']['titre'] = $titre;
$widget['donnees']['flux_rss_url'] = $this->flux_rss_url;
$widget['donnees']['url_widget'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'photo');
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/css/');
$widget['donnees']['url_js'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/js/');
$widget['donnees']['colonne'] = $colonne;
$widget['donnees']['extra_actif'] = $extra;
$widget['donnees']['icone_rss'] = $icone_rss;
$widget['donnees']['utilise_fancybox'] = $utilise_fancybox;
$max_photo = $colonne * $ligne;
$num = 0;
$galerie_id = md5(http_build_query($_GET));
$widget['donnees']['galerie_id'] = $galerie_id;
foreach ($flux as $entree) {
if ($num == $max_photo) {
break;
}
$item = array();
// Formatage date
$date = $entree->updated ? $entree->updated : null;
$date = $entree->pubDate ? $entree->pubDate : $date;
$item['date'] = strftime('%A %d %B %Y', $date);
$item['lien'] = $entree->link;
$item['url_tpl'] = preg_replace('/(XS|[SML]|X(?:[23]|)L|CR(?:|X2)S|C(?:|X)S)\.jpg$/', '%s.jpg', $entree->guid);
// Formatage titre
$item['titre'] = $entree->title;
$item['infos'] = $this->decouperTitre($item['titre']);
$item['nn'] = '';
$item['eflore_url'] = '#';
if (preg_match('/\[nn([0-9]+)\]/', $entree->title, $match)) {
$item['nn'] = $match[1];
$item['eflore_url'] = sprintf($this->eflore_url_tpl, $item['nn']);
}
// Récupération du GUID
if (preg_match('/appli:cel-img:([0-9]+)[^.]+\.jpg$/', $entree->guid, $match)) {
$item['guid'] = (int) $match[1];
} else {
$item['guid'] = $entree->guid;
}
// Ajout aux items et si première photo à extra
if ($num == 0) {
$widget['donnees']['extra'] = $item;
}
$widget['donnees']['items'][$num++] = $item;
//TODO: voir si l'on ne peut pas faire mieux
$url_galerie_popup = sprintf($item['url_tpl'],'XL');
$_SESSION[$galerie_id]['urls'][] = $url_galerie_popup;
$_SESSION[$galerie_id]['infos_images'][$url_galerie_popup] = array('titre' => $item['titre'],
'date' => $item['titre'],
'guid' => $item['guid'],
'lien' => $item['lien']
);
}
$widget['squelette'] = 'photo';
} catch (XmlFeedParserException $e) {
trigger_error('Flux invalide : '.$e->getMessage(), E_USER_WARNING);
}
} else {
$this->messages[] = "Fichier xml invalide.";
}
} else {
$this->messages[] = "L'URI suivante est invalide : $this->flux_rss_url.\n".
"Veuillez vérifier les paramêtres indiqués et la présence d'images associées.";
}
return $widget;
}
private function traiterParametres() {
$parametres_flux = '?';
$criteres = array('utilisateur', 'commune', 'dept', 'taxon', 'commentaire', 'date', 'tag', 'motcle', 'projet', 'num_taxon');
foreach($this->parametres as $nom_critere => $valeur_critere) {
if (in_array($nom_critere, $criteres)) {
$valeur_critere = str_replace(' ', '%20', $valeur_critere);
$parametres_flux .= $nom_critere.'='.$valeur_critere.'&';
}
}
if ($parametres_flux == '?') {
$parametres_flux = '';
} else {
$parametres_flux = rtrim($parametres_flux, '&');
}
return $parametres_flux;
}
}
?>
/tags/widget-origin-mobile/modules/photo/config.defaut.ini
New file
0,0 → 1,19
[photo]
; Chemin pour l'autoload à ajouter
autoload = "bibliotheque/;bibliotheque/xml_feed_parser/1.0.4/;bibliotheque/xml_feed_parser/1.0.4/parsers/"
; URL ou chemin du flux RSS contenant les liens vers les photos
fluxRssUrl = "http://www.tela-botanica.org/service:cel:CelSyndicationImage/multicriteres/atom/M"
; Squelette d'url pour accéder à la fiche eFlore
efloreUrlTpl = "http://www.tela-botanica.org/bdtfx-nn-%s"
; Nombre de vignette à afficher : nombre de vignettes par ligne et nombre de lignes séparés par une vigule (ex. : 4,3).
vignette = 4,3
; Afficher/Cacher l'affichage en grand de la dernière image ajoutée
extraActif = true
 
[photo.cache]
; Active/Désactive le cache
activation = true
; Dossier où stocker les fichiers de cache du widget
stockageDossier = "/tmp"
; Durée de vie du fichier de cache
dureeDeVie = 86400
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/schemas/atom.rng
New file
0,0 → 1,598
<?xml version="1.0" encoding="UTF-8"?>
<!--
-*- rnc -*-
RELAX NG Compact Syntax Grammar for the
Atom Format Specification Version 11
-->
<grammar ns="http://www.w3.org/1999/xhtml" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<choice>
<ref name="atomFeed"/>
<ref name="atomEntry"/>
</choice>
</start>
<!-- Common attributes -->
<define name="atomCommonAttributes">
<optional>
<attribute name="xml:base">
<ref name="atomUri"/>
</attribute>
</optional>
<optional>
<attribute name="xml:lang">
<ref name="atomLanguageTag"/>
</attribute>
</optional>
<zeroOrMore>
<ref name="undefinedAttribute"/>
</zeroOrMore>
</define>
<!-- Text Constructs -->
<define name="atomPlainTextConstruct">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<choice>
<value>text</value>
<value>html</value>
</choice>
</attribute>
</optional>
<text/>
</define>
<define name="atomXHTMLTextConstruct">
<ref name="atomCommonAttributes"/>
<attribute name="type">
<value>xhtml</value>
</attribute>
<ref name="xhtmlDiv"/>
</define>
<define name="atomTextConstruct">
<choice>
<ref name="atomPlainTextConstruct"/>
<ref name="atomXHTMLTextConstruct"/>
</choice>
</define>
<!-- Person Construct -->
<define name="atomPersonConstruct">
<ref name="atomCommonAttributes"/>
<interleave>
<element name="atom:name">
<text/>
</element>
<optional>
<element name="atom:uri">
<ref name="atomUri"/>
</element>
</optional>
<optional>
<element name="atom:email">
<ref name="atomEmailAddress"/>
</element>
</optional>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
</define>
<!-- Date Construct -->
<define name="atomDateConstruct">
<ref name="atomCommonAttributes"/>
<data type="dateTime"/>
</define>
<!-- atom:feed -->
<define name="atomFeed">
<element name="atom:feed">
<s:rule context="atom:feed">
<s:assert test="atom:author or not(atom:entry[not(atom:author)])">An atom:feed must have an atom:author unless all of its atom:entry children have an atom:author.</s:assert>
</s:rule>
<ref name="atomCommonAttributes"/>
<interleave>
<zeroOrMore>
<ref name="atomAuthor"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomCategory"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomContributor"/>
</zeroOrMore>
<optional>
<ref name="atomGenerator"/>
</optional>
<optional>
<ref name="atomIcon"/>
</optional>
<ref name="atomId"/>
<zeroOrMore>
<ref name="atomLink"/>
</zeroOrMore>
<optional>
<ref name="atomLogo"/>
</optional>
<optional>
<ref name="atomRights"/>
</optional>
<optional>
<ref name="atomSubtitle"/>
</optional>
<ref name="atomTitle"/>
<ref name="atomUpdated"/>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
<zeroOrMore>
<ref name="atomEntry"/>
</zeroOrMore>
</element>
</define>
<!-- atom:entry -->
<define name="atomEntry">
<element name="atom:entry">
<s:rule context="atom:entry">
<s:assert test="atom:link[@rel='alternate'] or atom:link[not(@rel)] or atom:content">An atom:entry must have at least one atom:link element with a rel attribute of 'alternate' or an atom:content.</s:assert>
</s:rule>
<s:rule context="atom:entry">
<s:assert test="atom:author or ../atom:author or atom:source/atom:author">An atom:entry must have an atom:author if its feed does not.</s:assert>
</s:rule>
<ref name="atomCommonAttributes"/>
<interleave>
<zeroOrMore>
<ref name="atomAuthor"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomCategory"/>
</zeroOrMore>
<optional>
<ref name="atomContent"/>
</optional>
<zeroOrMore>
<ref name="atomContributor"/>
</zeroOrMore>
<ref name="atomId"/>
<zeroOrMore>
<ref name="atomLink"/>
</zeroOrMore>
<optional>
<ref name="atomPublished"/>
</optional>
<optional>
<ref name="atomRights"/>
</optional>
<optional>
<ref name="atomSource"/>
</optional>
<optional>
<ref name="atomSummary"/>
</optional>
<ref name="atomTitle"/>
<ref name="atomUpdated"/>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
</element>
</define>
<!-- atom:content -->
<define name="atomInlineTextContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<choice>
<value>text</value>
<value>html</value>
</choice>
</attribute>
</optional>
<zeroOrMore>
<text/>
</zeroOrMore>
</element>
</define>
<define name="atomInlineXHTMLContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<attribute name="type">
<value>xhtml</value>
</attribute>
<ref name="xhtmlDiv"/>
</element>
</define>
<define name="atomInlineOtherContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<ref name="atomMediaType"/>
</attribute>
</optional>
<zeroOrMore>
<choice>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="atomOutOfLineContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<ref name="atomMediaType"/>
</attribute>
</optional>
<attribute name="src">
<ref name="atomUri"/>
</attribute>
<empty/>
</element>
</define>
<define name="atomContent">
<choice>
<ref name="atomInlineTextContent"/>
<ref name="atomInlineXHTMLContent"/>
<ref name="atomInlineOtherContent"/>
<ref name="atomOutOfLineContent"/>
</choice>
</define>
<!-- atom:author -->
<define name="atomAuthor">
<element name="atom:author">
<ref name="atomPersonConstruct"/>
</element>
</define>
<!-- atom:category -->
<define name="atomCategory">
<element name="atom:category">
<ref name="atomCommonAttributes"/>
<attribute name="term"/>
<optional>
<attribute name="scheme">
<ref name="atomUri"/>
</attribute>
</optional>
<optional>
<attribute name="label"/>
</optional>
<ref name="undefinedContent"/>
</element>
</define>
<!-- atom:contributor -->
<define name="atomContributor">
<element name="atom:contributor">
<ref name="atomPersonConstruct"/>
</element>
</define>
<!-- atom:generator -->
<define name="atomGenerator">
<element name="atom:generator">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="uri">
<ref name="atomUri"/>
</attribute>
</optional>
<optional>
<attribute name="version"/>
</optional>
<text/>
</element>
</define>
<!-- atom:icon -->
<define name="atomIcon">
<element name="atom:icon">
<ref name="atomCommonAttributes"/>
<ref name="atomUri"/>
</element>
</define>
<!-- atom:id -->
<define name="atomId">
<element name="atom:id">
<ref name="atomCommonAttributes"/>
<ref name="atomUri"/>
</element>
</define>
<!-- atom:logo -->
<define name="atomLogo">
<element name="atom:logo">
<ref name="atomCommonAttributes"/>
<ref name="atomUri"/>
</element>
</define>
<!-- atom:link -->
<define name="atomLink">
<element name="atom:link">
<ref name="atomCommonAttributes"/>
<attribute name="href">
<ref name="atomUri"/>
</attribute>
<optional>
<attribute name="rel">
<choice>
<ref name="atomNCName"/>
<ref name="atomUri"/>
</choice>
</attribute>
</optional>
<optional>
<attribute name="type">
<ref name="atomMediaType"/>
</attribute>
</optional>
<optional>
<attribute name="hreflang">
<ref name="atomLanguageTag"/>
</attribute>
</optional>
<optional>
<attribute name="title"/>
</optional>
<optional>
<attribute name="length"/>
</optional>
<ref name="undefinedContent"/>
</element>
</define>
<!-- atom:published -->
<define name="atomPublished">
<element name="atom:published">
<ref name="atomDateConstruct"/>
</element>
</define>
<!-- atom:rights -->
<define name="atomRights">
<element name="atom:rights">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:source -->
<define name="atomSource">
<element name="atom:source">
<ref name="atomCommonAttributes"/>
<interleave>
<zeroOrMore>
<ref name="atomAuthor"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomCategory"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomContributor"/>
</zeroOrMore>
<optional>
<ref name="atomGenerator"/>
</optional>
<optional>
<ref name="atomIcon"/>
</optional>
<optional>
<ref name="atomId"/>
</optional>
<zeroOrMore>
<ref name="atomLink"/>
</zeroOrMore>
<optional>
<ref name="atomLogo"/>
</optional>
<optional>
<ref name="atomRights"/>
</optional>
<optional>
<ref name="atomSubtitle"/>
</optional>
<optional>
<ref name="atomTitle"/>
</optional>
<optional>
<ref name="atomUpdated"/>
</optional>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
</element>
</define>
<!-- atom:subtitle -->
<define name="atomSubtitle">
<element name="atom:subtitle">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:summary -->
<define name="atomSummary">
<element name="atom:summary">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:title -->
<define name="atomTitle">
<element name="atom:title">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:updated -->
<define name="atomUpdated">
<element name="atom:updated">
<ref name="atomDateConstruct"/>
</element>
</define>
<!-- Low-level simple types -->
<define name="atomNCName">
<data type="string">
<param name="minLength">1</param>
<param name="pattern">[^:]*</param>
</data>
</define>
<!-- Whatever a media type is, it contains at least one slash -->
<define name="atomMediaType">
<data type="string">
<param name="pattern">.+/.+</param>
</data>
</define>
<!-- As defined in RFC 3066 -->
<define name="atomLanguageTag">
<data type="string">
<param name="pattern">[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*</param>
</data>
</define>
<!--
Unconstrained; it's not entirely clear how IRI fit into
xsd:anyURI so let's not try to constrain it here
-->
<define name="atomUri">
<text/>
</define>
<!-- Whatever an email address is, it contains at least one @ -->
<define name="atomEmailAddress">
<data type="string">
<param name="pattern">.+@.+</param>
</data>
</define>
<!-- Simple Extension -->
<define name="simpleExtensionElement">
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/2005/Atom"/>
</except>
</anyName>
<text/>
</element>
</define>
<!-- Structured Extension -->
<define name="structuredExtensionElement">
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/2005/Atom"/>
</except>
</anyName>
<choice>
<group>
<oneOrMore>
<attribute>
<anyName/>
</attribute>
</oneOrMore>
<zeroOrMore>
<choice>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</group>
<group>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<group>
<optional>
<text/>
</optional>
<oneOrMore>
<ref name="anyElement"/>
</oneOrMore>
<zeroOrMore>
<choice>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</group>
</group>
</choice>
</element>
</define>
<!-- Other Extensibility -->
<define name="extensionElement">
<choice>
<ref name="simpleExtensionElement"/>
<ref name="structuredExtensionElement"/>
</choice>
</define>
<define name="undefinedAttribute">
<attribute>
<anyName>
<except>
<name>xml:base</name>
<name>xml:lang</name>
<nsName ns=""/>
</except>
</anyName>
</attribute>
</define>
<define name="undefinedContent">
<zeroOrMore>
<choice>
<text/>
<ref name="anyForeignElement"/>
</choice>
</zeroOrMore>
</define>
<define name="anyElement">
<element>
<anyName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="anyForeignElement">
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/2005/Atom"/>
</except>
</anyName>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<!-- XHTML -->
<define name="anyXHTML">
<element>
<nsName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyXHTML"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="xhtmlDiv">
<element name="xhtml:div">
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyXHTML"/>
</choice>
</zeroOrMore>
</element>
</define>
</grammar>
<!-- EOF -->
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/schemas/README
New file
0,0 → 1,9
Most of these schemas are only available in RNC (RelaxNG, Compact) format.
 
libxml (and therefor PHP) only supports RelaxNG - the XML version.
 
To update these, you will need a conversion utility, like trang (http://www.thaiopensource.com/relaxng/trang.html).
 
 
 
clockwerx@clockwerx-desktop:~/trang$ java -jar trang.jar -I rnc -O rng http://atompub.org/2005/08/17/atom.rnc atom.rng
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/schemas/rss10.rng
New file
0,0 → 1,113
<?xml version='1.0' encoding='UTF-8'?>
<!-- http://www.xml.com/lpt/a/2002/01/23/relaxng.html -->
<!-- http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html -->
<!-- http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_wildcards_st8.html -->
 
<grammar xmlns='http://relaxng.org/ns/structure/1.0'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
ns='http://purl.org/rss/1.0/'
datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'>
 
<start>
<element name='RDF' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<ref name='RDFContent'/>
</element>
</start>
 
<define name='RDFContent' ns='http://purl.org/rss/1.0/'>
<interleave>
<element name='channel'>
<ref name='channelContent'/>
</element>
<optional>
<element name='image'><ref name='imageContent'/></element>
</optional>
<oneOrMore>
<element name='item'><ref name='itemContent'/></element>
</oneOrMore>
</interleave>
</define>
 
<define name='channelContent' combine="interleave">
<interleave>
<element name='title'><data type='string'/></element>
<element name='link'><data type='anyURI'/></element>
<element name='description'><data type='string'/></element>
<element name='image'>
<attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</element>
<element name='items'>
<ref name='itemsContent'/>
</element>
<attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</interleave>
</define>
<define name="itemsContent">
<element name="Seq" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<oneOrMore>
<element name="li" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<choice>
<attribute name='resource'> <!-- Why doesn't RDF/RSS1.0 ns qualify this attribute? -->
<data type='anyURI'/>
</attribute>
<attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</choice>
</element>
</oneOrMore>
</element>
</define>
<define name='imageContent'>
<interleave>
<element name='title'><data type='string'/></element>
<element name='link'><data type='anyURI'/></element>
<element name='url'><data type='anyURI'/></element>
<attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</interleave>
</define>
 
<define name='itemContent'>
<interleave>
<element name='title'><data type='string'/></element>
<element name='link'><data type='anyURI'/></element>
<optional><element name='description'><data type='string'/></element></optional>
<ref name="anyThing"/>
<attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</interleave>
</define>
 
<define name='anyThing'>
<zeroOrMore>
<choice>
<text/>
<element>
<anyName>
<except>
<nsName/>
</except>
</anyName>
<ref name='anyThing'/>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
</element>
</choice>
</zeroOrMore>
</define>
</grammar>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/schemas/rss11.rng
New file
0,0 → 1,218
<?xml version="1.0" encoding="UTF-8"?>
<!--
RELAX NG Compact Schema for RSS 1.1
Sean B. Palmer, inamidst.com
Christopher Schmidt, crschmidt.net
License: This schema is in the public domain
-->
<grammar xmlns:rss="http://purl.org/net/rss1.1#" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ns="http://purl.org/net/rss1.1#" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<ref name="Channel"/>
</start>
<define name="Channel">
<a:documentation>http://purl.org/net/rss1.1#Channel</a:documentation>
<element name="Channel">
<ref name="Channel.content"/>
 
</element>
</define>
<define name="Channel.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<optional>
<ref name="AttrXMLBase"/>
</optional>
 
<ref name="AttrRDFAbout"/>
<interleave>
<ref name="title"/>
<ref name="link"/>
<ref name="description"/>
<optional>
<ref name="image"/>
</optional>
<zeroOrMore>
 
<ref name="Any"/>
</zeroOrMore>
<ref name="items"/>
</interleave>
</define>
<define name="title">
<a:documentation>http://purl.org/net/rss1.1#title</a:documentation>
<element name="title">
 
<ref name="title.content"/>
</element>
</define>
<define name="title.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<text/>
</define>
 
<define name="link">
<a:documentation>http://purl.org/net/rss1.1#link</a:documentation>
<element name="link">
<ref name="link.content"/>
</element>
</define>
<define name="link.content">
<data type="anyURI"/>
 
</define>
<define name="description">
<a:documentation>http://purl.org/net/rss1.1#description</a:documentation>
<element name="description">
<ref name="description.content"/>
</element>
</define>
<define name="description.content">
 
<optional>
<ref name="AttrXMLLang"/>
</optional>
<text/>
</define>
<define name="image">
<a:documentation>http://purl.org/net/rss1.1#image</a:documentation>
<element name="image">
 
<ref name="image.content"/>
</element>
</define>
<define name="image.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<ref name="AttrRDFResource"/>
<interleave>
 
<ref name="title"/>
<optional>
<ref name="link"/>
</optional>
<ref name="url"/>
<zeroOrMore>
<ref name="Any"/>
</zeroOrMore>
</interleave>
 
</define>
<define name="url">
<a:documentation>http://purl.org/net/rss1.1#url</a:documentation>
<element name="url">
<ref name="url.content"/>
</element>
</define>
<define name="url.content">
 
<data type="anyURI"/>
</define>
<define name="items">
<a:documentation>http://purl.org/net/rss1.1#items</a:documentation>
<element name="items">
<ref name="items.content"/>
</element>
</define>
 
<define name="items.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<ref name="AttrRDFCollection"/>
<zeroOrMore>
<ref name="item"/>
</zeroOrMore>
</define>
 
<define name="item">
<a:documentation>http://purl.org/net/rss1.1#item</a:documentation>
<element name="item">
<ref name="item.content"/>
</element>
</define>
<define name="item.content">
<optional>
 
<ref name="AttrXMLLang"/>
</optional>
<ref name="AttrRDFAbout"/>
<interleave>
<ref name="title"/>
<ref name="link"/>
<optional>
<ref name="description"/>
</optional>
 
<optional>
<ref name="image"/>
</optional>
<zeroOrMore>
<ref name="Any"/>
</zeroOrMore>
</interleave>
</define>
<define name="Any">
 
<a:documentation>http://purl.org/net/rss1.1#Any</a:documentation>
<element>
<anyName>
<except>
<nsName/>
</except>
</anyName>
<ref name="Any.content"/>
 
</element>
</define>
<define name="Any.content">
<zeroOrMore>
<attribute>
<anyName>
<except>
<nsName/>
<nsName ns=""/>
 
</except>
</anyName>
</attribute>
</zeroOrMore>
<mixed>
<zeroOrMore>
<ref name="Any"/>
</zeroOrMore>
</mixed>
 
</define>
<define name="AttrXMLLang">
<attribute name="xml:lang">
<data type="language"/>
</attribute>
</define>
<define name="AttrXMLBase">
<attribute name="xml:base">
<data type="anyURI"/>
 
</attribute>
</define>
<define name="AttrRDFAbout">
<attribute name="rdf:about">
<data type="anyURI"/>
</attribute>
</define>
<define name="AttrRDFResource">
<attribute name="rdf:parseType">
 
<value>Resource</value>
</attribute>
</define>
<define name="AttrRDFCollection">
<attribute name="rdf:parseType">
<value>Collection</value>
</attribute>
</define>
 
</grammar>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/schemas/rss20.rng
New file
0,0 → 1,298
<?xml version="1.0" encoding="utf-8"?>
 
<!-- ======================================================================
* Author: Dino Morelli
* Began: 2004-Feb-18
* Build #: 0001
* Version: 0.1
* E-Mail: dino.morelli@snet.net
* URL: (none yet)
* License: (none yet)
*
* ========================================================================
*
* RSS v2.0 Relax NG schema
*
* ==================================================================== -->
 
 
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
 
<start>
<ref name="element-rss" />
</start>
 
<define name="element-title">
<element name="title">
 
<text />
</element>
</define>
 
<define name="element-description">
<element name="description">
<text />
</element>
</define>
 
<define name="element-link">
<element name="link">
<text />
</element>
</define>
 
<define name="element-category">
<element name="category">
<optional>
 
<attribute name="domain" />
</optional>
<text />
</element>
</define>
 
<define name="element-rss">
<element name="rss">
<attribute name="version">
 
<value>2.0</value>
</attribute>
<element name="channel">
<interleave>
<ref name="element-title" />
<ref name="element-link" />
<ref name="element-description" />
<optional>
 
<element name="language"><text /></element>
</optional>
<optional>
<element name="copyright"><text /></element>
</optional>
<optional>
<element name="lastBuildDate"><text /></element>
</optional>
<optional>
 
<element name="docs"><text /></element>
</optional>
<optional>
<element name="generator"><text /></element>
</optional>
<optional>
<ref name="element-category" />
</optional>
<optional>
 
<element name="managingEditor"><text /></element>
</optional>
<optional>
<element name="webMaster"><text /></element>
</optional>
<optional>
<element name="pubDate"><text /></element>
</optional>
<optional>
 
<element name="rating"><text /></element>
</optional>
<optional>
<element name="image">
<interleave>
<element name="url"><text /></element>
<ref name="element-title" />
<ref name="element-link" />
<optional>
 
<element name="width"><text /></element>
</optional>
<optional>
<element name="height"><text /></element>
</optional>
<optional>
<ref name="element-description" />
</optional>
</interleave>
 
</element>
</optional>
<optional>
<element name="cloud">
<attribute name="domain" />
<attribute name="port" />
<attribute name="path" />
<attribute name="registerProcedure" />
<attribute name="protocol" />
 
</element>
</optional>
<optional>
<element name="textInput">
<interleave>
<ref name="element-title" />
<ref name="element-description" />
<element name="name"><text /></element>
<ref name="element-link" />
 
</interleave>
</element>
</optional>
<optional>
<element name="skipHours">
<oneOrMore>
<element name="hour">
<choice>
<value>0</value>
 
<value>1</value>
<value>2</value>
<value>3</value>
<value>4</value>
<value>5</value>
<value>6</value>
 
<value>7</value>
<value>8</value>
<value>9</value>
<value>10</value>
<value>11</value>
<value>12</value>
 
<value>13</value>
<value>14</value>
<value>15</value>
<value>16</value>
<value>17</value>
<value>18</value>
 
<value>19</value>
<value>20</value>
<value>21</value>
<value>22</value>
<value>23</value>
</choice>
 
</element>
</oneOrMore>
</element>
</optional>
<optional>
<element name="skipDays">
<oneOrMore>
<element name="day">
<choice>
 
<value>0</value>
<value>1</value>
<value>2</value>
<value>3</value>
<value>4</value>
<value>5</value>
 
<value>6</value>
<value>7</value>
<value>8</value>
<value>9</value>
<value>10</value>
<value>11</value>
 
<value>12</value>
<value>13</value>
<value>14</value>
<value>15</value>
<value>16</value>
<value>17</value>
 
<value>18</value>
<value>19</value>
<value>20</value>
<value>21</value>
<value>22</value>
<value>23</value>
 
<value>24</value>
<value>25</value>
<value>26</value>
<value>27</value>
<value>28</value>
<value>29</value>
 
<value>30</value>
<value>31</value>
</choice>
</element>
</oneOrMore>
</element>
</optional>
<optional>
 
<element name="ttl"><text /></element>
</optional>
<zeroOrMore>
<element name="item">
<interleave>
<choice>
<ref name="element-title" />
<ref name="element-description" />
<interleave>
 
<ref name="element-title" />
<ref name="element-description" />
</interleave>
</choice>
<optional>
<ref name="element-link" />
</optional>
<optional>
<element name="author"><text /></element>
 
</optional>
<optional>
<ref name="element-category" />
</optional>
<optional>
<element name="comments"><text /></element>
</optional>
<optional>
<element name="enclosure">
 
<attribute name="url" />
<attribute name="length" />
<attribute name="type" />
<text />
</element>
</optional>
<optional>
<element name="guid">
<optional>
 
<attribute name="isPermaLink">
<choice>
<value>true</value>
<value>false</value>
</choice>
</attribute>
</optional>
<text />
 
</element>
</optional>
<optional>
<element name="pubDate"><text /></element>
</optional>
<optional>
<element name="source">
<attribute name="url" />
<text />
 
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>
</element>
</define>
 
</grammar>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/XmlFeedParser.php
New file
0,0 → 1,304
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Key gateway class for XML_Feed_Parser package
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
* @version CVS: $Id: Parser.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This is the core of the XML_Feed_Parser package. It identifies feed types
* and abstracts access to them. It is an iterator, allowing for easy access
* to the entire feed.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParser implements Iterator {
/**
* This is where we hold the feed object
* @var Object
*/
private $feed;
 
/**
* To allow for extensions, we make a public reference to the feed model
* @var DOMDocument
*/
public $model;
/**
* A map between entry ID and offset
* @var array
*/
protected $idMappings = array();
 
/**
* A storage space for Namespace URIs.
* @var array
*/
private $feedNamespaces = array(
'rss2' => array(
'http://backend.userland.com/rss',
'http://backend.userland.com/rss2',
'http://blogs.law.harvard.edu/tech/rss'));
/**
* Detects feed types and instantiate appropriate objects.
*
* Our constructor takes care of detecting feed types and instantiating
* appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0
* but raise a warning. I do not intend to introduce full support for
* Atom 0.3 as it has been deprecated, but others are welcome to.
*
* @param string $feed XML serialization of the feed
* @param bool $strict Whether or not to validate the feed
* @param bool $suppressWarnings Trigger errors for deprecated feed types?
* @param bool $tidy Whether or not to try and use the tidy library on input
*/
function __construct($feed, $strict = false, $suppressWarnings = true, $tidy = true) {
$this->model = new DOMDocument;
if (! $this->model->loadXML($feed)) {
if (extension_loaded('tidy') && $tidy) {
$tidy = new tidy;
$tidy->parseString($feed, array('input-xml' => true, 'output-xml' => true));
$tidy->cleanRepair();
if (! $this->model->loadXML((string) $tidy)) {
throw new XmlFeedParserException("Entrée invalide : le flux n'est pas du XML valide");
}
} else {
throw new XmlFeedParserException("Entrée invalide : le flux n'est pas du XML valide");
}
}
 
/* detect feed type */
$doc_element = $this->model->documentElement;
$error = false;
 
switch (true) {
case ($doc_element->namespaceURI == 'http://www.w3.org/2005/Atom'):
$class = 'XmlFeedParserAtom';
break;
case ($doc_element->namespaceURI == 'http://purl.org/atom/ns#'):
$class = 'XmlFeedParserAtom';
$error = "Atom 0.3 est déprécié, le parseur en version 1.0 sera utilisé mais toutes les options ne seront pas disponibles.";
break;
case ($doc_element->namespaceURI == 'http://purl.org/rss/1.0/'
|| ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
&& $doc_element->childNodes->item(1)->namespaceURI == 'http://purl.org/rss/1.0/')):
$class = 'XmlFeedParserRss1';
break;
case ($doc_element->namespaceURI == 'http://purl.org/rss/1.1/'
|| ($doc_element->hasChildNodes()
&& $doc_element->childNodes->length > 1
&& $doc_element->childNodes->item(1)->namespaceURI == 'http://purl.org/rss/1.1/')):
$class = 'XmlFeedParserRss11';
break;
case (($doc_element->hasChildNodes()
&& $doc_element->childNodes->length > 1
&& $doc_element->childNodes->item(1)->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/')
|| $doc_element->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/'):
$class = 'XmlFeedParserRss09';
break;
case ($doc_element->tagName == 'rss'
and $doc_element->hasAttribute('version')
&& $doc_element->getAttribute('version') == 0.91):
$error = 'RSS 0.91 has been superceded by RSS2.0. Using RSS2.0 parser.';
$class = 'XmlFeedParserRss2';
break;
case ($doc_element->tagName == 'rss'
and $doc_element->hasAttribute('version')
&& $doc_element->getAttribute('version') == 0.92):
$error = 'RSS 0.92 has been superceded by RSS2.0. Using RSS2.0 parser.';
$class = 'XmlFeedParserRss2';
break;
case (in_array($doc_element->namespaceURI, $this->feedNamespaces['rss2'])
|| $doc_element->tagName == 'rss'):
if (! $doc_element->hasAttribute('version') || $doc_element->getAttribute('version') != 2) {
$error = 'RSS version not specified. Parsing as RSS2.0';
}
$class = 'XmlFeedParserRss2';
break;
default:
throw new XmlFeedParserException('Type de flux de syndicaton inconnu');
break;
}
 
if (! $suppressWarnings && ! empty($error)) {
trigger_error($error, E_USER_WARNING);
}
 
/* Instantiate feed object */
$this->feed = new $class($this->model, $strict);
}
 
/**
* Proxy to allow feed element names to be used as method names
*
* For top-level feed elements we will provide access using methods or
* attributes. This function simply passes on a request to the appropriate
* feed type object.
*
* @param string $call - the method being called
* @param array $attributes
*/
function __call($call, $attributes) {
$attributes = array_pad($attributes, 5, false);
list($a, $b, $c, $d, $e) = $attributes;
return $this->feed->$call($a, $b, $c, $d, $e);
}
 
/**
* Proxy to allow feed element names to be used as attribute names
*
* To allow variable-like access to feed-level data we use this
* method. It simply passes along to __call() which in turn passes
* along to the relevant object.
*
* @param string $val - the name of the variable required
*/
function __get($val) {
return $this->feed->$val;
}
 
/**
* Provides iteration functionality.
*
* Of course we must be able to iterate... This function simply increases
* our internal counter.
*/
function next() {
if (isset($this->current_item) &&
$this->current_item <= $this->feed->numberEntries - 1) {
++$this->current_item;
} else if (! isset($this->current_item)) {
$this->current_item = 0;
} else {
return false;
}
}
 
/**
* Return XML_Feed_Type object for current element
*
* @return XML_Feed_Parser_Type Object
*/
function current() {
return $this->getEntryByOffset($this->current_item);
}
 
/**
* For iteration -- returns the key for the current stage in the array.
*
* @return int
*/
function key() {
return $this->current_item;
}
 
/**
* For iteration -- tells whether we have reached the
* end.
*
* @return bool
*/
function valid() {
return $this->current_item < $this->feed->numberEntries;
}
 
/**
* For iteration -- resets the internal counter to the beginning.
*/
function rewind() {
$this->current_item = 0;
}
 
/**
* Provides access to entries by ID if one is specified in the source feed.
*
* As well as allowing the items to be iterated over we want to allow
* users to be able to access a specific entry. This is one of two ways of
* doing that, the other being by offset. This method can be quite slow
* if dealing with a large feed that hasn't yet been processed as it
* instantiates objects for every entry until it finds the one needed.
*
* @param string $id Valid ID for the given feed format
* @return XML_Feed_Parser_Type|false
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->getEntryByOffset($this->idMappings[$id]);
}
 
/*
* Since we have not yet encountered that ID, let's go through all the
* remaining entries in order till we find it.
* This is a fairly slow implementation, but it should work.
*/
return $this->feed->getEntryById($id);
}
 
/**
* Retrieve entry by numeric offset, starting from zero.
*
* As well as allowing the items to be iterated over we want to allow
* users to be able to access a specific entry. This is one of two ways of
* doing that, the other being by ID.
*
* @param int $offset The position of the entry within the feed, starting from 0
* @return XML_Feed_Parser_Type|false
*/
function getEntryByOffset($offset) {
if ($offset < $this->feed->numberEntries) {
if (isset($this->feed->entries[$offset])) {
return $this->feed->entries[$offset];
} else {
try {
$this->feed->getEntryByOffset($offset);
} catch (Exception $e) {
return false;
}
$id = $this->feed->entries[$offset]->getID();
$this->idMappings[$id] = $offset;
return $this->feed->entries[$offset];
}
} else {
return false;
}
}
 
/**
* Retrieve version details from feed type class.
*
* @return void
* @author James Stewart
*/
function version() {
return $this->feed->version;
}
/**
* Returns a string representation of the feed.
*
* @return String
**/
function __toString() {
return $this->feed->__toString();
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserAtom.php
New file
0,0 → 1,358
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Atom feed class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: Atom.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This is the class that determines how we manage Atom 1.0 feeds
*
* How we deal with constructs:
* date - return as unix datetime for use with the 'date' function unless specified otherwise
* text - return as is. optional parameter will give access to attributes
* person - defaults to name, but parameter based access
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserAtom extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'atom.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
public $xpath;
 
/**
* When performing XPath queries we will use this prefix
* @var string
*/
private $xpathPrefix = '//';
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'Atom 1.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserAtomElement';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'entry';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'author' => array('Person'),
'contributor' => array('Person'),
'icon' => array('Text'),
'logo' => array('Text'),
'id' => array('Text', 'fail'),
'rights' => array('Text'),
'subtitle' => array('Text'),
'title' => array('Text', 'fail'),
'updated' => array('Date', 'fail'),
'link' => array('Link'),
'generator' => array('Text'),
'category' => array('Category'),
'content' => array('Text'));
 
/**
* Here we provide a few mappings for those very special circumstances in
* which it makes sense to map back to the RSS2 spec. Key is RSS2 version
* value is an array consisting of the equivalent in atom and any attributes
* needed to make the mapping.
* @var array
*/
protected $compatMap = array(
'guid' => array('id'),
'links' => array('link'),
'tags' => array('category'),
'contributors' => array('contributor'));
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XML_Feed_Parser_Exception('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($this->model);
$this->xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
$this->numberEntries = $this->count('entry');
}
 
/**
* Implement retrieval of an entry based on its ID for atom feeds.
*
* This function uses XPath to get the entry based on its ID. If DOMXPath::evaluate
* is available, we also use that to store a reference to the entry in the array
* used by getEntryByOffset so that method does not have to seek out the entry
* if it's requested that way.
*
* @param string $id any valid Atom ID.
* @return XML_Feed_Parser_AtomElement
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//atom:entry[atom:id='$id']");
 
if ($entries->length > 0) {
$xmlBase = $entries->item(0)->baseURI;
$entry = new $this->itemClass($entries->item(0), $this, $xmlBase);
if (in_array('evaluate', get_class_methods($this->xpath))) {
$offset = $this->xpath->evaluate("count(preceding-sibling::atom:entry)", $entries->item(0));
$this->entries[$offset] = $entry;
}
 
$this->idMappings[$id] = $entry;
 
return $entry;
}
}
 
/**
* Retrieves data from a person construct.
*
* Get a person construct. We default to the 'name' element but allow
* access to any of the elements.
*
* @param string $method The name of the person construct we want
* @param array $arguments An array which we hope gives a 'param'
* @return string|false
*/
protected function getPerson($method, $arguments) {
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$parameter = empty($arguments[1]['param']) ? 'name' : $arguments[1]['param'];
$section = $this->model->getElementsByTagName($method);
if ($parameter == 'url') {
$parameter = 'uri';
}
 
if ($section->length <= $offset) {
return false;
}
 
$param = $section->item($offset)->getElementsByTagName($parameter);
if ($param->length == 0) {
return false;
}
return $param->item(0)->nodeValue;
}
 
/**
* Retrieves an element's content where that content is a text construct.
*
* Get a text construct. When calling this method, the two arguments
* allowed are 'offset' and 'attribute', so $parser->subtitle() would
* return the content of the element, while $parser->subtitle(false, 'type')
* would return the value of the type attribute.
*
* @todo Clarify overlap with getContent()
* @param string $method The name of the text construct we want
* @param array $arguments An array which we hope gives a 'param'
* @return string
*/
protected function getText($method, $arguments) {
$offset = empty($arguments[0]) ? 0: $arguments[0];
$attribute = empty($arguments[1]) ? false : $arguments[1];
$tags = $this->model->getElementsByTagName($method);
 
if ($tags->length <= $offset) {
return false;
}
 
$content = $tags->item($offset);
 
if (! $content->hasAttribute('type')) {
$content->setAttribute('type', 'text');
}
$type = $content->getAttribute('type');
 
if (! empty($attribute) and
! ($method == 'generator' and $attribute == 'name')) {
if ($content->hasAttribute($attribute)) {
return $content->getAttribute($attribute);
} else if ($attribute == 'href' and $content->hasAttribute('uri')) {
return $content->getAttribute('uri');
}
return false;
}
 
return $this->parseTextConstruct($content);
}
/**
* Extract content appropriately from atom text constructs
*
* Because of different rules applied to the content element and other text
* constructs, they are deployed as separate functions, but they share quite
* a bit of processing. This method performs the core common process, which is
* to apply the rules for different mime types in order to extract the content.
*
* @param DOMNode $content the text construct node to be parsed
* @return String
* @author James Stewart
**/
protected function parseTextConstruct(DOMNode $content) {
if ($content->hasAttribute('type')) {
$type = $content->getAttribute('type');
} else {
$type = 'text';
}
 
if (strpos($type, 'text/') === 0) {
$type = 'text';
}
 
switch ($type) {
case 'text':
case 'html':
return $content->textContent;
break;
case 'xhtml':
$container = $content->getElementsByTagName('div');
if ($container->length == 0) {
return false;
}
$contents = $container->item(0);
if ($contents->hasChildNodes()) {
/* Iterate through, applying xml:base and store the result */
$result = '';
foreach ($contents->childNodes as $node) {
$result .= $this->traverseNode($node);
}
return $result;
}
break;
case preg_match('@^[a-zA-Z]+/[a-zA-Z+]*xml@i', $type) > 0:
return $content;
break;
case 'application/octet-stream':
default:
return base64_decode(trim($content->nodeValue));
break;
}
return false;
}
/**
* Get a category from the entry.
*
* A feed or entry can have any number of categories. A category can have the
* attributes term, scheme and label.
*
* @param string $method The name of the text construct we want
* @param array $arguments An array which we hope gives a 'param'
* @return string
*/
function getCategory($method, $arguments) {
$offset = empty($arguments[0]) ? 0: $arguments[0];
$attribute = empty($arguments[1]) ? 'term' : $arguments[1];
$categories = $this->model->getElementsByTagName('category');
if ($categories->length <= $offset) {
$category = $categories->item($offset);
if ($category->hasAttribute($attribute)) {
return $category->getAttribute($attribute);
}
}
return false;
}
 
/**
* This element must be present at least once with rel="feed". This element may be
* present any number of further times so long as there is no clash. If no 'rel' is
* present and we're asked for one, we follow the example of the Universal Feed
* Parser and presume 'alternate'.
*
* @param int $offset the position of the link within the container
* @param string $attribute the attribute name required
* @param array an array of attributes to search by
* @return string the value of the attribute
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
if (is_array($params) and !empty($params)) {
$terms = array();
$alt_predicate = '';
$other_predicate = '';
 
foreach ($params as $key => $value) {
if ($key == 'rel' && $value == 'alternate') {
$alt_predicate = '[not(@rel) or @rel="alternate"]';
} else {
$terms[] = "@$key='$value'";
}
}
if (!empty($terms)) {
$other_predicate = '[' . join(' and ', $terms) . ']';
}
$query = $this->xpathPrefix . 'atom:link' . $alt_predicate . $other_predicate;
$links = $this->xpath->query($query);
} else {
$links = $this->model->getElementsByTagName('link');
}
if ($links->length > $offset) {
if ($links->item($offset)->hasAttribute($attribute)) {
$value = $links->item($offset)->getAttribute($attribute);
if ($attribute == 'href') {
$value = $this->addBase($value, $links->item($offset));
}
return $value;
} else if ($attribute == 'rel') {
return 'alternate';
}
}
return false;
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss09.php
New file
0,0 → 1,215
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS0.9 class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS09.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS0.9 feeds.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
* @todo Find a Relax NG URI we can use
*/
class XmlFeedParserRss09 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = '';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 0.9';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss09Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Text'),
'description' => array('Text'),
'image' => array('Image'),
'textinput' => array('TextInput'));
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'link' => array('link'),
'subtitle' => array('description'));
 
/**
* We will be working with multiple namespaces and it is useful to
* keep them together
* @var array
*/
protected $namespaces = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
 
/**
* Our constructor does nothing more than its parent.
*
* @todo RelaxNG validation
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
$this->xpath = new DOMXPath($model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Included for compatibility -- will not work with RSS 0.9
*
* This is not something that will work with RSS0.9 as it does not have
* clear restrictions on the global uniqueness of IDs.
*
* @param string $id any valid ID.
* @return false
*/
function getEntryById($id) {
return false;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->model->getElementsByTagName('image');
if ($images->length > 0) {
$image = $images->item(0);
$details = array();
if ($image->hasChildNodes()) {
$details = array(
'title' => $image->getElementsByTagName('title')->item(0)->value,
'link' => $image->getElementsByTagName('link')->item(0)->value,
'url' => $image->getElementsByTagName('url')->item(0)->value);
} else {
$details = array('title' => false,
'link' => false,
'url' => $image->attributes->getNamedItem('resource')->nodeValue);
}
$details = array_merge($details,
array('description' => false, 'height' => false, 'width' => false));
if (! empty($details)) {
return $details;
}
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness we will support it.
*
* @return array|false
*/
protected function getTextInput() {
$inputs = $this->model->getElementsByTagName('textinput');
if ($inputs->length > 0) {
$input = $inputs->item(0);
$results = array();
$results['title'] = isset(
$input->getElementsByTagName('title')->item(0)->value) ?
$input->getElementsByTagName('title')->item(0)->value : null;
$results['description'] = isset(
$input->getElementsByTagName('description')->item(0)->value) ?
$input->getElementsByTagName('description')->item(0)->value : null;
$results['name'] = isset(
$input->getElementsByTagName('name')->item(0)->value) ?
$input->getElementsByTagName('name')->item(0)->value : null;
$results['link'] = isset(
$input->getElementsByTagName('link')->item(0)->value) ?
$input->getElementsByTagName('link')->item(0)->value : null;
if (empty($results['link']) &&
$input->attributes->getNamedItem('resource')) {
$results['link'] = $input->attributes->getNamedItem('resource')->nodeValue;
}
if (! empty($results)) {
return $results;
}
}
return false;
}
/**
* Get details of a link from the feed.
*
* In RSS1 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them.
*
* @return string
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
$links = $this->model->getElementsByTagName('link');
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
 
/**
* Not implemented - no available validation.
*/
public function relaxNGValidate() {
return true;
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserType.php
New file
0,0 → 1,455
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Abstract class providing common methods for XML_Feed_Parser feeds.
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: Type.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This abstract class provides some general methods that are likely to be
* implemented exactly the same way for all feed types.
*
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
*/
abstract class XmlFeedParserType {
/**
* Where we store our DOM object for this feed
* @var DOMDocument
*/
public $model;
 
/**
* For iteration we'll want a count of the number of entries
* @var int
*/
public $numberEntries;
 
/**
* Where we store our entry objects once instantiated
* @var array
*/
public $entries = array();
 
/**
* Store mappings between entry IDs and their position in the feed
*/
public $idMappings = array();
 
/**
* Proxy to allow use of element names as method names
*
* We are not going to provide methods for every entry type so this
* function will allow for a lot of mapping. We rely pretty heavily
* on this to handle our mappings between other feed types and atom.
*
* @param string $call - the method attempted
* @param array $arguments - arguments to that method
* @return mixed
*/
function __call($call, $arguments = array()) {
if (! is_array($arguments)) {
$arguments = array();
}
 
if (isset($this->compatMap[$call])) {
$tempMap = $this->compatMap;
$tempcall = array_pop($tempMap[$call]);
if (! empty($tempMap)) {
$arguments = array_merge($arguments, $tempMap[$call]);
}
$call = $tempcall;
}
 
/* To be helpful, we allow a case-insensitive search for this method */
if (! isset($this->map[$call])) {
foreach (array_keys($this->map) as $key) {
if (strtoupper($key) == strtoupper($call)) {
$call = $key;
break;
}
}
}
 
if (empty($this->map[$call])) {
return false;
}
 
$method = 'get' . $this->map[$call][0];
if ($method == 'getLink') {
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$attribute = empty($arguments[1]) ? 'href' : $arguments[1];
$params = isset($arguments[2]) ? $arguments[2] : array();
return $this->getLink($offset, $attribute, $params);
}
if (method_exists($this, $method)) {
return $this->$method($call, $arguments);
}
 
return false;
}
 
/**
* Proxy to allow use of element names as attribute names
*
* For many elements variable-style access will be desirable. This function
* provides for that.
*
* @param string $value - the variable required
* @return mixed
*/
function __get($value) {
return $this->__call($value, array());
}
 
/**
* Utility function to help us resolve xml:base values
*
* We have other methods which will traverse the DOM and work out the different
* xml:base declarations we need to be aware of. We then need to combine them.
* If a declaration starts with a protocol then we restart the string. If it
* starts with a / then we add on to the domain name. Otherwise we simply tag
* it on to the end.
*
* @param string $base - the base to add the link to
* @param string $link
*/
function combineBases($base, $link) {
if (preg_match('/^[A-Za-z]+:\/\//', $link)) {
return $link;
} else if (preg_match('/^\//', $link)) {
/* Extract domain and suffix link to that */
preg_match('/^([A-Za-z]+:\/\/.*)?\/*/', $base, $results);
$firstLayer = $results[0];
return $firstLayer . "/" . $link;
} else if (preg_match('/^\.\.\//', $base)) {
/* Step up link to find place to be */
preg_match('/^((\.\.\/)+)(.*)$/', $link, $bases);
$suffix = $bases[3];
$count = preg_match_all('/\.\.\//', $bases[1], $steps);
$url = explode("/", $base);
for ($i = 0; $i <= $count; $i++) {
array_pop($url);
}
return implode("/", $url) . "/" . $suffix;
} else if (preg_match('/^(?!\/$)/', $base)) {
$base = preg_replace('/(.*\/).*$/', '$1', $base) ;
return $base . $link;
} else {
/* Just stick it on the end */
return $base . $link;
}
}
 
/**
* Determine whether we need to apply our xml:base rules
*
* Gets us the xml:base data and then processes that with regard
* to our current link.
*
* @param string
* @param DOMElement
* @return string
*/
function addBase($link, $element) {
if (preg_match('/^[A-Za-z]+:\/\//', $link)) {
return $link;
}
 
return $this->combineBases($element->baseURI, $link);
}
 
/**
* Get an entry by its position in the feed, starting from zero
*
* As well as allowing the items to be iterated over we want to allow
* users to be able to access a specific entry. This is one of two ways of
* doing that, the other being by ID.
*
* @param int $offset
* @return XML_Feed_Parser_RSS1Element
*/
function getEntryByOffset($offset) {
if (! isset($this->entries[$offset])) {
$entries = $this->model->getElementsByTagName($this->itemElement);
if ($entries->length > $offset) {
$xmlBase = $entries->item($offset)->baseURI;
$this->entries[$offset] = new $this->itemClass(
$entries->item($offset), $this, $xmlBase);
if ($id = $this->entries[$offset]->id) {
$this->idMappings[$id] = $this->entries[$offset];
}
} else {
throw new XML_Feed_Parser_Exception('No entries found');
}
}
 
return $this->entries[$offset];
}
 
/**
* Return a date in seconds since epoch.
*
* Get a date construct. We use PHP's strtotime to return it as a unix datetime, which
* is the number of seconds since 1970-01-01 00:00:00.
*
* @link http://php.net/strtotime
* @param string $method The name of the date construct we want
* @param array $arguments Included for compatibility with our __call usage
* @return int|false datetime
*/
protected function getDate($method, $arguments) {
$time = $this->model->getElementsByTagName($method);
if ($time->length == 0 || empty($time->item(0)->nodeValue)) {
return false;
}
return strtotime($time->item(0)->nodeValue);
}
 
/**
* Get a text construct.
*
* @param string $method The name of the text construct we want
* @param array $arguments Included for compatibility with our __call usage
* @return string
*/
protected function getText($method, $arguments = array()) {
$tags = $this->model->getElementsByTagName($method);
if ($tags->length > 0) {
$value = $tags->item(0)->nodeValue;
return $value;
}
return false;
}
 
/**
* Apply various rules to retrieve category data.
*
* There is no single way of declaring a category in RSS1/1.1 as there is in RSS2
* and Atom. Instead the usual approach is to use the dublin core namespace to
* declare categories. For example delicious use both:
* <dc:subject>PEAR</dc:subject> and: <taxo:topics><rdf:Bag>
* <rdf:li resource="http://del.icio.us/tag/PEAR" /></rdf:Bag></taxo:topics>
* to declare a categorisation of 'PEAR'.
*
* We need to be sensitive to this where possible.
*
* @param string $call for compatibility with our overloading
* @param array $arguments - arg 0 is the offset, arg 1 is whether to return as array
* @return string|array|false
*/
protected function getCategory($call, $arguments) {
$categories = $this->model->getElementsByTagName('subject');
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$array = empty($arguments[1]) ? false : true;
if ($categories->length <= $offset) {
return false;
}
if ($array) {
$list = array();
foreach ($categories as $category) {
array_push($list, $category->nodeValue);
}
return $list;
}
return $categories->item($offset)->nodeValue;
}
 
/**
* Count occurrences of an element
*
* This function will tell us how many times the element $type
* appears at this level of the feed.
*
* @param string $type the element we want to get a count of
* @return int
*/
protected function count($type) {
if ($tags = $this->model->getElementsByTagName($type)) {
return $tags->length;
}
return 0;
}
 
/**
* Part of our xml:base processing code
*
* We need a couple of methods to access XHTML content stored in feeds.
* This is because we dereference all xml:base references before returning
* the element. This method handles the attributes.
*
* @param DOMElement $node The DOM node we are iterating over
* @return string
*/
function processXHTMLAttributes($node) {
$return = '';
foreach ($node->attributes as $attribute) {
if ($attribute->name == 'src' or $attribute->name == 'href') {
$attribute->value = $this->addBase(htmlentities($attribute->value, NULL, 'utf-8'), $attribute);
}
if ($attribute->name == 'base') {
continue;
}
$return .= $attribute->name . '="' . htmlentities($attribute->value, NULL, 'utf-8') .'" ';
}
if (! empty($return)) {
return ' ' . trim($return);
}
return '';
}
 
/**
* Convert HTML entities based on the current character set.
*
* @param String
* @return String
*/
function processEntitiesForNodeValue($node) {
if (function_exists('iconv')) {
$current_encoding = $node->ownerDocument->encoding;
$value = iconv($current_encoding, 'UTF-8', $node->nodeValue);
} else if ($current_encoding == 'iso-8859-1') {
$value = utf8_encode($node->nodeValue);
} else {
$value = $node->nodeValue;
}
 
$decoded = html_entity_decode($value, NULL, 'UTF-8');
return htmlentities($decoded, NULL, 'UTF-8');
}
 
/**
* Part of our xml:base processing code
*
* We need a couple of methods to access XHTML content stored in feeds.
* This is because we dereference all xml:base references before returning
* the element. This method recurs through the tree descending from the node
* and builds our string.
*
* @param DOMElement $node The DOM node we are processing
* @return string
*/
function traverseNode($node) {
$content = '';
 
/* Add the opening of this node to the content */
if ($node instanceof DOMElement) {
$content .= '<' . $node->tagName .
$this->processXHTMLAttributes($node) . '>';
}
 
/* Process children */
if ($node->hasChildNodes()) {
foreach ($node->childNodes as $child) {
$content .= $this->traverseNode($child);
}
}
 
if ($node instanceof DOMText) {
$content .= $this->processEntitiesForNodeValue($node);
}
 
/* Add the closing of this node to the content */
if ($node instanceof DOMElement) {
$content .= '</' . $node->tagName . '>';
}
 
return $content;
}
 
/**
* Get content from RSS feeds (atom has its own implementation)
*
* The official way to include full content in an RSS1 entry is to use
* the content module's element 'encoded', and RSS2 feeds often duplicate that.
* Often, however, the 'description' element is used instead. We will offer that
* as a fallback. Atom uses its own approach and overrides this method.
*
* @return string|false
*/
protected function getContent() {
$options = array('encoded', 'description');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length == 0) {
continue;
}
if ($test->item(0)->hasChildNodes()) {
$value = '';
foreach ($test->item(0)->childNodes as $child) {
if ($child instanceof DOMText) {
$value .= $child->nodeValue;
} else {
$simple = simplexml_import_dom($child);
$value .= $simple->asXML();
}
}
return $value;
} else if ($test->length > 0) {
return $test->item(0)->nodeValue;
}
}
return false;
}
 
/**
* Checks if this element has a particular child element.
*
* @param String
* @param Integer
* @return bool
**/
function hasKey($name, $offset = 0) {
$search = $this->model->getElementsByTagName($name);
return $search->length > $offset;
}
 
/**
* Return an XML serialization of the feed, should it be required. Most
* users however, will already have a serialization that they used when
* instantiating the object.
*
* @return string XML serialization of element
*/
function __toString() {
$simple = simplexml_import_dom($this->model);
return $simple->asXML();
}
/**
* Get directory holding RNG schemas. Method is based on that
* found in Contact_AddressBook.
*
* @return string PEAR data directory.
* @access public
* @static
*/
static function getSchemaDir() {
return dirname(__FILE__).'/../schemas';
}
 
public function relaxNGValidate() {
$dir = self::getSchemaDir();
$path = $dir . '/' . $this->relax;
return $this->model->relaxNGValidate($path);
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss1Element.php
New file
0,0 → 1,111
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1 Element class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS1Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/*
* This class provides support for RSS 1.0 entries. It will usually be called by
* XML_Feed_Parser_RSS1 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss1Element extends XmlFeedParserRss1 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS1
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'id' => array('Id'),
'title' => array('Text'),
'link' => array('Link'),
'description' => array('Text'), # or dc:description
'category' => array('Category'),
'rights' => array('Text'), # dc:rights
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date'), # dc:date
'content' => array('Content')
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS1.
* @var array
*/
protected $compatMap = array(
'content' => array('content'),
'updated' => array('lastBuildDate'),
'published' => array('date'),
'subtitle' => array('description'),
'updated' => array('date'),
'author' => array('creator'),
'contributor' => array('contributor')
);
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
 
/**
* If an rdf:about attribute is specified, return it as an ID
*
* There is no established way of showing an ID for an RSS1 entry. We will
* simulate it using the rdf:about attribute of the entry element. This cannot
* be relied upon for unique IDs but may prove useful.
*
* @return string|false
*/
function getId() {
if ($this->model->attributes->getNamedItem('about')) {
return $this->model->attributes->getNamedItem('about')->nodeValue;
}
return false;
}
 
/**
* How RSS1 should support for enclosures is not clear. For now we will return
* false.
*
* @return false
*/
function getEnclosure() {
return false;
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss11Element.php
New file
0,0 → 1,145
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1 Element class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS11Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/*
* This class provides support for RSS 1.1 entries. It will usually be called by
* XML_Feed_Parser_RSS11 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss11Element extends XmlFeedParserRss11 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS1
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'id' => array('Id'),
'title' => array('Text'),
'link' => array('Link'),
'description' => array('Text'), # or dc:description
'category' => array('Category'),
'rights' => array('Text'), # dc:rights
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date'), # dc:date
'content' => array('Content')
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS1.
* @var array
*/
protected $compatMap = array(
'content' => array('content'),
'updated' => array('lastBuildDate'),
'published' => array('date'),
'subtitle' => array('description'),
'updated' => array('date'),
'author' => array('creator'),
'contributor' => array('contributor')
);
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
 
/**
* If an rdf:about attribute is specified, return that as an ID
*
* There is no established way of showing an ID for an RSS1 entry. We will
* simulate it using the rdf:about attribute of the entry element. This cannot
* be relied upon for unique IDs but may prove useful.
*
* @return string|false
*/
function getId() {
if ($this->model->attributes->getNamedItem('about')) {
return $this->model->attributes->getNamedItem('about')->nodeValue;
}
return false;
}
 
/**
* Return the entry's content
*
* The official way to include full content in an RSS1 entry is to use
* the content module's element 'encoded'. Often, however, the 'description'
* element is used instead. We will offer that as a fallback.
*
* @return string|false
*/
function getContent() {
$options = array('encoded', 'description');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length == 0) {
continue;
}
if ($test->item(0)->hasChildNodes()) {
$value = '';
foreach ($test->item(0)->childNodes as $child) {
if ($child instanceof DOMText) {
$value .= $child->nodeValue;
} else {
$simple = simplexml_import_dom($child);
$value .= $simple->asXML();
}
}
return $value;
} else if ($test->length > 0) {
return $test->item(0)->nodeValue;
}
}
return false;
}
/**
* How RSS1.1 should support for enclosures is not clear. For now we will return
* false.
*
* @return false
*/
function getEnclosure() {
return false;
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss2Element.php
New file
0,0 → 1,166
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Class representing entries in an RSS2 feed.
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS2Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class provides support for RSS 2.0 entries. It will usually be
* called by XML_Feed_Parser_RSS2 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss2Element extends XmlFeedParserRss2 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS2
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'title' => array('Text'),
'guid' => array('Guid'),
'description' => array('Text'),
'author' => array('Text'),
'comments' => array('Text'),
'enclosure' => array('Enclosure'),
'pubDate' => array('Date'),
'source' => array('Source'),
'link' => array('Text'),
'content' => array('Content'));
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'id' => array('guid'),
'updated' => array('lastBuildDate'),
'published' => array('pubdate'),
'guidislink' => array('guid', 'ispermalink'),
'summary' => array('description'));
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS2 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
 
/**
* Get the value of the guid element, if specified
*
* guid is the closest RSS2 has to atom's ID. It is usually but not always a
* URI. The one attribute that RSS2 can posess is 'ispermalink' which specifies
* whether the guid is itself dereferencable. Use of guid is not obligatory,
* but is advisable. To get the guid you would call $item->id() (for atom
* compatibility) or $item->guid(). To check if this guid is a permalink call
* $item->guid("ispermalink").
*
* @param string $method - the method name being called
* @param array $params - parameters required
* @return string the guid or value of ispermalink
*/
protected function getGuid($method, $params) {
$attribute = (isset($params[0]) and $params[0] == 'ispermalink') ?
true : false;
$tag = $this->model->getElementsByTagName('guid');
if ($tag->length > 0) {
if ($attribute) {
if ($tag->hasAttribute("ispermalink")) {
return $tag->getAttribute("ispermalink");
}
}
return $tag->item(0)->nodeValue;
}
return false;
}
 
/**
* Access details of file enclosures
*
* The RSS2 spec is ambiguous as to whether an enclosure element must be
* unique in a given entry. For now we will assume it needn't, and allow
* for an offset.
*
* @param string $method - the method being called
* @param array $parameters - we expect the first of these to be our offset
* @return array|false
*/
protected function getEnclosure($method, $parameters) {
$encs = $this->model->getElementsByTagName('enclosure');
$offset = isset($parameters[0]) ? $parameters[0] : 0;
if ($encs->length > $offset) {
try {
if (! $encs->item($offset)->hasAttribute('url')) {
return false;
}
$attrs = $encs->item($offset)->attributes;
return array(
'url' => $attrs->getNamedItem('url')->value,
'length' => $attrs->getNamedItem('length')->value,
'type' => $attrs->getNamedItem('type')->value);
} catch (Exception $e) {
return false;
}
}
return false;
}
 
/**
* Get the entry source if specified
*
* source is an optional sub-element of item. Like atom:source it tells
* us about where the entry came from (eg. if it's been copied from another
* feed). It is not a rich source of metadata in the same way as atom:source
* and while it would be good to maintain compatibility by returning an
* XML_Feed_Parser_RSS2 element, it makes a lot more sense to return an array.
*
* @return array|false
*/
protected function getSource() {
$get = $this->model->getElementsByTagName('source');
if ($get->length) {
$source = $get->item(0);
$array = array(
'content' => $source->nodeValue);
foreach ($source->attributes as $attribute) {
$array[$attribute->name] = $attribute->value;
}
return $array;
}
return false;
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss1.php
New file
0,0 → 1,267
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1 class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS1.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS1.0 feeds.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
* @todo Find a Relax NG URI we can use
*/
class XmlFeedParserRss1 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'rss10.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 1.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss1Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Text'),
'description' => array('Text'),
'image' => array('Image'),
'textinput' => array('TextInput'),
'updatePeriod' => array('Text'),
'updateFrequency' => array('Text'),
'updateBase' => array('Date'),
'rights' => array('Text'), # dc:rights
'description' => array('Text'), # dc:description
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date') # dc:contributor
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'link' => array('link'),
'subtitle' => array('description'),
'author' => array('creator'),
'updated' => array('date'));
 
/**
* We will be working with multiple namespaces and it is useful to
* keep them together
* @var array
*/
protected $namespaces = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'rss' => 'http://purl.org/rss/1.0/',
'dc' => 'http://purl.org/rss/1.0/modules/dc/',
'content' => 'http://purl.org/rss/1.0/modules/content/',
'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/');
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XML_Feed_Parser_Exception('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Allows retrieval of an entry by ID where the rdf:about attribute is used
*
* This is not really something that will work with RSS1 as it does not have
* clear restrictions on the global uniqueness of IDs. We will employ the
* _very_ hit and miss method of selecting entries based on the rdf:about
* attribute. If DOMXPath::evaluate is available, we also use that to store
* a reference to the entry in the array used by getEntryByOffset so that
* method does not have to seek out the entry if it's requested that way.
*
* @param string $id any valid ID.
* @return XML_Feed_Parser_RSS1Element
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//rss:item[@rdf:about='$id']");
if ($entries->length > 0) {
$classname = $this->itemClass;
$entry = new $classname($entries->item(0), $this);
if (in_array('evaluate', get_class_methods($this->xpath))) {
$offset = $this->xpath->evaluate("count(preceding-sibling::rss:item)", $entries->item(0));
$this->entries[$offset] = $entry;
}
$this->idMappings[$id] = $entry;
return $entry;
}
return false;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->model->getElementsByTagName('image');
if ($images->length > 0) {
$image = $images->item(0);
$details = array();
if ($image->hasChildNodes()) {
$details = array(
'title' => $image->getElementsByTagName('title')->item(0)->value,
'link' => $image->getElementsByTagName('link')->item(0)->value,
'url' => $image->getElementsByTagName('url')->item(0)->value);
} else {
$details = array('title' => false,
'link' => false,
'url' => $image->attributes->getNamedItem('resource')->nodeValue);
}
$details = array_merge($details, array('description' => false, 'height' => false, 'width' => false));
if (! empty($details)) {
return $details;
}
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness we will support it.
*
* @return array|false
*/
protected function getTextInput() {
$inputs = $this->model->getElementsByTagName('textinput');
if ($inputs->length > 0) {
$input = $inputs->item(0);
$results = array();
$results['title'] = isset(
$input->getElementsByTagName('title')->item(0)->value) ?
$input->getElementsByTagName('title')->item(0)->value : null;
$results['description'] = isset(
$input->getElementsByTagName('description')->item(0)->value) ?
$input->getElementsByTagName('description')->item(0)->value : null;
$results['name'] = isset(
$input->getElementsByTagName('name')->item(0)->value) ?
$input->getElementsByTagName('name')->item(0)->value : null;
$results['link'] = isset(
$input->getElementsByTagName('link')->item(0)->value) ?
$input->getElementsByTagName('link')->item(0)->value : null;
if (empty($results['link']) and
$input->attributes->getNamedItem('resource')) {
$results['link'] =
$input->attributes->getNamedItem('resource')->nodeValue;
}
if (! empty($results)) {
return $results;
}
}
return false;
}
 
/**
* Employs various techniques to identify the author
*
* Dublin Core provides the dc:creator, dc:contributor, and dc:publisher
* elements for defining authorship in RSS1. We will try each of those in
* turn in order to simulate the atom author element and will return it
* as text.
*
* @return array|false
*/
function getAuthor() {
$options = array('creator', 'contributor', 'publisher');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length > 0) {
return $test->item(0)->value;
}
}
return false;
}
/**
* Retrieve a link
*
* In RSS1 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them.
*
* @return string
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
$links = $this->model->getElementsByTagName('link');
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss11.php
New file
0,0 → 1,266
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1.1 class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS11.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS1.1 feeds. RSS1.1 is documented at:
* http://inamidst.com/rss1.1/
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
* @todo Support for RDF:List
* @todo Ensure xml:lang is accessible to users
*/
class XmlFeedParserRss11 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'rss11.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 1.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss11Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Text'),
'description' => array('Text'),
'image' => array('Image'),
'updatePeriod' => array('Text'),
'updateFrequency' => array('Text'),
'updateBase' => array('Date'),
'rights' => array('Text'), # dc:rights
'description' => array('Text'), # dc:description
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date') # dc:contributor
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'link' => array('link'),
'subtitle' => array('description'),
'author' => array('creator'),
'updated' => array('date'));
 
/**
* We will be working with multiple namespaces and it is useful to
* keep them together. We will retain support for some common RSS1.0 modules
* @var array
*/
protected $namespaces = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'rss' => 'http://purl.org/net/rss1.1#',
'dc' => 'http://purl.org/rss/1.0/modules/dc/',
'content' => 'http://purl.org/rss/1.0/modules/content/',
'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/');
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XML_Feed_Parser_Exception('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Attempts to identify an element by ID given by the rdf:about attribute
*
* This is not really something that will work with RSS1.1 as it does not have
* clear restrictions on the global uniqueness of IDs. We will employ the
* _very_ hit and miss method of selecting entries based on the rdf:about
* attribute. Please note that this is even more hit and miss with RSS1.1 than
* with RSS1.0 since RSS1.1 does not require the rdf:about attribute for items.
*
* @param string $id any valid ID.
* @return XML_Feed_Parser_RSS1Element
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//rss:item[@rdf:about='$id']");
if ($entries->length > 0) {
$classname = $this->itemClass;
$entry = new $classname($entries->item(0), $this);
return $entry;
}
return false;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->model->getElementsByTagName('image');
if ($images->length > 0) {
$image = $images->item(0);
$details = array();
if ($image->hasChildNodes()) {
$details = array(
'title' => $image->getElementsByTagName('title')->item(0)->value,
'url' => $image->getElementsByTagName('url')->item(0)->value);
if ($image->getElementsByTagName('link')->length > 0) {
$details['link'] =
$image->getElementsByTagName('link')->item(0)->value;
}
} else {
$details = array('title' => false,
'link' => false,
'url' => $image->attributes->getNamedItem('resource')->nodeValue);
}
$details = array_merge($details,
array('description' => false, 'height' => false, 'width' => false));
if (! empty($details)) {
return $details;
}
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness we will support it.
*
* @return array|false
*/
protected function getTextInput() {
$inputs = $this->model->getElementsByTagName('textinput');
if ($inputs->length > 0) {
$input = $inputs->item(0);
$results = array();
$results['title'] = isset(
$input->getElementsByTagName('title')->item(0)->value) ?
$input->getElementsByTagName('title')->item(0)->value : null;
$results['description'] = isset(
$input->getElementsByTagName('description')->item(0)->value) ?
$input->getElementsByTagName('description')->item(0)->value : null;
$results['name'] = isset(
$input->getElementsByTagName('name')->item(0)->value) ?
$input->getElementsByTagName('name')->item(0)->value : null;
$results['link'] = isset(
$input->getElementsByTagName('link')->item(0)->value) ?
$input->getElementsByTagName('link')->item(0)->value : null;
if (empty($results['link']) and
$input->attributes->getNamedItem('resource')) {
$results['link'] = $input->attributes->getNamedItem('resource')->nodeValue;
}
if (! empty($results)) {
return $results;
}
}
return false;
}
 
/**
* Attempts to discern authorship
*
* Dublin Core provides the dc:creator, dc:contributor, and dc:publisher
* elements for defining authorship in RSS1. We will try each of those in
* turn in order to simulate the atom author element and will return it
* as text.
*
* @return array|false
*/
function getAuthor() {
$options = array('creator', 'contributor', 'publisher');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length > 0) {
return $test->item(0)->value;
}
}
return false;
}
/**
* Retrieve a link
*
* In RSS1 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them.
*
* @return string
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
$links = $this->model->getElementsByTagName('link');
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss2.php
New file
0,0 → 1,323
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Class representing feed-level data for an RSS2 feed
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS2.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS2 feeds.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss2 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'rss20.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 2.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss2Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'ttl' => array('Text'),
'pubDate' => array('Date'),
'lastBuildDate' => array('Date'),
'title' => array('Text'),
'link' => array('Link'),
'description' => array('Text'),
'language' => array('Text'),
'copyright' => array('Text'),
'managingEditor' => array('Text'),
'webMaster' => array('Text'),
'category' => array('Text'),
'generator' => array('Text'),
'docs' => array('Text'),
'ttl' => array('Text'),
'image' => array('Image'),
'skipDays' => array('skipDays'),
'skipHours' => array('skipHours'));
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'rights' => array('copyright'),
'updated' => array('lastBuildDate'),
'subtitle' => array('description'),
'date' => array('pubDate'),
'author' => array('managingEditor'));
 
protected $namespaces = array(
'dc' => 'http://purl.org/rss/1.0/modules/dc/',
'content' => 'http://purl.org/rss/1.0/modules/content/');
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XmlFeedParserException('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($this->model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Retrieves an entry by ID, if the ID is specified with the guid element
*
* This is not really something that will work with RSS2 as it does not have
* clear restrictions on the global uniqueness of IDs. But we can emulate
* it by allowing access based on the 'guid' element. If DOMXPath::evaluate
* is available, we also use that to store a reference to the entry in the array
* used by getEntryByOffset so that method does not have to seek out the entry
* if it's requested that way.
*
* @param string $id any valid ID.
* @return XML_Feed_Parser_RSS2Element
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//item[guid='$id']");
if ($entries->length > 0) {
$entry = new $this->itemElement($entries->item(0), $this);
if (in_array('evaluate', get_class_methods($this->xpath))) {
$offset = $this->xpath->evaluate("count(preceding-sibling::item)", $entries->item(0));
$this->entries[$offset] = $entry;
}
$this->idMappings[$id] = $entry;
return $entry;
}
}
 
/**
* Get a category from the element
*
* The category element is a simple text construct which can occur any number
* of times. We allow access by offset or access to an array of results.
*
* @param string $call for compatibility with our overloading
* @param array $arguments - arg 0 is the offset, arg 1 is whether to return as array
* @return string|array|false
*/
function getCategory($call, $arguments = array()) {
$categories = $this->model->getElementsByTagName('category');
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$array = empty($arguments[1]) ? false : true;
if ($categories->length <= $offset) {
return false;
}
if ($array) {
$list = array();
foreach ($categories as $category) {
array_push($list, $category->nodeValue);
}
return $list;
}
return $categories->item($offset)->nodeValue;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->xpath->query("//image");
if ($images->length > 0) {
$image = $images->item(0);
$desc = $image->getElementsByTagName('description');
$description = $desc->length ? $desc->item(0)->nodeValue : false;
$heigh = $image->getElementsByTagName('height');
$height = $heigh->length ? $heigh->item(0)->nodeValue : false;
$widt = $image->getElementsByTagName('width');
$width = $widt->length ? $widt->item(0)->nodeValue : false;
return array(
'title' => $image->getElementsByTagName('title')->item(0)->nodeValue,
'link' => $image->getElementsByTagName('link')->item(0)->nodeValue,
'url' => $image->getElementsByTagName('url')->item(0)->nodeValue,
'description' => $description,
'height' => $height,
'width' => $width);
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness...
*
* @return array|false
*/
function getTextInput() {
$inputs = $this->model->getElementsByTagName('input');
if ($inputs->length > 0) {
$input = $inputs->item(0);
return array(
'title' => $input->getElementsByTagName('title')->item(0)->value,
'description' =>
$input->getElementsByTagName('description')->item(0)->value,
'name' => $input->getElementsByTagName('name')->item(0)->value,
'link' => $input->getElementsByTagName('link')->item(0)->value);
}
return false;
}
 
/**
* Utility function for getSkipDays and getSkipHours
*
* This is a general function used by both getSkipDays and getSkipHours. It simply
* returns an array of the values of the children of the appropriate tag.
*
* @param string $tagName The tag name (getSkipDays or getSkipHours)
* @return array|false
*/
protected function getSkips($tagName) {
$hours = $this->model->getElementsByTagName($tagName);
if ($hours->length == 0) {
return false;
}
$skipHours = array();
foreach($hours->item(0)->childNodes as $hour) {
if ($hour instanceof DOMElement) {
array_push($skipHours, $hour->nodeValue);
}
}
return $skipHours;
}
 
/**
* Retrieve skipHours data
*
* The skiphours element provides a list of hours on which this feed should
* not be checked. We return an array of those hours (integers, 24 hour clock)
*
* @return array
*/
function getSkipHours() {
return $this->getSkips('skipHours');
}
 
/**
* Retrieve skipDays data
*
* The skipdays element provides a list of days on which this feed should
* not be checked. We return an array of those days.
*
* @return array
*/
function getSkipDays() {
return $this->getSkips('skipDays');
}
 
/**
* Return content of the little-used 'cloud' element
*
* The cloud element is rarely used. It is designed to provide some details
* of a location to update the feed.
*
* @return array an array of the attributes of the element
*/
function getCloud() {
$cloud = $this->model->getElementsByTagName('cloud');
if ($cloud->length == 0) {
return false;
}
$cloudData = array();
foreach ($cloud->item(0)->attributes as $attribute) {
$cloudData[$attribute->name] = $attribute->value;
}
return $cloudData;
}
/**
* Get link URL
*
* In RSS2 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them. We maintain the
* parameter used by the atom getLink method, though we only use the offset
* parameter.
*
* @param int $offset The position of the link within the feed. Starts from 0
* @param string $attribute The attribute of the link element required
* @param array $params An array of other parameters. Not used.
* @return string
*/
function getLink($offset, $attribute = 'href', $params = array()) {
$links = $this->model->getElementsByTagName('link');
 
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserAtomElement.php
New file
0,0 → 1,254
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* AtomElement class for XML_Feed_Parser package
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: AtomElement.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class provides support for atom entries. It will usually be called by
* XML_Feed_Parser_Atom with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserAtomElement extends XmlFeedParserAtom {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_Atom
*/
protected $parent;
 
/**
* When performing XPath queries we will use this prefix
* @var string
*/
private $xpathPrefix = '';
/**
* xml:base values inherited by the element
* @var string
*/
protected $xmlBase;
 
/**
* Here we provide a few mappings for those very special circumstances in
* which it makes sense to map back to the RSS2 spec or to manage other
* compatibilities (eg. with the Univeral Feed Parser). Key is the other version's
* name for the command, value is an array consisting of the equivalent in our atom
* api and any attributes needed to make the mapping.
* @var array
*/
protected $compatMap = array(
'guid' => array('id'),
'links' => array('link'),
'tags' => array('category'),
'contributors' => array('contributor'));
/**
* Our specific element map
* @var array
*/
protected $map = array(
'author' => array('Person', 'fallback'),
'contributor' => array('Person'),
'id' => array('Text', 'fail'),
'published' => array('Date'),
'updated' => array('Date', 'fail'),
'title' => array('Text', 'fail'),
'rights' => array('Text', 'fallback'),
'summary' => array('Text'),
'content' => array('Content'),
'link' => array('Link'),
'enclosure' => array('Enclosure'),
'category' => array('Category'));
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_Atom $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
$this->xmlBase = $xmlBase;
$this->xpathPrefix = "//atom:entry[atom:id='" . $this->id . "']/";
$this->xpath = $this->parent->xpath;
}
 
/**
* Provides access to specific aspects of the author data for an atom entry
*
* Author data at the entry level is more complex than at the feed level.
* If atom:author is not present for the entry we need to look for it in
* an atom:source child of the atom:entry. If it's not there either, then
* we look to the parent for data.
*
* @param array
* @return string
*/
function getAuthor($arguments) {
/* Find out which part of the author data we're looking for */
if (isset($arguments['param'])) {
$parameter = $arguments['param'];
} else {
$parameter = 'name';
}
$test = $this->model->getElementsByTagName('author');
if ($test->length > 0) {
$item = $test->item(0);
return $item->getElementsByTagName($parameter)->item(0)->nodeValue;
}
$source = $this->model->getElementsByTagName('source');
if ($source->length > 0) {
$test = $this->model->getElementsByTagName('author');
if ($test->length > 0) {
$item = $test->item(0);
return $item->getElementsByTagName($parameter)->item(0)->nodeValue;
}
}
return $this->parent->getAuthor($arguments);
}
 
/**
* Returns the content of the content element or info on a specific attribute
*
* This element may or may not be present. It cannot be present more than
* once. It may have a 'src' attribute, in which case there's no content
* If not present, then the entry must have link with rel="alternate".
* If there is content we return it, if not and there's a 'src' attribute
* we return the value of that instead. The method can take an 'attribute'
* argument, in which case we return the value of that attribute if present.
* eg. $item->content("type") will return the type of the content. It is
* recommended that all users check the type before getting the content to
* ensure that their script is capable of handling the type of returned data.
* (data carried in the content element can be either 'text', 'html', 'xhtml',
* or any standard MIME type).
*
* @return string|false
*/
protected function getContent($method, $arguments = array()) {
$attribute = empty($arguments[0]) ? false : $arguments[0];
$tags = $this->model->getElementsByTagName('content');
 
if ($tags->length == 0) {
return false;
}
 
$content = $tags->item(0);
 
if (! $content->hasAttribute('type')) {
$content->setAttribute('type', 'text');
}
if (! empty($attribute)) {
return $content->getAttribute($attribute);
}
 
$type = $content->getAttribute('type');
 
if (! empty($attribute)) {
if ($content->hasAttribute($attribute))
{
return $content->getAttribute($attribute);
}
return false;
}
 
if ($content->hasAttribute('src')) {
return $content->getAttribute('src');
}
 
return $this->parseTextConstruct($content);
}
 
/**
* For compatibility, this method provides a mapping to access enclosures.
*
* The Atom spec doesn't provide for an enclosure element, but it is
* generally supported using the link element with rel='enclosure'.
*
* @param string $method - for compatibility with our __call usage
* @param array $arguments - for compatibility with our __call usage
* @return array|false
*/
function getEnclosure($method, $arguments = array()) {
$offset = isset($arguments[0]) ? $arguments[0] : 0;
$query = "//atom:entry[atom:id='" . $this->getText('id', false) .
"']/atom:link[@rel='enclosure']";
 
$encs = $this->parent->xpath->query($query);
if ($encs->length > $offset) {
try {
if (! $encs->item($offset)->hasAttribute('href')) {
return false;
}
$attrs = $encs->item($offset)->attributes;
$length = $encs->item($offset)->hasAttribute('length') ?
$encs->item($offset)->getAttribute('length') : false;
return array(
'url' => $attrs->getNamedItem('href')->value,
'type' => $attrs->getNamedItem('type')->value,
'length' => $length);
} catch (Exception $e) {
return false;
}
}
return false;
}
/**
* Get details of this entry's source, if available/relevant
*
* Where an atom:entry is taken from another feed then the aggregator
* is supposed to include an atom:source element which replicates at least
* the atom:id, atom:title, and atom:updated metadata from the original
* feed. Atom:source therefore has a very similar structure to atom:feed
* and if we find it we will return it as an XML_Feed_Parser_Atom object.
*
* @return XML_Feed_Parser_Atom|false
*/
function getSource() {
$test = $this->model->getElementsByTagName('source');
if ($test->length == 0) {
return false;
}
$source = new XML_Feed_Parser_Atom($test->item(0));
}
 
/**
* Get the entry as an XML string
*
* Return an XML serialization of the feed, should it be required. Most
* users however, will already have a serialization that they used when
* instantiating the object.
*
* @return string XML serialization of element
*/
function __toString() {
$simple = simplexml_import_dom($this->model);
return $simple->asXML();
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss09Element.php
New file
0,0 → 1,59
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS0.9 Element class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS09Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/*
* This class provides support for RSS 0.9 entries. It will usually be called by
* XML_Feed_Parser_RSS09 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss09Element extends XmlFeedParserRss09 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS09
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Link'));
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserException.php
New file
0,0 → 1,36
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Keeps the exception class for XML_Feed_Parser.
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
* @version CVS: $Id: Exception.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
/**
* XML_Feed_Parser_Exception is a simple extension of PEAR_Exception, existing
* to help with identification of the source of exceptions.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserException extends Exception {
 
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/photo/bibliotheque/Cache.php
New file
0,0 → 1,128
<?php
class Cache {
private $actif = null;
private $dossier_stockage = null;
private $duree_de_vie = null;
public function __construct($dossier_stockage = null, $duree_de_vie = null, $activation = true) {
$this->actif = ($activation) ? true : false;
if ($this->actif) {
$this->dossier_stockage = $dossier_stockage;
if (is_null($dossier_stockage)) {
$this->dossier_stockage = self::getDossierTmp();
}
$this->duree_de_vie = $duree_de_vie;
if (is_null($duree_de_vie)) {
$this->duree_de_vie = 3600*24;
}
}
}
public function charger($id) {
$contenu = false;
if ($this->actif) {
$chemin_fichier_cache = $this->dossier_stockage.DIRECTORY_SEPARATOR.$id.'.txt';
if (file_exists($chemin_fichier_cache ) && (time() - @filemtime($chemin_fichier_cache) < $this->duree_de_vie)) {
$contenu = file_get_contents($chemin_fichier_cache);
}
}
return $contenu;
}
public function sauver($id, $contenu) {
if ($this->actif) {
$chemin_fichier_cache = $this->dossier_stockage.DIRECTORY_SEPARATOR.$id.'.txt';
if (!file_exists($chemin_fichier_cache) || (time() - @filemtime($chemin_fichier_cache) > $this->duree_de_vie)) {
$fh = fopen($chemin_fichier_cache,'w+');
if ($fh) {
fputs($fh, $contenu);
fclose($fh);
}
}
}
}
/**
* Détermine le dossier système temporaire et détecte si nous y avons accès en lecture et écriture.
*
* Inspiré de Zend_File_Transfer_Adapter_Abstract & Zend_Cache
*
* @return string|false le chemine vers le dossier temporaire ou false en cas d'échec.
*/
private static function getDossierTmp() {
$dossier_tmp = false;
foreach (array($_ENV, $_SERVER) as $environnement) {
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $cle) {
if (isset($environnement[$cle])) {
if (($cle == 'windir') or ($cle == 'SystemRoot')) {
$dossier = realpath($environnement[$cle] . '\\temp');
} else {
$dossier = realpath($environnement[$cle]);
}
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
break 2;
}
}
}
}
if ( ! $dossier_tmp) {
$dossier_televersement_tmp = ini_get('upload_tmp_dir');
if ($dossier_televersement_tmp) {
$dossier = realpath($dossier_televersement_tmp);
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
}
}
}
if ( ! $dossier_tmp) {
if (function_exists('sys_get_temp_dir')) {
$dossier = sys_get_temp_dir();
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
}
}
}
if ( ! $dossier_tmp) {
// Tentative de création d'un fichier temporaire
$fichier_tmp = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($fichier_tmp) {
$dossier = realpath(dirname($fichier_tmp));
unlink($fichier_tmp);
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
}
}
}
if ( ! $dossier_tmp && self::etreAccessibleEnLectureEtEcriture('/tmp')) {
$dossier_tmp = '/tmp';
}
if ( ! $dossier_tmp && self::etreAccessibleEnLectureEtEcriture('\\temp')) {
$dossier_tmp = '\\temp';
}
return $dossier_tmp;
}
/**
* Vérifie si le fichier ou dossier est accessible en lecture et écriture.
*
* @param $ressource chemin vers le dossier ou fichier à tester
* @return boolean true si la ressource est accessible en lecture et écriture.
*/
protected static function etreAccessibleEnLectureEtEcriture($ressource){
$accessible = false;
if (is_readable($ressource) && is_writable($ressource)) {
$accessible = true;
}
return $accessible;
}
}
?>
/tags/widget-origin-mobile/modules/photo/squelettes/css/photo.css
New file
0,0 → 1,112
@charset "UTF-8";
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Widget */
.cel-photo-contenu{
position:relative;
padding:0 5px;
margin:5px auto;
font-family:Arial,verdana,sans-serif;
background-color:#DDDDDD;
color:black;
}
.cel-photo-contenu h1 {
margin:5px !important;
padding:0 !important;
font-size:16px !important;
color:black !important;
background-color:transparent !important;
background-image:none !important;
text-transform:none !important;
text-align:left !important;
}
.cel-photo-contenu h1 a{
color: #AAAAAA !important
}
.cel-photo-contenu h1 a:hover {
color:#56B80E !important;
border-bottom:1px dotted #56B80E;
}
.cel-photo-contenu h1 .cel-photo-flux{
width:16px;
height:20px;
}
.cel-photo-contenu img {
border:0 !important;
padding:0 !important;
margin:0 !important;
}
.cel-photo-contenu a, .cel-photo-contenu a:active, .cel-photo-contenu a:visited {
border-bottom:1px dotted #666;
color: black;
text-decoration:none;
background-image:none;
}
.cel-photo-contenu a:active {
outline:none;
}
.cel-photo-contenu a:focus {
outline:thin dotted;
}
.cel-photo-contenu a:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
}
.cel-photo-date-generation{
float:right;
font-size:8px;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Général */
.cel-photo-contenu .discretion {
color:grey;
font-family:arial;
font-size:11px;
font-weight:bold;
}
.cel-photo-contenu .nettoyage {
clear:both;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Galerie Photos CEL */
.cel-photo-contenu .cel-photo a{
float:left;
padding:2px;
border:1px solid white;
}
.cel-photo-contenu .cel-photo a:hover{
border:1px dotted #FD8C13;
}
.cel-photo-contenu .cel-photo a img{
float:left;
width:63px;
height:63px;
}
.cel-photo-contenu .cel-photo-extra a img{
height:auto;
}
.cel-photo-contenu .cel-infos {
display:none;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Diaporama */
.cel-legende{
text-align:left;
}
.cel-legende-vei{
float:right;
}
.cel-legende p{
color:black;
font-size:12px;
margin:5px 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;
}
/tags/widget-origin-mobile/modules/photo/squelettes/css/contact.css
New file
0,0 → 1,17
#tpl-form-contact {
width: 350px;
padding: 15px;
}
 
input, textarea {
max-width: 100%;
width: 100% !important;
}
 
textarea {
height: 185px !important;
}
 
.error {
color: red;
}
/tags/widget-origin-mobile/modules/photo/squelettes/css/popup.css
New file
0,0 → 1,85
@CHARSET "UTF-8";
 
body {
color: black !important;
font-size: 16px !important;
font-weight: bold;
font-family: Arial,verdana,sans-serif;
}
 
hr.nettoyage {
visibility:hidden;
}
 
/*----------------------------------------------------------------------------------------------------------*/
/* Disposition */
#zone-pied {
text-align:center;
}
#eflore_pied_page {
text-align:center;
}
#zone-debug {
background-color:grey;
color:white;
}
 
/*----------------------------------------------------------------------------------------------------------*/
/* Spécifiques popup : ILLUSTRATION */
#info-img .img-cadre {
text-align:center;
}
#info-img img {
display:inline;
vertical-align:middle;
margin:0;
border:0;
border: 1px solid lightgrey;
padding:2px;
}
 
/*----------------------------------------------------------------------------------------------------------*/
/* Spécifiques popup : GALERIE */
#info-img-galerie .conteneur-precedent {
float:left;
width:50px;
position: absolute;
top: 50%;
}
 
#info-img-galerie .conteneur-suivant {
position: absolute;
top: 50%;
right:10px;
width:50px;
float:right;
}
 
#info-img-galerie .conteneur-precedent #precedent, #info-img-galerie .conteneur-suivant #suivant {
position:relative;
top:50%;
font-size:1.3em;
border:none;
}
 
#info-img-galerie .conteneur-suivant #suivant {
float:right;
text-align:right;
}
 
#info-img-galerie .img-cadre {
float:left;
left: 60px;
position: absolute;
height:100%;
}
 
#info-img-galerie #lien-voir-meta {
text-align: center;
}
 
#bloc-infos-img {
position: absolute;
bottom: 10px;
left: 60px;
}
/tags/widget-origin-mobile/modules/photo/squelettes/photo.tpl.html
New file
0,0 → 1,183
<!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>Photographies 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="Jean-Pascal MILCENT, Grégoire DUCHÉ" />
<meta name="keywords" content="Tela Botanica, photographie, CEL" />
<meta name="description" content="Widget de présentation des dernières photo publiées sur le Carnet en Ligne de Tela Botanica" />
 
<!-- Spécial mobile -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- 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" />
<!-- Feuilles de styles -->
<link rel="stylesheet" type="text/css" href="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?=$url_css?>photo.css" media="screen" />
<style type="text/css">
html {
overflow:hidden;
}
body{
overflow:hidden;
padding:0;
margin:0;
width:100%;
height:100%;
background-color:#DDDDDD;
color:black;
}
#cel-photo-contenu<?=$id?>, #cel-galerie-photo<?=$id?>{
width:<?=(($colonne * 69))?>px;
}
#cel-galerie-photo<?=$id?> #cel-photo-extra<?=$id?> img{
width:<?=(($colonne * 69)-6)?>px;
}
</style>
<!-- Javascript : bibliothèques -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.6/jquery-1.6.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.js"></script>
</head>
<body>
<!-- WIDGET:CEL:PHOTO - DEBUT -->
<div id="cel-photo-contenu<?=$id?>" class="cel-photo-contenu">
<?php if (isset($erreurs) || isset($informations)) : ?>
<h1>Erreur &amp; informations</h1>
<p>Impossible d'afficher le flux.</p>
<!-- Affichage des erreurs et messages d'information : -->
<?php if ($erreurs) : ?>
<?php foreach ($erreurs as $erreur) : ?>
<p class="erreur"><?=$erreur;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($informations) : ?>
<?php foreach ($informations as $information) : ?>
<p class="info"><?=$information;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<h1>
<? if (!empty($titre)) : ?>
<?=$titre?>
<? endif ; ?>
<? if($icone_rss) : ?>
<a href="<?=$flux_rss_url?>"
class="cel-photo-flux"
title="Suivre les images"
onclick="window.open(this.href);return false;">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/rss.png" alt="Suivre les images" />
</a>
<? endif; ?>
</h1>
<div id="cel-galerie-photo<?=$id?>">
<?php foreach ($items as $item) : ?>
<div class="cel-photo">
<a href="<?=sprintf($item['url_tpl'], 'XL')?>" class="cel-img" title="<?=$item['titre']?> - Publiée le <?=$item['date']?> - GUID : <?=$item['guid']?>" rel="galerie-princ<?=$id?>">
<img src="<?=sprintf($item['url_tpl'], 'CRX2S')?>" alt="<?=$item['titre']?>"/>
</a>
<div id="cel-info-<?=$item['guid']?>" class="cel-infos">
<strong>
<?php if ($item['eflore_url'] != '#' && $item['eflore_url'] != '') { ?>
<a class="cel-img-titre" href="<?=$item['eflore_url']?>"
onclick="window.open(this.href);return false;"
title="Cliquez pour accéder à la fiche eFlore">
<?=$item['infos']['nom_sci']?>
</a> par
<a class="cel-img-contact"
href="?mode=contact&nn=<?= urlencode($item['infos']['nn']) ;?>&nom_sci=<?= urlencode($item['infos']['nom_sci']) ;?>&date=<?= urlencode($item['infos']['date']) ;?>&id_image=<?= $item['guid']; ?>"
title="Cliquez pour contacter l'auteur de la photo">
<?=$item['infos']['auteur']?>
</a>
le <?=$item['infos']['date']?>
<?php } else { ?>
<?=$item['titre']?>
<?php } ?>
</strong><br />
<span class="cel-img-date">Publiée le <?=$item['date']?></span>
</div>
</div>
<?php endforeach; ?>
<?php if ($extra_actif) : ?>
<div id="cel-photo-extra<?=$id?>" class="cel-photo-extra cel-photo">
<a href="<?=sprintf($extra['url_tpl'], 'XL')?>" class="cel-img" title="<?=$extra['titre']?> - Publiée le <?=$extra['date']?> - GUID : <?=$extra['guid']?>" rel="galerie-princ<?=$id?>">
<img src="<?=sprintf($extra['url_tpl'], 'CRS')?>" alt="<?=$extra['titre']?>"/>
</a>
</div>
</div>
<?php endif ?>
<p class="cel-photo-pieds discretion nettoyage">
<span class="cel-photo-source">
Source :
<a href="http://www.tela-botanica.org/page:cel" title="Carnet en Ligne" onclick="window.open(this.href);return false;">
CEL
</a>
</span>
<span class="cel-photo-date-generation">Au <?=strftime('%A %d %B %Y à %H:%M:%S')?></span>
</p>
<script type="text/Javascript">
//<![CDATA[
var utiliseFancybox = "<?= $utilise_fancybox; ?>";
if(utiliseFancybox) {
$('a.cel-img').attr('rel', 'galerie-princ<?=$id?>').fancybox({
transitionIn:'elastic',
transitionOut:'elastic',
speedIn :600,
speedOut:200,
overlayShow:true,
titleShow:true,
titlePosition:'inside',
titleFormat:function (titre, currentArray, currentIndex, currentOpts) {
var motif = /GUID : ([0-9]+)$/;
motif.exec(titre);
var guid = RegExp.$1;
var info = $('#cel-info-'+guid).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;
}
});
} else {
$('a.cel-img').click(function(event) {
ouvrirFenetrePopup($(this));
event.preventDefault();
});
}
$(document).ready(function() {
$('a.cel-img-contact').live('click', function(event) {
event.preventDefault();
ouvrirFenetreContact($(this));
});
});
function ouvrirFenetrePopup(lienImage) {
var url = "?mode=popup&url_image="+lienImage.attr('href')+'&galerie_id=<?= $galerie_id ?>';
window.open(url, '', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(700)+', height='+(650));
}
function ouvrirFenetreContact(lienImage) {
var url = lienImage.attr("href");
window.open(url, '_blank', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(550));
}
//]]>
</script>
<?php endif; ?>
</div>
<!-- WIDGET:CEL:PHOTO - FIN -->
</body>
</html>
/tags/widget-origin-mobile/modules/photo/squelettes/contact.tpl.html
New file
0,0 → 1,134
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Contacter l'auteur de l'image</title>
<link rel="stylesheet" type="text/css" href="<?=$url_css?>contact.css" media="screen" />
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.6.2/jquery-1.6.2.min.js"></script>
<link type="text/css" rel="stylesheet" href="http://www.tela-botanica.org/commun/bootstrap/2.0.2/css/bootstrap.css">
<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>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
var donnees = new Array();
function envoyerCourriel() {
//console.log('Formulaire soumis');
if ($("#form-contact").valid()) {
var destinataireId = $("#fc_destinataire_id").attr('value');
var typeEnvoi = $("#fc_type_envoi").attr('value');
// l'envoi aux non inscrits passe par le service intermédiaire du cel
// qui va récupérer le courriel associé à l'image indiquée
var urlMessage = "http://www.tela-botanica.org/service:cel:celMessage/image/"+destinataireId;
var erreurMsg = "";
console.log($(this));
$.each($("#form-contact").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 photo "+
"du Carnet en Ligne du réseau Tela Botanica.\n"+
"http://www.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 carto'+
"&body="+erreurMsg+"\nDébogage :\n"+debugMsg+
'">cel@tela-botanica.org</a>.'+
'</p>');
}
}
});
}
return false;
}
function initialiserFormulaireContact() {
$("#form-contact").validate({
rules: {
fc_sujet : "required",
fc_message : "required",
fc_utilisateur_courriel : {
required : true,
email : true}
}
});
$("#form-contact").live("submit", function(event) {
event.preventDefault();
envoyerCourriel();
});
$("#fc_annuler").live("click", function() {window.close();});
}
$(document).ready(function() {
initialiserFormulaireContact();
});
//]]>
</script>
<!-- Squelette du formulaire de contact -->
<div id="tpl-form-contact">
<form id="form-contact" method="post" action="">
<div id="fc-zone-dialogue"></div>
<div>
<div><label for="fc_sujet">Sujet</label></div>
<div><input id="fc_sujet" name="fc_sujet" value="<?= $donnees['sujet'] ?>"/></div>
<div><label for="fc_message">Message</label></div>
<div><textarea id="fc_message" name="fc_message"><?= $donnees['message'] ?></textarea></div>
<div><label for="fc_utilisateur_courriel" title="Utilisez le courriel avec lequel vous êtes inscrit à Tela Botanica">Votre courriel</label></div>
<div><input id="fc_utilisateur_courriel" name="fc_utilisateur_courriel"/></div>
</div>
<p>
<input id="fc_destinataire_id" name="fc_destinataire_id" type="hidden" value="<?= $donnees['id_image'] ?>" />
<input id="fc_copies" name="fc_copies" type="hidden" value="aurelien@tela-botanica.org" />
<input type="hidden" name="fc_type_envoi" id="fc_type_envoi" value="non-inscrit" />
<input id="fc_annuler" type="button" value="Annuler">
<input id="fc_effacer" type="reset" value="Effacer">
<input id="fc_envoyer" type="submit" value="Envoyer" />
</p>
</form>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/photo/squelettes/photo_ajax.tpl.html
New file
0,0 → 1,142
<!-- WIDGET:CEL:PHOTO - DEBUT -->
<div id="cel-photo-contenu<?=$id?>" class="cel-photo-contenu">
<!-- Feuilles de styles -->
<style type="text/css">
#cel-photo-contenu<?=$id?>, #cel-galerie-photo<?=$id?>{
width:<?=(($colonne * 69))?>px;
}
#cel-galerie-photo<?=$id?> #cel-photo-extra<?=$id?> img{
width:<?=(($colonne * 69)-6)?>px;
}
</style>
<?php if (isset($erreurs) || isset($informations)) : ?>
<h1>Erreur &amp; informations</h1>
<p>Impossible d'afficher le flux.</p>
<!-- Affichage des erreurs et messages d'information : -->
<?php if ($erreurs) : ?>
<?php foreach ($erreurs as $erreur) : ?>
<p class="erreur"><?=$erreur;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($informations) : ?>
<?php foreach ($informations as $information) : ?>
<p class="info"><?=$information;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<h1>
<? if (!empty($titre)) : ?>
<?=$titre?>
<? endif ; ?>
<? if($icone_rss) : ?>
<a href="<?=$flux_rss_url?>"
class="cel-photo-flux"
title="Suivre les images"
onclick="window.open(this.href);return false;">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/rss.png" alt="Suivre les images" />
</a>
<? endif; ?>
</h1>
<div id="cel-galerie-photo<?=$id?>">
<?php foreach ($items as $item) : ?>
<div class="cel-photo">
<a href="<?=sprintf($item['url_tpl'], 'XL')?>" class="cel-img" title="<?=$item['titre']?> - Publiée le <?=$item['date']?> - GUID : <?=$item['guid']?>" rel="galerie-princ<?=$id?>">
<img src="<?=sprintf($item['url_tpl'], 'CRX2S')?>" alt="<?=$item['titre']?>"/>
</a>
<div id="cel-info-<?=$item['guid']?>" class="cel-infos">
<strong>
<?php if ($item['eflore_url'] != '#' && $item['eflore_url'] != '') { ?>
<a class="cel-img-titre" href="<?=$item['eflore_url']?>"
onclick="window.open(this.href);return false;"
title="Cliquez pour accéder à la fiche eFlore">
<?=$item['infos']['nom_sci']?>
</a> par
<a class="cel-img-contact"
href="<?= $url_widget ?>?mode=contact&nn=<?= urlencode($item['infos']['nn']) ;?>&nom_sci=<?= urlencode($item['infos']['nom_sci']) ;?>&date=<?= urlencode($item['infos']['date']) ;?>&id_image=<?= $item['guid']; ?>"
title="Cliquez pour contacter l'auteur de la photo">
<?=$item['infos']['auteur']?>
</a>
le <?=$item['infos']['date']?>
<?php } else { ?>
<?=$item['titre']?>
<?php } ?>
</strong><br />
<span class="cel-img-date">Publiée le <?=$item['date']?></span>
</div>
</div>
<?php endforeach; ?>
<?php if ($extra_actif) : ?>
<div id="cel-photo-extra<?=$id?>" class="cel-photo cel-photo-extra">
<a href="<?=sprintf($extra['url_tpl'], 'XL')?>" class="cel-img" title="<?=$extra['titre']?> - Publiée le <?=$extra['date']?> - GUID : <?=$extra['guid']?>" rel="galerie-princ<?=$id?>">
<img src="<?=sprintf($extra['url_tpl'], 'CRS')?>" alt="<?=$extra['titre']?>"/>
</a>
</div>
</div>
<?php endif ?>
<p class="cel-photo-pieds discretion nettoyage">
<span class="cel-photo-source">
Source :
<a href="http://www.tela-botanica.org/page:cel" title="Carnet en Ligne" onclick="window.open(this.href);return false;">
CEL
</a>
</span>
<span class="cel-photo-date-generation">Au <?=strftime('%A %d %B %Y à %H:%M:%S')?></span>
</p>
<script type="text/Javascript">
//<![CDATA[
var utiliseFancybox = "<?= $utilise_fancybox; ?>";
if(utiliseFancybox) {
$(document).ready(function() {
$('a.cel-img').attr('rel', 'galerie-princ<?=$id?>').fancybox({
transitionIn:'elastic',
transitionOut:'elastic',
speedIn :600,
speedOut:200,
overlayShow:true,
titleShow:true,
titlePosition:'inside',
titleFormat:function (titre, currentArray, currentIndex, currentOpts) {
var motif = /GUID : ([0-9]+)$/;
motif.exec(titre);
var guid = RegExp.$1;
var info = $('#cel-info-'+guid).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;
}
});
});
} else {
$('a.cel-img').click(function(event) {
ouvrirFenetrePopup($(this));
event.preventDefault();
});
}
$(document).ready(function() {
$('a.cel-img-contact').live('click', function(event) {
event.preventDefault();
ouvrirFenetreContact($(this));
});
});
function ouvrirFenetrePopup(lienImage) {
var url = "?mode=popup&url_image="+lienImage.attr('href')+'&galerie_id=<?= $galerie_id ?>';
window.open(url, '', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(700)+', height='+(650));
}
function ouvrirFenetreContact(lienImage) {
var url = lienImage.attr("href");
window.open(url, '_blank', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(550));
}
//]]>
</script>
<?php endif; ?>
</div>
<!-- WIDGET:CEL:PHOTO - FIN -->
/tags/widget-origin-mobile/modules/photo/squelettes/popup.tpl.html
New file
0,0 → 1,145
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="<?=$url_css?>popup.css" media="screen" />
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.6/jquery-1.6.min.js"></script>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
var urls = [<?= '"'.implode($urls, '","').'"'; ?>];
var infos_images = <?= json_encode($infos_images); ?>;
var indexImage = 0;
var urlImage = "<?= $url_image; ?>";
var tailleMax = 580;
function redimensionnerImage(objet) {
objet.removeAttr("width");
objet.removeAttr("height");
var hauteurImage = objet.height();
var largeurImage = objet.width();
var rapport = 1;
if(hauteurImage > largeurImage && hauteurImage > tailleMax) {
rapport = largeurImage/hauteurImage;
hauteurImage = 580;
largeurImage = hauteurImage*rapport;
$('#illustration').attr("height", hauteurImage);
$('#illustration').attr("width", largeurImage);
}
hauteurFleches = ((hauteurImage+90)/2);
$('#info-img-galerie .conteneur-precedent').attr("top", hauteurFleches);
$('#info-img-galerie .conteneur-suivant').attr("top", hauteurFleches);
window.resizeTo(largeurImage+120,hauteurImage+120);
}
function imageSuivante() {
indexImage++;
if(indexImage >= urls.length) {
indexImage = 0;
}
afficherTitreImage();
$('#illustration').attr('src', urls[indexImage]);
}
function imagePrecedente() {
indexImage--;
if(indexImage <= 0) {
indexImage = urls.length - 1;
}
afficherTitreImage();
$('#illustration').attr('src', urls[indexImage]);
}
function afficherTitreImage() {
item = infos_images[urls[indexImage]];
var titre = item['titre'];
var infos = decouperTitre(titre);
var lienContact = '<?= $url_widget ?>?mode=contact&nn='+infos.nn+
'&nom_sci='+infos.nom_sci+
'&date='+infos.date+
'&id_image='+item['guid'];
titre = '<a href="'+item['lien']+'">'+infos.nom_sci+'</a> '+
' par <a class="lien_contact" href="'+lienContact+'">'+infos.auteur+'</a> '+
' le '+infos.date+' ';
$('#bloc-infos-img').html(titre);
}
function decouperTitre(titre) {
var tab_titre = titre.split('[nn');
var nom_sci = tab_titre[0];
var tab_titre_suite = tab_titre[1].split(' par ');
var nn = '[nn'+tab_titre_suite[0];
var tab_titre_fin = tab_titre_suite[1].split(' le ');
var utilisateur = tab_titre_fin[0];
var date = tab_titre_fin[1];
var titre_decoupe = {'nom_sci' : nom_sci, 'nn' : nn, 'date' : date, 'auteur' : utilisateur};
return titre_decoupe;
}
function ouvrirFenetreContact(lienImage) {
var url = lienImage.attr("href");
window.open(url, '_blank', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(550));
}
$(document).ready(function() {
$('#precedent').click(function() {
imagePrecedente();
});
$('#suivant').click(function() {
imageSuivante();
});
if(urlImage != "null" && urlImage != "") {
indexImage = Array.indexOf(urls, urlImage);
$('#illustration').attr('src', urls[indexImage]);
afficherTitreImage();
}
$('#illustration').load(function() {
redimensionnerImage($(this));
});
$("body").keydown(function(e) {
if(e.keyCode == 37) { // gauche
imagePrecedente();
}
else if(e.keyCode == 39) { // droite
imageSuivante();
}
});
$('.lien_contact').live('click', function(event) {
event.preventDefault();
ouvrirFenetreContact($(this));
});
});
//]]>
</script>
 
<div id="info-img-galerie">
<div class="conteneur-precedent">
<a id="precedent" href="#" title="cliquez ici ou utilisez la flèche gauche pour afficher l'image précédente">
<img style="border:none" src="http://www.tela-botanica.org/sites/commun/generique/images/flecheGauche.jpg" alt="&lt;" />
</a>
</div>
<div class="img-cadre">
<img id="illustration" src="<?=$urls[0]?>" alt="" /><br />
</div>
<div class="conteneur-suivant">
<a id="suivant" href="#" title="cliquez ici ou utilisez la flèche droite pour afficher l'image suivante">
<img style="border:none" src="http://www.tela-botanica.org/sites/commun/generique/images/flecheDroite.jpg" alt="&gt;" />
</a>
</div>
<hr class="nettoyage" />
<div id="bloc-infos-img"></div>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/photo
New file
Property changes:
Added: svn:ignore
+config.ini
/tags/widget-origin-mobile/modules/observation/config.defaut.ini
New file
0,0 → 1,18
[observation]
; Chemin pour l'autoload à ajouter
autoload = "bibliotheque/;bibliotheque/xml_feed_parser/1.0.4/;bibliotheque/xml_feed_parser/1.0.4/parsers/"
; URL ou chemin du flux RSS contenant les liens vers les photos
fluxRssUrl = "http://www.tela-botanica.org/service:cel:CelSyndicationObservation/multicriteres/atom"
; Squelette d'url pour accéder à la fiche eFlore
efloreUrlTpl = "http://www.tela-botanica.org/bdtfx-nn-%s"
; Nombre de vignette à afficher : nombre de vignettes par ligne et nombre de lignes séparés par une vigule (ex. : 4,3).
vignette = 4,3
 
 
[observation.cache]
; Active/Désactive le cache
activation = true
; Dossier où stocker les fichiers de cache du widget
stockageDossier = "/tmp"
; Durée de vie du fichier de cache
dureeDeVie = 86400
/tags/widget-origin-mobile/modules/observation/bibliotheque/Cache.php
New file
0,0 → 1,128
<?php
class Cache {
private $actif = null;
private $dossier_stockage = null;
private $duree_de_vie = null;
public function __construct($dossier_stockage = null, $duree_de_vie = null, $activation = true) {
$this->actif = ($activation) ? true : false;
if ($this->actif) {
$this->dossier_stockage = $dossier_stockage;
if (is_null($dossier_stockage)) {
$this->dossier_stockage = self::getDossierTmp();
}
$this->duree_de_vie = $duree_de_vie;
if (is_null($duree_de_vie)) {
$this->duree_de_vie = 3600*24;
}
}
}
public function charger($id) {
$contenu = false;
if ($this->actif) {
$chemin_fichier_cache = $this->dossier_stockage.DIRECTORY_SEPARATOR.$id.'.txt';
if (file_exists($chemin_fichier_cache ) && (time() - @filemtime($chemin_fichier_cache) < $this->duree_de_vie)) {
$contenu = file_get_contents($chemin_fichier_cache);
}
}
return $contenu;
}
public function sauver($id, $contenu) {
if ($this->actif) {
$chemin_fichier_cache = $this->dossier_stockage.DIRECTORY_SEPARATOR.$id.'.txt';
if (!file_exists($chemin_fichier_cache) || (time() - @filemtime($chemin_fichier_cache) > $this->duree_de_vie)) {
$fh = fopen($chemin_fichier_cache,'w+');
if ($fh) {
fputs($fh, $contenu);
fclose($fh);
}
}
}
}
/**
* Détermine le dossier système temporaire et détecte si nous y avons accès en lecture et écriture.
*
* Inspiré de Zend_File_Transfer_Adapter_Abstract & Zend_Cache
*
* @return string|false le chemine vers le dossier temporaire ou false en cas d'échec.
*/
private static function getDossierTmp() {
$dossier_tmp = false;
foreach (array($_ENV, $_SERVER) as $environnement) {
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $cle) {
if (isset($environnement[$cle])) {
if (($cle == 'windir') or ($cle == 'SystemRoot')) {
$dossier = realpath($environnement[$cle] . '\\temp');
} else {
$dossier = realpath($environnement[$cle]);
}
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
break 2;
}
}
}
}
if ( ! $dossier_tmp) {
$dossier_televersement_tmp = ini_get('upload_tmp_dir');
if ($dossier_televersement_tmp) {
$dossier = realpath($dossier_televersement_tmp);
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
}
}
}
if ( ! $dossier_tmp) {
if (function_exists('sys_get_temp_dir')) {
$dossier = sys_get_temp_dir();
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
}
}
}
if ( ! $dossier_tmp) {
// Tentative de création d'un fichier temporaire
$fichier_tmp = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($fichier_tmp) {
$dossier = realpath(dirname($fichier_tmp));
unlink($fichier_tmp);
if (self::etreAccessibleEnLectureEtEcriture($dossier)) {
$dossier_tmp = $dossier;
}
}
}
if ( ! $dossier_tmp && self::etreAccessibleEnLectureEtEcriture('/tmp')) {
$dossier_tmp = '/tmp';
}
if ( ! $dossier_tmp && self::etreAccessibleEnLectureEtEcriture('\\temp')) {
$dossier_tmp = '\\temp';
}
return $dossier_tmp;
}
/**
* Vérifie si le fichier ou dossier est accessible en lecture et écriture.
*
* @param $ressource chemin vers le dossier ou fichier à tester
* @return boolean true si la ressource est accessible en lecture et écriture.
*/
protected static function etreAccessibleEnLectureEtEcriture($ressource){
$accessible = false;
if (is_readable($ressource) && is_writable($ressource)) {
$accessible = true;
}
return $accessible;
}
}
?>
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserException.php
New file
0,0 → 1,36
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Keeps the exception class for XML_Feed_Parser.
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
* @version CVS: $Id: Exception.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
/**
* XML_Feed_Parser_Exception is a simple extension of PEAR_Exception, existing
* to help with identification of the source of exceptions.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserException extends Exception {
 
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserAtom.php
New file
0,0 → 1,358
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Atom feed class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: Atom.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This is the class that determines how we manage Atom 1.0 feeds
*
* How we deal with constructs:
* date - return as unix datetime for use with the 'date' function unless specified otherwise
* text - return as is. optional parameter will give access to attributes
* person - defaults to name, but parameter based access
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserAtom extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'atom.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
public $xpath;
 
/**
* When performing XPath queries we will use this prefix
* @var string
*/
private $xpathPrefix = '//';
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'Atom 1.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserAtomElement';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'entry';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'author' => array('Person'),
'contributor' => array('Person'),
'icon' => array('Text'),
'logo' => array('Text'),
'id' => array('Text', 'fail'),
'rights' => array('Text'),
'subtitle' => array('Text'),
'title' => array('Text', 'fail'),
'updated' => array('Date', 'fail'),
'link' => array('Link'),
'generator' => array('Text'),
'category' => array('Category'),
'content' => array('Text'));
 
/**
* Here we provide a few mappings for those very special circumstances in
* which it makes sense to map back to the RSS2 spec. Key is RSS2 version
* value is an array consisting of the equivalent in atom and any attributes
* needed to make the mapping.
* @var array
*/
protected $compatMap = array(
'guid' => array('id'),
'links' => array('link'),
'tags' => array('category'),
'contributors' => array('contributor'));
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XML_Feed_Parser_Exception('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($this->model);
$this->xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
$this->numberEntries = $this->count('entry');
}
 
/**
* Implement retrieval of an entry based on its ID for atom feeds.
*
* This function uses XPath to get the entry based on its ID. If DOMXPath::evaluate
* is available, we also use that to store a reference to the entry in the array
* used by getEntryByOffset so that method does not have to seek out the entry
* if it's requested that way.
*
* @param string $id any valid Atom ID.
* @return XML_Feed_Parser_AtomElement
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//atom:entry[atom:id='$id']");
 
if ($entries->length > 0) {
$xmlBase = $entries->item(0)->baseURI;
$entry = new $this->itemClass($entries->item(0), $this, $xmlBase);
if (in_array('evaluate', get_class_methods($this->xpath))) {
$offset = $this->xpath->evaluate("count(preceding-sibling::atom:entry)", $entries->item(0));
$this->entries[$offset] = $entry;
}
 
$this->idMappings[$id] = $entry;
 
return $entry;
}
}
 
/**
* Retrieves data from a person construct.
*
* Get a person construct. We default to the 'name' element but allow
* access to any of the elements.
*
* @param string $method The name of the person construct we want
* @param array $arguments An array which we hope gives a 'param'
* @return string|false
*/
protected function getPerson($method, $arguments) {
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$parameter = empty($arguments[1]['param']) ? 'name' : $arguments[1]['param'];
$section = $this->model->getElementsByTagName($method);
if ($parameter == 'url') {
$parameter = 'uri';
}
 
if ($section->length <= $offset) {
return false;
}
 
$param = $section->item($offset)->getElementsByTagName($parameter);
if ($param->length == 0) {
return false;
}
return $param->item(0)->nodeValue;
}
 
/**
* Retrieves an element's content where that content is a text construct.
*
* Get a text construct. When calling this method, the two arguments
* allowed are 'offset' and 'attribute', so $parser->subtitle() would
* return the content of the element, while $parser->subtitle(false, 'type')
* would return the value of the type attribute.
*
* @todo Clarify overlap with getContent()
* @param string $method The name of the text construct we want
* @param array $arguments An array which we hope gives a 'param'
* @return string
*/
protected function getText($method, $arguments) {
$offset = empty($arguments[0]) ? 0: $arguments[0];
$attribute = empty($arguments[1]) ? false : $arguments[1];
$tags = $this->model->getElementsByTagName($method);
 
if ($tags->length <= $offset) {
return false;
}
 
$content = $tags->item($offset);
 
if (! $content->hasAttribute('type')) {
$content->setAttribute('type', 'text');
}
$type = $content->getAttribute('type');
 
if (! empty($attribute) and
! ($method == 'generator' and $attribute == 'name')) {
if ($content->hasAttribute($attribute)) {
return $content->getAttribute($attribute);
} else if ($attribute == 'href' and $content->hasAttribute('uri')) {
return $content->getAttribute('uri');
}
return false;
}
 
return $this->parseTextConstruct($content);
}
/**
* Extract content appropriately from atom text constructs
*
* Because of different rules applied to the content element and other text
* constructs, they are deployed as separate functions, but they share quite
* a bit of processing. This method performs the core common process, which is
* to apply the rules for different mime types in order to extract the content.
*
* @param DOMNode $content the text construct node to be parsed
* @return String
* @author James Stewart
**/
protected function parseTextConstruct(DOMNode $content) {
if ($content->hasAttribute('type')) {
$type = $content->getAttribute('type');
} else {
$type = 'text';
}
 
if (strpos($type, 'text/') === 0) {
$type = 'text';
}
 
switch ($type) {
case 'text':
case 'html':
return $content->textContent;
break;
case 'xhtml':
$container = $content->getElementsByTagName('div');
if ($container->length == 0) {
return false;
}
$contents = $container->item(0);
if ($contents->hasChildNodes()) {
/* Iterate through, applying xml:base and store the result */
$result = '';
foreach ($contents->childNodes as $node) {
$result .= $this->traverseNode($node);
}
return $result;
}
break;
case preg_match('@^[a-zA-Z]+/[a-zA-Z+]*xml@i', $type) > 0:
return $content;
break;
case 'application/octet-stream':
default:
return base64_decode(trim($content->nodeValue));
break;
}
return false;
}
/**
* Get a category from the entry.
*
* A feed or entry can have any number of categories. A category can have the
* attributes term, scheme and label.
*
* @param string $method The name of the text construct we want
* @param array $arguments An array which we hope gives a 'param'
* @return string
*/
function getCategory($method, $arguments) {
$offset = empty($arguments[0]) ? 0: $arguments[0];
$attribute = empty($arguments[1]) ? 'term' : $arguments[1];
$categories = $this->model->getElementsByTagName('category');
if ($categories->length <= $offset) {
$category = $categories->item($offset);
if ($category->hasAttribute($attribute)) {
return $category->getAttribute($attribute);
}
}
return false;
}
 
/**
* This element must be present at least once with rel="feed". This element may be
* present any number of further times so long as there is no clash. If no 'rel' is
* present and we're asked for one, we follow the example of the Universal Feed
* Parser and presume 'alternate'.
*
* @param int $offset the position of the link within the container
* @param string $attribute the attribute name required
* @param array an array of attributes to search by
* @return string the value of the attribute
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
if (is_array($params) and !empty($params)) {
$terms = array();
$alt_predicate = '';
$other_predicate = '';
 
foreach ($params as $key => $value) {
if ($key == 'rel' && $value == 'alternate') {
$alt_predicate = '[not(@rel) or @rel="alternate"]';
} else {
$terms[] = "@$key='$value'";
}
}
if (!empty($terms)) {
$other_predicate = '[' . join(' and ', $terms) . ']';
}
$query = $this->xpathPrefix . 'atom:link' . $alt_predicate . $other_predicate;
$links = $this->xpath->query($query);
} else {
$links = $this->model->getElementsByTagName('link');
}
if ($links->length > $offset) {
if ($links->item($offset)->hasAttribute($attribute)) {
$value = $links->item($offset)->getAttribute($attribute);
if ($attribute == 'href') {
$value = $this->addBase($value, $links->item($offset));
}
return $value;
} else if ($attribute == 'rel') {
return 'alternate';
}
}
return false;
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss09.php
New file
0,0 → 1,215
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS0.9 class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS09.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS0.9 feeds.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
* @todo Find a Relax NG URI we can use
*/
class XmlFeedParserRss09 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = '';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 0.9';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss09Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Text'),
'description' => array('Text'),
'image' => array('Image'),
'textinput' => array('TextInput'));
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'link' => array('link'),
'subtitle' => array('description'));
 
/**
* We will be working with multiple namespaces and it is useful to
* keep them together
* @var array
*/
protected $namespaces = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
 
/**
* Our constructor does nothing more than its parent.
*
* @todo RelaxNG validation
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
$this->xpath = new DOMXPath($model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Included for compatibility -- will not work with RSS 0.9
*
* This is not something that will work with RSS0.9 as it does not have
* clear restrictions on the global uniqueness of IDs.
*
* @param string $id any valid ID.
* @return false
*/
function getEntryById($id) {
return false;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->model->getElementsByTagName('image');
if ($images->length > 0) {
$image = $images->item(0);
$details = array();
if ($image->hasChildNodes()) {
$details = array(
'title' => $image->getElementsByTagName('title')->item(0)->value,
'link' => $image->getElementsByTagName('link')->item(0)->value,
'url' => $image->getElementsByTagName('url')->item(0)->value);
} else {
$details = array('title' => false,
'link' => false,
'url' => $image->attributes->getNamedItem('resource')->nodeValue);
}
$details = array_merge($details,
array('description' => false, 'height' => false, 'width' => false));
if (! empty($details)) {
return $details;
}
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness we will support it.
*
* @return array|false
*/
protected function getTextInput() {
$inputs = $this->model->getElementsByTagName('textinput');
if ($inputs->length > 0) {
$input = $inputs->item(0);
$results = array();
$results['title'] = isset(
$input->getElementsByTagName('title')->item(0)->value) ?
$input->getElementsByTagName('title')->item(0)->value : null;
$results['description'] = isset(
$input->getElementsByTagName('description')->item(0)->value) ?
$input->getElementsByTagName('description')->item(0)->value : null;
$results['name'] = isset(
$input->getElementsByTagName('name')->item(0)->value) ?
$input->getElementsByTagName('name')->item(0)->value : null;
$results['link'] = isset(
$input->getElementsByTagName('link')->item(0)->value) ?
$input->getElementsByTagName('link')->item(0)->value : null;
if (empty($results['link']) &&
$input->attributes->getNamedItem('resource')) {
$results['link'] = $input->attributes->getNamedItem('resource')->nodeValue;
}
if (! empty($results)) {
return $results;
}
}
return false;
}
/**
* Get details of a link from the feed.
*
* In RSS1 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them.
*
* @return string
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
$links = $this->model->getElementsByTagName('link');
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
 
/**
* Not implemented - no available validation.
*/
public function relaxNGValidate() {
return true;
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserType.php
New file
0,0 → 1,455
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Abstract class providing common methods for XML_Feed_Parser feeds.
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: Type.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This abstract class provides some general methods that are likely to be
* implemented exactly the same way for all feed types.
*
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
*/
abstract class XmlFeedParserType {
/**
* Where we store our DOM object for this feed
* @var DOMDocument
*/
public $model;
 
/**
* For iteration we'll want a count of the number of entries
* @var int
*/
public $numberEntries;
 
/**
* Where we store our entry objects once instantiated
* @var array
*/
public $entries = array();
 
/**
* Store mappings between entry IDs and their position in the feed
*/
public $idMappings = array();
 
/**
* Proxy to allow use of element names as method names
*
* We are not going to provide methods for every entry type so this
* function will allow for a lot of mapping. We rely pretty heavily
* on this to handle our mappings between other feed types and atom.
*
* @param string $call - the method attempted
* @param array $arguments - arguments to that method
* @return mixed
*/
function __call($call, $arguments = array()) {
if (! is_array($arguments)) {
$arguments = array();
}
 
if (isset($this->compatMap[$call])) {
$tempMap = $this->compatMap;
$tempcall = array_pop($tempMap[$call]);
if (! empty($tempMap)) {
$arguments = array_merge($arguments, $tempMap[$call]);
}
$call = $tempcall;
}
 
/* To be helpful, we allow a case-insensitive search for this method */
if (! isset($this->map[$call])) {
foreach (array_keys($this->map) as $key) {
if (strtoupper($key) == strtoupper($call)) {
$call = $key;
break;
}
}
}
 
if (empty($this->map[$call])) {
return false;
}
 
$method = 'get' . $this->map[$call][0];
if ($method == 'getLink') {
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$attribute = empty($arguments[1]) ? 'href' : $arguments[1];
$params = isset($arguments[2]) ? $arguments[2] : array();
return $this->getLink($offset, $attribute, $params);
}
if (method_exists($this, $method)) {
return $this->$method($call, $arguments);
}
 
return false;
}
 
/**
* Proxy to allow use of element names as attribute names
*
* For many elements variable-style access will be desirable. This function
* provides for that.
*
* @param string $value - the variable required
* @return mixed
*/
function __get($value) {
return $this->__call($value, array());
}
 
/**
* Utility function to help us resolve xml:base values
*
* We have other methods which will traverse the DOM and work out the different
* xml:base declarations we need to be aware of. We then need to combine them.
* If a declaration starts with a protocol then we restart the string. If it
* starts with a / then we add on to the domain name. Otherwise we simply tag
* it on to the end.
*
* @param string $base - the base to add the link to
* @param string $link
*/
function combineBases($base, $link) {
if (preg_match('/^[A-Za-z]+:\/\//', $link)) {
return $link;
} else if (preg_match('/^\//', $link)) {
/* Extract domain and suffix link to that */
preg_match('/^([A-Za-z]+:\/\/.*)?\/*/', $base, $results);
$firstLayer = $results[0];
return $firstLayer . "/" . $link;
} else if (preg_match('/^\.\.\//', $base)) {
/* Step up link to find place to be */
preg_match('/^((\.\.\/)+)(.*)$/', $link, $bases);
$suffix = $bases[3];
$count = preg_match_all('/\.\.\//', $bases[1], $steps);
$url = explode("/", $base);
for ($i = 0; $i <= $count; $i++) {
array_pop($url);
}
return implode("/", $url) . "/" . $suffix;
} else if (preg_match('/^(?!\/$)/', $base)) {
$base = preg_replace('/(.*\/).*$/', '$1', $base) ;
return $base . $link;
} else {
/* Just stick it on the end */
return $base . $link;
}
}
 
/**
* Determine whether we need to apply our xml:base rules
*
* Gets us the xml:base data and then processes that with regard
* to our current link.
*
* @param string
* @param DOMElement
* @return string
*/
function addBase($link, $element) {
if (preg_match('/^[A-Za-z]+:\/\//', $link)) {
return $link;
}
 
return $this->combineBases($element->baseURI, $link);
}
 
/**
* Get an entry by its position in the feed, starting from zero
*
* As well as allowing the items to be iterated over we want to allow
* users to be able to access a specific entry. This is one of two ways of
* doing that, the other being by ID.
*
* @param int $offset
* @return XML_Feed_Parser_RSS1Element
*/
function getEntryByOffset($offset) {
if (! isset($this->entries[$offset])) {
$entries = $this->model->getElementsByTagName($this->itemElement);
if ($entries->length > $offset) {
$xmlBase = $entries->item($offset)->baseURI;
$this->entries[$offset] = new $this->itemClass(
$entries->item($offset), $this, $xmlBase);
if ($id = $this->entries[$offset]->id) {
$this->idMappings[$id] = $this->entries[$offset];
}
} else {
throw new XML_Feed_Parser_Exception('No entries found');
}
}
 
return $this->entries[$offset];
}
 
/**
* Return a date in seconds since epoch.
*
* Get a date construct. We use PHP's strtotime to return it as a unix datetime, which
* is the number of seconds since 1970-01-01 00:00:00.
*
* @link http://php.net/strtotime
* @param string $method The name of the date construct we want
* @param array $arguments Included for compatibility with our __call usage
* @return int|false datetime
*/
protected function getDate($method, $arguments) {
$time = $this->model->getElementsByTagName($method);
if ($time->length == 0 || empty($time->item(0)->nodeValue)) {
return false;
}
return strtotime($time->item(0)->nodeValue);
}
 
/**
* Get a text construct.
*
* @param string $method The name of the text construct we want
* @param array $arguments Included for compatibility with our __call usage
* @return string
*/
protected function getText($method, $arguments = array()) {
$tags = $this->model->getElementsByTagName($method);
if ($tags->length > 0) {
$value = $tags->item(0)->nodeValue;
return $value;
}
return false;
}
 
/**
* Apply various rules to retrieve category data.
*
* There is no single way of declaring a category in RSS1/1.1 as there is in RSS2
* and Atom. Instead the usual approach is to use the dublin core namespace to
* declare categories. For example delicious use both:
* <dc:subject>PEAR</dc:subject> and: <taxo:topics><rdf:Bag>
* <rdf:li resource="http://del.icio.us/tag/PEAR" /></rdf:Bag></taxo:topics>
* to declare a categorisation of 'PEAR'.
*
* We need to be sensitive to this where possible.
*
* @param string $call for compatibility with our overloading
* @param array $arguments - arg 0 is the offset, arg 1 is whether to return as array
* @return string|array|false
*/
protected function getCategory($call, $arguments) {
$categories = $this->model->getElementsByTagName('subject');
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$array = empty($arguments[1]) ? false : true;
if ($categories->length <= $offset) {
return false;
}
if ($array) {
$list = array();
foreach ($categories as $category) {
array_push($list, $category->nodeValue);
}
return $list;
}
return $categories->item($offset)->nodeValue;
}
 
/**
* Count occurrences of an element
*
* This function will tell us how many times the element $type
* appears at this level of the feed.
*
* @param string $type the element we want to get a count of
* @return int
*/
protected function count($type) {
if ($tags = $this->model->getElementsByTagName($type)) {
return $tags->length;
}
return 0;
}
 
/**
* Part of our xml:base processing code
*
* We need a couple of methods to access XHTML content stored in feeds.
* This is because we dereference all xml:base references before returning
* the element. This method handles the attributes.
*
* @param DOMElement $node The DOM node we are iterating over
* @return string
*/
function processXHTMLAttributes($node) {
$return = '';
foreach ($node->attributes as $attribute) {
if ($attribute->name == 'src' or $attribute->name == 'href') {
$attribute->value = $this->addBase(htmlentities($attribute->value, NULL, 'utf-8'), $attribute);
}
if ($attribute->name == 'base') {
continue;
}
$return .= $attribute->name . '="' . htmlentities($attribute->value, NULL, 'utf-8') .'" ';
}
if (! empty($return)) {
return ' ' . trim($return);
}
return '';
}
 
/**
* Convert HTML entities based on the current character set.
*
* @param String
* @return String
*/
function processEntitiesForNodeValue($node) {
if (function_exists('iconv')) {
$current_encoding = $node->ownerDocument->encoding;
$value = iconv($current_encoding, 'UTF-8', $node->nodeValue);
} else if ($current_encoding == 'iso-8859-1') {
$value = utf8_encode($node->nodeValue);
} else {
$value = $node->nodeValue;
}
 
$decoded = html_entity_decode($value, NULL, 'UTF-8');
return htmlentities($decoded, NULL, 'UTF-8');
}
 
/**
* Part of our xml:base processing code
*
* We need a couple of methods to access XHTML content stored in feeds.
* This is because we dereference all xml:base references before returning
* the element. This method recurs through the tree descending from the node
* and builds our string.
*
* @param DOMElement $node The DOM node we are processing
* @return string
*/
function traverseNode($node) {
$content = '';
 
/* Add the opening of this node to the content */
if ($node instanceof DOMElement) {
$content .= '<' . $node->tagName .
$this->processXHTMLAttributes($node) . '>';
}
 
/* Process children */
if ($node->hasChildNodes()) {
foreach ($node->childNodes as $child) {
$content .= $this->traverseNode($child);
}
}
 
if ($node instanceof DOMText) {
$content .= $this->processEntitiesForNodeValue($node);
}
 
/* Add the closing of this node to the content */
if ($node instanceof DOMElement) {
$content .= '</' . $node->tagName . '>';
}
 
return $content;
}
 
/**
* Get content from RSS feeds (atom has its own implementation)
*
* The official way to include full content in an RSS1 entry is to use
* the content module's element 'encoded', and RSS2 feeds often duplicate that.
* Often, however, the 'description' element is used instead. We will offer that
* as a fallback. Atom uses its own approach and overrides this method.
*
* @return string|false
*/
protected function getContent() {
$options = array('encoded', 'description');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length == 0) {
continue;
}
if ($test->item(0)->hasChildNodes()) {
$value = '';
foreach ($test->item(0)->childNodes as $child) {
if ($child instanceof DOMText) {
$value .= $child->nodeValue;
} else {
$simple = simplexml_import_dom($child);
$value .= $simple->asXML();
}
}
return $value;
} else if ($test->length > 0) {
return $test->item(0)->nodeValue;
}
}
return false;
}
 
/**
* Checks if this element has a particular child element.
*
* @param String
* @param Integer
* @return bool
**/
function hasKey($name, $offset = 0) {
$search = $this->model->getElementsByTagName($name);
return $search->length > $offset;
}
 
/**
* Return an XML serialization of the feed, should it be required. Most
* users however, will already have a serialization that they used when
* instantiating the object.
*
* @return string XML serialization of element
*/
function __toString() {
$simple = simplexml_import_dom($this->model);
return $simple->asXML();
}
/**
* Get directory holding RNG schemas. Method is based on that
* found in Contact_AddressBook.
*
* @return string PEAR data directory.
* @access public
* @static
*/
static function getSchemaDir() {
return dirname(__FILE__).'/../schemas';
}
 
public function relaxNGValidate() {
$dir = self::getSchemaDir();
$path = $dir . '/' . $this->relax;
return $this->model->relaxNGValidate($path);
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss1Element.php
New file
0,0 → 1,111
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1 Element class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS1Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/*
* This class provides support for RSS 1.0 entries. It will usually be called by
* XML_Feed_Parser_RSS1 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss1Element extends XmlFeedParserRss1 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS1
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'id' => array('Id'),
'title' => array('Text'),
'link' => array('Link'),
'description' => array('Text'), # or dc:description
'category' => array('Category'),
'rights' => array('Text'), # dc:rights
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date'), # dc:date
'content' => array('Content')
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS1.
* @var array
*/
protected $compatMap = array(
'content' => array('content'),
'updated' => array('lastBuildDate'),
'published' => array('date'),
'subtitle' => array('description'),
'updated' => array('date'),
'author' => array('creator'),
'contributor' => array('contributor')
);
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
 
/**
* If an rdf:about attribute is specified, return it as an ID
*
* There is no established way of showing an ID for an RSS1 entry. We will
* simulate it using the rdf:about attribute of the entry element. This cannot
* be relied upon for unique IDs but may prove useful.
*
* @return string|false
*/
function getId() {
if ($this->model->attributes->getNamedItem('about')) {
return $this->model->attributes->getNamedItem('about')->nodeValue;
}
return false;
}
 
/**
* How RSS1 should support for enclosures is not clear. For now we will return
* false.
*
* @return false
*/
function getEnclosure() {
return false;
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss11Element.php
New file
0,0 → 1,145
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1 Element class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS11Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/*
* This class provides support for RSS 1.1 entries. It will usually be called by
* XML_Feed_Parser_RSS11 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss11Element extends XmlFeedParserRss11 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS1
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'id' => array('Id'),
'title' => array('Text'),
'link' => array('Link'),
'description' => array('Text'), # or dc:description
'category' => array('Category'),
'rights' => array('Text'), # dc:rights
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date'), # dc:date
'content' => array('Content')
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS1.
* @var array
*/
protected $compatMap = array(
'content' => array('content'),
'updated' => array('lastBuildDate'),
'published' => array('date'),
'subtitle' => array('description'),
'updated' => array('date'),
'author' => array('creator'),
'contributor' => array('contributor')
);
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
 
/**
* If an rdf:about attribute is specified, return that as an ID
*
* There is no established way of showing an ID for an RSS1 entry. We will
* simulate it using the rdf:about attribute of the entry element. This cannot
* be relied upon for unique IDs but may prove useful.
*
* @return string|false
*/
function getId() {
if ($this->model->attributes->getNamedItem('about')) {
return $this->model->attributes->getNamedItem('about')->nodeValue;
}
return false;
}
 
/**
* Return the entry's content
*
* The official way to include full content in an RSS1 entry is to use
* the content module's element 'encoded'. Often, however, the 'description'
* element is used instead. We will offer that as a fallback.
*
* @return string|false
*/
function getContent() {
$options = array('encoded', 'description');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length == 0) {
continue;
}
if ($test->item(0)->hasChildNodes()) {
$value = '';
foreach ($test->item(0)->childNodes as $child) {
if ($child instanceof DOMText) {
$value .= $child->nodeValue;
} else {
$simple = simplexml_import_dom($child);
$value .= $simple->asXML();
}
}
return $value;
} else if ($test->length > 0) {
return $test->item(0)->nodeValue;
}
}
return false;
}
/**
* How RSS1.1 should support for enclosures is not clear. For now we will return
* false.
*
* @return false
*/
function getEnclosure() {
return false;
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss2Element.php
New file
0,0 → 1,166
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Class representing entries in an RSS2 feed.
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS2Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class provides support for RSS 2.0 entries. It will usually be
* called by XML_Feed_Parser_RSS2 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss2Element extends XmlFeedParserRss2 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS2
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'title' => array('Text'),
'guid' => array('Guid'),
'description' => array('Text'),
'author' => array('Text'),
'comments' => array('Text'),
'enclosure' => array('Enclosure'),
'pubDate' => array('Date'),
'source' => array('Source'),
'link' => array('Text'),
'content' => array('Content'));
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'id' => array('guid'),
'updated' => array('lastBuildDate'),
'published' => array('pubdate'),
'guidislink' => array('guid', 'ispermalink'),
'summary' => array('description'));
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS2 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
 
/**
* Get the value of the guid element, if specified
*
* guid is the closest RSS2 has to atom's ID. It is usually but not always a
* URI. The one attribute that RSS2 can posess is 'ispermalink' which specifies
* whether the guid is itself dereferencable. Use of guid is not obligatory,
* but is advisable. To get the guid you would call $item->id() (for atom
* compatibility) or $item->guid(). To check if this guid is a permalink call
* $item->guid("ispermalink").
*
* @param string $method - the method name being called
* @param array $params - parameters required
* @return string the guid or value of ispermalink
*/
protected function getGuid($method, $params) {
$attribute = (isset($params[0]) and $params[0] == 'ispermalink') ?
true : false;
$tag = $this->model->getElementsByTagName('guid');
if ($tag->length > 0) {
if ($attribute) {
if ($tag->hasAttribute("ispermalink")) {
return $tag->getAttribute("ispermalink");
}
}
return $tag->item(0)->nodeValue;
}
return false;
}
 
/**
* Access details of file enclosures
*
* The RSS2 spec is ambiguous as to whether an enclosure element must be
* unique in a given entry. For now we will assume it needn't, and allow
* for an offset.
*
* @param string $method - the method being called
* @param array $parameters - we expect the first of these to be our offset
* @return array|false
*/
protected function getEnclosure($method, $parameters) {
$encs = $this->model->getElementsByTagName('enclosure');
$offset = isset($parameters[0]) ? $parameters[0] : 0;
if ($encs->length > $offset) {
try {
if (! $encs->item($offset)->hasAttribute('url')) {
return false;
}
$attrs = $encs->item($offset)->attributes;
return array(
'url' => $attrs->getNamedItem('url')->value,
'length' => $attrs->getNamedItem('length')->value,
'type' => $attrs->getNamedItem('type')->value);
} catch (Exception $e) {
return false;
}
}
return false;
}
 
/**
* Get the entry source if specified
*
* source is an optional sub-element of item. Like atom:source it tells
* us about where the entry came from (eg. if it's been copied from another
* feed). It is not a rich source of metadata in the same way as atom:source
* and while it would be good to maintain compatibility by returning an
* XML_Feed_Parser_RSS2 element, it makes a lot more sense to return an array.
*
* @return array|false
*/
protected function getSource() {
$get = $this->model->getElementsByTagName('source');
if ($get->length) {
$source = $get->item(0);
$array = array(
'content' => $source->nodeValue);
foreach ($source->attributes as $attribute) {
$array[$attribute->name] = $attribute->value;
}
return $array;
}
return false;
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss1.php
New file
0,0 → 1,267
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1 class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS1.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS1.0 feeds.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
* @todo Find a Relax NG URI we can use
*/
class XmlFeedParserRss1 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'rss10.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 1.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss1Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Text'),
'description' => array('Text'),
'image' => array('Image'),
'textinput' => array('TextInput'),
'updatePeriod' => array('Text'),
'updateFrequency' => array('Text'),
'updateBase' => array('Date'),
'rights' => array('Text'), # dc:rights
'description' => array('Text'), # dc:description
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date') # dc:contributor
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'link' => array('link'),
'subtitle' => array('description'),
'author' => array('creator'),
'updated' => array('date'));
 
/**
* We will be working with multiple namespaces and it is useful to
* keep them together
* @var array
*/
protected $namespaces = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'rss' => 'http://purl.org/rss/1.0/',
'dc' => 'http://purl.org/rss/1.0/modules/dc/',
'content' => 'http://purl.org/rss/1.0/modules/content/',
'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/');
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XML_Feed_Parser_Exception('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Allows retrieval of an entry by ID where the rdf:about attribute is used
*
* This is not really something that will work with RSS1 as it does not have
* clear restrictions on the global uniqueness of IDs. We will employ the
* _very_ hit and miss method of selecting entries based on the rdf:about
* attribute. If DOMXPath::evaluate is available, we also use that to store
* a reference to the entry in the array used by getEntryByOffset so that
* method does not have to seek out the entry if it's requested that way.
*
* @param string $id any valid ID.
* @return XML_Feed_Parser_RSS1Element
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//rss:item[@rdf:about='$id']");
if ($entries->length > 0) {
$classname = $this->itemClass;
$entry = new $classname($entries->item(0), $this);
if (in_array('evaluate', get_class_methods($this->xpath))) {
$offset = $this->xpath->evaluate("count(preceding-sibling::rss:item)", $entries->item(0));
$this->entries[$offset] = $entry;
}
$this->idMappings[$id] = $entry;
return $entry;
}
return false;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->model->getElementsByTagName('image');
if ($images->length > 0) {
$image = $images->item(0);
$details = array();
if ($image->hasChildNodes()) {
$details = array(
'title' => $image->getElementsByTagName('title')->item(0)->value,
'link' => $image->getElementsByTagName('link')->item(0)->value,
'url' => $image->getElementsByTagName('url')->item(0)->value);
} else {
$details = array('title' => false,
'link' => false,
'url' => $image->attributes->getNamedItem('resource')->nodeValue);
}
$details = array_merge($details, array('description' => false, 'height' => false, 'width' => false));
if (! empty($details)) {
return $details;
}
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness we will support it.
*
* @return array|false
*/
protected function getTextInput() {
$inputs = $this->model->getElementsByTagName('textinput');
if ($inputs->length > 0) {
$input = $inputs->item(0);
$results = array();
$results['title'] = isset(
$input->getElementsByTagName('title')->item(0)->value) ?
$input->getElementsByTagName('title')->item(0)->value : null;
$results['description'] = isset(
$input->getElementsByTagName('description')->item(0)->value) ?
$input->getElementsByTagName('description')->item(0)->value : null;
$results['name'] = isset(
$input->getElementsByTagName('name')->item(0)->value) ?
$input->getElementsByTagName('name')->item(0)->value : null;
$results['link'] = isset(
$input->getElementsByTagName('link')->item(0)->value) ?
$input->getElementsByTagName('link')->item(0)->value : null;
if (empty($results['link']) and
$input->attributes->getNamedItem('resource')) {
$results['link'] =
$input->attributes->getNamedItem('resource')->nodeValue;
}
if (! empty($results)) {
return $results;
}
}
return false;
}
 
/**
* Employs various techniques to identify the author
*
* Dublin Core provides the dc:creator, dc:contributor, and dc:publisher
* elements for defining authorship in RSS1. We will try each of those in
* turn in order to simulate the atom author element and will return it
* as text.
*
* @return array|false
*/
function getAuthor() {
$options = array('creator', 'contributor', 'publisher');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length > 0) {
return $test->item(0)->value;
}
}
return false;
}
/**
* Retrieve a link
*
* In RSS1 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them.
*
* @return string
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
$links = $this->model->getElementsByTagName('link');
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss11.php
New file
0,0 → 1,266
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS1.1 class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS11.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS1.1 feeds. RSS1.1 is documented at:
* http://inamidst.com/rss1.1/
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
* @todo Support for RDF:List
* @todo Ensure xml:lang is accessible to users
*/
class XmlFeedParserRss11 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'rss11.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 1.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss11Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Text'),
'description' => array('Text'),
'image' => array('Image'),
'updatePeriod' => array('Text'),
'updateFrequency' => array('Text'),
'updateBase' => array('Date'),
'rights' => array('Text'), # dc:rights
'description' => array('Text'), # dc:description
'creator' => array('Text'), # dc:creator
'publisher' => array('Text'), # dc:publisher
'contributor' => array('Text'), # dc:contributor
'date' => array('Date') # dc:contributor
);
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'link' => array('link'),
'subtitle' => array('description'),
'author' => array('creator'),
'updated' => array('date'));
 
/**
* We will be working with multiple namespaces and it is useful to
* keep them together. We will retain support for some common RSS1.0 modules
* @var array
*/
protected $namespaces = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'rss' => 'http://purl.org/net/rss1.1#',
'dc' => 'http://purl.org/rss/1.0/modules/dc/',
'content' => 'http://purl.org/rss/1.0/modules/content/',
'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/');
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XML_Feed_Parser_Exception('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Attempts to identify an element by ID given by the rdf:about attribute
*
* This is not really something that will work with RSS1.1 as it does not have
* clear restrictions on the global uniqueness of IDs. We will employ the
* _very_ hit and miss method of selecting entries based on the rdf:about
* attribute. Please note that this is even more hit and miss with RSS1.1 than
* with RSS1.0 since RSS1.1 does not require the rdf:about attribute for items.
*
* @param string $id any valid ID.
* @return XML_Feed_Parser_RSS1Element
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//rss:item[@rdf:about='$id']");
if ($entries->length > 0) {
$classname = $this->itemClass;
$entry = new $classname($entries->item(0), $this);
return $entry;
}
return false;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->model->getElementsByTagName('image');
if ($images->length > 0) {
$image = $images->item(0);
$details = array();
if ($image->hasChildNodes()) {
$details = array(
'title' => $image->getElementsByTagName('title')->item(0)->value,
'url' => $image->getElementsByTagName('url')->item(0)->value);
if ($image->getElementsByTagName('link')->length > 0) {
$details['link'] =
$image->getElementsByTagName('link')->item(0)->value;
}
} else {
$details = array('title' => false,
'link' => false,
'url' => $image->attributes->getNamedItem('resource')->nodeValue);
}
$details = array_merge($details,
array('description' => false, 'height' => false, 'width' => false));
if (! empty($details)) {
return $details;
}
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness we will support it.
*
* @return array|false
*/
protected function getTextInput() {
$inputs = $this->model->getElementsByTagName('textinput');
if ($inputs->length > 0) {
$input = $inputs->item(0);
$results = array();
$results['title'] = isset(
$input->getElementsByTagName('title')->item(0)->value) ?
$input->getElementsByTagName('title')->item(0)->value : null;
$results['description'] = isset(
$input->getElementsByTagName('description')->item(0)->value) ?
$input->getElementsByTagName('description')->item(0)->value : null;
$results['name'] = isset(
$input->getElementsByTagName('name')->item(0)->value) ?
$input->getElementsByTagName('name')->item(0)->value : null;
$results['link'] = isset(
$input->getElementsByTagName('link')->item(0)->value) ?
$input->getElementsByTagName('link')->item(0)->value : null;
if (empty($results['link']) and
$input->attributes->getNamedItem('resource')) {
$results['link'] = $input->attributes->getNamedItem('resource')->nodeValue;
}
if (! empty($results)) {
return $results;
}
}
return false;
}
 
/**
* Attempts to discern authorship
*
* Dublin Core provides the dc:creator, dc:contributor, and dc:publisher
* elements for defining authorship in RSS1. We will try each of those in
* turn in order to simulate the atom author element and will return it
* as text.
*
* @return array|false
*/
function getAuthor() {
$options = array('creator', 'contributor', 'publisher');
foreach ($options as $element) {
$test = $this->model->getElementsByTagName($element);
if ($test->length > 0) {
return $test->item(0)->value;
}
}
return false;
}
/**
* Retrieve a link
*
* In RSS1 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them.
*
* @return string
*/
function getLink($offset = 0, $attribute = 'href', $params = false) {
$links = $this->model->getElementsByTagName('link');
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss2.php
New file
0,0 → 1,323
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Class representing feed-level data for an RSS2 feed
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS2.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class handles RSS2 feeds.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss2 extends XmlFeedParserType {
/**
* The URI of the RelaxNG schema used to (optionally) validate the feed
* @var string
*/
protected $relax = 'rss20.rng';
 
/**
* We're likely to use XPath, so let's keep it global
* @var DOMXPath
*/
protected $xpath;
 
/**
* The feed type we are parsing
* @var string
*/
public $version = 'RSS 2.0';
 
/**
* The class used to represent individual items
* @var string
*/
protected $itemClass = 'XmlFeedParserRss2Element';
/**
* The element containing entries
* @var string
*/
protected $itemElement = 'item';
 
/**
* Here we map those elements we're not going to handle individually
* to the constructs they are. The optional second parameter in the array
* tells the parser whether to 'fall back' (not apt. at the feed level) or
* fail if the element is missing. If the parameter is not set, the function
* will simply return false and leave it to the client to decide what to do.
* @var array
*/
protected $map = array(
'ttl' => array('Text'),
'pubDate' => array('Date'),
'lastBuildDate' => array('Date'),
'title' => array('Text'),
'link' => array('Link'),
'description' => array('Text'),
'language' => array('Text'),
'copyright' => array('Text'),
'managingEditor' => array('Text'),
'webMaster' => array('Text'),
'category' => array('Text'),
'generator' => array('Text'),
'docs' => array('Text'),
'ttl' => array('Text'),
'image' => array('Image'),
'skipDays' => array('skipDays'),
'skipHours' => array('skipHours'));
 
/**
* Here we map some elements to their atom equivalents. This is going to be
* quite tricky to pull off effectively (and some users' methods may vary)
* but is worth trying. The key is the atom version, the value is RSS2.
* @var array
*/
protected $compatMap = array(
'title' => array('title'),
'rights' => array('copyright'),
'updated' => array('lastBuildDate'),
'subtitle' => array('description'),
'date' => array('pubDate'),
'author' => array('managingEditor'));
 
protected $namespaces = array(
'dc' => 'http://purl.org/rss/1.0/modules/dc/',
'content' => 'http://purl.org/rss/1.0/modules/content/');
 
/**
* Our constructor does nothing more than its parent.
*
* @param DOMDocument $xml A DOM object representing the feed
* @param bool (optional) $string Whether or not to validate this feed
*/
function __construct(DOMDocument $model, $strict = false) {
$this->model = $model;
 
if ($strict) {
if (! $this->relaxNGValidate()) {
throw new XmlFeedParserException('Failed required validation');
}
}
 
$this->xpath = new DOMXPath($this->model);
foreach ($this->namespaces as $key => $value) {
$this->xpath->registerNamespace($key, $value);
}
$this->numberEntries = $this->count('item');
}
 
/**
* Retrieves an entry by ID, if the ID is specified with the guid element
*
* This is not really something that will work with RSS2 as it does not have
* clear restrictions on the global uniqueness of IDs. But we can emulate
* it by allowing access based on the 'guid' element. If DOMXPath::evaluate
* is available, we also use that to store a reference to the entry in the array
* used by getEntryByOffset so that method does not have to seek out the entry
* if it's requested that way.
*
* @param string $id any valid ID.
* @return XML_Feed_Parser_RSS2Element
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->entries[$this->idMappings[$id]];
}
 
$entries = $this->xpath->query("//item[guid='$id']");
if ($entries->length > 0) {
$entry = new $this->itemElement($entries->item(0), $this);
if (in_array('evaluate', get_class_methods($this->xpath))) {
$offset = $this->xpath->evaluate("count(preceding-sibling::item)", $entries->item(0));
$this->entries[$offset] = $entry;
}
$this->idMappings[$id] = $entry;
return $entry;
}
}
 
/**
* Get a category from the element
*
* The category element is a simple text construct which can occur any number
* of times. We allow access by offset or access to an array of results.
*
* @param string $call for compatibility with our overloading
* @param array $arguments - arg 0 is the offset, arg 1 is whether to return as array
* @return string|array|false
*/
function getCategory($call, $arguments = array()) {
$categories = $this->model->getElementsByTagName('category');
$offset = empty($arguments[0]) ? 0 : $arguments[0];
$array = empty($arguments[1]) ? false : true;
if ($categories->length <= $offset) {
return false;
}
if ($array) {
$list = array();
foreach ($categories as $category) {
array_push($list, $category->nodeValue);
}
return $list;
}
return $categories->item($offset)->nodeValue;
}
 
/**
* Get details of the image associated with the feed.
*
* @return array|false an array simply containing the child elements
*/
protected function getImage() {
$images = $this->xpath->query("//image");
if ($images->length > 0) {
$image = $images->item(0);
$desc = $image->getElementsByTagName('description');
$description = $desc->length ? $desc->item(0)->nodeValue : false;
$heigh = $image->getElementsByTagName('height');
$height = $heigh->length ? $heigh->item(0)->nodeValue : false;
$widt = $image->getElementsByTagName('width');
$width = $widt->length ? $widt->item(0)->nodeValue : false;
return array(
'title' => $image->getElementsByTagName('title')->item(0)->nodeValue,
'link' => $image->getElementsByTagName('link')->item(0)->nodeValue,
'url' => $image->getElementsByTagName('url')->item(0)->nodeValue,
'description' => $description,
'height' => $height,
'width' => $width);
}
return false;
}
 
/**
* The textinput element is little used, but in the interests of
* completeness...
*
* @return array|false
*/
function getTextInput() {
$inputs = $this->model->getElementsByTagName('input');
if ($inputs->length > 0) {
$input = $inputs->item(0);
return array(
'title' => $input->getElementsByTagName('title')->item(0)->value,
'description' =>
$input->getElementsByTagName('description')->item(0)->value,
'name' => $input->getElementsByTagName('name')->item(0)->value,
'link' => $input->getElementsByTagName('link')->item(0)->value);
}
return false;
}
 
/**
* Utility function for getSkipDays and getSkipHours
*
* This is a general function used by both getSkipDays and getSkipHours. It simply
* returns an array of the values of the children of the appropriate tag.
*
* @param string $tagName The tag name (getSkipDays or getSkipHours)
* @return array|false
*/
protected function getSkips($tagName) {
$hours = $this->model->getElementsByTagName($tagName);
if ($hours->length == 0) {
return false;
}
$skipHours = array();
foreach($hours->item(0)->childNodes as $hour) {
if ($hour instanceof DOMElement) {
array_push($skipHours, $hour->nodeValue);
}
}
return $skipHours;
}
 
/**
* Retrieve skipHours data
*
* The skiphours element provides a list of hours on which this feed should
* not be checked. We return an array of those hours (integers, 24 hour clock)
*
* @return array
*/
function getSkipHours() {
return $this->getSkips('skipHours');
}
 
/**
* Retrieve skipDays data
*
* The skipdays element provides a list of days on which this feed should
* not be checked. We return an array of those days.
*
* @return array
*/
function getSkipDays() {
return $this->getSkips('skipDays');
}
 
/**
* Return content of the little-used 'cloud' element
*
* The cloud element is rarely used. It is designed to provide some details
* of a location to update the feed.
*
* @return array an array of the attributes of the element
*/
function getCloud() {
$cloud = $this->model->getElementsByTagName('cloud');
if ($cloud->length == 0) {
return false;
}
$cloudData = array();
foreach ($cloud->item(0)->attributes as $attribute) {
$cloudData[$attribute->name] = $attribute->value;
}
return $cloudData;
}
/**
* Get link URL
*
* In RSS2 a link is a text element but in order to ensure that we resolve
* URLs properly we have a special function for them. We maintain the
* parameter used by the atom getLink method, though we only use the offset
* parameter.
*
* @param int $offset The position of the link within the feed. Starts from 0
* @param string $attribute The attribute of the link element required
* @param array $params An array of other parameters. Not used.
* @return string
*/
function getLink($offset, $attribute = 'href', $params = array()) {
$links = $this->model->getElementsByTagName('link');
 
if ($links->length <= $offset) {
return false;
}
$link = $links->item($offset);
return $this->addBase($link->nodeValue, $link);
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserAtomElement.php
New file
0,0 → 1,254
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* AtomElement class for XML_Feed_Parser package
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: AtomElement.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This class provides support for atom entries. It will usually be called by
* XML_Feed_Parser_Atom with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserAtomElement extends XmlFeedParserAtom {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_Atom
*/
protected $parent;
 
/**
* When performing XPath queries we will use this prefix
* @var string
*/
private $xpathPrefix = '';
/**
* xml:base values inherited by the element
* @var string
*/
protected $xmlBase;
 
/**
* Here we provide a few mappings for those very special circumstances in
* which it makes sense to map back to the RSS2 spec or to manage other
* compatibilities (eg. with the Univeral Feed Parser). Key is the other version's
* name for the command, value is an array consisting of the equivalent in our atom
* api and any attributes needed to make the mapping.
* @var array
*/
protected $compatMap = array(
'guid' => array('id'),
'links' => array('link'),
'tags' => array('category'),
'contributors' => array('contributor'));
/**
* Our specific element map
* @var array
*/
protected $map = array(
'author' => array('Person', 'fallback'),
'contributor' => array('Person'),
'id' => array('Text', 'fail'),
'published' => array('Date'),
'updated' => array('Date', 'fail'),
'title' => array('Text', 'fail'),
'rights' => array('Text', 'fallback'),
'summary' => array('Text'),
'content' => array('Content'),
'link' => array('Link'),
'enclosure' => array('Enclosure'),
'category' => array('Category'));
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_Atom $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
$this->xmlBase = $xmlBase;
$this->xpathPrefix = "//atom:entry[atom:id='" . $this->id . "']/";
$this->xpath = $this->parent->xpath;
}
 
/**
* Provides access to specific aspects of the author data for an atom entry
*
* Author data at the entry level is more complex than at the feed level.
* If atom:author is not present for the entry we need to look for it in
* an atom:source child of the atom:entry. If it's not there either, then
* we look to the parent for data.
*
* @param array
* @return string
*/
function getAuthor($arguments) {
/* Find out which part of the author data we're looking for */
if (isset($arguments['param'])) {
$parameter = $arguments['param'];
} else {
$parameter = 'name';
}
$test = $this->model->getElementsByTagName('author');
if ($test->length > 0) {
$item = $test->item(0);
return $item->getElementsByTagName($parameter)->item(0)->nodeValue;
}
$source = $this->model->getElementsByTagName('source');
if ($source->length > 0) {
$test = $this->model->getElementsByTagName('author');
if ($test->length > 0) {
$item = $test->item(0);
return $item->getElementsByTagName($parameter)->item(0)->nodeValue;
}
}
return $this->parent->getAuthor($arguments);
}
 
/**
* Returns the content of the content element or info on a specific attribute
*
* This element may or may not be present. It cannot be present more than
* once. It may have a 'src' attribute, in which case there's no content
* If not present, then the entry must have link with rel="alternate".
* If there is content we return it, if not and there's a 'src' attribute
* we return the value of that instead. The method can take an 'attribute'
* argument, in which case we return the value of that attribute if present.
* eg. $item->content("type") will return the type of the content. It is
* recommended that all users check the type before getting the content to
* ensure that their script is capable of handling the type of returned data.
* (data carried in the content element can be either 'text', 'html', 'xhtml',
* or any standard MIME type).
*
* @return string|false
*/
protected function getContent($method, $arguments = array()) {
$attribute = empty($arguments[0]) ? false : $arguments[0];
$tags = $this->model->getElementsByTagName('content');
 
if ($tags->length == 0) {
return false;
}
 
$content = $tags->item(0);
 
if (! $content->hasAttribute('type')) {
$content->setAttribute('type', 'text');
}
if (! empty($attribute)) {
return $content->getAttribute($attribute);
}
 
$type = $content->getAttribute('type');
 
if (! empty($attribute)) {
if ($content->hasAttribute($attribute))
{
return $content->getAttribute($attribute);
}
return false;
}
 
if ($content->hasAttribute('src')) {
return $content->getAttribute('src');
}
 
return $this->parseTextConstruct($content);
}
 
/**
* For compatibility, this method provides a mapping to access enclosures.
*
* The Atom spec doesn't provide for an enclosure element, but it is
* generally supported using the link element with rel='enclosure'.
*
* @param string $method - for compatibility with our __call usage
* @param array $arguments - for compatibility with our __call usage
* @return array|false
*/
function getEnclosure($method, $arguments = array()) {
$offset = isset($arguments[0]) ? $arguments[0] : 0;
$query = "//atom:entry[atom:id='" . $this->getText('id', false) .
"']/atom:link[@rel='enclosure']";
 
$encs = $this->parent->xpath->query($query);
if ($encs->length > $offset) {
try {
if (! $encs->item($offset)->hasAttribute('href')) {
return false;
}
$attrs = $encs->item($offset)->attributes;
$length = $encs->item($offset)->hasAttribute('length') ?
$encs->item($offset)->getAttribute('length') : false;
return array(
'url' => $attrs->getNamedItem('href')->value,
'type' => $attrs->getNamedItem('type')->value,
'length' => $length);
} catch (Exception $e) {
return false;
}
}
return false;
}
/**
* Get details of this entry's source, if available/relevant
*
* Where an atom:entry is taken from another feed then the aggregator
* is supposed to include an atom:source element which replicates at least
* the atom:id, atom:title, and atom:updated metadata from the original
* feed. Atom:source therefore has a very similar structure to atom:feed
* and if we find it we will return it as an XML_Feed_Parser_Atom object.
*
* @return XML_Feed_Parser_Atom|false
*/
function getSource() {
$test = $this->model->getElementsByTagName('source');
if ($test->length == 0) {
return false;
}
$source = new XML_Feed_Parser_Atom($test->item(0));
}
 
/**
* Get the entry as an XML string
*
* Return an XML serialization of the feed, should it be required. Most
* users however, will already have a serialization that they used when
* instantiating the object.
*
* @return string XML serialization of element
*/
function __toString() {
$simple = simplexml_import_dom($this->model);
return $simple->asXML();
}
}
 
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/parsers/XmlFeedParserRss09Element.php
New file
0,0 → 1,59
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* RSS0.9 Element class for XML_Feed_Parser
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
* @version CVS: $Id: RSS09Element.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/*
* This class provides support for RSS 0.9 entries. It will usually be called by
* XML_Feed_Parser_RSS09 with which it shares many methods.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParserRss09Element extends XmlFeedParserRss09 {
/**
* This will be a reference to the parent object for when we want
* to use a 'fallback' rule
* @var XML_Feed_Parser_RSS09
*/
protected $parent;
 
/**
* Our specific element map
* @var array
*/
protected $map = array(
'title' => array('Text'),
'link' => array('Link'));
 
/**
* Store useful information for later.
*
* @param DOMElement $element - this item as a DOM element
* @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
*/
function __construct(DOMElement $element, $parent, $xmlBase = '') {
$this->model = $element;
$this->parent = $parent;
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/schemas/README
New file
0,0 → 1,9
Most of these schemas are only available in RNC (RelaxNG, Compact) format.
 
libxml (and therefor PHP) only supports RelaxNG - the XML version.
 
To update these, you will need a conversion utility, like trang (http://www.thaiopensource.com/relaxng/trang.html).
 
 
 
clockwerx@clockwerx-desktop:~/trang$ java -jar trang.jar -I rnc -O rng http://atompub.org/2005/08/17/atom.rnc atom.rng
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/schemas/rss10.rng
New file
0,0 → 1,113
<?xml version='1.0' encoding='UTF-8'?>
<!-- http://www.xml.com/lpt/a/2002/01/23/relaxng.html -->
<!-- http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html -->
<!-- http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_wildcards_st8.html -->
 
<grammar xmlns='http://relaxng.org/ns/structure/1.0'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
ns='http://purl.org/rss/1.0/'
datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'>
 
<start>
<element name='RDF' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<ref name='RDFContent'/>
</element>
</start>
 
<define name='RDFContent' ns='http://purl.org/rss/1.0/'>
<interleave>
<element name='channel'>
<ref name='channelContent'/>
</element>
<optional>
<element name='image'><ref name='imageContent'/></element>
</optional>
<oneOrMore>
<element name='item'><ref name='itemContent'/></element>
</oneOrMore>
</interleave>
</define>
 
<define name='channelContent' combine="interleave">
<interleave>
<element name='title'><data type='string'/></element>
<element name='link'><data type='anyURI'/></element>
<element name='description'><data type='string'/></element>
<element name='image'>
<attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</element>
<element name='items'>
<ref name='itemsContent'/>
</element>
<attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</interleave>
</define>
<define name="itemsContent">
<element name="Seq" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<oneOrMore>
<element name="li" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<choice>
<attribute name='resource'> <!-- Why doesn't RDF/RSS1.0 ns qualify this attribute? -->
<data type='anyURI'/>
</attribute>
<attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</choice>
</element>
</oneOrMore>
</element>
</define>
<define name='imageContent'>
<interleave>
<element name='title'><data type='string'/></element>
<element name='link'><data type='anyURI'/></element>
<element name='url'><data type='anyURI'/></element>
<attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</interleave>
</define>
 
<define name='itemContent'>
<interleave>
<element name='title'><data type='string'/></element>
<element name='link'><data type='anyURI'/></element>
<optional><element name='description'><data type='string'/></element></optional>
<ref name="anyThing"/>
<attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<data type='anyURI'/>
</attribute>
</interleave>
</define>
 
<define name='anyThing'>
<zeroOrMore>
<choice>
<text/>
<element>
<anyName>
<except>
<nsName/>
</except>
</anyName>
<ref name='anyThing'/>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
</element>
</choice>
</zeroOrMore>
</define>
</grammar>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/schemas/rss11.rng
New file
0,0 → 1,218
<?xml version="1.0" encoding="UTF-8"?>
<!--
RELAX NG Compact Schema for RSS 1.1
Sean B. Palmer, inamidst.com
Christopher Schmidt, crschmidt.net
License: This schema is in the public domain
-->
<grammar xmlns:rss="http://purl.org/net/rss1.1#" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ns="http://purl.org/net/rss1.1#" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<ref name="Channel"/>
</start>
<define name="Channel">
<a:documentation>http://purl.org/net/rss1.1#Channel</a:documentation>
<element name="Channel">
<ref name="Channel.content"/>
 
</element>
</define>
<define name="Channel.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<optional>
<ref name="AttrXMLBase"/>
</optional>
 
<ref name="AttrRDFAbout"/>
<interleave>
<ref name="title"/>
<ref name="link"/>
<ref name="description"/>
<optional>
<ref name="image"/>
</optional>
<zeroOrMore>
 
<ref name="Any"/>
</zeroOrMore>
<ref name="items"/>
</interleave>
</define>
<define name="title">
<a:documentation>http://purl.org/net/rss1.1#title</a:documentation>
<element name="title">
 
<ref name="title.content"/>
</element>
</define>
<define name="title.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<text/>
</define>
 
<define name="link">
<a:documentation>http://purl.org/net/rss1.1#link</a:documentation>
<element name="link">
<ref name="link.content"/>
</element>
</define>
<define name="link.content">
<data type="anyURI"/>
 
</define>
<define name="description">
<a:documentation>http://purl.org/net/rss1.1#description</a:documentation>
<element name="description">
<ref name="description.content"/>
</element>
</define>
<define name="description.content">
 
<optional>
<ref name="AttrXMLLang"/>
</optional>
<text/>
</define>
<define name="image">
<a:documentation>http://purl.org/net/rss1.1#image</a:documentation>
<element name="image">
 
<ref name="image.content"/>
</element>
</define>
<define name="image.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<ref name="AttrRDFResource"/>
<interleave>
 
<ref name="title"/>
<optional>
<ref name="link"/>
</optional>
<ref name="url"/>
<zeroOrMore>
<ref name="Any"/>
</zeroOrMore>
</interleave>
 
</define>
<define name="url">
<a:documentation>http://purl.org/net/rss1.1#url</a:documentation>
<element name="url">
<ref name="url.content"/>
</element>
</define>
<define name="url.content">
 
<data type="anyURI"/>
</define>
<define name="items">
<a:documentation>http://purl.org/net/rss1.1#items</a:documentation>
<element name="items">
<ref name="items.content"/>
</element>
</define>
 
<define name="items.content">
<optional>
<ref name="AttrXMLLang"/>
</optional>
<ref name="AttrRDFCollection"/>
<zeroOrMore>
<ref name="item"/>
</zeroOrMore>
</define>
 
<define name="item">
<a:documentation>http://purl.org/net/rss1.1#item</a:documentation>
<element name="item">
<ref name="item.content"/>
</element>
</define>
<define name="item.content">
<optional>
 
<ref name="AttrXMLLang"/>
</optional>
<ref name="AttrRDFAbout"/>
<interleave>
<ref name="title"/>
<ref name="link"/>
<optional>
<ref name="description"/>
</optional>
 
<optional>
<ref name="image"/>
</optional>
<zeroOrMore>
<ref name="Any"/>
</zeroOrMore>
</interleave>
</define>
<define name="Any">
 
<a:documentation>http://purl.org/net/rss1.1#Any</a:documentation>
<element>
<anyName>
<except>
<nsName/>
</except>
</anyName>
<ref name="Any.content"/>
 
</element>
</define>
<define name="Any.content">
<zeroOrMore>
<attribute>
<anyName>
<except>
<nsName/>
<nsName ns=""/>
 
</except>
</anyName>
</attribute>
</zeroOrMore>
<mixed>
<zeroOrMore>
<ref name="Any"/>
</zeroOrMore>
</mixed>
 
</define>
<define name="AttrXMLLang">
<attribute name="xml:lang">
<data type="language"/>
</attribute>
</define>
<define name="AttrXMLBase">
<attribute name="xml:base">
<data type="anyURI"/>
 
</attribute>
</define>
<define name="AttrRDFAbout">
<attribute name="rdf:about">
<data type="anyURI"/>
</attribute>
</define>
<define name="AttrRDFResource">
<attribute name="rdf:parseType">
 
<value>Resource</value>
</attribute>
</define>
<define name="AttrRDFCollection">
<attribute name="rdf:parseType">
<value>Collection</value>
</attribute>
</define>
 
</grammar>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/schemas/rss20.rng
New file
0,0 → 1,298
<?xml version="1.0" encoding="utf-8"?>
 
<!-- ======================================================================
* Author: Dino Morelli
* Began: 2004-Feb-18
* Build #: 0001
* Version: 0.1
* E-Mail: dino.morelli@snet.net
* URL: (none yet)
* License: (none yet)
*
* ========================================================================
*
* RSS v2.0 Relax NG schema
*
* ==================================================================== -->
 
 
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
 
<start>
<ref name="element-rss" />
</start>
 
<define name="element-title">
<element name="title">
 
<text />
</element>
</define>
 
<define name="element-description">
<element name="description">
<text />
</element>
</define>
 
<define name="element-link">
<element name="link">
<text />
</element>
</define>
 
<define name="element-category">
<element name="category">
<optional>
 
<attribute name="domain" />
</optional>
<text />
</element>
</define>
 
<define name="element-rss">
<element name="rss">
<attribute name="version">
 
<value>2.0</value>
</attribute>
<element name="channel">
<interleave>
<ref name="element-title" />
<ref name="element-link" />
<ref name="element-description" />
<optional>
 
<element name="language"><text /></element>
</optional>
<optional>
<element name="copyright"><text /></element>
</optional>
<optional>
<element name="lastBuildDate"><text /></element>
</optional>
<optional>
 
<element name="docs"><text /></element>
</optional>
<optional>
<element name="generator"><text /></element>
</optional>
<optional>
<ref name="element-category" />
</optional>
<optional>
 
<element name="managingEditor"><text /></element>
</optional>
<optional>
<element name="webMaster"><text /></element>
</optional>
<optional>
<element name="pubDate"><text /></element>
</optional>
<optional>
 
<element name="rating"><text /></element>
</optional>
<optional>
<element name="image">
<interleave>
<element name="url"><text /></element>
<ref name="element-title" />
<ref name="element-link" />
<optional>
 
<element name="width"><text /></element>
</optional>
<optional>
<element name="height"><text /></element>
</optional>
<optional>
<ref name="element-description" />
</optional>
</interleave>
 
</element>
</optional>
<optional>
<element name="cloud">
<attribute name="domain" />
<attribute name="port" />
<attribute name="path" />
<attribute name="registerProcedure" />
<attribute name="protocol" />
 
</element>
</optional>
<optional>
<element name="textInput">
<interleave>
<ref name="element-title" />
<ref name="element-description" />
<element name="name"><text /></element>
<ref name="element-link" />
 
</interleave>
</element>
</optional>
<optional>
<element name="skipHours">
<oneOrMore>
<element name="hour">
<choice>
<value>0</value>
 
<value>1</value>
<value>2</value>
<value>3</value>
<value>4</value>
<value>5</value>
<value>6</value>
 
<value>7</value>
<value>8</value>
<value>9</value>
<value>10</value>
<value>11</value>
<value>12</value>
 
<value>13</value>
<value>14</value>
<value>15</value>
<value>16</value>
<value>17</value>
<value>18</value>
 
<value>19</value>
<value>20</value>
<value>21</value>
<value>22</value>
<value>23</value>
</choice>
 
</element>
</oneOrMore>
</element>
</optional>
<optional>
<element name="skipDays">
<oneOrMore>
<element name="day">
<choice>
 
<value>0</value>
<value>1</value>
<value>2</value>
<value>3</value>
<value>4</value>
<value>5</value>
 
<value>6</value>
<value>7</value>
<value>8</value>
<value>9</value>
<value>10</value>
<value>11</value>
 
<value>12</value>
<value>13</value>
<value>14</value>
<value>15</value>
<value>16</value>
<value>17</value>
 
<value>18</value>
<value>19</value>
<value>20</value>
<value>21</value>
<value>22</value>
<value>23</value>
 
<value>24</value>
<value>25</value>
<value>26</value>
<value>27</value>
<value>28</value>
<value>29</value>
 
<value>30</value>
<value>31</value>
</choice>
</element>
</oneOrMore>
</element>
</optional>
<optional>
 
<element name="ttl"><text /></element>
</optional>
<zeroOrMore>
<element name="item">
<interleave>
<choice>
<ref name="element-title" />
<ref name="element-description" />
<interleave>
 
<ref name="element-title" />
<ref name="element-description" />
</interleave>
</choice>
<optional>
<ref name="element-link" />
</optional>
<optional>
<element name="author"><text /></element>
 
</optional>
<optional>
<ref name="element-category" />
</optional>
<optional>
<element name="comments"><text /></element>
</optional>
<optional>
<element name="enclosure">
 
<attribute name="url" />
<attribute name="length" />
<attribute name="type" />
<text />
</element>
</optional>
<optional>
<element name="guid">
<optional>
 
<attribute name="isPermaLink">
<choice>
<value>true</value>
<value>false</value>
</choice>
</attribute>
</optional>
<text />
 
</element>
</optional>
<optional>
<element name="pubDate"><text /></element>
</optional>
<optional>
<element name="source">
<attribute name="url" />
<text />
 
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>
</element>
</define>
 
</grammar>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/schemas/atom.rng
New file
0,0 → 1,598
<?xml version="1.0" encoding="UTF-8"?>
<!--
-*- rnc -*-
RELAX NG Compact Syntax Grammar for the
Atom Format Specification Version 11
-->
<grammar ns="http://www.w3.org/1999/xhtml" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<choice>
<ref name="atomFeed"/>
<ref name="atomEntry"/>
</choice>
</start>
<!-- Common attributes -->
<define name="atomCommonAttributes">
<optional>
<attribute name="xml:base">
<ref name="atomUri"/>
</attribute>
</optional>
<optional>
<attribute name="xml:lang">
<ref name="atomLanguageTag"/>
</attribute>
</optional>
<zeroOrMore>
<ref name="undefinedAttribute"/>
</zeroOrMore>
</define>
<!-- Text Constructs -->
<define name="atomPlainTextConstruct">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<choice>
<value>text</value>
<value>html</value>
</choice>
</attribute>
</optional>
<text/>
</define>
<define name="atomXHTMLTextConstruct">
<ref name="atomCommonAttributes"/>
<attribute name="type">
<value>xhtml</value>
</attribute>
<ref name="xhtmlDiv"/>
</define>
<define name="atomTextConstruct">
<choice>
<ref name="atomPlainTextConstruct"/>
<ref name="atomXHTMLTextConstruct"/>
</choice>
</define>
<!-- Person Construct -->
<define name="atomPersonConstruct">
<ref name="atomCommonAttributes"/>
<interleave>
<element name="atom:name">
<text/>
</element>
<optional>
<element name="atom:uri">
<ref name="atomUri"/>
</element>
</optional>
<optional>
<element name="atom:email">
<ref name="atomEmailAddress"/>
</element>
</optional>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
</define>
<!-- Date Construct -->
<define name="atomDateConstruct">
<ref name="atomCommonAttributes"/>
<data type="dateTime"/>
</define>
<!-- atom:feed -->
<define name="atomFeed">
<element name="atom:feed">
<s:rule context="atom:feed">
<s:assert test="atom:author or not(atom:entry[not(atom:author)])">An atom:feed must have an atom:author unless all of its atom:entry children have an atom:author.</s:assert>
</s:rule>
<ref name="atomCommonAttributes"/>
<interleave>
<zeroOrMore>
<ref name="atomAuthor"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomCategory"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomContributor"/>
</zeroOrMore>
<optional>
<ref name="atomGenerator"/>
</optional>
<optional>
<ref name="atomIcon"/>
</optional>
<ref name="atomId"/>
<zeroOrMore>
<ref name="atomLink"/>
</zeroOrMore>
<optional>
<ref name="atomLogo"/>
</optional>
<optional>
<ref name="atomRights"/>
</optional>
<optional>
<ref name="atomSubtitle"/>
</optional>
<ref name="atomTitle"/>
<ref name="atomUpdated"/>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
<zeroOrMore>
<ref name="atomEntry"/>
</zeroOrMore>
</element>
</define>
<!-- atom:entry -->
<define name="atomEntry">
<element name="atom:entry">
<s:rule context="atom:entry">
<s:assert test="atom:link[@rel='alternate'] or atom:link[not(@rel)] or atom:content">An atom:entry must have at least one atom:link element with a rel attribute of 'alternate' or an atom:content.</s:assert>
</s:rule>
<s:rule context="atom:entry">
<s:assert test="atom:author or ../atom:author or atom:source/atom:author">An atom:entry must have an atom:author if its feed does not.</s:assert>
</s:rule>
<ref name="atomCommonAttributes"/>
<interleave>
<zeroOrMore>
<ref name="atomAuthor"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomCategory"/>
</zeroOrMore>
<optional>
<ref name="atomContent"/>
</optional>
<zeroOrMore>
<ref name="atomContributor"/>
</zeroOrMore>
<ref name="atomId"/>
<zeroOrMore>
<ref name="atomLink"/>
</zeroOrMore>
<optional>
<ref name="atomPublished"/>
</optional>
<optional>
<ref name="atomRights"/>
</optional>
<optional>
<ref name="atomSource"/>
</optional>
<optional>
<ref name="atomSummary"/>
</optional>
<ref name="atomTitle"/>
<ref name="atomUpdated"/>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
</element>
</define>
<!-- atom:content -->
<define name="atomInlineTextContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<choice>
<value>text</value>
<value>html</value>
</choice>
</attribute>
</optional>
<zeroOrMore>
<text/>
</zeroOrMore>
</element>
</define>
<define name="atomInlineXHTMLContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<attribute name="type">
<value>xhtml</value>
</attribute>
<ref name="xhtmlDiv"/>
</element>
</define>
<define name="atomInlineOtherContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<ref name="atomMediaType"/>
</attribute>
</optional>
<zeroOrMore>
<choice>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="atomOutOfLineContent">
<element name="atom:content">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="type">
<ref name="atomMediaType"/>
</attribute>
</optional>
<attribute name="src">
<ref name="atomUri"/>
</attribute>
<empty/>
</element>
</define>
<define name="atomContent">
<choice>
<ref name="atomInlineTextContent"/>
<ref name="atomInlineXHTMLContent"/>
<ref name="atomInlineOtherContent"/>
<ref name="atomOutOfLineContent"/>
</choice>
</define>
<!-- atom:author -->
<define name="atomAuthor">
<element name="atom:author">
<ref name="atomPersonConstruct"/>
</element>
</define>
<!-- atom:category -->
<define name="atomCategory">
<element name="atom:category">
<ref name="atomCommonAttributes"/>
<attribute name="term"/>
<optional>
<attribute name="scheme">
<ref name="atomUri"/>
</attribute>
</optional>
<optional>
<attribute name="label"/>
</optional>
<ref name="undefinedContent"/>
</element>
</define>
<!-- atom:contributor -->
<define name="atomContributor">
<element name="atom:contributor">
<ref name="atomPersonConstruct"/>
</element>
</define>
<!-- atom:generator -->
<define name="atomGenerator">
<element name="atom:generator">
<ref name="atomCommonAttributes"/>
<optional>
<attribute name="uri">
<ref name="atomUri"/>
</attribute>
</optional>
<optional>
<attribute name="version"/>
</optional>
<text/>
</element>
</define>
<!-- atom:icon -->
<define name="atomIcon">
<element name="atom:icon">
<ref name="atomCommonAttributes"/>
<ref name="atomUri"/>
</element>
</define>
<!-- atom:id -->
<define name="atomId">
<element name="atom:id">
<ref name="atomCommonAttributes"/>
<ref name="atomUri"/>
</element>
</define>
<!-- atom:logo -->
<define name="atomLogo">
<element name="atom:logo">
<ref name="atomCommonAttributes"/>
<ref name="atomUri"/>
</element>
</define>
<!-- atom:link -->
<define name="atomLink">
<element name="atom:link">
<ref name="atomCommonAttributes"/>
<attribute name="href">
<ref name="atomUri"/>
</attribute>
<optional>
<attribute name="rel">
<choice>
<ref name="atomNCName"/>
<ref name="atomUri"/>
</choice>
</attribute>
</optional>
<optional>
<attribute name="type">
<ref name="atomMediaType"/>
</attribute>
</optional>
<optional>
<attribute name="hreflang">
<ref name="atomLanguageTag"/>
</attribute>
</optional>
<optional>
<attribute name="title"/>
</optional>
<optional>
<attribute name="length"/>
</optional>
<ref name="undefinedContent"/>
</element>
</define>
<!-- atom:published -->
<define name="atomPublished">
<element name="atom:published">
<ref name="atomDateConstruct"/>
</element>
</define>
<!-- atom:rights -->
<define name="atomRights">
<element name="atom:rights">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:source -->
<define name="atomSource">
<element name="atom:source">
<ref name="atomCommonAttributes"/>
<interleave>
<zeroOrMore>
<ref name="atomAuthor"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomCategory"/>
</zeroOrMore>
<zeroOrMore>
<ref name="atomContributor"/>
</zeroOrMore>
<optional>
<ref name="atomGenerator"/>
</optional>
<optional>
<ref name="atomIcon"/>
</optional>
<optional>
<ref name="atomId"/>
</optional>
<zeroOrMore>
<ref name="atomLink"/>
</zeroOrMore>
<optional>
<ref name="atomLogo"/>
</optional>
<optional>
<ref name="atomRights"/>
</optional>
<optional>
<ref name="atomSubtitle"/>
</optional>
<optional>
<ref name="atomTitle"/>
</optional>
<optional>
<ref name="atomUpdated"/>
</optional>
<zeroOrMore>
<ref name="extensionElement"/>
</zeroOrMore>
</interleave>
</element>
</define>
<!-- atom:subtitle -->
<define name="atomSubtitle">
<element name="atom:subtitle">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:summary -->
<define name="atomSummary">
<element name="atom:summary">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:title -->
<define name="atomTitle">
<element name="atom:title">
<ref name="atomTextConstruct"/>
</element>
</define>
<!-- atom:updated -->
<define name="atomUpdated">
<element name="atom:updated">
<ref name="atomDateConstruct"/>
</element>
</define>
<!-- Low-level simple types -->
<define name="atomNCName">
<data type="string">
<param name="minLength">1</param>
<param name="pattern">[^:]*</param>
</data>
</define>
<!-- Whatever a media type is, it contains at least one slash -->
<define name="atomMediaType">
<data type="string">
<param name="pattern">.+/.+</param>
</data>
</define>
<!-- As defined in RFC 3066 -->
<define name="atomLanguageTag">
<data type="string">
<param name="pattern">[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*</param>
</data>
</define>
<!--
Unconstrained; it's not entirely clear how IRI fit into
xsd:anyURI so let's not try to constrain it here
-->
<define name="atomUri">
<text/>
</define>
<!-- Whatever an email address is, it contains at least one @ -->
<define name="atomEmailAddress">
<data type="string">
<param name="pattern">.+@.+</param>
</data>
</define>
<!-- Simple Extension -->
<define name="simpleExtensionElement">
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/2005/Atom"/>
</except>
</anyName>
<text/>
</element>
</define>
<!-- Structured Extension -->
<define name="structuredExtensionElement">
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/2005/Atom"/>
</except>
</anyName>
<choice>
<group>
<oneOrMore>
<attribute>
<anyName/>
</attribute>
</oneOrMore>
<zeroOrMore>
<choice>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</group>
<group>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<group>
<optional>
<text/>
</optional>
<oneOrMore>
<ref name="anyElement"/>
</oneOrMore>
<zeroOrMore>
<choice>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</group>
</group>
</choice>
</element>
</define>
<!-- Other Extensibility -->
<define name="extensionElement">
<choice>
<ref name="simpleExtensionElement"/>
<ref name="structuredExtensionElement"/>
</choice>
</define>
<define name="undefinedAttribute">
<attribute>
<anyName>
<except>
<name>xml:base</name>
<name>xml:lang</name>
<nsName ns=""/>
</except>
</anyName>
</attribute>
</define>
<define name="undefinedContent">
<zeroOrMore>
<choice>
<text/>
<ref name="anyForeignElement"/>
</choice>
</zeroOrMore>
</define>
<define name="anyElement">
<element>
<anyName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="anyForeignElement">
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/2005/Atom"/>
</except>
</anyName>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<!-- XHTML -->
<define name="anyXHTML">
<element>
<nsName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyXHTML"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="xhtmlDiv">
<element name="xhtml:div">
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyXHTML"/>
</choice>
</zeroOrMore>
</element>
</define>
</grammar>
<!-- EOF -->
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/bibliotheque/xml_feed_parser/1.0.4/XmlFeedParser.php
New file
0,0 → 1,304
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
/**
* Key gateway class for XML_Feed_Parser package
*
* PHP versions 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category XML
* @package XML_Feed_Parser
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
* @version CVS: $Id: Parser.php 304308 2010-10-11 12:05:50Z clockwerx $
* @link http://pear.php.net/package/XML_Feed_Parser/
*/
 
/**
* This is the core of the XML_Feed_Parser package. It identifies feed types
* and abstracts access to them. It is an iterator, allowing for easy access
* to the entire feed.
*
* @author James Stewart <james@jystewart.net>
* @version Release: @package_version@
* @package XML_Feed_Parser
*/
class XmlFeedParser implements Iterator {
/**
* This is where we hold the feed object
* @var Object
*/
private $feed;
 
/**
* To allow for extensions, we make a public reference to the feed model
* @var DOMDocument
*/
public $model;
/**
* A map between entry ID and offset
* @var array
*/
protected $idMappings = array();
 
/**
* A storage space for Namespace URIs.
* @var array
*/
private $feedNamespaces = array(
'rss2' => array(
'http://backend.userland.com/rss',
'http://backend.userland.com/rss2',
'http://blogs.law.harvard.edu/tech/rss'));
/**
* Detects feed types and instantiate appropriate objects.
*
* Our constructor takes care of detecting feed types and instantiating
* appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0
* but raise a warning. I do not intend to introduce full support for
* Atom 0.3 as it has been deprecated, but others are welcome to.
*
* @param string $feed XML serialization of the feed
* @param bool $strict Whether or not to validate the feed
* @param bool $suppressWarnings Trigger errors for deprecated feed types?
* @param bool $tidy Whether or not to try and use the tidy library on input
*/
function __construct($feed, $strict = false, $suppressWarnings = true, $tidy = true) {
$this->model = new DOMDocument;
if (! $this->model->loadXML($feed)) {
if (extension_loaded('tidy') && $tidy) {
$tidy = new tidy;
$tidy->parseString($feed, array('input-xml' => true, 'output-xml' => true));
$tidy->cleanRepair();
if (! $this->model->loadXML((string) $tidy)) {
throw new XmlFeedParserException("Entrée invalide : le flux n'est pas du XML valide");
}
} else {
throw new XmlFeedParserException("Entrée invalide : le flux n'est pas du XML valide");
}
}
 
/* detect feed type */
$doc_element = $this->model->documentElement;
$error = false;
 
switch (true) {
case ($doc_element->namespaceURI == 'http://www.w3.org/2005/Atom'):
$class = 'XmlFeedParserAtom';
break;
case ($doc_element->namespaceURI == 'http://purl.org/atom/ns#'):
$class = 'XmlFeedParserAtom';
$error = "Atom 0.3 est déprécié, le parseur en version 1.0 sera utilisé mais toutes les options ne seront pas disponibles.";
break;
case ($doc_element->namespaceURI == 'http://purl.org/rss/1.0/'
|| ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
&& $doc_element->childNodes->item(1)->namespaceURI == 'http://purl.org/rss/1.0/')):
$class = 'XmlFeedParserRss1';
break;
case ($doc_element->namespaceURI == 'http://purl.org/rss/1.1/'
|| ($doc_element->hasChildNodes()
&& $doc_element->childNodes->length > 1
&& $doc_element->childNodes->item(1)->namespaceURI == 'http://purl.org/rss/1.1/')):
$class = 'XmlFeedParserRss11';
break;
case (($doc_element->hasChildNodes()
&& $doc_element->childNodes->length > 1
&& $doc_element->childNodes->item(1)->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/')
|| $doc_element->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/'):
$class = 'XmlFeedParserRss09';
break;
case ($doc_element->tagName == 'rss'
and $doc_element->hasAttribute('version')
&& $doc_element->getAttribute('version') == 0.91):
$error = 'RSS 0.91 has been superceded by RSS2.0. Using RSS2.0 parser.';
$class = 'XmlFeedParserRss2';
break;
case ($doc_element->tagName == 'rss'
and $doc_element->hasAttribute('version')
&& $doc_element->getAttribute('version') == 0.92):
$error = 'RSS 0.92 has been superceded by RSS2.0. Using RSS2.0 parser.';
$class = 'XmlFeedParserRss2';
break;
case (in_array($doc_element->namespaceURI, $this->feedNamespaces['rss2'])
|| $doc_element->tagName == 'rss'):
if (! $doc_element->hasAttribute('version') || $doc_element->getAttribute('version') != 2) {
$error = 'RSS version not specified. Parsing as RSS2.0';
}
$class = 'XmlFeedParserRss2';
break;
default:
throw new XmlFeedParserException('Type de flux de syndicaton inconnu');
break;
}
 
if (! $suppressWarnings && ! empty($error)) {
trigger_error($error, E_USER_WARNING);
}
 
/* Instantiate feed object */
$this->feed = new $class($this->model, $strict);
}
 
/**
* Proxy to allow feed element names to be used as method names
*
* For top-level feed elements we will provide access using methods or
* attributes. This function simply passes on a request to the appropriate
* feed type object.
*
* @param string $call - the method being called
* @param array $attributes
*/
function __call($call, $attributes) {
$attributes = array_pad($attributes, 5, false);
list($a, $b, $c, $d, $e) = $attributes;
return $this->feed->$call($a, $b, $c, $d, $e);
}
 
/**
* Proxy to allow feed element names to be used as attribute names
*
* To allow variable-like access to feed-level data we use this
* method. It simply passes along to __call() which in turn passes
* along to the relevant object.
*
* @param string $val - the name of the variable required
*/
function __get($val) {
return $this->feed->$val;
}
 
/**
* Provides iteration functionality.
*
* Of course we must be able to iterate... This function simply increases
* our internal counter.
*/
function next() {
if (isset($this->current_item) &&
$this->current_item <= $this->feed->numberEntries - 1) {
++$this->current_item;
} else if (! isset($this->current_item)) {
$this->current_item = 0;
} else {
return false;
}
}
 
/**
* Return XML_Feed_Type object for current element
*
* @return XML_Feed_Parser_Type Object
*/
function current() {
return $this->getEntryByOffset($this->current_item);
}
 
/**
* For iteration -- returns the key for the current stage in the array.
*
* @return int
*/
function key() {
return $this->current_item;
}
 
/**
* For iteration -- tells whether we have reached the
* end.
*
* @return bool
*/
function valid() {
return $this->current_item < $this->feed->numberEntries;
}
 
/**
* For iteration -- resets the internal counter to the beginning.
*/
function rewind() {
$this->current_item = 0;
}
 
/**
* Provides access to entries by ID if one is specified in the source feed.
*
* As well as allowing the items to be iterated over we want to allow
* users to be able to access a specific entry. This is one of two ways of
* doing that, the other being by offset. This method can be quite slow
* if dealing with a large feed that hasn't yet been processed as it
* instantiates objects for every entry until it finds the one needed.
*
* @param string $id Valid ID for the given feed format
* @return XML_Feed_Parser_Type|false
*/
function getEntryById($id) {
if (isset($this->idMappings[$id])) {
return $this->getEntryByOffset($this->idMappings[$id]);
}
 
/*
* Since we have not yet encountered that ID, let's go through all the
* remaining entries in order till we find it.
* This is a fairly slow implementation, but it should work.
*/
return $this->feed->getEntryById($id);
}
 
/**
* Retrieve entry by numeric offset, starting from zero.
*
* As well as allowing the items to be iterated over we want to allow
* users to be able to access a specific entry. This is one of two ways of
* doing that, the other being by ID.
*
* @param int $offset The position of the entry within the feed, starting from 0
* @return XML_Feed_Parser_Type|false
*/
function getEntryByOffset($offset) {
if ($offset < $this->feed->numberEntries) {
if (isset($this->feed->entries[$offset])) {
return $this->feed->entries[$offset];
} else {
try {
$this->feed->getEntryByOffset($offset);
} catch (Exception $e) {
return false;
}
$id = $this->feed->entries[$offset]->getID();
$this->idMappings[$id] = $offset;
return $this->feed->entries[$offset];
}
} else {
return false;
}
}
 
/**
* Retrieve version details from feed type class.
*
* @return void
* @author James Stewart
*/
function version() {
return $this->feed->version;
}
/**
* Returns a string representation of the feed.
*
* @return String
**/
function __toString() {
return $this->feed->__toString();
}
}
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/widget-origin-mobile/modules/observation/squelettes/css/observation.css
New file
0,0 → 1,80
@charset "UTF-8";
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Widget */
#cel-observation-contenu{
position:relative;
padding:0 5px;
margin:5px auto;
font-family:Arial,verdana,sans-serif;
font-size:12px;
background-color:#DDDDDD;
color:black;
}
#cel-observation-contenu h1 {
margin:5px;
padding:0;
font-size:1.6em;
color:black;
background-color:transparent;
background-image:none;
text-transform:none;
text-align:left;
}
#cel-observation-contenu h1 a{
color: #AAAAAA !important
}
#cel-observation-contenu h1 #cel-observation-flux{
width:16px;
height:20px;
}
#cel-observation-contenu img {
border:0;
padding:0;
margin:0;
}
#cel-observation-contenu a, #cel-observation-contenu a:active, #cel-observation-contenu a:visited {
border-bottom:1px dotted #666;
color:black;
text-decoration:none;
background-image:none;
}
#cel-observation-contenu a:active {
outline:none;
}
#cel-observation-contenu a:focus {
outline:thin dotted;
}
#cel-observation-contenu a:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
}
#cel-observation-date-generation{
text-align:right;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Général */
#cel-observation-contenu .discretion {
color:grey;
font-family:arial;
font-size:11px;
font-weight:bold;
}
#cel-observation-contenu .nettoyage {
clear:both;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Galerie observations CEL */
#cel-observation-contenu .cel-observation {
width:99%;
float:left;
padding:2px;
border:1px solid white;
}
#cel-observation-contenu .cel-observation h2{
font-size:1em;
}
 
#cel-observation-contenu .cel-infos{
color:white;
}
 
/tags/widget-origin-mobile/modules/observation/squelettes/observation.tpl.html
New file
0,0 → 1,126
<!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="Jean-Pascal MILCENT, Grégoire DUCHÉ" />
<meta name="keywords" content="Tela Botanica, observation, CEL" />
<meta name="description" content="Widget de présentation des dernières observations publiées sur le Carnet en Ligne de Tela Botanica" />
 
<!-- Spécial mobile -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- 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" />
<!-- Feuilles de styles -->
<link rel="stylesheet" type="text/css" href="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?=$url_css?>observation.css" media="screen" />
<!-- Javascript : bibliothèques -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.4.4/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.js"></script>
</head>
<body>
<!-- WIDGET:CEL:OBSERVATION - DEBUT -->
<div id="cel-observation-contenu">
<?php if (isset($erreurs) || isset($informations)) : ?>
<h1>Erreur &amp; informations</h1>
<p>Impossible d'afficher le flux.</p>
<!-- Affichage des erreurs et messages d'information : -->
<?php if ($erreurs) : ?>
<?php foreach ($erreurs as $erreur) : ?>
<p class="erreur"><?=$erreur;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($informations) : ?>
<?php foreach ($informations as $information) : ?>
<p class="info"><?=$information;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<h1>
<? if (!empty($titre)) : ?>
<?=$titre?>
<? endif ; ?>
<? if($icone_rss) : ?>
<a href="<?=$flux_rss_url?>" id="cel-observation-flux" title="Suivre les observations"
onclick="window.open(this.href);return false;">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/rss.png" alt="Suivre les observations" />
</a>
<? endif; ?>
</h1>
<div id="cel-liste-observation">
<?php foreach ($items as $item) : ?>
<div id="cel-observation-<?=$item['guid']?>" class="cel-observation" rel="<?=$item['guid']?>" >
<img id="imPlus-<?=$item['guid']?>" width="10" height="10"
name="imPlus-<?=$item['guid']?>" title="Voir les informations complémentaires" alt="+"
src="http://www.tela-botanica.org/sites/commun/generique/images/plus.png" />
<img id="imMoins-<?=$item['guid']?>" width="10" height="10" class="imMoins"
name="imMoins-<?=$item['guid']?>" title="Cacher les informations complémentaires" alt="+"
src="http://www.tela-botanica.org/sites/commun/generique/images/moins.png" />
<strong>
<?php if ($item['eflore_url'] != '#' && $item['eflore_url'] != '' && $item['eflore_url'] != 'http://www.tela-botanica.org/bdtfx-nn-0') { ?>
<a class="cel-img-titre" href="<?=$item['eflore_url']?>"
onclick="window.open(this.href);return false;"
title="Cliquez pour accéder à la fiche eFlore">
<?=$item['titre']?>
</a>
<?php } else { ?>
<?=$item['titre']?>
<?php } ?>
</strong><br />
<span class="cel-img-date">Publiée le <?=$item['date']?></span><br />
<div id="cel-info-<?=$item['guid']?>" class="cel-infos">
<?=$item['description']?>
</div>
</div>
<?php endforeach; ?>
</div>
<p id="cel-observation-pieds" class="cel-observation-pieds discretion nettoyage">
<span class="cel-observation-source">
Source :
<a href="http://www.tela-botanica.org/page:cel" title="Carnet en Ligne" onclick="window.open(this.href);return false;">
CEL
</a>
</span>
<span class="cel-observation-date-generation">Au <?=strftime('%A %d %B %Y à %H:%M:%S')?></span>
</p>
<script type="text/Javascript">
// Function pour cacher / afficher le détail des observations
$(document).ready(function() {
 
$('.cel-infos').hide();
$('.imMoins').hide();
$('.cel-observation').hover(function() {
var id_obs = $(this).attr("rel");
$('#cel-info-'+id_obs).show();
$('#imPlus-'+id_obs).hide();
$('#imMoins-'+id_obs).show();
},
function() {
var id_obs = $(this).attr("rel");
$('#cel-info-'+id_obs).hide();
$('#imPlus-'+id_obs).show();
$('#imMoins-'+id_obs).hide();
});
 
});
</script>
<?php endif; ?>
</div>
<!-- WIDGET:CEL:OBSERVATION - FIN -->
</body>
</html>
/tags/widget-origin-mobile/modules/observation/squelettes/observation_ajax.tpl.html
New file
0,0 → 1,89
<div id="cel-observation-contenu">
<?php if (isset($erreurs) || isset($informations)) : ?>
<h1>Erreur &amp; informations</h1>
<p>Impossible d'afficher le flux.</p>
<!-- Affichage des erreurs et messages d'information : -->
<?php if ($erreurs) : ?>
<?php foreach ($erreurs as $erreur) : ?>
<p class="erreur"><?=$erreur;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($informations) : ?>
<?php foreach ($informations as $information) : ?>
<p class="info"><?=$information;?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<h1>
<? if (!empty($titre)) : ?>
<?=$titre?>
<? endif ; ?>
<? if($icone_rss) : ?>
<a href="<?=$flux_rss_url?>" id="cel-observation-flux" title="Suivre les observations"
onclick="window.open(this.href);return false;">
<img src="http://www.tela-botanica.org/sites/commun/generique/images/rss.png" alt="Suivre les observations" />
</a>
<? endif; ?>
</h1>
<div id="cel-liste-observation">
<?php foreach ($items as $item) : ?>
<div id="cel-observation-<?=$item['guid']?>" class="cel-observation" rel="<?=$item['guid']?>" >
<img id="imPlus-<?=$item['guid']?>" width="10" height="10"
name="imPlus-<?=$item['guid']?>" title="Voir les informations complémentaires" alt="+"
src="http://www.tela-botanica.org/sites/commun/generique/images/plus.png" />
<img id="imMoins-<?=$item['guid']?>" width="10" height="10" class="imMoins"
name="imMoins-<?=$item['guid']?>" title="Cacher les informations complémentaires" alt="+"
src="http://www.tela-botanica.org/sites/commun/generique/images/moins.png" />
<strong>
<?php if ($item['eflore_url'] != '#' && $item['eflore_url'] != '' && $item['eflore_url'] != 'http://www.tela-botanica.org/bdtfx-nn-0') { ?>
<a class="cel-img-titre" href="<?=$item['eflore_url']?>"
onclick="window.open(this.href);return false;"
title="Cliquez pour accéder à la fiche eFlore">
<?=$item['titre']?>
</a>
<?php } else { ?>
<?=$item['titre']?>
<?php } ?>
</strong><br />
<span class="cel-img-date">Publiée le <?=$item['date']?></span><br />
<div id="cel-info-<?=$item['guid']?>" class="cel-infos">
<?=$item['description']?>
</div>
</div>
<?php endforeach; ?>
</div>
<p id="cel-observation-pieds" class="cel-observation-pieds discretion nettoyage">
<span class="cel-observation-source">
Source :
<a href="http://www.tela-botanica.org/page:cel" title="Carnet en Ligne" onclick="window.open(this.href);return false;">
CEL
</a>
</span>
<span class="cel-observation-date-generation">Au <?=strftime('%A %d %B %Y à %H:%M:%S')?></span>
</p>
<script type="text/Javascript">
// Function pour cacher / afficher le détail des observations
$(document).ready(function() {
 
$('.cel-infos').hide();
$('.imMoins').hide();
$('.cel-observation').hover(function() {
var id_obs = $(this).attr("rel");
$('#cel-info-'+id_obs).show();
$('#imPlus-'+id_obs).hide();
$('#imMoins-'+id_obs).show();
},
function() {
var id_obs = $(this).attr("rel");
$('#cel-info-'+id_obs).hide();
$('#imPlus-'+id_obs).show();
$('#imMoins-'+id_obs).hide();
});
 
});
</script>
<?php endif; ?>
</div>
/tags/widget-origin-mobile/modules/observation/Observation.php
New file
0,0 → 1,157
<?php
// declare(encoding='UTF-8');
/**
* Service affichant les dernières observations 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=AideCELWidget
*
* Paramètres :
* ===> vignette = [0-9]+,[0-9]+ [par défaut : 4,3]
* Indique le nombre de vignette par ligne et le nombre de ligne.
*
* @author Delphine <jpm@tela-botanica.org>
* @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) 2011, Tela Botanica (accueil@tela-botanica.org)
*/
class Observation extends WidgetCommun {
const DS = DIRECTORY_SEPARATOR;
const SERVICE_DEFAUT = 'observation';
private $flux_rss_url = null;
private $eflore_url_tpl = null;
/**
* Méthode appelée par défaut pour charger ce widget.
*/
public function executer() {
$retour = null;
// Pour la création de l'id du cache nous ne tenons pas compte du paramètre de l'url callback
unset($this->parametres['callback']);
extract($this->parametres);
 
if (!isset($mode)) {
$mode = self::SERVICE_DEFAUT;
}
$this->eflore_url_tpl = $this->config['observation']['efloreUrlTpl'];
$this->flux_rss_url = $this->config['observation']['fluxRssUrl'];
$cache_activation = $this->config['observation.cache']['activation'];
$cache_stockage = $this->config['observation.cache']['stockageDossier'];
$ddv = $this->config['observation.cache']['dureeDeVie'];
$cache = new Cache($cache_stockage, $ddv, $cache_activation);
$id_cache = 'observation-'.hash('adler32', print_r($this->parametres, true));
if (! $contenu = $cache->charger($id_cache)) {
$methode = $this->traiterNomMethodeExecuter($mode);
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 {
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].'.tpl.html';
$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
$cache->sauver($id_cache, $contenu);
}
}
if (isset($_GET['callback'])) {
$this->envoyerJsonp(array('contenu' => $contenu));
} else {
$this->envoyer($contenu);
}
}
private function executerAjax() {
$widget = $this->executerObservation();
$widget['squelette'] = 'observation_ajax';
return $widget;
}
private function executerObservation() {
$widget = null;
extract($this->parametres);
$max_obs = (isset($max_obs) && preg_match('/^[0-9]+,[0-9]+$/', $max_obs)) ? $max_obs : '10';
$icone_rss = (isset($_GET['rss']) && $_GET['rss'] != 1) ? false : true;
$this->flux_rss_url .= $this->traiterParametres();
$titre = isset($titre) ? htmlentities(rawurldecode($titre)) : '';
if (@file_get_contents($this->flux_rss_url, false) != false) {
$xml = file_get_contents($this->flux_rss_url);
if ($xml) {
try {
$flux = new XmlFeedParser($xml);
$widget['donnees']['flux_rss_url'] = $this->flux_rss_url;
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/observation/squelettes/css/');
$widget['donnees']['colonne'] = 1;
$widget['donnees']['icone_rss'] = $icone_rss;
$widget['donnees']['titre'] = $titre;
$num = 0;
foreach ($flux as $entree) {
if ($num == $max_obs) {
break;
}
$item = array();
// Formatage date
$date = $entree->updated ? $entree->updated : null;
$date = $entree->pubDate ? $entree->pubDate : $date;
$item['date'] = strftime('%A %d %B %Y', $date);
// Formatage titre
$item['titre'] = $entree->title;
$item['nn'] = '';
$item['eflore_url'] = '#';
if (preg_match('/\[nn([0-9]+)\]/', $entree->title, $match)) {
$item['nn'] = $match[1];
$item['eflore_url'] = sprintf($this->eflore_url_tpl, $item['nn']);
}
// Récupération du GUID
if (preg_match('/urn:lsid:tela-botanica.org:cel:obs([0-9]+)$/', $entree->id, $match)) {
$item['guid'] = (int) $match[1];
} else {
$item['guid'] = $entree->id;
}
$item['description'] = $entree->content;
$widget['donnees']['items'][$num++] = $item;
}
$widget['squelette'] = 'observation';
} catch (XmlFeedParserException $e) {
trigger_error('Flux invalide : '.$e->getMessage(), E_USER_WARNING);
}
} else {
$this->messages[] = "Fichier xml invalide.";
}
} else {
$this->messages[] = "L'URI, $this->flux_rss_url, est invalide.";
}
return $widget;
}
private function traiterParametres() {
$parametres_flux = '?';
$criteres = array('utilisateur', 'commune', 'dept', 'taxon', 'commentaire', 'date', 'projet', 'motcle', 'num_taxon');
foreach($this->parametres as $nom_critere => $valeur_critere) {
if (in_array($nom_critere, $criteres)) {
$valeur_critere = str_replace(' ', '%20', $valeur_critere);
$parametres_flux .= $nom_critere.'='.$valeur_critere.'&';
}
}
if ($parametres_flux == '?') {
$parametres_flux = '';
} else {
$parametres_flux = rtrim($parametres_flux, '&');
}
return $parametres_flux;
}
}
?>
/tags/widget-origin-mobile/modules/observation
New file
Property changes:
Added: svn:ignore
+config.ini
/tags/widget-origin-mobile/modules/saisie/configurations/sauvages.ini
New file
0,0 → 1,0
milieux="Fissures|Pied d'arbre|Mur|Pelouse|Plate bande|Haie|Chemin;"
/tags/widget-origin-mobile/modules/saisie/configurations/biodiversite34.ini
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/configurations/biodiversite34.ini
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/configurations/sauvages_taxons.tsv
New file
0,0 → 1,478
nom_sel num_nom_sel nom_ret num_nom_ret num_taxon famille nom_fr nom_fr_autre groupe
Ailante faux-vernis-du-japon 2088 Ailanthus altissima (Mill.) Swingle 2088 5537 Simaroubaceae Ailante faux-vernis-du-japon arbres et arbustes
Aubépine à un style 19472 Crataegus monogyna Jacq. 19472 4721 Rosaceae Aubépine à un style arbres et arbustes
Aulne glutineux 3318 Alnus glutinosa (L.) Gaertn. 3318 1321 Betulaceae Aulne glutineux arbres et arbustes
Bouleau verruqueux 9626 Betula pendula Roth 9626 1325 Betulaceae Bouleau verruqueux arbres et arbustes
Buddléia arbre-aux-papillons 11336 Buddleja davidii Franch. 11336 1837 Buddlejaceae Buddléia arbre-aux-papillons arbres et arbustes
Cornouiller sanguin 75064 Cornus sanguinea L. 75064 30056 Cornaceae Cornouiller sanguin arbres et arbustes
Érable négundo 74932 Acer negundo L. 74932 29924 Aceraceae Érable négundo arbres et arbustes
Érable plane 74934 Acer platanoides L. 74934 29926 Aceraceae Érable plane arbres et arbustes
Figuier commun 75134 Ficus carica L. 75134 30126 Moraceae Figuier commun arbres et arbustes
Mahonia à feuilles de houx 40676 Mahonia aquifolium (Pursh) Nutt. 40676 1317 Berberidaceae Mahonia à feuilles de houx arbres et arbustes
Paulownia tomenteux 48115 Paulownia tomentosa (Thunb.) Steud. 48115 5411 Scrophulariaceae Paulownia tomenteux arbres et arbustes
Peuplier noir 52030 Populus nigra L. 52030 5128 Salicaceae Peuplier noir arbres et arbustes
Prunelier épine-noire 53652 Prunus spinosa L. 53652 4847 Rosaceae Prunelier épine-noire arbres et arbustes
Robinier faux-acacia 56245 Robinia pseudoacacia L. 56245 3124 Fabaceae Robinier faux-acacia arbres et arbustes
Sureau noir 60241 Sambucus nigra L. 60241 1968 Caprifoliaceae Sureau noir arbres et arbustes
Asplenium capillaire 7728 Asplenium trichomanes L. 7728 7358 Aspleniaceae Asplenium capillaire fougères et prêles
Asplenium cétérac 74978 Ceterach officinarum Willd. 77204 29970 Aspleniaceae Asplenium cétérac fougères et prêles
Asplenium rue-des-murailes 7681 Asplenium ruta-muraria L. 7681 8688 Aspleniaceae Asplenium rue-des-murailes fougères et prêles
Prêle des champs 24488 Equisetum arvense L. 24488 7397 Equisetaceae Prêle des champs fougères et prêles
Amarante couchée 3944 Amaranthus deflexus L. 3944 39 Amaranthaceae Amarante couchée plante à fleurs minuscules
Amarante réfléchie 4009 Amaranthus retroflexus L. 4009 49 Amaranthaceae Amarante réfléchie plante à fleurs minuscules
Ambroisie à feuilles d'armoise 4066 Ambrosia artemisiifolia L. 4066 383 Asteraceae Ambroisie à feuilles d'armoise plante à fleurs minuscules
Arabette des dames 5767 Arabidopsis thaliana (L.) Heynh. 5767 1484 Brassicaceae Arabette des dames plante à fleurs minuscules
Armoise annuelle 6765 Artemisia annua L. 6765 430 Asteraceae Armoise annuelle plante à fleurs minuscules
Armoise commune 6987 Artemisia vulgaris L. 6987 459 Asteraceae Armoise commune plante à fleurs minuscules
Armoise des frères Verlot 6983 Artemisia verlotiorum Lamotte 6983 458 Asteraceae Armoise des frères Verlot plante à fleurs minuscules
Arroche couchée 8444 Atriplex prostrata Boucher ex DC. 8444 8712 Chenopodiaceae Arroche couchée plante à fleurs minuscules
Arroche étalée 74991 Atriplex patula L. 74991 29983 Chenopodiaceae Arroche étalée plante à fleurs minuscules
Asperge à feuilles aigües 7214 Asparagus acutifolius L. 7214 6269 Asparagaceae Asperge à feuilles aigües plante à fleurs minuscules
Capselle bourse-à-pasteur 75016 Capsella bursa-pastoris (L.) Medik. 75016 30008 Brassicaceae Capselle bourse-à-pasteur plante à fleurs minuscules
Cardamine hérissée 12878 Cardamine hirsuta L. 12878 1592 Brassicaceae Cardamine hérissée plante à fleurs minuscules
Céraiste aggloméré 15862 Cerastium glomeratum Thuill. 15862 2024 Caryophyllaceae Céraiste aggloméré plante à fleurs minuscules
Céraiste des fontaines 15840 Cerastium fontanum Baumg. 15840 9277 Caryophyllaceae Céraiste des fontaines plante à fleurs minuscules
Chénopode blanc 16741 Chenopodium album L. 16741 2335 Chenopodiaceae Chénopode blanc plante à fleurs minuscules
Chénopode des murailles 16847 Chenopodium murale L. 16847 2353 Chenopodiaceae Chénopode des murailles plante à fleurs minuscules
Gaillet grateron 28896 Galium aparine L. 28896 5037 Rubiaceae Gaillet grateron plante à fleurs minuscules
Gaillet mollugine 29078 Galium mollugo L. 29078 5057 Rubiaceae Gaillet mollugine plante à fleurs minuscules
Lycope d'Europe 40533 Lycopus europaeus L. 40533 3576 Lamiaceae Lycope d'Europe plante à fleurs minuscules
Mercuriale annuelle 42320 Mercurialis annua L. 42320 2751 Euphorbiaceae Mercuriale annuelle plante à fleurs minuscules
Ortie brûlante 70431 Urtica urens L. 70431 5650 Urticaceae Ortie brûlante plante à fleurs minuscules
Ortie dioïque 70396 Urtica dioica L. 70396 14875 Urticaceae Ortie dioïque plante à fleurs minuscules
Pariètaire de Judée 47921 Parietaria judaica L. 47921 5641 Urticaceae Pariètaire de Judée plante à fleurs minuscules
Passerage de Virginie 38574 Lepidium virginicum L. 38574 1743 Brassicaceae Passerage de Virginie plante à fleurs minuscules
Persicaire tachetée 48340 Polygonum persicaria L. 51630 4236 Polygonaceae Persicaire tachetée plante à fleurs minuscules
Pimprenelle mineure 60289 Sanguisorba minor Scop. 60289 4976 Rosaceae Pimprenelle mineure plante à fleurs minuscules
Plantain corne-de-cerf 49875 Plantago coronopus L. 49875 4088 Plantaginaceae Plantain corne-de-cerf plante à fleurs minuscules
Plantain lancéolé 49948 Plantago lanceolata L. 49948 4094 Plantaginaceae Plantain lancéolé plante à fleurs minuscules
Plantain majeur 49976 Plantago major L. 49976 4096 Plantaginaceae Plantain majeur plante à fleurs minuscules
Plantain toujours vert 50068 Plantago sempervirens Crantz 50068 4105 Plantaginaceae Plantain toujours vert plante à fleurs minuscules
Polycarpon quatre-feuilles 51112 Polycarpon tetraphyllum (L.) L. 51112 13356 Caryophyllaceae Polycarpon quatre-feuilles plante à fleurs minuscules
Renouée des oiseaux 51363 Polygonum aviculare L. 51363 4224 Polygonaceae Renouée des oiseaux plante à fleurs minuscules
Renouée faux-liseron 26474 Fallopia convolvulus (L.) Á.Löve 26474 4218 Polygonaceae Renouée faux-liseron plante à fleurs minuscules
Rumex à feuilles obtuses 58812 Rumex obtusifolius L. 58812 4274 Polygonaceae Rumex à feuilles obtuses plante à fleurs minuscules
Rumex crépue 58698 Rumex crispus L. 58698 4262 Polygonaceae Rumex crépue plante à fleurs minuscules
Sagine couchée 59112 Sagina procumbens L. 59112 2167 Caryophyllaceae Sagine couchée plante à fleurs minuscules
Sagine sans pétale 59056 Sagina apetala Ard. 59056 2161 Caryophyllaceae Sagine sans pétale plante à fleurs minuscules
Vergerette de Buenos Aires 24874 Conyza bonariensis (L.) Cronquist 18835 699 Asteraceae Vergerette de Buenos Aires plante à fleurs minuscules
Vergerette de Sumatra 24956 Conyza sumatrensis (Retz.) E.Walker 18851 702 Asteraceae Vergerette de Sumatra plante à fleurs minuscules
Vergerette du Canada 24880 Conyza canadensis (L.) Cronquist 18836 700 Asteraceae Vergerette du Canada plante à fleurs minuscules
Verveine officinale 71022 Verbena officinalis L. 71022 5710 Verbenaceae Verveine officinale plante à fleurs minuscules
Vesce hérissée 71616 Vicia hirsuta (L.) Gray 71616 3242 Fabaceae Vesce hérissée plante à fleurs minuscules
Andryale à feuilles entières 4699 Andryala integrifolia L. 4699 395 Asteraceae Andryale à feuilles entières plantes à capitules jaunes
Chondrille à feuilles de joncs 17040 Chondrilla juncea L. 17040 647 Asteraceae Chondrille à feuilles de joncs plantes à capitules jaunes
Crépide à feuilles de capselle 19627 Crepis bursifolia L. 19627 715 Asteraceae Crépide à feuilles de capselle plantes à capitules jaunes
Crépis à feuilles de pissenlit 19797 Crepis vesicaria subsp. taraxacifolia (Thuill.) Thell. ex Schinz & R.Keller 19797 739 Asteraceae Crépis à feuilles de pissenlit plantes à capitules jaunes
Crépis capillaire 19630 Crepis capillaris (L.) Wallr. 19630 716 Asteraceae Crépis capillaire plantes à capitules jaunes
Crépis de Nîmes 19756 Crepis sancta subsp. nemausensis (Vill.) Babc. 19756 734 Asteraceae Crépis de Nîmes plantes à capitules jaunes
Crépis fétide 19654 Crepis foetida L. 19654 719 Asteraceae Crépis fétide plantes à capitules jaunes
Crépis hérissée 19762 Crepis setosa Haller f. 19762 735 Asteraceae Crépis hérissée plantes à capitules jaunes
Jacobée commune 36239 Senecio jacobaea subsp. jacobaea 62926 14453 Asteraceae Jacobée commune plantes à capitules jaunes
Laiteron délicat 65231 Sonchus tenerrimus L. 65231 1234 Asteraceae Laiteron délicat plantes à capitules jaunes
Laiteron maraîcher 65205 Sonchus oleraceus L. 65205 1232 Asteraceae Laiteron maraîcher plantes à capitules jaunes
Laiteron rude 65171 Sonchus asper (L.) Hill 65171 14563 Asteraceae Laiteron rude plantes à capitules jaunes
Laitue des murailles 37338 Mycelis muralis (L.) Dumort. 43130 1066 Asteraceae Laitue des murailles plantes à capitules jaunes
Laitue scariole 37373 Lactuca serriola L. 37373 991 Asteraceae Laitue scariole plantes à capitules jaunes
Lampsane commune 37660 Lapsana communis L. 37660 997 Asteraceae Lampsane commune plantes à capitules jaunes
Picris fausse-épervière 49351 Picris hieracioides L. 49351 1102 Asteraceae Picris fausse-épervière plantes à capitules jaunes
Picris fausse-vipérine 31546 Picris echioides L. 49346 1101 Asteraceae Picris fausse-vipérine plantes à capitules jaunes
Pissenlit 87290 Taraxacum 87290 36245 Asteraceae Pissenlit plantes à capitules jaunes
Porcelle enracinée 35439 Hypochaeris radicata L. 35439 967 Asteraceae Porcelle enracinée plantes à capitules jaunes
Reichardie fausse-picride 55654 Reichardia picroides (L.) Roth 55654 1115 Asteraceae Reichardie fausse-picride plantes à capitules jaunes
Salsifis des prés 68767 Tragopogon pratensis L. 68767 14813 Asteraceae Salsifis des prés plantes à capitules jaunes
Séneçon à feuilles de roquette 62849 Senecio erucifolius L. 62849 1166 Asteraceae Séneçon à feuilles de roquette plantes à capitules jaunes
Séneçon commun 63096 Senecio vulgaris L. 63096 1203 Asteraceae Séneçon commun plantes à capitules jaunes
Séneçon du Cap 62909 Senecio inaequidens DC. 62909 1176 Asteraceae Séneçon du Cap plantes à capitules jaunes
Séneçon visqueux 63095 Senecio viscosus L. 63095 1202 Asteraceae Séneçon visqueux plantes à capitules jaunes
Solidage géant 65065 Solidago gigantea Aiton 65065 14560 Asteraceae Solidage géant plantes à capitules jaunes
Tussilage pas-d'âne 70113 Tussilago farfara L. 70113 1284 Asteraceae Tussilage pas-d'âne plantes à capitules jaunes
Urosperme de Daléchamps 70381 Urospermum dalechampii (L.) Scop. ex F.W.Schmidt 70381 1286 Asteraceae Urosperme de Daléchamps plantes à capitules jaunes
Achillée millefeuille 365 Achillea millefolium L. 365 8527 Asteraceae Achillée millefeuille plantes à fleurs blanches
Alliaire officinale 2913 Alliaria petiolata (M.Bieb.) Cavara & Grande 2913 1468 Brassicaceae Alliaire officinale plantes à fleurs blanches
Berce commune 31656 Heracleum sphondylium L. 31656 187 Apiaceae Berce commune plantes à fleurs blanches
Carotte sauvage 21674 Daucus carota L. 21674 151 Apiaceae Carotte sauvage plantes à fleurs blanches
Cerfeuil des bois 5290 Anthriscus sylvestris (L.) Hoffm. 5290 8626 Apiaceae Cerfeuil des bois plantes à fleurs blanches
Cerfeuil enivrant 16354 Chaerophyllum temulum L. 16354 140 Apiaceae Cerfeuil enivrant plantes à fleurs blanches
Clématite vigne-blanche 18235 Clematis vitalba L. 18235 4436 Ranunculaceae Clématite vigne-blanche plantes à fleurs blanches
Datura stramoine 21654 Datura stramonium L. 21654 5544 Solanaceae Datura stramoine plantes à fleurs blanches
Diplotaxis fausse-roquette 75095 Diplotaxis erucoides (L.) DC. 75095 30087 Brassicaceae Diplotaxis fausse-roquette plantes à fleurs blanches
Drave de printemps 22994 Erophila verna (L.) Chevall. 25208 1653 Brassicaceae Drave de printemps plantes à fleurs blanches
Fumeterre grimpante 75465 Fumaria capreolata L. 75465 30457 Papaveraceae Fumeterre grimpante plantes à fleurs blanches
Lamier blanc 37472 Lamium album L. 37472 3557 Lamiaceae Lamier blanc plantes à fleurs blanches
Linaire mineure 16280 Chaenorrhinum minus (L.) Lange 16280 5311 Scrophulariaceae Linaire mineure plantes à fleurs blanches
Liseron des haies 12341 Calystegia sepium (L.) R.Br. 12341 2448 Convolvulaceae Liseron des haies plantes à fleurs blanches
Mauve négligée 40856 Malva neglecta Wallr. 40856 3827 Malvaceae Mauve négligée plantes à fleurs blanches
Mélilot blanc 41764 Melilotus albus Medik. 41764 3053 Fabaceae Mélilot blanc plantes à fleurs blanches
Ombilic nombril-de-Vénus 70339 Umbilicus rupestris (Salisb.) Dandy 70339 2545 Crassulaceae Ombilic nombril-de-Vénus plantes à fleurs blanches
Orpin blanc 62141 Sedum album L. 62141 2489 Crassulaceae Orpin blanc plantes à fleurs blanches
Passerage drave 38489 Lepidium draba L. 38489 1609 Brassicaceae Passerage drave plantes à fleurs blanches
Pensée des champs 72065 Viola arvensis Murray 72065 14914 Violaceae Pensée des champs plantes à fleurs blanches
Phytolaque raisin-d'Amérique 49293 Phytolacca americana L. 49293 4061 Phytolaccaceae Phytolaque raisin-d'Amérique plantes à fleurs blanches
Renouée du Japon 55763 Reynoutria japonica Houtt. 55763 4244 Polygonaceae Renouée du Japon plantes à fleurs blanches
Réséda blanc 55658 Reseda alba L. 55658 4601 Resedaceae Réséda blanc plantes à fleurs blanches
Ronces 77191 Rubus 77191 31181 Rosaceae Ronces plantes à fleurs blanches
Sabline à feuilles de serpolet 6292 Arenaria serpyllifolia L. 6292 8642 Caryophyllaceae Sabline à feuilles de serpolet plantes à fleurs blanches
Saxifrage à trois doigts 61042 Saxifraga tridactylites L. 61042 5290 Saxifragaceae Saxifrage à trois doigts plantes à fleurs blanches
Silène compagnon-blanc 64192 Silene latifolia subsp. alba (Mill.) Greuter & Burdet 64192 2218 Caryophyllaceae Silène compagnon-blanc plantes à fleurs blanches
Silène enflé 64419 Silene vulgaris (Moench) Garcke 64419 14537 Caryophyllaceae Silène enflé plantes à fleurs blanches
Stellaire intermédiaire 75396 Stellaria media (L.) Vill. 75396 30388 Caryophyllaceae Stellaire intermédiaire plantes à fleurs blanches
Torilis du Japon 68580 Torilis japonica (Houtt.) DC. 68580 312 Apiaceae Torilis du Japon plantes à fleurs blanches
Trèfle pied-de-lièvre 68989 Trifolium arvense L. 68989 14822 Fabaceae Trèfle pied-de-lièvre plantes à fleurs blanches
Trèfle rampant 69341 Trifolium repens L. 69341 14834 Fabaceae Trèfle rampant plantes à fleurs blanches
Véronique cymbalaire 71145 Veronica cymbalaria Bodard 71145 5506 Scrophulariaceae Véronique cymbalaire plantes à fleurs blanches
Aster écailleux 7909 Aster squamatus (Spreng.) Hieron. 7909 478 Asteraceae Aster écailleux plantes à fleurs blanches à coeur jaune
Galinsoga à petites fleurs 28869 Galinsoga parviflora Cav. 28869 800 Asteraceae Galinsoga à petites fleurs plantes à fleurs blanches à coeur jaune
Galinsoga cilié 28871 Galinsoga quadriradiata Ruiz & Pav. 28871 801 Asteraceae Galinsoga cilié plantes à fleurs blanches à coeur jaune
Matricaire camomille 41057 Matricaria recutita L. 41057 1063 Asteraceae Matricaire camomille plantes à fleurs blanches à coeur jaune
Matricaire inodore 69569 Matricaria perforata Mérat 41054 1062 Asteraceae Matricaire inodore plantes à fleurs blanches à coeur jaune
Morelle noire 64930 Solanum nigrum L. 64930 14552 Solanaceae Morelle noire plantes à fleurs blanches à coeur jaune
Pâquerette vivace 9408 Bellis perennis L. 9408 493 Asteraceae Pâquerette vivace plantes à fleurs blanches à coeur jaune
Bourrache officinale 9966 Borago officinalis L. 9966 1350 Boraginaceae Bourrache officinale plantes à fleurs bleues
Bugle rampante 2407 Ajuga reptans L. 2407 3519 Lamiaceae Bugle rampante plantes à fleurs bleues
Chicorée amère 17314 Cichorium intybus L. 17314 661 Asteraceae Chicorée amère plantes à fleurs bleues
Myosotis des champs 43173 Myosotis arvensis Hill 43173 1400 Boraginaceae Myosotis des champs plantes à fleurs bleues
Passiflore bleue 48083 Passiflora caerulea L. 48083 4059 Passifloraceae Passiflore bleue plantes à fleurs bleues
Véronique à feuilles de lierre 71191 Veronica hederifolia L. 71191 14890 Scrophulariaceae Véronique à feuilles de lierre plantes à fleurs bleues
Véronique à feuilles de serpolet 71348 Veronica serpyllifolia L. 71348 14893 Scrophulariaceae Véronique à feuilles de serpolet plantes à fleurs bleues
Véronique de Perse 71290 Veronica persica Poir. 71290 5522 Scrophulariaceae Véronique de Perse plantes à fleurs bleues
Véronique des champs 71090 Veronica arvensis L. 71090 5496 Scrophulariaceae Véronique des champs plantes à fleurs bleues
Véronique petit-chêne 75431 Veronica chamaedrys L. 75431 30423 Scrophulariaceae Véronique petit-chêne plantes à fleurs bleues
Vesce des haies 71787 Vicia sepium L. 71787 3266 Fabaceae Vesce des haies plantes à fleurs bleues
Vipérine commune 23559 Echium vulgare L. 23559 9898 Boraginaceae Vipérine commune plantes à fleurs bleues
Benoîte des villes 30154 Geum urbanum L. 30154 4758 Rosaceae Benoîte des villes plantes à fleurs jaunes
Chélidoine grande-éclaire 16703 Chelidonium majus L. 16703 4026 Papaveraceae Chélidoine grande-éclaire plantes à fleurs jaunes
Chou colza 10308 Brassica napus L. 10308 1556 Brassicaceae Chou colza plantes à fleurs jaunes
Diplotaxis à feuilles étroites 22660 Diplotaxis tenuifolia (L.) DC. 22660 1633 Brassicaceae Diplotaxis à feuilles étroites plantes à fleurs jaunes
Fenouil commun 27986 Foeniculum vulgare Mill. 27986 180 Apiaceae Fenouil commun plantes à fleurs jaunes
Fraisier de Duchesne 23328 Duchesnea indica (Andrews) Focke 23328 4738 Rosaceae Fraisier de Duchesne plantes à fleurs jaunes
Giroflée des murailles 25436 Erysimum cheiri (L.) Crantz 25436 1611 Brassicaceae Giroflée des murailles plantes à fleurs jaunes
Linaire commune 39331 Linaria vulgaris Mill. 39331 5377 Scrophulariaceae Linaire commune plantes à fleurs jaunes
Lotier corniculé 39988 Lotus corniculatus L. 39988 2988 Fabaceae Lotier corniculé plantes à fleurs jaunes
Luzerne d'Arabie 41184 Medicago arabica (L.) Huds. 41184 3014 Fabaceae Luzerne d'Arabie plantes à fleurs jaunes
Luzerne lupuline 41325 Medicago lupulina L. 41325 3029 Fabaceae Luzerne lupuline plantes à fleurs jaunes
Mélilot officinal 41839 Melilotus officinalis Lam. 41839 3060 Fabaceae Mélilot officinal plantes à fleurs jaunes
Millepertuis perforé 35348 Hypericum perforatum L. 35348 3494 Hypericaceae Millepertuis perforé plantes à fleurs jaunes
Moutarde des champs 75386 Sinapis arvensis L. 75386 30378 Brassicaceae Moutarde des champs plantes à fleurs jaunes
Muflier gueule-de-loup 5474 Antirrhinum majus L. 5474 8631 Scrophulariaceae Muflier gueule-de-loup plantes à fleurs jaunes
Onagre bisanuelle 44495 Oenothera biennis L. 44495 3914 Onagraceae Onagre bisanuelle plantes à fleurs jaunes
Orpin âcre 75358 Sedum acre L. 75358 30350 Crassulaceae Orpin âcre plantes à fleurs jaunes
Oxalis corniculée 47119 Oxalis corniculata L. 47119 4010 Oxalidaceae Oxalis corniculée plantes à fleurs jaunes
Oxalis des fontaines 47141 Oxalis fontana Bunge 47141 4017 Oxalidaceae Oxalis des fontaines plantes à fleurs jaunes
Panais cultivé 48097 Pastinaca sativa L. 48097 237 Apiaceae Panais cultivé plantes à fleurs jaunes
Potentille rampante 52829 Potentilla reptans L. 52829 4818 Rosaceae Potentille rampante plantes à fleurs jaunes
Pourpier maraîcher 52102 Portulaca oleracea L. 52102 4300 Portulacaceae Pourpier maraîcher plantes à fleurs jaunes
Renoncule âcre 54682 Ranunculus acris L. 54682 4490 Ranunculaceae Renoncule âcre plantes à fleurs jaunes
Renoncule bulbeuse 54838 Ranunculus bulbosus L. 54838 4502 Ranunculaceae Renoncule bulbeuse plantes à fleurs jaunes
Renoncule rampante 55340 Ranunculus repens L. 55340 4561 Ranunculaceae Renoncule rampante plantes à fleurs jaunes
Réséda jaune 75322 Reseda lutea L. 75322 30314 Resedaceae Réséda jaune plantes à fleurs jaunes
Sisymbre officinal 64674 Sisymbrium officinale (L.) Scop. 64674 14546 Brassicaceae Sisymbre officinal plantes à fleurs jaunes
Sisymbre vélaret 64651 Sisymbrium irio L. 64651 1803 Brassicaceae Sisymbre vélaret plantes à fleurs jaunes
Trèfle douteux 69085 Trifolium dubium Sibth. 69085 3152 Fabaceae Trèfle douteux plantes à fleurs jaunes
Trèfle jaune 75495 Trifolium campestre Schreb. 75495 30487 Fabaceae Trèfle jaune plantes à fleurs jaunes
Alcée rose-trémière 2451 Alcea rosea L. 2451 3801 Malvaceae Alcée rose-trémière plantes à fleurs roses
Belle-de-nuit commune 42698 Mirabilis jalapa L. 42698 3865 Nyctaginaceae Belle-de-nuit commune plantes à fleurs roses
Cardère à foulon 22678 Dipsacus fullonum L. 22678 2584 Dipsacaceae Cardère à foulon plantes à fleurs roses
Chardon à capitules denses 75026 Carduus pycnocephalus L. 75026 30018 Asteraceae Chardon à capitules denses plantes à fleurs roses
Epilobe à quatre angles 24336 Epilobium tetragonum L. 24336 9924 Onagraceae Epilobe à quatre angles plantes à fleurs roses
Érodium à feuilles de cigüe 25064 Erodium cicutarium (L.) L'Hér. 25064 9954 Geraniaceae Érodium à feuilles de cigüe plantes à fleurs roses
Érodium à feuilles de mauve 75116 Erodium malacoides (L.) L'Hér. 75116 30108 Geraniaceae Érodium à feuilles de mauve plantes à fleurs roses
Eupatoire chanvrine 25746 Eupatorium cannabinum L. 25746 786 Asteraceae Eupatoire chanvrine plantes à fleurs roses
Fumeterre officinale 28525 Fumaria officinalis L. 28525 3314 Papaveraceae Fumeterre officinale plantes à fleurs roses
Géranium à feuilles découpées 29941 Geranium dissectum L. 29941 3420 Geraniaceae Géranium à feuilles découpées plantes à fleurs roses
Géranium à feuilles molles 75468 Geranium molle L. 75468 30460 Geraniaceae Géranium à feuilles molles plantes à fleurs roses
Géranium à feuilles rondes 30056 Geranium rotundifolium L. 30056 3438 Geraniaceae Géranium à feuilles rondes plantes à fleurs roses
Géranium herbe-à-Robert 30049 Geranium robertianum subsp. robertianum 30049 10265 Geraniaceae Géranium herbe-à-Robert plantes à fleurs roses
Impatiente glanduleuse 35713 Impatiens glandulifera Royle 35713 1307 Balsaminaceae Impatiente glanduleuse plantes à fleurs roses
Lamier à feuilles embrassantes 75206 Lamium amplexicaule L. 75206 30198 Lamiaceae Lamier à feuilles embrassantes plantes à fleurs roses
Lamier pourpre 37538 Lamium purpureum L. 37538 3568 Lamiaceae Lamier pourpre plantes à fleurs roses
Liseron des champs 75060 Convolvulus arvensis L. 75060 30052 Convolvulaceae Liseron des champs plantes à fleurs roses
Salicaire rouge 40631 Lythrum salicaria L. 40631 3792 Lythraceae Salicaire rouge plantes à fleurs roses
Saponaire officinale 60403 Saponaria officinalis L. 60403 2178 Caryophyllaceae Saponaire officinale plantes à fleurs roses
Shérardie des champs 63722 Sherardia arvensis L. 63722 14514 Rubiaceae Shérardie des champs plantes à fleurs roses
Trèfle des près 69291 Trifolium pratense L. 69291 14832 Fabaceae Trèfle des près plantes à fleurs roses
Vesce cultivée 71760 Vicia sativa L. 71760 14908 Fabaceae Vesce cultivée plantes à fleurs roses
Centranthe lilas-d'Espagne 75042 Centranthus ruber (L.) DC. 75042 30034 Valerianaceae Centranthe lilas-d'Espagne plantes à fleurs rouges
Mouron des champs 101468 Lysimachia arvensis (L.) U.Manns & Anderb. 101468 8601 Primulacea Mouron des champs plantes à fleurs rouges
Pavot coquelicot 75277 Papaver rhoeas L. 75277 30269 Papaveraceae Pavot coquelicot plantes à fleurs rouges
Aphanès des champs 5600 Aphanes arvensis L. 5600 4700 Rosaceae Aphanès des champs plantes à fleurs vertes
Arum d'Italie 7024 Arum italicum Mill. 7024 8677 Araceae Arum d'Italie plantes à fleurs vertes
Bryone dioïque 11290 Bryonia dioica Jacq. 11290 2547 Cucurbitaceae Bryone dioïque plantes à fleurs vertes
Euphorbe des jardins 25996 Euphorbia peplus L. 25996 7570 Euphorbiaceae Euphorbe des jardins plantes à fleurs vertes
Euphorbe épurge 25941 Euphorbia lathyris L. 25941 2717 Euphorbiaceae Euphorbe épurge plantes à fleurs vertes
Euphorbe petit-cyprès 25823 Euphorbia cyparissias L. 25823 2692 Euphorbiaceae Euphorbe petit-cyprès plantes à fleurs vertes
Euphorbe réveille-matin 25914 Euphorbia helioscopia L. 25914 2710 Euphorbiaceae Euphorbe réveille-matin plantes à fleurs vertes
Euphorbe tachetée 25956 Euphorbia maculata L. 25956 2719 Euphorbiaceae Euphorbe tachetée plantes à fleurs vertes
Houblon grimpant 34958 Humulus lupulus L. 34958 1947 Cannabaceae Houblon grimpant plantes à fleurs vertes
Lierre grimpant 30892 Hedera helix L. 30892 329 Araliaceae Lierre grimpant plantes à fleurs vertes
Matricaire sans ligule 41027 Matricaria discoidea DC. 41027 1060 Asteraceae Matricaire sans ligule plantes à fleurs vertes
Vigne-vierge à cinq folioles 47997 Parthenocissus quinquefolia (L.) Planch. 47997 5769 Vitaceae Vigne-vierge à cinq folioles plantes à fleurs vertes
Bardane à petites têtes 6091 Arctium minus (Hill) Bernh. 6091 417 Asteraceae Bardane à petites têtes plantes à fleurs violettes
Brunelle commune 75307 Prunella vulgaris L. 75307 30299 Lamiaceae Brunelle commune plantes à fleurs violettes
Cirse commun 17870 Cirsium vulgare (Savi) Ten. 17870 691 Asteraceae Cirse commun plantes à fleurs violettes
Cirse des champs 17468 Cirsium arvense (L.) Scop. 17468 664 Asteraceae Cirse des champs plantes à fleurs violettes
Cymbalaire des murailles 75081 Cymbalaria muralis P.Gaertn. B.Mey. & Scherb. 75081 30073 Scrophulariaceae Cymbalaire des murailles plantes à fleurs violettes
Glécome lierre-terrestre 30252 Glechoma hederacea L. 30252 3549 Lamiaceae Glécome lierre-terrestre plantes à fleurs violettes
Luzerne cultivée 41470 Medicago sativa L. 41470 3041 Fabaceae Luzerne cultivée plantes à fleurs violettes
Mauve sylvestre 40893 Malva sylvestris L. 40893 3831 Malvaceae Mauve sylvestre plantes à fleurs violettes
Morelle douce-amère 64869 Solanum dulcamara L. 64869 5570 Solanaceae Morelle douce-amère plantes à fleurs violettes
Scabieuse des jardins 64813 Sixalix atropurpurea (L.) Greuter & Burdet 64813 14549 Dipsacaceae Scabieuse des jardins plantes à fleurs violettes
Violette odorante 72389 Viola odorata L. 72389 5746 Violaceae Violette odorante plantes à fleurs violettes
Agrostis stolonifère 1908 Agrostis stolonifera L. 1908 8558 Poaceae Agrostis stolonifère Graminées
Brome mou 10780 Bromus hordeaceus L. 10780 6698 Poaceae Brome mou Graminées
Brome stérile 11176 Bromus sterilis L. 11176 6720 Poaceae Brome stérile Graminées
Chiendent pied-de-poule 20551 Cynodon dactylon (L.) Pers. 20551 6750 Poaceae Chiendent pied-de-poule Graminées
Chiendent rampant 23913 Elytrigia repens (L.) Desv. ex Nevski 23913 9912 Poaceae Chiendent rampant Graminées
Dactyle aggloméré 21111 Dactylis glomerata L. 21111 6754 Poaceae Dactyle aggloméré Graminées
Digitaire sanguine 22486 Digitaria sanguinalis (L.) Scop. 22486 6780 Poaceae Digitaire sanguine Graminées
Echinochloé pied-de-coq 23376 Echinochloa crus-galli (L.) P.Beauv. 23376 9891 Poaceae Echinochloé pied-de-coq Graminées
Éragrostis mineure 24658 Eragrostis minor Host 24658 6817 Poaceae Éragrostis mineure Graminées
Faux millet 49724 Piptatherum miliaceum (L.) Coss. 49724 7069 Poaceae Faux millet Graminées
Houlque laineuse 34724 Holcus lanatus L. 34724 6947 Poaceae Houlque laineuse Graminées
Orge des rats 34857 Hordeum murinum L. 34857 6955 Poaceae Orge des rats Graminées
Pâturin annuel 50284 Poa annua L. 50284 7075 Poaceae Pâturin annuel Graminées
Ray-grass anglais 39692 Lolium perenne L. 39692 6983 Poaceae Ray-grass anglais Graminées
Rostraria à crête 57834 Rostraria cristata (L.) Tzvelev 57834 7117 Poaceae Rostraria à crête Graminées
Sétaire verticillée 63668 Setaria verticillata (L.) P.Beauv. 63668 7137 Poaceae Sétaire verticillée Graminées
Ailanthus altissima (Mill.) Swingle 2088 Ailanthus altissima (Mill.) Swingle 2088 5537 Simaroubaceae Ailanthus altissima (Mill.) Swingle arbres et arbustes
Crataegus monogyna Jacq. 19472 Crataegus monogyna Jacq. 19472 4721 Rosaceae Crataegus monogyna Jacq. arbres et arbustes
Alnus glutinosa (L.) Gaertn. 3318 Alnus glutinosa (L.) Gaertn. 3318 1321 Betulaceae Alnus glutinosa (L.) Gaertn. arbres et arbustes
Betula pendula Roth 9626 Betula pendula Roth 9626 1325 Betulaceae Betula pendula Roth arbres et arbustes
Buddleja davidii Franch. 11336 Buddleja davidii Franch. 11336 1837 Buddlejaceae Buddleja davidii Franch. arbres et arbustes
Cornus sanguinea L. 75064 Cornus sanguinea L. 75064 30056 Cornaceae Cornus sanguinea L. arbres et arbustes
Acer negundo L. 74932 Acer negundo L. 74932 29924 Aceraceae Acer negundo L. arbres et arbustes
Acer platanoides L. 74934 Acer platanoides L. 74934 29926 Aceraceae Acer platanoides L. arbres et arbustes
Ficus carica L. 75134 Ficus carica L. 75134 30126 Moraceae Ficus carica L. arbres et arbustes
Mahonia aquifolium (Pursh) Nutt. 40676 Mahonia aquifolium (Pursh) Nutt. 40676 1317 Berberidaceae Mahonia aquifolium (Pursh) Nutt. arbres et arbustes
Paulownia tomentosa (Thunb.) Steud. 48115 Paulownia tomentosa (Thunb.) Steud. 48115 5411 Scrophulariaceae Paulownia tomentosa (Thunb.) Steud. arbres et arbustes
Populus nigra L. 52030 Populus nigra L. 52030 5128 Salicaceae Populus nigra L. arbres et arbustes
Prunus spinosa L. 53652 Prunus spinosa L. 53652 4847 Rosaceae Prunus spinosa L. arbres et arbustes
Robinia pseudoacacia L. 56245 Robinia pseudoacacia L. 56245 3124 Fabaceae Robinia pseudoacacia L. arbres et arbustes
Sambucus nigra L. 60241 Sambucus nigra L. 60241 1968 Caprifoliaceae Sambucus nigra L. arbres et arbustes
Asplenium trichomanes L. 7728 Asplenium trichomanes L. 7728 7358 Aspleniaceae Asplenium trichomanes L. fougères et prêles
Asplenium ceterach L. 74978 Ceterach officinarum Willd. 77204 29970 Aspleniaceae Asplenium ceterach L. fougères et prêles
Asplenium ruta-muraria L. 7681 Asplenium ruta-muraria L. 7681 8688 Aspleniaceae Asplenium ruta-muraria L. fougères et prêles
Equisetum arvense L. 24488 Equisetum arvense L. 24488 7397 Equisetaceae Equisetum arvense L. fougères et prêles
Amaranthus deflexus L. 3944 Amaranthus deflexus L. 3944 39 Amaranthaceae Amaranthus deflexus L. plante à fleurs minuscules
Amaranthus retroflexus L. 4009 Amaranthus retroflexus L. 4009 49 Amaranthaceae Amaranthus retroflexus L. plante à fleurs minuscules
Ambrosia artemisiifolia L. 4066 Ambrosia artemisiifolia L. 4066 383 Asteraceae Ambrosia artemisiifolia L. plante à fleurs minuscules
Arabidopsis thaliana (L.) Heynh. 5767 Arabidopsis thaliana (L.) Heynh. 5767 1484 Brassicaceae Arabidopsis thaliana (L.) Heynh. plante à fleurs minuscules
Artemisia annua L. 6765 Artemisia annua L. 6765 430 Asteraceae Artemisia annua L. plante à fleurs minuscules
Artemisia vulgaris L. 6987 Artemisia vulgaris L. 6987 459 Asteraceae Artemisia vulgaris L. plante à fleurs minuscules
Artemisia verlotiorum Lamotte 6983 Artemisia verlotiorum Lamotte 6983 458 Asteraceae Artemisia verlotiorum Lamotte plante à fleurs minuscules
Atriplex prostrata Boucher ex DC. 8444 Atriplex prostrata Boucher ex DC. 8444 8712 Chenopodiaceae Atriplex prostrata Boucher ex DC. plante à fleurs minuscules
Atriplex patula L. 74991 Atriplex patula L. 74991 29983 Chenopodiaceae Atriplex patula L. plante à fleurs minuscules
Asparagus acutifolius L. 7214 Asparagus acutifolius L. 7214 6269 Asparagaceae Asparagus acutifolius L. plante à fleurs minuscules
Capsella bursa-pastoris (L.) Medik. 75016 Capsella bursa-pastoris (L.) Medik. 75016 30008 Brassicaceae Capsella bursa-pastoris (L.) Medik. plante à fleurs minuscules
Cardamine hirsuta L. 12878 Cardamine hirsuta L. 12878 1592 Brassicaceae Cardamine hirsuta L. plante à fleurs minuscules
Cerastium glomeratum Thuill. 15862 Cerastium glomeratum Thuill. 15862 2024 Caryophyllaceae Cerastium glomeratum Thuill. plante à fleurs minuscules
Cerastium fontanum Baumg. 15840 Cerastium fontanum Baumg. 15840 9277 Caryophyllaceae Cerastium fontanum Baumg. plante à fleurs minuscules
Chenopodium album L. 16741 Chenopodium album L. 16741 2335 Chenopodiaceae Chenopodium album L. plante à fleurs minuscules
Chenopodium murale L. 16847 Chenopodium murale L. 16847 2353 Chenopodiaceae Chenopodium murale L. plante à fleurs minuscules
Galium aparine L. 28896 Galium aparine L. 28896 5037 Rubiaceae Galium aparine L. plante à fleurs minuscules
Galium mollugo L. 29078 Galium mollugo L. 29078 5057 Rubiaceae Galium mollugo L. plante à fleurs minuscules
Lycopus europaeus L. 40533 Lycopus europaeus L. 40533 3576 Lamiaceae Lycopus europaeus L. plante à fleurs minuscules
Mercurialis annua L. 42320 Mercurialis annua L. 42320 2751 Euphorbiaceae Mercurialis annua L. plante à fleurs minuscules
Urtica urens L. 70431 Urtica urens L. 70431 5650 Urticaceae Urtica urens L. plante à fleurs minuscules
Urtica dioica L. 70396 Urtica dioica L. 70396 14875 Urticaceae Urtica dioica L. plante à fleurs minuscules
Parietaria judaica L. 47921 Parietaria judaica L. 47921 5641 Urticaceae Parietaria judaica L. plante à fleurs minuscules
Lepidium virginicum L. 38574 Lepidium virginicum L. 38574 1743 Brassicaceae Lepidium virginicum L. plante à fleurs minuscules
Persicaria maculosa Gray 48340 Polygonum persicaria L. 51630 4236 Polygonaceae Persicaria maculosa Gray plante à fleurs minuscules
Sanguisorba minor Scop. 60289 Sanguisorba minor Scop. 60289 4976 Rosaceae Sanguisorba minor Scop. plante à fleurs minuscules
Plantago coronopus L. 49875 Plantago coronopus L. 49875 4088 Plantaginaceae Plantago coronopus L. plante à fleurs minuscules
Plantago lanceolata L. 49948 Plantago lanceolata L. 49948 4094 Plantaginaceae Plantago lanceolata L. plante à fleurs minuscules
Plantago major L. 49976 Plantago major L. 49976 4096 Plantaginaceae Plantago major L. plante à fleurs minuscules
Plantago sempervirens Crantz 50068 Plantago sempervirens Crantz 50068 4105 Plantaginaceae Plantago sempervirens Crantz plante à fleurs minuscules
Polycarpon tetraphyllum (L.) L. 51112 Polycarpon tetraphyllum (L.) L. 51112 13356 Caryophyllaceae Polycarpon tetraphyllum (L.) L. plante à fleurs minuscules
Polygonum aviculare L. 51363 Polygonum aviculare L. 51363 4224 Polygonaceae Polygonum aviculare L. plante à fleurs minuscules
Fallopia convolvulus (L.) Á.Löve 26474 Fallopia convolvulus (L.) Á.Löve 26474 4218 Polygonaceae Fallopia convolvulus (L.) Á.Löve plante à fleurs minuscules
Rumex obtusifolius L. 58812 Rumex obtusifolius L. 58812 4274 Polygonaceae Rumex obtusifolius L. plante à fleurs minuscules
Rumex crispus L. 58698 Rumex crispus L. 58698 4262 Polygonaceae Rumex crispus L. plante à fleurs minuscules
Sagina procumbens L. 59112 Sagina procumbens L. 59112 2167 Caryophyllaceae Sagina procumbens L. plante à fleurs minuscules
Sagina apetala Ard. 59056 Sagina apetala Ard. 59056 2161 Caryophyllaceae Sagina apetala Ard. plante à fleurs minuscules
Erigeron bonariensis L. 24874 Conyza bonariensis (L.) Cronquist 18835 699 Asteraceae Erigeron bonariensis L. plante à fleurs minuscules
Erigeron sumatrensis Retz. 24956 Conyza sumatrensis (Retz.) E.Walker 18851 702 Asteraceae Erigeron sumatrensis Retz. plante à fleurs minuscules
Erigeron canadensis L. 24880 Conyza canadensis (L.) Cronquist 18836 700 Asteraceae Erigeron canadensis L. plante à fleurs minuscules
Verbena officinalis L. 71022 Verbena officinalis L. 71022 5710 Verbenaceae Verbena officinalis L. plante à fleurs minuscules
Vicia hirsuta (L.) Gray 71616 Vicia hirsuta (L.) Gray 71616 3242 Fabaceae Vicia hirsuta (L.) Gray plante à fleurs minuscules
Andryala integrifolia L. 4699 Andryala integrifolia L. 4699 395 Asteraceae Andryala integrifolia L. plantes à capitules jaunes
Chondrilla juncea L. 17040 Chondrilla juncea L. 17040 647 Asteraceae Chondrilla juncea L. plantes à capitules jaunes
Crepis bursifolia L. 19627 Crepis bursifolia L. 19627 715 Asteraceae Crepis bursifolia L. plantes à capitules jaunes
Crepis vesicaria subsp. taraxacifolia (Thuill.) Thell. ex Schinz & R.Keller 19797 Crepis vesicaria subsp. taraxacifolia (Thuill.) Thell. ex Schinz & R.Keller 19797 739 Asteraceae Crepis vesicaria subsp. taraxacifolia (Thuill.) Thell. ex Schinz & R.Keller plantes à capitules jaunes
Crepis capillaris (L.) Wallr. 19630 Crepis capillaris (L.) Wallr. 19630 716 Asteraceae Crepis capillaris (L.) Wallr. plantes à capitules jaunes
Crepis sancta subsp. nemausensis (Vill.) Babc. 19756 Crepis sancta subsp. nemausensis (Vill.) Babc. 19756 734 Asteraceae Crepis sancta subsp. nemausensis (Vill.) Babc. plantes à capitules jaunes
Crepis foetida L. 19654 Crepis foetida L. 19654 719 Asteraceae Crepis foetida L. plantes à capitules jaunes
Crepis setosa Haller f. 19762 Crepis setosa Haller f. 19762 735 Asteraceae Crepis setosa Haller f. plantes à capitules jaunes
Jacobaea vulgaris Moench 36239 Senecio jacobaea subsp. jacobaea 62926 14453 Asteraceae Jacobaea vulgaris Moench plantes à capitules jaunes
Sonchus tenerrimus L. 65231 Sonchus tenerrimus L. 65231 1234 Asteraceae Sonchus tenerrimus L. plantes à capitules jaunes
Sonchus oleraceus L. 65205 Sonchus oleraceus L. 65205 1232 Asteraceae Sonchus oleraceus L. plantes à capitules jaunes
Sonchus asper (L.) Hill 65171 Sonchus asper (L.) Hill 65171 14563 Asteraceae Sonchus asper (L.) Hill plantes à capitules jaunes
Lactuca muralis (L.) G.Mey. 37338 Mycelis muralis (L.) Dumort. 43130 1066 Asteraceae Lactuca muralis (L.) G.Mey. plantes à capitules jaunes
Lactuca serriola L. 37373 Lactuca serriola L. 37373 991 Asteraceae Lactuca serriola L. plantes à capitules jaunes
Lapsana communis L. 37660 Lapsana communis L. 37660 997 Asteraceae Lapsana communis L. plantes à capitules jaunes
Picris hieracioides L. 49351 Picris hieracioides L. 49351 1102 Asteraceae Picris hieracioides L. plantes à capitules jaunes
Helminthotheca echioides (L.) Holub 31546 Picris echioides L. 49346 1101 Asteraceae Helminthotheca echioides (L.) Holub plantes à capitules jaunes
Taraxacum div. Sp. 87290 Taraxacum 87290 36245 Asteraceae Taraxacum div. Sp. plantes à capitules jaunes
Hypochaeris radicata L. 35439 Hypochaeris radicata L. 35439 967 Asteraceae Hypochaeris radicata L. plantes à capitules jaunes
Reichardia picroides (L.) Roth 55654 Reichardia picroides (L.) Roth 55654 1115 Asteraceae Reichardia picroides (L.) Roth plantes à capitules jaunes
Tragopogon pratensis L. 68767 Tragopogon pratensis L. 68767 14813 Asteraceae Tragopogon pratensis L. plantes à capitules jaunes
Senecio erucifolius L. 62849 Senecio erucifolius L. 62849 1166 Asteraceae Senecio erucifolius L. plantes à capitules jaunes
Senecio vulgaris L. 63096 Senecio vulgaris L. 63096 1203 Asteraceae Senecio vulgaris L. plantes à capitules jaunes
Senecio inaequidens DC. 62909 Senecio inaequidens DC. 62909 1176 Asteraceae Senecio inaequidens DC. plantes à capitules jaunes
Senecio viscosus L. 63095 Senecio viscosus L. 63095 1202 Asteraceae Senecio viscosus L. plantes à capitules jaunes
Solidago gigantea Aiton 65065 Solidago gigantea Aiton 65065 14560 Asteraceae Solidago gigantea Aiton plantes à capitules jaunes
Tussilago farfara L. 70113 Tussilago farfara L. 70113 1284 Asteraceae Tussilago farfara L. plantes à capitules jaunes
Urospermum dalechampii (L.) Scop. ex F.W.Schmidt 70381 Urospermum dalechampii (L.) Scop. ex F.W.Schmidt 70381 1286 Asteraceae Urospermum dalechampii (L.) Scop. ex F.W.Schmidt plantes à capitules jaunes
Achillea millefolium L. 365 Achillea millefolium L. 365 8527 Asteraceae Achillea millefolium L. plantes à fleurs blanches
Alliaria petiolata (M.Bieb.) Cavara & Grande 2913 Alliaria petiolata (M.Bieb.) Cavara & Grande 2913 1468 Brassicaceae Alliaria petiolata (M.Bieb.) Cavara & Grande plantes à fleurs blanches
Heracleum sphondylium L. 31656 Heracleum sphondylium L. 31656 187 Apiaceae Heracleum sphondylium L. plantes à fleurs blanches
Daucus carota L. 21674 Daucus carota L. 21674 151 Apiaceae Daucus carota L. plantes à fleurs blanches
Anthriscus sylvestris (L.) Hoffm. 5290 Anthriscus sylvestris (L.) Hoffm. 5290 8626 Apiaceae Anthriscus sylvestris (L.) Hoffm. plantes à fleurs blanches
Chaerophyllum temulum L. 16354 Chaerophyllum temulum L. 16354 140 Apiaceae Chaerophyllum temulum L. plantes à fleurs blanches
Clematis vitalba L. 18235 Clematis vitalba L. 18235 4436 Ranunculaceae Clematis vitalba L. plantes à fleurs blanches
Datura stramonium L. 21654 Datura stramonium L. 21654 5544 Solanaceae Datura stramonium L. plantes à fleurs blanches
Diplotaxis erucoides (L.) DC. 75095 Diplotaxis erucoides (L.) DC. 75095 30087 Brassicaceae Diplotaxis erucoides (L.) DC. plantes à fleurs blanches
Draba verna L. 22994 Erophila verna (L.) Chevall. 25208 1653 Brassicaceae Draba verna L. plantes à fleurs blanches
Fumaria capreolata L. 75465 Fumaria capreolata L. 75465 30457 Papaveraceae Fumaria capreolata L. plantes à fleurs blanches
Lamium album L. 37472 Lamium album L. 37472 3557 Lamiaceae Lamium album L. plantes à fleurs blanches
Chaenorrhinum minus (L.) Lange 16280 Chaenorrhinum minus (L.) Lange 16280 5311 Scrophulariaceae Chaenorrhinum minus (L.) Lange plantes à fleurs blanches
Calystegia sepium (L.) R.Br. 12341 Calystegia sepium (L.) R.Br. 12341 2448 Convolvulaceae Calystegia sepium (L.) R.Br. plantes à fleurs blanches
Malva neglecta Wallr. 40856 Malva neglecta Wallr. 40856 3827 Malvaceae Malva neglecta Wallr. plantes à fleurs blanches
Melilotus albus Medik. 41764 Melilotus albus Medik. 41764 3053 Fabaceae Melilotus albus Medik. plantes à fleurs blanches
Umbilicus rupestris (Salisb.) Dandy 70339 Umbilicus rupestris (Salisb.) Dandy 70339 2545 Crassulaceae Umbilicus rupestris (Salisb.) Dandy plantes à fleurs blanches
Sedum album L. 62141 Sedum album L. 62141 2489 Crassulaceae Sedum album L. plantes à fleurs blanches
Lepidium draba L. 38489 Lepidium draba L. 38489 1609 Brassicaceae Lepidium draba L. plantes à fleurs blanches
Viola arvensis Murray 72065 Viola arvensis Murray 72065 14914 Violaceae Viola arvensis Murray plantes à fleurs blanches
Phytolacca americana L. 49293 Phytolacca americana L. 49293 4061 Phytolaccaceae Phytolacca americana L. plantes à fleurs blanches
Reynoutria japonica Houtt. 55763 Reynoutria japonica Houtt. 55763 4244 Polygonaceae Reynoutria japonica Houtt. plantes à fleurs blanches
Reseda alba L. 55658 Reseda alba L. 55658 4601 Resedaceae Reseda alba L. plantes à fleurs blanches
Rubus div. sp. 77191 Rubus 77191 31181 Rosaceae Rubus div. sp. plantes à fleurs blanches
Arenaria serpyllifolia L. 6292 Arenaria serpyllifolia L. 6292 8642 Caryophyllaceae Arenaria serpyllifolia L. plantes à fleurs blanches
Saxifraga tridactylites L. 61042 Saxifraga tridactylites L. 61042 5290 Saxifragaceae Saxifraga tridactylites L. plantes à fleurs blanches
Silene latifolia subsp. alba (Mill.) Greuter & Burdet 64192 Silene latifolia subsp. alba (Mill.) Greuter & Burdet 64192 2218 Caryophyllaceae Silene latifolia subsp. alba (Mill.) Greuter & Burdet plantes à fleurs blanches
Silene vulgaris (Moench) Garcke 64419 Silene vulgaris (Moench) Garcke 64419 14537 Caryophyllaceae Silene vulgaris (Moench) Garcke plantes à fleurs blanches
Stellaria media (L.) Vill. 75396 Stellaria media (L.) Vill. 75396 30388 Caryophyllaceae Stellaria media (L.) Vill. plantes à fleurs blanches
Torilis japonica (Houtt.) DC. 68580 Torilis japonica (Houtt.) DC. 68580 312 Apiaceae Torilis japonica (Houtt.) DC. plantes à fleurs blanches
Trifolium arvense L. 68989 Trifolium arvense L. 68989 14822 Fabaceae Trifolium arvense L. plantes à fleurs blanches
Trifolium repens L. 69341 Trifolium repens L. 69341 14834 Fabaceae Trifolium repens L. plantes à fleurs blanches
Veronica cymbalaria Bodard 71145 Veronica cymbalaria Bodard 71145 5506 Scrophulariaceae Veronica cymbalaria Bodard plantes à fleurs blanches
Aster squamatus (Spreng.) Hieron. 7909 Aster squamatus (Spreng.) Hieron. 7909 478 Asteraceae Aster squamatus (Spreng.) Hieron. plantes à fleurs blanches à coeur jaune
Galinsoga parviflora Cav. 28869 Galinsoga parviflora Cav. 28869 800 Asteraceae Galinsoga parviflora Cav. plantes à fleurs blanches à coeur jaune
Galinsoga quadriradiata Ruiz & Pav. 28871 Galinsoga quadriradiata Ruiz & Pav. 28871 801 Asteraceae Galinsoga quadriradiata Ruiz & Pav. plantes à fleurs blanches à coeur jaune
Matricaria recutita L. 41057 Matricaria recutita L. 41057 1063 Asteraceae Matricaria recutita L. plantes à fleurs blanches à coeur jaune
Tripleurospermum inodorum Sch.Bip. 69569 Matricaria perforata Mérat 41054 1062 Asteraceae Tripleurospermum inodorum Sch.Bip. plantes à fleurs blanches à coeur jaune
Solanum nigrum L. 64930 Solanum nigrum L. 64930 14552 Solanaceae Solanum nigrum L. plantes à fleurs blanches à coeur jaune
Bellis perennis L. 9408 Bellis perennis L. 9408 493 Asteraceae Bellis perennis L. plantes à fleurs blanches à coeur jaune
Borago officinalis L. 9966 Borago officinalis L. 9966 1350 Boraginaceae Borago officinalis L. plantes à fleurs bleues
Ajuga reptans L. 2407 Ajuga reptans L. 2407 3519 Lamiaceae Ajuga reptans L. plantes à fleurs bleues
Cichorium intybus L. 17314 Cichorium intybus L. 17314 661 Asteraceae Cichorium intybus L. plantes à fleurs bleues
Myosotis arvensis Hill 43173 Myosotis arvensis Hill 43173 1400 Boraginaceae Myosotis arvensis Hill plantes à fleurs bleues
Passiflora caerulea L. 48083 Passiflora caerulea L. 48083 4059 Passifloraceae Passiflora caerulea L. plantes à fleurs bleues
Veronica hederifolia L. 71191 Veronica hederifolia L. 71191 14890 Scrophulariaceae Veronica hederifolia L. plantes à fleurs bleues
Veronica serpyllifolia L. 71348 Veronica serpyllifolia L. 71348 14893 Scrophulariaceae Veronica serpyllifolia L. plantes à fleurs bleues
Veronica persica Poir. 71290 Veronica persica Poir. 71290 5522 Scrophulariaceae Veronica persica Poir. plantes à fleurs bleues
Veronica arvensis L. 71090 Veronica arvensis L. 71090 5496 Scrophulariaceae Veronica arvensis L. plantes à fleurs bleues
Veronica chamaedrys L. 75431 Veronica chamaedrys L. 75431 30423 Scrophulariaceae Veronica chamaedrys L. plantes à fleurs bleues
Vicia sepium L. 71787 Vicia sepium L. 71787 3266 Fabaceae Vicia sepium L. plantes à fleurs bleues
Echium vulgare L. 23559 Echium vulgare L. 23559 9898 Boraginaceae Echium vulgare L. plantes à fleurs bleues
Geum urbanum L. 30154 Geum urbanum L. 30154 4758 Rosaceae Geum urbanum L. plantes à fleurs jaunes
Chelidonium majus L. 16703 Chelidonium majus L. 16703 4026 Papaveraceae Chelidonium majus L. plantes à fleurs jaunes
Brassica napus L. 10308 Brassica napus L. 10308 1556 Brassicaceae Brassica napus L. plantes à fleurs jaunes
Diplotaxis tenuifolia (L.) DC. 22660 Diplotaxis tenuifolia (L.) DC. 22660 1633 Brassicaceae Diplotaxis tenuifolia (L.) DC. plantes à fleurs jaunes
Foeniculum vulgare Mill. 27986 Foeniculum vulgare Mill. 27986 180 Apiaceae Foeniculum vulgare Mill. plantes à fleurs jaunes
Duchesnea indica (Andrews) Focke 23328 Duchesnea indica (Andrews) Focke 23328 4738 Rosaceae Duchesnea indica (Andrews) Focke plantes à fleurs jaunes
Erysimum cheiri (L.) Crantz 25436 Erysimum cheiri (L.) Crantz 25436 1611 Brassicaceae Erysimum cheiri (L.) Crantz plantes à fleurs jaunes
Linaria vulgaris Mill. 39331 Linaria vulgaris Mill. 39331 5377 Scrophulariaceae Linaria vulgaris Mill. plantes à fleurs jaunes
Lotus corniculatus L. 39988 Lotus corniculatus L. 39988 2988 Fabaceae Lotus corniculatus L. plantes à fleurs jaunes
Medicago arabica (L.) Huds. 41184 Medicago arabica (L.) Huds. 41184 3014 Fabaceae Medicago arabica (L.) Huds. plantes à fleurs jaunes
Medicago lupulina L. 41325 Medicago lupulina L. 41325 3029 Fabaceae Medicago lupulina L. plantes à fleurs jaunes
Melilotus officinalis Lam. 41839 Melilotus officinalis Lam. 41839 3060 Fabaceae Melilotus officinalis Lam. plantes à fleurs jaunes
Hypericum perforatum L. 35348 Hypericum perforatum L. 35348 3494 Hypericaceae Hypericum perforatum L. plantes à fleurs jaunes
Sinapis arvensis L. 75386 Sinapis arvensis L. 75386 30378 Brassicaceae Sinapis arvensis L. plantes à fleurs jaunes
Antirrhinum majus L. 5474 Antirrhinum majus L. 5474 8631 Scrophulariaceae Antirrhinum majus L. plantes à fleurs jaunes
Oenothera biennis L. 44495 Oenothera biennis L. 44495 3914 Onagraceae Oenothera biennis L. plantes à fleurs jaunes
Sedum acre L. 75358 Sedum acre L. 75358 30350 Crassulaceae Sedum acre L. plantes à fleurs jaunes
Oxalis corniculata L. 47119 Oxalis corniculata L. 47119 4010 Oxalidaceae Oxalis corniculata L. plantes à fleurs jaunes
Oxalis fontana Bunge 47141 Oxalis fontana Bunge 47141 4017 Oxalidaceae Oxalis fontana Bunge plantes à fleurs jaunes
Pastinaca sativa L. 48097 Pastinaca sativa L. 48097 237 Apiaceae Pastinaca sativa L. plantes à fleurs jaunes
Potentilla reptans L. 52829 Potentilla reptans L. 52829 4818 Rosaceae Potentilla reptans L. plantes à fleurs jaunes
Portulaca oleracea L. 52102 Portulaca oleracea L. 52102 4300 Portulacaceae Portulaca oleracea L. plantes à fleurs jaunes
Ranunculus acris L. 54682 Ranunculus acris L. 54682 4490 Ranunculaceae Ranunculus acris L. plantes à fleurs jaunes
Ranunculus bulbosus L. 54838 Ranunculus bulbosus L. 54838 4502 Ranunculaceae Ranunculus bulbosus L. plantes à fleurs jaunes
Ranunculus repens L. 55340 Ranunculus repens L. 55340 4561 Ranunculaceae Ranunculus repens L. plantes à fleurs jaunes
Reseda lutea L. 75322 Reseda lutea L. 75322 30314 Resedaceae Reseda lutea L. plantes à fleurs jaunes
Sisymbrium officinale (L.) Scop. 64674 Sisymbrium officinale (L.) Scop. 64674 14546 Brassicaceae Sisymbrium officinale (L.) Scop. plantes à fleurs jaunes
Sisymbrium irio L. 64651 Sisymbrium irio L. 64651 1803 Brassicaceae Sisymbrium irio L. plantes à fleurs jaunes
Trifolium dubium Sibth. 69085 Trifolium dubium Sibth. 69085 3152 Fabaceae Trifolium dubium Sibth. plantes à fleurs jaunes
Trifolium campestre Schreb. 75495 Trifolium campestre Schreb. 75495 30487 Fabaceae Trifolium campestre Schreb. plantes à fleurs jaunes
Alcea rosea L. 2451 Alcea rosea L. 2451 3801 Malvaceae Alcea rosea L. plantes à fleurs roses
Mirabilis jalapa L. 42698 Mirabilis jalapa L. 42698 3865 Nyctaginaceae Mirabilis jalapa L. plantes à fleurs roses
Dipsacus fullonum L. 22678 Dipsacus fullonum L. 22678 2584 Dipsacaceae Dipsacus fullonum L. plantes à fleurs roses
Carduus pycnocephalus L. 75026 Carduus pycnocephalus L. 75026 30018 Asteraceae Carduus pycnocephalus L. plantes à fleurs roses
Epilobium tetragonum L. 24336 Epilobium tetragonum L. 24336 9924 Onagraceae Epilobium tetragonum L. plantes à fleurs roses
Erodium cicutarium (L.) L'Hér. 25064 Erodium cicutarium (L.) L'Hér. 25064 9954 Geraniaceae Erodium cicutarium (L.) L'Hér. plantes à fleurs roses
Erodium malacoides (L.) L'Hér. 75116 Erodium malacoides (L.) L'Hér. 75116 30108 Geraniaceae Erodium malacoides (L.) L'Hér. plantes à fleurs roses
Eupatorium cannabinum L. 25746 Eupatorium cannabinum L. 25746 786 Asteraceae Eupatorium cannabinum L. plantes à fleurs roses
Fumaria officinalis L. 28525 Fumaria officinalis L. 28525 3314 Papaveraceae Fumaria officinalis L. plantes à fleurs roses
Geranium dissectum L. 29941 Geranium dissectum L. 29941 3420 Geraniaceae Geranium dissectum L. plantes à fleurs roses
Geranium molle L. 75468 Geranium molle L. 75468 30460 Geraniaceae Geranium molle L. plantes à fleurs roses
Geranium rotundifolium L. 30056 Geranium rotundifolium L. 30056 3438 Geraniaceae Geranium rotundifolium L. plantes à fleurs roses
Geranium robertianum subsp. robertianum 30049 Geranium robertianum subsp. robertianum 30049 10265 Geraniaceae Geranium robertianum subsp. robertianum plantes à fleurs roses
Impatiens glandulifera Royle 35713 Impatiens glandulifera Royle 35713 1307 Balsaminaceae Impatiens glandulifera Royle plantes à fleurs roses
Lamium amplexicaule L. 75206 Lamium amplexicaule L. 75206 30198 Lamiaceae Lamium amplexicaule L. plantes à fleurs roses
Lamium purpureum L. 37538 Lamium purpureum L. 37538 3568 Lamiaceae Lamium purpureum L. plantes à fleurs roses
Convolvulus arvensis L. 75060 Convolvulus arvensis L. 75060 30052 Convolvulaceae Convolvulus arvensis L. plantes à fleurs roses
Lythrum salicaria L. 40631 Lythrum salicaria L. 40631 3792 Lythraceae Lythrum salicaria L. plantes à fleurs roses
Saponaria officinalis L. 60403 Saponaria officinalis L. 60403 2178 Caryophyllaceae Saponaria officinalis L. plantes à fleurs roses
Sherardia arvensis L. 63722 Sherardia arvensis L. 63722 14514 Rubiaceae Sherardia arvensis L. plantes à fleurs roses
Trifolium pratense L. 69291 Trifolium pratense L. 69291 14832 Fabaceae Trifolium pratense L. plantes à fleurs roses
Vicia sativa L. 71760 Vicia sativa L. 71760 14908 Fabaceae Vicia sativa L. plantes à fleurs roses
Centranthus ruber (L.) DC. 75042 Centranthus ruber (L.) DC. 75042 30034 Valerianaceae Centranthus ruber (L.) DC. plantes à fleurs rouges
Lysimachia arvensis (L.) U.Manns & Anderb. 101468 Lysimachia arvensis (L.) U.Manns & Anderb. 101468 8601 Primulacea Lysimachia arvensis (L.) U.Manns & Anderb. plantes à fleurs rouges
Papaver rhoeas L. 75277 Papaver rhoeas L. 75277 30269 Papaveraceae Papaver rhoeas L. plantes à fleurs rouges
Aphanes arvensis L. 5600 Aphanes arvensis L. 5600 4700 Rosaceae Aphanes arvensis L. plantes à fleurs vertes
Arum italicum Mill. 7024 Arum italicum Mill. 7024 8677 Araceae Arum italicum Mill. plantes à fleurs vertes
Bryonia dioica Jacq. 11290 Bryonia dioica Jacq. 11290 2547 Cucurbitaceae Bryonia dioica Jacq. plantes à fleurs vertes
Euphorbia peplus L. 25996 Euphorbia peplus L. 25996 7570 Euphorbiaceae Euphorbia peplus L. plantes à fleurs vertes
Euphorbia lathyris L. 25941 Euphorbia lathyris L. 25941 2717 Euphorbiaceae Euphorbia lathyris L. plantes à fleurs vertes
Euphorbia cyparissias L. 25823 Euphorbia cyparissias L. 25823 2692 Euphorbiaceae Euphorbia cyparissias L. plantes à fleurs vertes
Euphorbia helioscopia L. 25914 Euphorbia helioscopia L. 25914 2710 Euphorbiaceae Euphorbia helioscopia L. plantes à fleurs vertes
Euphorbia maculata L. 25956 Euphorbia maculata L. 25956 2719 Euphorbiaceae Euphorbia maculata L. plantes à fleurs vertes
Humulus lupulus L. 34958 Humulus lupulus L. 34958 1947 Cannabaceae Humulus lupulus L. plantes à fleurs vertes
Hedera helix L. 30892 Hedera helix L. 30892 329 Araliaceae Hedera helix L. plantes à fleurs vertes
Matricaria discoidea DC. 41027 Matricaria discoidea DC. 41027 1060 Asteraceae Matricaria discoidea DC. plantes à fleurs vertes
Parthenocissus quinquefolia (L.) Planch. 47997 Parthenocissus quinquefolia (L.) Planch. 47997 5769 Vitaceae Parthenocissus quinquefolia (L.) Planch. plantes à fleurs vertes
Arctium minus (Hill) Bernh. 6091 Arctium minus (Hill) Bernh. 6091 417 Asteraceae Arctium minus (Hill) Bernh. plantes à fleurs violettes
Prunella vulgaris L. 75307 Prunella vulgaris L. 75307 30299 Lamiaceae Prunella vulgaris L. plantes à fleurs violettes
Cirsium vulgare (Savi) Ten. 17870 Cirsium vulgare (Savi) Ten. 17870 691 Asteraceae Cirsium vulgare (Savi) Ten. plantes à fleurs violettes
Cirsium arvense (L.) Scop. 17468 Cirsium arvense (L.) Scop. 17468 664 Asteraceae Cirsium arvense (L.) Scop. plantes à fleurs violettes
Cymbalaria muralis P.Gaertn. B.Mey. & Scherb. 75081 Cymbalaria muralis P.Gaertn. B.Mey. & Scherb. 75081 30073 Scrophulariaceae Cymbalaria muralis P.Gaertn. B.Mey. & Scherb. plantes à fleurs violettes
Glechoma hederacea L. 30252 Glechoma hederacea L. 30252 3549 Lamiaceae Glechoma hederacea L. plantes à fleurs violettes
Medicago sativa L. 41470 Medicago sativa L. 41470 3041 Fabaceae Medicago sativa L. plantes à fleurs violettes
Malva sylvestris L. 40893 Malva sylvestris L. 40893 3831 Malvaceae Malva sylvestris L. plantes à fleurs violettes
Solanum dulcamara L. 64869 Solanum dulcamara L. 64869 5570 Solanaceae Solanum dulcamara L. plantes à fleurs violettes
Sixalix atropurpurea (L.) Greuter & Burdet 64813 Sixalix atropurpurea (L.) Greuter & Burdet 64813 14549 Dipsacaceae Sixalix atropurpurea (L.) Greuter & Burdet plantes à fleurs violettes
Viola odorata L. 72389 Viola odorata L. 72389 5746 Violaceae Viola odorata L. plantes à fleurs violettes
Agrostis stolonifera L. 1908 Agrostis stolonifera L. 1908 8558 Poaceae Agrostis stolonifera L. Graminées
Bromus hordeaceus L. 10780 Bromus hordeaceus L. 10780 6698 Poaceae Bromus hordeaceus L. Graminées
Bromus sterilis L. 11176 Bromus sterilis L. 11176 6720 Poaceae Bromus sterilis L. Graminées
Cynodon dactylon (L.) Pers. 20551 Cynodon dactylon (L.) Pers. 20551 6750 Poaceae Cynodon dactylon (L.) Pers. Graminées
Elytrigia repens (L.) Desv. ex Nevski 23913 Elytrigia repens (L.) Desv. ex Nevski 23913 9912 Poaceae Elytrigia repens (L.) Desv. ex Nevski Graminées
Dactylis glomerata L. 21111 Dactylis glomerata L. 21111 6754 Poaceae Dactylis glomerata L. Graminées
Digitaria sanguinalis (L.) Scop. 22486 Digitaria sanguinalis (L.) Scop. 22486 6780 Poaceae Digitaria sanguinalis (L.) Scop. Graminées
Echinochloa crus-galli (L.) P.Beauv. 23376 Echinochloa crus-galli (L.) P.Beauv. 23376 9891 Poaceae Echinochloa crus-galli (L.) P.Beauv. Graminées
Eragrostis minor Host 24658 Eragrostis minor Host 24658 6817 Poaceae Eragrostis minor Host Graminées
Piptatherum miliaceum (L.) Coss. 49724 Piptatherum miliaceum (L.) Coss. 49724 7069 Poaceae Piptatherum miliaceum (L.) Coss. Graminées
Holcus lanatus L. 34724 Holcus lanatus L. 34724 6947 Poaceae Holcus lanatus L. Graminées
Hordeum murinum L. 34857 Hordeum murinum L. 34857 6955 Poaceae Hordeum murinum L. Graminées
Poa annua L. 50284 Poa annua L. 50284 7075 Poaceae Poa annua L. Graminées
Lolium perenne L. 39692 Lolium perenne L. 39692 6983 Poaceae Lolium perenne L. Graminées
Rostraria cristata (L.) Tzvelev 57834 Rostraria cristata (L.) Tzvelev 57834 7117 Poaceae Rostraria cristata (L.) Tzvelev Graminées
Setaria verticillata (L.) P.Beauv. 63668 Setaria verticillata (L.) P.Beauv. 63668 7137 Poaceae Setaria verticillata (L.) P.Beauv. Graminées
Coquelicot 75277 Papaver rhoeas L. 75277 30269 Papaveraceae Coquelicot plantes à fleurs rouges
Plante de type pissenlit (capitules jaunes non déterminée) 100897 Asteracea 100897 36470 Asteraceae Plante de type pissenlit (capitules jaunes non déterminée) plantes à capitules jaunes
Plante de type carotte (ombelle blanche ou jaune non déterminée) 100948 Apiaceae 100948 36521 Apiaceae Plante de type carotte (ombelle blanche ou jaune non déterminée)
Graminée non déterminée 100898 Poaceae 100898 36471 Poaceae Graminée non déterminée Graminées
Autre(s) espèce(s) (écrire le/les nom(s) dans les notes) 87491 Tracheophytes 87491 36446 Autre(s) espèce(s) (écrire le/les nom(s) dans les notes)
Crucifère non déterminée (4 pétales jaunes ou blancs, disposés en croix) 100902 Brassicaceae 100902 36475 Brassicaceae Crucifère non déterminée (4 pétales jaunes ou blancs, disposés en croix)
Colza 10308 Brassica napus L. 10308 1556 Brassicaceae Colza plantes à fleurs jaunes
/tags/widget-origin-mobile/modules/saisie/configurations/biodiversite34_taxons.tsv
New file
0,0 → 1,45
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
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
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
Robinia pseudoacacia L. 56245 Robinia pseudoacacia L. 56245 3124 Fabaceae Robinier faux acacia Acacia
Ailanthus altissima (Mill.) Swingle 2088 Ailanthus altissima (Mill.) Swingle 2088 5537 Simaroubaceae Ailante Ailante glanduleux, Faux Vernis du Japon, Vernis de Chine
Gentiana pneumonanthe L. 29803 Gentiana pneumonanthe L. 29803 3369 Gentianaceae Gentiane pneumonanthe Gentiane des marais
/tags/widget-origin-mobile/modules/saisie/configurations/defaut.ini
New file
0,0 → 1,5
titre = "Saisie rapide"
 
[referentiels]
bdtfx.version = 1.01
bdtxa.version = 1.00
/tags/widget-origin-mobile/modules/saisie/configurations
New file
Property changes:
Added: svn:ignore
+sauvages_taxons_ancien.tsv
/tags/widget-origin-mobile/modules/saisie/squelettes/mobile/js/mobile.js
New file
0,0 → 1,124
//+----------------------------------------------------------------------------------------------------------+
// Initialisation de Jquery mobile
$(document).bind("mobileinit", function(){
$.mobile.defaultPageTransition = "fade";
});
 
//+----------------------------------------------------------------------------------------------------------+
// Géolocalisation
var gps = navigator.geolocation;
 
$(document).ready(function() {
$('#geolocaliser').on('click', geolocaliser);
});
 
function geolocaliser(event) {
if (gps) {
navigator.geolocation.getCurrentPosition(surSuccesGeoloc, surErreurGeoloc);
} else {
var erreur = {code:'0', message:'Géolocalisation non supportée par le navigateur'};
surErreurGeoloc(erreur);
}
event.stopPropagation();
event.preventDefault();
}
function surSuccesGeoloc(position){
if (position){
var lat = position.coords.latitude;
var lng = position.coords.longitude;
$('#lat').val(lat);
$('#lng').val(lng);
}
}
function surErreurGeoloc(error){
alert("Echec de la géolocalisation, code: " + error.code + " message: "+ error.message);
}
//+----------------------------------------------------------------------------------------------------------+
// Local Storage
var bdd = window.localStorage;
bdd.clear();
$(document).ready(function() {
$('#sauver-obs').on('click', ajouterObs);
$('body').on('pageshow', '#liste', chargerListeObs);
});
 
function ajouterObs(event) {
var obs = {num:0, date:'', lat:'', lng:'', nom:''};
obs.num = (bdd.length + 1);
obs.date = $('#date').val();
obs.lat = $('#lat').val();
obs.lng = $('#lng').val();
obs.nom = $('#nom').val();
var cle = 'obs'+obs.num;
var val = JSON.stringify(obs);
bdd.setItem(cle, val);
var txt = 'Observation n°'+obs.num+'/'+bdd.length+' créée';
$('#obs-saisie-infos').html('<p class="reponse ui-btn-inner ui-btn-corner-all">'+txt+'</p>')
.fadeIn("slow")
.delay(1600)
.fadeOut("slow");
event.stopPropagation();
event.preventDefault();
}
 
function supprimerObs(event) {
var cle = 'obs'+obs.num;
bdd.removeItem(cle);
var txt = 'Observation n°'+obs.num+' supprimée';
$('#obs-saisie-infos').html('<p class="reponse ui-btn-inner ui-btn-corner-all">'+txt+'</p>')
.fadeIn("slow")
.delay(1600)
.fadeOut("slow");
event.stopPropagation();
event.preventDefault();
}
 
function chargerListeObs() {
$('#liste-obs').empty();
var nbre = bdd.length;
for (var i = 0; i < nbre; i++) {
var cle = 'obs'+(i+1);
var obs = JSON.parse(bdd.getItem(cle));
$('#liste-obs').append(
'<li>'+
'<img src="http://www.tela-botanica.org/widget-test:cel:modules/saisie/squelettes/defaut/img/icones/pasdephoto.png" />'+
'<a href="#'+cle+'" data-split-icon="next" data-split-theme="a" title="Voir la fiche" data-obs-num="'+obs.num+'">'+
'<strong>'+obs.nom+'</strong> observé le '+obs.date+' à lat : '+obs.lat+' lng : '+obs.lng+
'</a>'+
'<a href="#" title="Supprimer l\'observation" data-obs-num="'+obs.num+'">'+
'Supprimer'+
'</a>'+
'</li>'
);
}
$('#liste-obs').listview('refresh');
}
 
 
//+----------------------------------------------------------------------------------------------------------+
// Manifest Cache
var appCache = window.applicationCache;
 
$(document).ready(function() {
appCache.addEventListener('updateready', function() {
alert('Mise à jour :'+appCache.status);
});
if (appCache.status === appCache.UPDATEREADY) {
surMiseAJourCache();
}
});
 
function surMiseAJourCache() {
// Browser downloaded a new app cache.
// Swap it in and reload the page to get the new hotness.
appCache.swapCache();
if (confirm('A new version of this site is available. Load it?')) {
window.location.reload();
}
}
/tags/widget-origin-mobile/modules/saisie/squelettes/mobile/css/mobile.css
New file
0,0 → 1,30
@CHARSET "UTF-8";
/*+--------------------------------------------------------------------------------------------------------+*/
/* Balises */
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Générique */
.ui-icon-pencil{
background:url(http://www.tela-botanica.org/commun/icones/glyphish/187-pencil-white.png) no-repeat;
}
.ui-icon-notepad{
background:url(http://www.tela-botanica.org/commun/icones/glyphish/179-notepad-white.png) no-repeat;
}
.ui-icon-cloud{
background:url(http://www.tela-botanica.org/commun/icones/glyphish/56-cloud-white.png) no-repeat;
}
.ui-icon-radar{
background:url(http://www.tela-botanica.org/commun/icones/glyphish/73-radar-white.png) no-repeat;
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* Formulaire à l'application */
#conteneur_reponse{
display:none;
}
.reponse{
background-color:#D5F2B6;
padding:20px;
text-align:center;
font-size:1.2 em;
font-weight:bold;
}
/tags/widget-origin-mobile/modules/saisie/squelettes/mobile/mobile.tpl.html
New file
0,0 → 1,162
<?php
$annee = date('Y');
$aujourdhui = date('d/m/Y');
?>
<!DOCTYPE html>
<html lang="fr" manifest="<?=$url_base?>modules/saisie/squelettes/mobile/mobile.appcache">
<head>
<title>CEL Mobile</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="Jean-Pascal MILCENT, Mathilde SALTHUN-LASSALLE" />
<meta name="keywords" content="Tela Botanica, CEL, mobile" />
<meta name="description" content="Widget de saisie du CEL pour smartphone" />
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="http://www.tela-botanica.org/favicon.ico" />
<!-- Viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS -->
<link rel="stylesheet" href="http://www.tela-botanica.org/commun/jquery/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css" />
<link href="<?=$url_base?>modules/saisie/squelettes/mobile/css/<?=isset($_GET['style']) ? $_GET['style'] : 'mobile'?>.css" rel="stylesheet" type="text/css" media="screen" />
<!-- Javascript -->
<script src="http://www.tela-botanica.org/commun/jquery/1.7.1/jquery-1.7.1.min.js"></script>
<!-- Javascript : appli saisie -->
<script type="text/javascript">
//<![CDATA[
// La présence du parametre 'debug' dans l'URL enclenche le dégogage
var DEBUG = <?=isset($_GET['debug']) ? 'true' : 'false'?>;
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/saisie/squelettes/mobile/js/mobile.js"></script>
<!-- Javascript : Jquery Mobile -->
<script src="http://www.tela-botanica.org/commun/jquery/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js"></script>
</head>
<body data-theme="b">
<div id="menu" data-role="page" data-add-back-btn="true" data-back-btn-text="Retour">
<div data-role="header">
<?php if($titre == 'defaut' ) { ?>
<h1>Accueil</h1>
<?php } else { ?>
<h1><?= $titre ?></h1>
<?php } ?>
</div>
<div data-role="content" data-theme="g">
<ul data-role="listview">
<li>
<img src="http://www.tela-botanica.org/commun/icones/glyphish/187-pencil.png" class="ui-li-icon"/>
<a href="#saisie" data-role="button">Saisir une observation</a>
</li>
<li>
<img src="http://www.tela-botanica.org/commun/icones/glyphish/179-notepad.png" class="ui-li-icon"/>
<a href="#liste" data-role="button">Voir mes observations</a>
</li>
<li>
<img src="http://www.tela-botanica.org/commun/icones/glyphish/56-cloud.png" class="ui-li-icon"/>
<a href="#transmission" data-role="button">Transmettre mes observations</a>
</li>
</ul>
</div>
<div data-role="footer" data-position="fixed">
<a href="#infos" data-role="button">Infos</a>
</div>
</div>
<div id="saisie" data-role="page">
<div data-role="header" data-position="inline">
<a href="#menu" data-icon="home" data-iconpos="notext" data-direction="reverse">Accueil</a>
<h1>Saisie</h1>
<a href="#liste" data-icon="notepad" data-iconpos="notext">Liste des obs</a>
</div>
<form id="form_saisie_observation" method="post" action="#">
<div data-role="content">
<div id="obs-saisie-infos"></div>
<div data-role="fieldcontain">
<!--
<label for="location">Commune :</label>
<input type="text" name="location" id="location"/>
-->
<button id="geolocaliser" data-role="button" data-icon="search" data-iconpos="">Trouver ma position</button>
<label for="lat">Latitude :</label>
<input id="lat" type="text" name="lat"/>
<label for="lng">Longitude :</label>
<input id="lng" type="text" name="lng"/>
<label for="date">Date :</label>
<input id="date" type="text" name="date" value="<?=$aujourdhui?>"/>
<label for="nom">Espece :</label>
<input id="nom" type="text" name="nom"/>
<input id="num_nom" type="hidden" name="num_nom"/>
</div>
</div>
<div data-role="footer" data-position="fixed">
<button id="sauver-obs" data-role="button" data-icon="check">Sauver</button>
</div>
</form>
</div>
<div id="liste" data-role="page">
<div data-role="header" data-position="inline">
<a href="#menu" data-icon="home" data-iconpos="notext" data-direction="reverse">Accueil</a>
<h1>Observations</h1>
</div>
<div data-role="content">
<ul id="liste-obs" data-role="listview" data-split-icon="delete" data-split-theme="g" data-theme="g" data-inset="true"></ul>
</div>
<div data-role="footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="#saisie" data-role="button" data-icon="pencil" data-iconpos="notext">Saisie</a></li>
<li><a href="#transmission" data-role="button" data-icon="cloud" data-iconpos="notext">Transmission</a></li>
</ul>
</div>
</div>
</div>
<div id="transmission" data-role="page">
<div data-role="header">
<a href="#menu" data-icon="home" data-iconpos="notext" data-direction="reverse">Accueil</a>
<h1>Transmission</h1>
<a href="#saisie" data-icon="notepad" data-iconpos="notext">Saisie</a>
</div>
<form id="form-transmission" method="post" action="#">
<div data-role="content">
<div data-role="fieldcontain">
<label for="courriel">Courriel :</label>
<input id="courriel" type="email" name="courriel"/>
</div>
</div>
<div data-role="footer" data-position="fixed">
<button data-role="button" data-icon="cloud">Transmettre</button>
</div>
</form>
</div>
<div id="infos" data-role="page">
<div data-role="header">
<a href="#menu" data-icon="home" data-iconpos="notext" data-direction="reverse">Accueil</a>
<h1>Infos</h1>
</div>
<div data-role="content">
<p>Icônes par <a href="http://glyphish.com">Joseph Wain - Glyphish</a>.</p>
</div>
<div data-role="footer" data-position="fixed">
<p>©Copyright <?=$annee?> - <a href="http://www.tela-botanica.org/site:accueil">Tela Botanica</a></p>
</div>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/saisie/squelettes/mobile/mobile.appcache
New file
0,0 → 1,18
CACHE MANIFEST
# v2 - 2012-03-28
# Fichier Manifest pour le cache du widget Mobile.
CACHE:
http://localhost/eflore/applications/cel-widget_cisaille/modules/saisie/squelettes/mobile/css/mobile.css
http://localhost/eflore/applications/cel-widget_cisaille/modules/saisie/squelettes/mobile/js/mobile.js
http://www.tela-botanica.org/favicon.ico
http://www.tela-botanica.org/commun/jquery/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css
http://www.tela-botanica.org/commun/jquery/mobile/1.1.0-rc.1/images/*
http://www.tela-botanica.org/commun/jquery/1.7.1/jquery-1.7.1.min.js
http://www.tela-botanica.org/commun/jquery/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js
http://www.tela-botanica.org/commun/icones/glyphish/187-pencil.png
http://www.tela-botanica.org/commun/icones/glyphish/179-notepad.png
http://www.tela-botanica.org/commun/icones/glyphish/56-cloud.png
http://www.tela-botanica.org/commun/icones/glyphish/73-radar-white.png
http://www.tela-botanica.org/commun/icones/glyphish/187-pencil-white.png
http://www.tela-botanica.org/commun/icones/glyphish/179-notepad-white.png
http://www.tela-botanica.org/commun/icones/glyphish/56-cloud-white.png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/defaut_image.tpl.xml
New file
0,0 → 1,7
<?='<?xml version="1.0" encoding="UTF-8"?>'."\n";?>
<root>
<miniature-url><?=$urlMiniature?></miniature-url>
<image-nom><?=$imageNom?></image-nom>
<message><?=$message?></message>
<debogage><?=$debogage?></debogage>
</root>
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/css/defaut.css
New file
0,0 → 1,167
@CHARSET "UTF-8";
/*+--------------------------------------------------------------------------------------------------------+*/
/* Balises */
footer p{
text-align:center;
}
button img {
display:block;
}
 
h1 {
font-size: 26px;
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* Générique */
.discretion {
color:grey;
font-family:arial;
font-size:11px;
line-height: 13px;
}
.droite {
text-align:right;
}
.centre {
text-align:center;
}
.modal-fenetre {
position:fixed;
z-index:1000;
top:0;
left:0;
height:100%;
width:100%;
background:#777;
background:rgba(90,86,93,0.7);
text-align:center;
}
.modal-contenu {
position:relative;
width:30%;
margin:0 auto;
top:30%;
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* Formulaire spécifique */
#map-canvas {
height:240px;
}
#info-commune {
text-align:right;
}
.ns-retenu {
font-weight:bold;
}
.nn{
color:#3B9D3B;
}
.nom-sci{
font-size:1.5em;
font-weight:bold;
}
.commune, .date{
font-size:1.3em;
font-weight:bold;
}
.obs-action{
opacity:1;
}
.miniature{
float: left;
height: 130px;
padding-left: 15px;
padding-right: 15px;
}
 
.miniature-img {
height: 100px;
}
 
.miniature img {
display: block;
}
 
.miniature-chargement {
height:100px;
width: 100px;
}
 
.defilement-miniatures-gauche, .defilement-miniatures-droite {
float: left;
font-size: 1.2em;
font-weight: bold;
height: 62px;
margin: 5px;
padding-top: 30px;
width: 12px;
}
 
.defilement-miniatures {
width: 210px;
}
 
.defilement-miniatures-cache {
visibility: hidden;
}
 
.miniature-cachee {
display: none;
}
 
.miniature-selectionnee {
display: block;
width: 90px;
}
 
.referentiel-obs {
color:#3B9D3B;
}
#referentiel {
display: inline;
}
 
#logo-titre {
position: relative;
top: -8px;
}
 
#fichier {
display: none;
}
 
#photos-conteneur {
height: 120px;
}
 
#photo-placeholder {
background: url("../img/icones/icone-photo.png");
background-size: 89px;
cursor: pointer;
margin-bottom: 15px;
margin-right: 15px;
float:left;
border: 5px dashed #CCCCCC;
border-radius: 8px 8px 8px 8px;
height: 100px;
margin: 2px 0 2px 2px;
text-align: center;
width: 98px;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
 
#photo-placeholder:hover {
background: url("../img/icones/icone-photo-hover.png");
background-size: 89px;
border: 5px dashed #111;
border-radius: 8px;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Correction style CSS Bootstrap */
.well {
margin-bottom: 5px;
padding: 4px;
}
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/defaut.tpl.html
New file
0,0 → 1,563
<!DOCTYPE html>
<html>
<head>
<title>Saisie simplifiée du CEL</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="Jean-Pascal MILCENT" />
<meta name="keywords" content="Tela Botanica, CEL" />
<meta name="description" content="Widget de saisie simplifiée pour le CEL" />
 
<!-- Viewport Mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="<?=$url_base?>/modules/saisie/squelettes/defaut/img/favicon.ico" />
<!-- Javascript : bibliothèques -->
<!-- Google Map v3 -->
<!--<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>-->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&amp;language=fr&amp;region=FR"></script>
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.7.1/jquery-1.7.1.js"></script>
<!-- Jquery UI : nécessaire pour le minicalendrier et l'auto-complétion -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.18/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.18/js/jquery.ui.datepicker-fr.js"></script>
<!-- Jquery Plugins -->
<!-- Jquery Validate : nécessaire pour la validation des formulaires -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/bootstrap/2.0.2/js/validate/1.9.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.9.0/messages_fr.js"></script>
<!-- Jquery Form :nécessaire pour l'upload des images -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/form/2.95/jquery.form.min.js"></script>
<!-- Bootstrap -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/bootstrap/2.0.2/js/bootstrap.min.js"></script>
<!-- Javascript : appli saisie -->
<script type="text/javascript">
//<![CDATA[
// La présence du parametre 'debug' dans l'URL enclenche le dégogage
var DEBUG = <?=isset($_GET['debug']) ? 'true' : 'false'?>;
// La présence du parametre 'html5' dans l'URL enclenche les fonctions avancées HTML5
var HTML5 = <?=isset($_GET['html5']) ? 'true' : 'false'?>;
// Mot-clé du widget/projet
var TAG_PROJET = "WidgetSaisie";
// Mots-clés à ajouter aux images
var TAG_IMG = "<?=isset($_GET['tag-img']) ? $_GET['tag-img'] : ''?>";
var SEPARATION_TAG_IMG = '<?= isset($_GET['motcle']) && isset($_GET['tag-img']) ? ',' : '' ?>';
TAG_IMG = <?=isset($_GET['motcle']) ? "'".$_GET['motcle']."'+SEPARATION_TAG_IMG+TAG_IMG" : 'TAG_IMG' ?>;
// Mots-clés à ajouter aux observations
var TAG_OBS = "<?=isset($_GET['tag-obs']) ? $_GET['tag-obs'] : ''?>";
var SEPARATION_TAG_OBS = '<?= isset($_GET['projet']) && isset($_GET['tag-obs']) ? ',' : '' ?>';
TAG_OBS = <?=isset($_GET['projet']) ? "'".$_GET['projet']."'+SEPARATION_TAG_OBS+TAG_OBS" : 'TAG_OBS' ?>;
// URL du web service réalisant l'insertion des données dans la base du CEL.
var SERVICE_SAISIE_URL = "<?=$url_ws_saisie?>";
// Code du référentiel utilisé pour les nom scientifiques (de la forme nom:code).
var NOM_SCI_REFERENTIEL = "<?=$ns_referentiel?>";
// Nom du référentiel utilisé pour les nom scientifiques.
var NOM_SCI_PROJET = "<?=$ns_projet?>";
// Code de la version du référentiel utilisé pour les nom scientifiques.
var NOM_SCI_VERSION = "<?=$ns_version?>";
// Indication de la présence d'une espèce imposée
var ESPECE_IMPOSEE = "<?=$espece_imposee; ?>";
// Tableau d'informations sur l'espèce imposée
var INFOS_ESPECE_IMPOSEE = <?=$infos_espece; ?>;
// Nombre d'élément dans les listes d'auto-complétion
var AUTOCOMPLETION_ELEMENTS_NBRE = 20;
// Indication de la présence d'un référentiel imposé
var REFERENTIEL_IMPOSE = "<?=$referentiel_impose; ?>";
// Indication des version utilisées de chaque référentiel
var PROJETS_VERSIONS = <?=json_encode($projets_versions)?>;
// URL du web service permettant l'auto-complétion des noms scientifiques.
var SERVICE_AUTOCOMPLETION_NOM_SCI_URL = "<?=$url_ws_autocompletion_ns?>?"+
"masque={masque}&"+
"recherche=etendue&"+
"retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
//"version.projet="+NOM_SCI_VERSION+"&"+
"ns.structure=au"+"&"+
"navigation.limite="+AUTOCOMPLETION_ELEMENTS_NBRE;
// URL du web service permettant l'auto-complétion des noms scientifiques.
var SERVICE_AUTOCOMPLETION_NOM_SCI_URL_TPL = "<?=$url_ws_autocompletion_ns_tpl?>?"+
"masque={masque}&"+
"recherche=etendue&"+
"retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
//"version.projet="+NOM_SCI_VERSION+"&"+
"ns.structure=au"+"&"+
"navigation.limite="+AUTOCOMPLETION_ELEMENTS_NBRE;
// Nombre d'observations max autorisé avant transmission
var OBS_MAX_NBRE = 10;
// Durée d'affichage en milliseconde des messages d'informations
var DUREE_MESSAGE = 15000;
// Squelette d'URL du web service d'eFlore fournissant les noms de communes.
var SERVICE_NOM_COMMUNE_URL = "http://www.tela-botanica.org/service:eflore:0.1/osm/nom-commune?lon={lon}&lat={lat}";
// Squelette d'URL du web service d'eFlore fournissant les noms de communes hors de France (localisation approximative).
var SERVICE_NOM_COMMUNE_URL_ALT = "http://www.tela-botanica.org/service:eflore:0.1/wikipedia/nom-commune?lon={lon}&lat={lat}&nbre=1";
// URL du marqueur à utiliser dans la carte Google Map
var GOOGLE_MAP_MARQUEUR_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/marqueurs/epingle.png";
// URL de l'icône du chargement en cours
var CHARGEMENT_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/chargement.gif";
// URL de l'icône du chargement en cours d'une image
var CHARGEMENT_IMAGE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/chargement-image.gif";
// URL de l'icône du calendrier
var CALENDRIER_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/calendrier.png";
// URL de l'icône du calendrier
var PAS_DE_PHOTO_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/pasdephoto.png";
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/saisie/squelettes/defaut/js/defaut.js"></script>
<!-- CSS -->
<link href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.18/css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/bootstrap/2.0.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/bootstrap/2.0.2/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?=$url_base?>modules/saisie/squelettes/defaut/css/<?=isset($_GET['style']) ? $_GET['style'] : 'defaut'?>.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body data-spy="scroll">
<div class="container">
<div class="row-fluid">
<div class="span6 page-header">
<div class="row">
<div class="span6">
<h1>
<?php if($logo != 'defaut' && $logo != '0') { ?>
<img id="logo-titre" class="span1" src="<?= $logo ?>" alt="Logo" />
<?php } else if($logo == 'defaut') { ?>
<img id="logo-titre" class="span1" src="<?=$url_base?>/modules/saisie/squelettes/defaut/img/logos/tela_botanica.png" alt="Tela Botanica" />
<?php } ?>
<?php if($titre != 'defaut') { ?>
<?= $titre; ?>
<?php } else { ?>
Ajout rapide d'observations
<?php } ?>
</h1>
</div>
</div>
<div class="row">
<div class="span6">
<p>
Cet outil vous permet de partager simplement vos observations avec le
<a href="http://www.tela-botanica.org/site:accueil">réseau Tela Botanica</a> (sous <a href="http://www.tela-botanica.org/page:licence?langue=fr">licence CC-BY-SA</a>).
Identifiez-vous bien pour ensuite retrouver et gérer vos données dans
<a href="http://www.tela-botanica.org/appli:cel">votre Carnet en ligne</a>.
Créez jusqu'à 10 observations (avec 10Mo max d'images) puis partagez-les avec le bouton 'transmettre'.
Elles apparaissent immédiatement sur les <a href="http://www.tela-botanica.org/site:botanique?langue=fr">cartes et galeries photos </a> du site.
</p>
<p class="discretion">
Pour toute question contactez <a href="mailto:cel_remarques@tela-botanica.org">cel_remarques@tela-botanica.org</a>
</p>
<p class="discretion">
Une fois familiarisé avec l'interface vous pouvez cliquer sur ce bouton pour désactiver l'aide.
<button id="btn-aide" class="btn btn-mini btn-success">
<span class="icon-question-sign icon-white"></span>
<span id="btn-aide-txt" >Désactiver l'aide</span>
</button>
</p>
</div>
</div>
</div>
<div class="span6">
<div class="well">
<h2>Observateur</h2>
<form id="form-observateur" action="#" class="" autocomplete="on">
<div class="row-fluid">
<div class="span6" rel="tooltip" data-placement="right"
title="Saisissez le courriel avec lequel vous être inscrit à Tela Botanica.
Si vous n'êtes pas inscrit, ce n'est pas grave, vous pourrez le faire
ultérieurement. Des informations complémentaires vont vous être
demandées : prénom et nom.">
<label for="courriel"
title="Veuillez saisir votre adresse courriel.">
<strong class="obligatoire">*</strong> Courriel
</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-envelope"></i>
</span>
<input id="courriel" class="input-medium" name="courriel" type="text"/>
<input id="id_utilisateur" name="id_utilisateur" type="hidden"/>
</div>
</div>
<div id="zone-courriel-confirmation" class="span6 hidden">
<label for="courriel_confirmation"
title="Veuillez saisir confirmer le courriel.">
<strong class="obligatoire">*</strong> Courriel (confirmation)
</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-envelope"></i>
</span><input id="courriel_confirmation" class="input-medium" name="courriel_confirmation" type="text"/>
</div>
</div>
</div>
<div id="zone-prenom-nom" class="row-fluid hidden">
<div class="span6">
<label for="prenom">Prénom</label>
<div>
<input id="prenom" name="prenom" class="span3" type="text"/>
</div>
</div>
<div class="span6">
<label for="nom">Nom</label>
<div>
<input id="nom" name="nom" class="span3" type="text"/>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Messages d'erreur du formulaire-->
<div class="row">
<div class="zone-alerte span6 offset3">
<div id="dialogue-bloquer-copier-coller" class="alert alert-info alert-block" style="display:none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : copier/coller</h4>
<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-courriel-introuvable" class="alert alert-info alert-block" style="display:none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : courriel introuvable</h4>
<p>
Vous n'êtes pas inscrit à Tela Botanica avec ce courriel.<br/>
Veuillez compléter les champs supplémentaires ou indiquer votre courriel d'inscription.<br/>
Pour retrouver vos observations dans le <a href="http://www.tela-botanica.org/appli:cel">Carnet en ligne</a>,
il sera nécesaire de <a href="http://www.tela-botanica.org/page:inscription">vous inscrire à Tela Botanica</a>.
</p>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="well">
<div class="row-fluid">
<div class="span6">
<div>
<div class="row-fluid">
<div class="span12">
<h2>Lieu du relevé</h2>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<label for="map_canvas" title="Veuillez localiser l'observation">
Géolocalisation
</label>
</div>
<div class="span8 droite">
<form id="form-carte-recherche" class="form-search form-horizontal" action="#" >
<div class="control-group">
<label for="carte-recherche">Rechercher</label>
<input id="carte-recherche" class="search-query" type="text" value=""
rel="tooltip"
title="Permet de centrer la carte sur le lieu recherché."
placeholder="Centrer la carte sur un lieu..."/>
</div>
</form>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div id="map-canvas" rel="tooltip"
title="Vous pouvez cliquer sur la carte pour déplacer le marqueur
représentant votre station ou bien le glisser-déposer sur
le lieu souhaité."></div>
</div>
</div>
<div class="row-fluid">
<label for="coordonnees-geo" class="span7">
<a href="#" class="afficher-coord">Afficher</a>
<a href="#" class="afficher-coord" style="display:none;">Cacher</a>
les coordonnées géographiques
<span id="lat-lon-info" class="info"
rel="tooltip"
title="Système géodésique mondial, révision de 1984 - Coordonnées non projetées">
(WGS84)
</span>
</label>
<div id="info-commune" class="span5">
<span for="marqueur-commune">Commune : </span>
<span id="marqueur-commune">
<span id="commune-nom" class="commune-info"></span>
(<span id="commune-code-insee" class="commune-info"
rel="tooltip"
title="Code INSEE de la commune"></span>)
</span>
</div>
</div>
<form id="form-station" class="control-group" action="#" enctype="multipart/form-data" autocomplete="on">
<div id="coordonnees-geo" class="well" style="display:none;">
<div class="row-fluid form-inline">
<div id="coord-lat" class="span4">
<label for="latitude">Latitude</label>
<div>
<input id="latitude" class="input-mini" name="latitude" type="text" value=""/>
</div>
</div>
<div id="coord-lng" class="span4">
<label for="longitude">Longitude</label>
<div>
<input id="longitude" class="input-mini" name="longitude" type="text" value=""/>
</div>
</div>
<div class="span1">
<div>
<input id="geolocaliser" type="button" value="Voir sur la carte"
rel="tooltip"
title="Centre la carte sur les coordonnées de latitude et longitude saisies."/>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span4" rel="tooltip"
title="Toponyme plus précis que la commune, utilisé localement et se trouvant souvent sur les cartes au 1/25 000." >
<label for="lieudit">Lieu-dit</label>
<div>
<input type="text" id="lieudit" class="span2" name="lieudit"/>
</div>
</div>
<div class="span4" rel="tooltip"
title="Lieu précis de l'observation définissant une unité écologique homogène (ex: le pré derrière la maison)." >
<label for="station">Station</label>
<div>
<input type="text" id="station" class="span2" name="station"/>
</div>
</div>
<div class="span4" rel="tooltip"
title="Type d'habitat plus ou moins standardisé dans les codes Corine ou Catminat (ex: prairie humide).">
<label for="milieux">Milieu</label>
<div>
<input type="text" id="milieu" class="span2" name="milieu" />
</div>
</div>
</div>
</form>
</div>
</div>
<div class="span6">
<form id="form-obs" action="#" autocomplete="on">
<h2>Observation</h2>
<?php if(!$referentiel_impose) : ?>
<div class="row-fluid">
<div rel="tooltip"
title="Sélectionnez le référentiel associé à votre relevé">
<label for="referentiel" title="Réferentiel">
Référentiel
</label>
<span class="input-prepend">
<span id="referentiel-icone" class="add-on"><i class="icon-book"></i></span>
<select id="referentiel" autocomplete="off">
<option value="bdtfx" selected="selected" title="Trachéophytes de France métropolitaine">Métropole (BDTFX)</option>
<option value="bdtxa" title="Trachéophytes des Antilles">Antilles françaises (BDTXA)</option>
</select>
</span>
</div>
</div>
<?php endif; ?>
<div class="row-fluid">
<div class="span4" rel="tooltip"
title="Vous pouvez cliquer sur l'icône de calendrier pour
sélectionner une date dans un calendrier.">
<label for="date" title="Veuillez indiquer la date du relevé au format jj/mm/aaaa">
Date du relevé
</label>
<div class="input-prepend">
<span id="date-icone" class="add-on"></span><input id="date"
class="input-small" name="date" type="text"
placeholder="jj/mm/aaaa" />
</div>
</div>
<div id="taxon-input-groupe" class="span8" rel="tooltip"
title="Sélectionnez une espèce dans la liste déroulante pour lier
votre nom au référentiel selectionné. Si vous
le désirez vous pouvez aussi saisir un nom absent du référentiel
(Ex. : 'fleur violette' ou 'viola sinensis???')." >
<label for="taxon" title="Choisissez une espèce">
<strong class="obligatoire">*</strong>
Espèce <?= $referentiel_impose ? '('.$ns_projet.')' : '' ?> <em>(ou indication sur la plante)</em>
</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-leaf"></i>
</span><input type="text" id="taxon" name="taxon" value="<?= $nom_sci_espece_defaut; ?>" />
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<label for="notes">Commentaires</label>
<div>
<textarea id="notes" class="span6" rows="7" name="notes"
placeholder="vous pouvez éventuellement ajouter des informations complémentaires à votre observation (altitude, taille de la plante...)"></textarea>
</div>
</div>
</div>
</form>
<form id="form-upload" class="form-horizontal" action="<?=$url_base?>saisie?projet=sauvages&amp;service=upload-image"
method="post" enctype="multipart/form-data">
<h2>Image(s) de cette plante</h2>
<strong>Cliquez sur l'icône "appareil photo" pour ajouter une image</strong>
<p class="miniature-info" class="discretion help-inline">Les photos doivent être au format JPEG et ne doivent pas excéder 5Mo chacunes.</p>
<div id ="photos-conteneur">
<div id="photo-placeholder" rel="tooltip"
title="Cliquez pour ajouter une photo de votre observation. Elle doit être au
format JPEG et ne doit pas excéder 5Mo."></div>
<input type="file" id="fichier" name="fichier" accept="image/jpeg" />
<input type="hidden" name="MAX_FILE_SIZE" value="5242880"/>
<div id="miniatures">
</div>
<p class="miniature-msg" class="span12">&nbsp;</p>
</div>
</form>
</div>
<div class="row-fluid">
<div class="span12 centre" rel="tooltip"
title="Une fois les champs remplis, vous pouvez cliquer sur ce bouton pour
ajouter votre observation à la liste à transmettre.">
<button id="ajouter-obs" class="btn btn-primary btn-large" type="button">
Créer
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Messages d'erreur du formulaire-->
<div class="row">
<div class="zone-alerte span6 offset3">
<div id="dialogue-bloquer-creer-obs" class="alert alert-warning alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : 10 observations maximum</h4>
<p>
Vous venez d'ajouter votre 10ème observation.<br/>
Pour en ajouter de nouvelles, il est nécessaire de les transmettre en cliquant sur le bouton ci-dessous.
</p>
</div>
</div>
<div class="zone-alerte span6 offset3">
<div id="dialogue-form-invalide" class="alert alert-warning alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : champs en erreur</h4>
<p>
Certains champs du formulaire sont mal remplis.<br/>
Veuillez vérifier vos données.
</p>
</div>
</div>
</div>
<!-- Affiche le tableau récapitualif des observations ajoutées -->
<div id="zone-liste-obs" class="row-fluid">
<div class="span12">
<div class="well">
<div class="row-fluid">
<div class="span8">
<h2>Observations à transmettre : <span class="obs-nbre">0</span></h2>
</div>
<div class="span4 droite">
<button id="transmettre-obs" class="btn btn-primary btn-large"
type="button" disabled="disabled" rel="tooltip"
title="Ajoute les observations ci-dessous à votre Carnet en Ligne et les rend publiques.">
Transmettre
</button>
</div>
</div>
<div id="liste-obs" ></div>
<div class="row">
<div class="zone-alerte span6 offset3">
<div id="dialogue-zero-obs" class="alert alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Attention : aucune observation</h4>
<p>Veuillez saisir des observations pour les transmettres.</p>
</div>
<div id="dialogue-obs-transaction-ok" class="alert alert-success alert-block" style="display: none;"">
<a class="close">×</a>
<h4 class="alert-heading">Information : transmission des observations</h4>
<div class="alert-txt"></div>
</div>
<div id="dialogue-obs-transaction-ko" class="alert alert-error alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Erreur : transmission des observations</h4>
<div class="alert-txt"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="row-fluid">
<p class="span12">&copy; Tela Botanica 2012</p>
</footer>
<!-- Fenêtres modales -->
<div id="chargement" class="modal-fenetre" style="display:none;">
<div id="chargement-centrage" class="modal-contenu">
<img id="chargement-img"
src="<?=$url_base?>modules/saisie/squelettes/sauvages/images/chargement_arbre.gif"
alt="Transfert en cours..."/>
<p id="chargement-txt" style="color:white;font-size:1.5em;">
Transfert des observations en cours...<br />
Cela peut prendre plusieurs minutes en fonction de la taille des images et du nombre
d'observations à transférer.
</p>
</div>
</div>
<!-- Templates HTML -->
<div id="tpl-transmission-ok" style="display:none;">
<p class="msg">
Vos observations ont bien été transmises.<br />
Elles sont désormais consultables à travers les différents outils de visualisation
du réseau (<a href="http://www.tela-botanica.org/site:botanique">eFlore</a>,
<a href="http://www.tela-botanica.org/page:cel_galerie">galeries d'images</a>,
<a href="http://www.tela-botanica.org/appli:test:del">identiplante</a>,
<a href="http://www.tela-botanica.org/widget:cel:cartoPoint">cartographie (widget)</a>...)<br />
Si vous souhaitez les modifier ou les supprimer, vous pouvez les retrouver en vous
connectant à votre <a href="http://www.tela-botanica.org/appli:cel">Carnet en ligne</a>.<br />
N'oubliez pas qu'il est nécessaire de
<a href="http://www.tela-botanica.org/page:inscription">s'inscrire à Tela Botanica</a>
au préalable, si ce n'est pas déjà fait.
</p>
</div>
<div id="tpl-transmission-ko" style="display:none;">
<p class="msg">
Une erreur est survenue lors de la transmission de vos observations.<br />
Vous pouvez signaler le dysfonctionnement à
<a class="courriel-erreur" href="mailto:">cel_remarques@tela-botanica.org</a>.
</p>
</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>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/favicon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/favicon.ico
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/chargement_arbre.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/chargement_arbre.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/chargement-image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/chargement-image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/aide.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/aide.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/plus.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/plus.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/icone-photo.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/icone-photo.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/icone-photo-hover.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/icone-photo-hover.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/pasdephoto.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/pasdephoto.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/supprimer.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/supprimer.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/calendrier.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/icones/calendrier.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/logos/tela_botanica.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/logos/tela_botanica.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/carre_vert_jaune.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/carre_vert_jaune.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/etoile_argent.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/etoile_argent.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/epingle.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/epingle.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/rond_vert_jaune.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/rond_vert_jaune.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/img/marqueurs/source.txt
New file
0,0 → 1,4
carre_vert_jaune.png Designer : Dat Nguyen, License: Free for commercial use, Size (px)16 x 16, Icon set Splashyfish
rond_vert_jaune.png Designer : Dat Nguyen, License: Free for commercial use, Size (px)16 x 16, Icon set Splashyfish
etoile_argent.png Designer : mebaze, Licence : License: Free for personal use only, Size (px)32 x 32, Icon set Brushed Metal Icons
epingle.png Designer : Nahas M.A., License: Free for commercial use | (Read me), Size (px)32 x 32, Icon set Aristocracy
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/defaut/js/defaut.js
New file
0,0 → 1,1020
//+---------------------------------------------------------------------------------------------------------+
// GÉNÉRAL
$(document).ready(function() {
$(window).on('beforeunload', function(event) {
return 'Êtes vous sûr de vouloir quiter la page?\nLes observations saisies mais non transmises seront perdues.';
});
});
//+----------------------------------------------------------------------------------------------------------+
// FONCTIONS GÉNÉRIQUES
/**
* 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();
}
if (evenement.preventDefault) {
evenement.preventDefault();
}
return false;
}
 
function extraireEnteteDebug(jqXHR) {
var msgDebug = '';
if (jqXHR.getResponseHeader("X-DebugJrest-Data") != '') {
var debugInfos = jQuery.parseJSON(jqXHR.getResponseHeader("X-DebugJrest-Data"));
if (debugInfos != null) {
$.each(debugInfos, function (cle, valeur) {
msgDebug += valeur + "\n";
});
}
}
return msgDebug;
}
 
function afficherPanneau(selecteur) {
$(selecteur).fadeIn("slow").delay(DUREE_MESSAGE).fadeOut("slow");
}
 
//+----------------------------------------------------------------------------------------------------------+
//UPLOAD PHOTO : Traitement de l'image
$(document).ready(function() {
$(".effacer-miniature").click(function () {
supprimerMiniatures($(this));
});
$('#photo-placeholder').click(function(event) {
$("#fichier").click();
});
$("#fichier").bind('change', function (e) {
arreter(e);
var options = {
success: afficherMiniature, // post-submit callback
dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
resetForm: true // reset the form after successful submit
};
$("#miniature").append('<img id="miniature-chargement" class="miniature" alt="chargement" src="'+CHARGEMENT_IMAGE_URL+'"/>');
$("#ajouter-obs").attr('disabled', 'disabled');
if(verifierFormat($("#fichier").val())) {
$("#form-upload").ajaxSubmit(options);
} else {
window.alert("Le format de fichier n'est pas supporté, les formats acceptés sont "+ $("#fichier").attr("accept"));
}
return false;
});
if(ESPECE_IMPOSEE) {
$("#taxon").attr("disabled", "disabled");
$("#taxon-input-groupe").attr("title","");
var infosAssociee = new Object();
infosAssociee.label = INFOS_ESPECE_IMPOSEE.nom_sci_complet;
infosAssociee.value = INFOS_ESPECE_IMPOSEE.nom_sci_complet;
infosAssociee.nt = INFOS_ESPECE_IMPOSEE.num_taxonomique;
infosAssociee.nomSel = INFOS_ESPECE_IMPOSEE.nom_sci;
infosAssociee.nomSelComplet = INFOS_ESPECE_IMPOSEE.nom_sci_complet;
infosAssociee.numNomSel = INFOS_ESPECE_IMPOSEE.id;
infosAssociee.nomRet = INFOS_ESPECE_IMPOSEE["nom_retenu.libelle"];
infosAssociee.numNomRet = INFOS_ESPECE_IMPOSEE["nom_retenu.id"];
infosAssociee.famille = INFOS_ESPECE_IMPOSEE.famille;
infosAssociee.retenu = (INFOS_ESPECE_IMPOSEE.retenu == 'false') ? false : true;
$("#taxon").data(infosAssociee);
}
$('.effacer-miniature').live('click', function() {
$(this).parent().remove();
});
});
 
function verifierFormat(nom) {
var parts = nom.split('.');
extension = parts[parts.length - 1];
return (extension.toLowerCase() == 'jpeg' || extension.toLowerCase() == 'jpg');
}
 
function afficherMiniature(reponse) {
if (DEBUG) {
var debogage = $("debogage", reponse).text();
console.log("Débogage upload : "+debogage);
}
var message = $("message", reponse).text();
if (message != '') {
$("#miniature-msg").append(message);
} else {
$("#miniatures").append(creerWidgetMiniature(reponse));
}
$('#ajouter-obs').removeAttr('disabled');
}
 
function creerWidgetMiniature(reponse) {
var miniatureUrl = $("miniature-url", reponse).text();
var imgNom = $("image-nom", reponse).text();
var html =
'<div class="miniature">'+
'<img class="miniature-img" class="miniature" alt="'+imgNom+'" src="'+miniatureUrl+'"/>'+
'<button class="effacer-miniature" type="button">Effacer</button>'+
'</div>'
return html;
}
 
function supprimerMiniatures() {
$("#miniatures").empty();
$("#miniature-msg").empty();
}
 
//+----------------------------------------------------------------------------------------------------------+
// GOOGLE MAP
var map;
var marker;
var latLng;
var geocoder;
 
$(document).ready(function() {
initialiserGoogleMap();
// Autocompletion du champ adresse
$("#carte-recherche").on('focus', function() {
$(this).select();
});
$("#carte-recherche").on('mouseup', function(event) {// Pour Safari...
event.preventDefault();
});
$("#carte-recherche").keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
}
});
$("#carte-recherche").autocomplete({
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
source: function(request, response) {
geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
response($.map(results, function(item) {
var retour = {
label: item.formatted_address,
value: item.formatted_address,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
};
return retour;
}));
} else {
afficherErreurGoogleMap(status);
}
});
},
// Cette partie est executee a la selection d'une adresse
select: function(event, ui) {
var latLng = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
deplacerMarker(latLng);
}
});
$("#geolocaliser").on('click', geolocaliser);
google.maps.event.addListener(marker, 'dragend', surDeplacementMarker);
google.maps.event.addListener(map, 'click', surClickDansCarte);
});
 
function surDeplacementMarker() {
trouverCommune(marker.getPosition());
mettreAJourMarkerPosition(marker.getPosition());
}
 
function surClickDansCarte(event) {
deplacerMarker(event.latLng);
}
 
function geolocaliser() {
var latitude = $('#latitude').val();
var longitude = $('#longitude').val();
latLng = new google.maps.LatLng(latitude, longitude);
deplacerMarker(latLng);
}
 
function initialiserGoogleMap(){
// Carte
if(REFERENTIEL_IMPOSE && NOM_SCI_PROJET == 'bdtxa') {
var latLng = new google.maps.LatLng(14.6, -61.08334);// Fort-De-France
// Les antilles étant dispersées, un zoom moins précis est préférable
var zoomDefaut = 8;
} else {
var latLng = new google.maps.LatLng(46.30871, 2.54395);// Centre de la France
var zoomDefaut = 5;
}
var options = {
zoom: zoomDefaut,
center: latLng,
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
});
// Création de la carte Google
map = new google.maps.Map(document.getElementById('map-canvas'), options); //affiche la google map dans la div map_canvas
map.mapTypes.set('OSM', osmMapType);
// Création du Geocoder
geocoder = new google.maps.Geocoder();
// Marqueur google draggable
marker = new google.maps.Marker({
map: map,
draggable: true,
title: 'Ma station',
icon: GOOGLE_MAP_MARQUEUR_URL,
position: latLng
});
initialiserMarker(latLng);
// Tentative de geocalisation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
latLng = new google.maps.LatLng(latitude, longitude);
deplacerMarker(latLng);
});
}
}
 
function initialiserMarker(latLng) {
if (marker != undefined) {
marker.setPosition(latLng);
map.setCenter(latLng);
}
}
 
function deplacerMarker(latLng) {
if (marker != undefined) {
marker.setPosition(latLng);
map.setCenter(latLng);
mettreAJourMarkerPosition(latLng);
trouverCommune(latLng);
}
}
 
function mettreAJourMarkerPosition(latLng) {
var lat = latLng.lat().toFixed(5);
var lng = latLng.lng().toFixed(5);
remplirChampLatitude(lat);
remplirChampLongitude(lng);
}
 
function remplirChampLatitude(latDecimale) {
var lat = Math.round(latDecimale * 100000) / 100000;
$('#latitude').val(lat);
}
 
function remplirChampLongitude(lngDecimale) {
var lng = Math.round(lngDecimale * 100000) / 100000;
$('#longitude').val(lng);
}
 
function trouverCommune(pos) {
$(function() {
var url_service = SERVICE_NOM_COMMUNE_URL;
var urlNomCommuneFormatee = url_service.replace('{lat}', pos.lat()).replace('{lon}', pos.lng());
$.ajax({
url : urlNomCommuneFormatee,
type : "GET",
dataType : "jsonp",
beforeSend : function() {
$(".commune-info").empty();
$("#dialogue-erreur .alert-txt").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 .alert-txt").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 .alert-txt").append('<p class="msg-erreur">Erreur 500 : '+errorThrown+"<br />"+erreurMsg+'</p>');
}
}
},
error : function(jqXHR, textStatus, errorThrown) {
if (DEBUG) {
$("#dialogue-erreur .alert-txt").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 .alert-txt").append('<p class="msg-erreur">Erreur Ajax : '+errorThrown+' (type : '+textStatus+') <br />'+erreurMsg+'</p>');
}
},
complete : function(jqXHR, textStatus) {
var debugMsg = extraireEnteteDebug(jqXHR);
if (debugMsg != '') {
if (DEBUG) {
$("#dialogue-erreur .alert-txt").append('<pre class="msg-debug msg">Débogage : '+debugMsg+'</pre>');
}
}
if ($("#dialogue-erreur .msg").length > 0) {
$("#dialogue-erreur").show();
}
}
});
});
}
//+---------------------------------------------------------------------------------------------------------+
// IDENTITÉ
$(document).ready(function() {
$("#courriel").on('blur', requeterIdentite);
$("#courriel").on('keypress', testerLancementRequeteIdentite);
});
 
function testerLancementRequeteIdentite(event) {
if (event.which == 13) {
requeterIdentite();
event.preventDefault();
event.stopPropagation();
}
}
 
function requeterIdentite() {
var courriel = $("#courriel").val();
//TODO: mettre ceci en paramètre de config
var urlAnnuaire = "http://www.tela-botanica.org/client/annuaire_nouveau/actuelle/jrest/utilisateur/identite-par-courriel/"+courriel;//http://localhost/applications/annuaire/jrest/
$.ajax({
url : urlAnnuaire,
type : "GET",
success : function(data, textStatus, jqXHR) {
console.log('SUCCESS:'+textStatus);
if (data != undefined && data[courriel] != undefined) {
var infos = data[courriel];
$("#id_utilisateur").val(infos.id);
$("#prenom").val(infos.prenom);
$("#nom").val(infos.nom);
$("#courriel_confirmation").val(courriel);
$("#prenom, #nom, #courriel_confirmation").attr('disabled', 'disabled');
$("#date").focus();
} else {
surErreurCompletionCourriel();
}
},
error : function(jqXHR, textStatus, errorThrown) {
console.log('ERREUR :'+textStatus);
surErreurCompletionCourriel();
},
complete : function(jqXHR, textStatus) {
console.log('COMPLETE :'+textStatus);
$("#zone-prenom-nom").removeClass("hidden");
$("#zone-courriel-confirmation").removeClass("hidden");
}
});
}
 
function surErreurCompletionCourriel() {
$("#prenom, #nom, #courriel_confirmation").val('');
$("#prenom, #nom, #courriel_confirmation").removeAttr('disabled');
afficherPanneau("#dialogue-courriel-introuvable");
}
//+---------------------------------------------------------------------------------------------------------+
//FORMULAIRE VALIDATION
$(document).ready(function() {
});
//+---------------------------------------------------------------------------------------------------------+
// FORMULAIRE
var obsNbre = 0;
 
$(document).ready(function() {
$(".alert .close").on('click', fermerPanneauAlert);
$("[rel=tooltip]").tooltip('enable');
$("#btn-aide").on('click', basculerAffichageAide);
$("#prenom").on("change", formaterPrenom);
$("#nom").on("change", formaterNom);
configurerDatePicker();
ajouterAutocompletionNoms();
configurerFormValidator();
definirReglesFormValidator();
$("#courriel_confirmation").on('paste', bloquerCopierCollerCourriel);
$("a.afficher-coord").on('click', basculerAffichageCoord);
$("#ajouter-obs").on('click', ajouterObs);
$(".obs-nbre").on('changement', surChangementNbreObs);
$("body").on('click', ".supprimer-obs", supprimerObs);
$("#transmettre-obs").on('click', transmettreObs);
$("#referentiel").on('change', surChangementReferentiel);
$("body").on('click', ".defilement-miniatures-gauche", function(event) {
event.preventDefault();
defilerMiniatures($(this));
});
$("body").on('click', ".defilement-miniatures-droite", function(event) {
event.preventDefault();
defilerMiniatures($(this));
});
});
 
function configurerFormValidator() {
$.validator.addMethod(
"dateCel",
function (value, element) {
return value == "" || (/^[0-9]{2}[-\/][0-9]{2}[-\/][0-9]{4}$/.test(value));
},
"Format : jj/mm/aaaa. Date incomplète, utiliser 0, exemple : 00/12/2011.");
$.extend($.validator.defaults, {
errorClass: "control-group error",
validClass: "control-group success",
errorElement: "span",
highlight: function(element, errorClass, validClass) {
if (element.type === 'radio') {
this.findByName(element.name).parent("div").parent("div").removeClass(validClass).addClass(errorClass);
} else {
$(element).parent("div").parent("div").removeClass(validClass).addClass(errorClass);
}
},
unhighlight: function(element, errorClass, validClass) {
if (element.type === 'radio') {
this.findByName(element.name).parent("div").parent("div").removeClass(errorClass).addClass(validClass);
} else {
if ($(element).attr('id') == 'taxon') {
if ($("#taxon").val() != '') {
// Si le taxon n'est pas lié au référentiel, on vide le data associé
if($("#taxon").data("value") != $("#taxon").val()) {
$("#taxon").data("numNomSel","");
$("#taxon").data("nomRet","");
$("#taxon").data("numNomRet","");
$("#taxon").data("nt","");
$("#taxon").data("famille","");
}
$("#taxon-input-groupe").removeClass(errorClass).addClass(validClass);
$(element).next(" span.help-inline").remove();
}
} else {
$(element).parent("div").parent("div").removeClass(errorClass).addClass(validClass);
$(element).next(" span.help-inline").remove();
}
}
}
});
}
 
function definirReglesFormValidator() {
$("#form-observateur").validate({
rules: {
courriel : {
required : true,
email : true},
courriel_confirmation : {
required : true,
equalTo: "#courriel"}
}
});
$("#form-station").validate({
rules: {
latitude : {
range: [-90, 90]},
longitude : {
range: [-180, 180]}
}
});
$("#form-obs").validate({
rules: {
date : "dateCel",
taxon : "required"
}
});
}
 
function configurerDatePicker() {
$.datepicker.setDefaults($.datepicker.regional["fr"]);
$("#date").datepicker({
dateFormat: "dd/mm/yy",
showOn: "button",
buttonImageOnly: true,
buttonImage: CALENDRIER_ICONE_URL,
buttonText: "Afficher le calendrier pour saisir la date.",
showButtonPanel: true
});
$("img.ui-datepicker-trigger").appendTo("#date-icone");
}
 
function fermerPanneauAlert() {
$(this).parentsUntil(".zone-alerte", ".alert").hide();
}
 
function formaterNom() {
$(this).val($(this).val().toUpperCase());
}
 
function formaterPrenom() {
var prenom = new Array();
var mots = $(this).val().split(' ');
for (var i = 0; i < mots.length; i++) {
var mot = mots[i];
if (mot.indexOf('-') >= 0) {
var prenomCompose = new Array();
var motsComposes = mot.split('-');
for (var j = 0; j < motsComposes.length; j++) {
var motSimple = motsComposes[j];
var motMajuscule = motSimple.charAt(0).toUpperCase() + motSimple.slice(1);
prenomCompose.push(motMajuscule);
}
prenom.push(prenomCompose.join('-'));
} else {
var motMajuscule = mot.charAt(0).toUpperCase() + mot.slice(1);
prenom.push(motMajuscule);
}
}
$(this).val(prenom.join(' '));
}
 
function basculerAffichageAide() {
if ($(this).hasClass('btn-warning')) {
$("[rel=tooltip]").tooltip('enable');
$(this).removeClass('btn-warning').addClass('btn-success');
$('#btn-aide-txt', this).text("Désactiver l'aide");
} else {
$("[rel=tooltip]").tooltip('disable');
$(this).removeClass('btn-success').addClass('btn-warning');
$('#btn-aide-txt', this).text("Activer l'aide");
}
}
 
function bloquerCopierCollerCourriel() {
afficherPanneau("#dialogue-bloquer-copier-coller");
return false;
}
 
function basculerAffichageCoord() {
$("a.afficher-coord").toggle();
$("#coordonnees-geo").toggle('slow');
//valeur false pour que le lien ne soit pas suivi
return false;
}
 
function ajouterObs() {
if (validerFormulaire() == true) {
obsNbre = obsNbre + 1;
$(".obs-nbre").text(obsNbre);
$(".obs-nbre").triggerHandler('changement');
afficherObs();
stockerObsData();
supprimerMiniatures();
$("#taxon").val("");
$("#taxon").data("numNomSel",undefined);
} else {
afficherPanneau('#dialogue-form-invalide');
}
}
 
function afficherObs() {
$("#liste-obs").prepend(
'<div id="obs'+obsNbre+'" class="row-fluid obs obs'+obsNbre+'">'+
'<div class="span12">'+
'<div class="well">'+
'<div class="obs-action pull-right" rel="tooltip" data-placement="bottom" '+
'title="Supprimer cette observation de la liste à transmettre">'+
'<button class="btn btn-danger supprimer-obs" value="'+obsNbre+'" title="'+obsNbre+'">'+
'<i class="icon-trash icon-white"></i>'+
'</button>'+
'</div> '+
'<div class="row-fluid">'+
'<div class="thumbnail span2">'+
ajouterImgMiniatureAuTransfert()+
'</div>'+
'<div class="span9">'+
'<ul class="unstyled">'+
'<li>'+
'<span class="nom-sci">'+$("#taxon").val()+'</span> '+
ajouterNumNomSel()+'<span class="referentiel-obs">'+
($("#taxon").data("numNomSel") == undefined ? '' : '['+NOM_SCI_PROJET+']')+'</span>'+
' observé à '+
'<span class="commune">'+$('#commune-nom').text()+'</span> '+
'('+$('#commune-code-insee').text()+') ['+$("#latitude").val()+' / '+$("#longitude").val()+']'+
' le '+
'<span class="date">'+$("#date").val()+'</span>'+
'</li>'+
'<li>'+
'<span>Lieu-dit :</span> '+$('#lieudit').val()+' '+
'<span>Station :</span> '+$('#station').val()+' '+
'<span>Milieu :</span> '+$('#milieu').val()+' '+
'</li>'+
'<li>'+
'Commentaires : <span class="discretion">'+$("#notes").val()+'</span>'+
'</li>'+
'</ul>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'</div>');
}
 
function stockerObsData() {
$("#liste-obs").data('obsId'+obsNbre, {
'date' : $("#date").val(),
'notes' : $("#notes").val(),
'nom_sel' : $("#taxon").val(),
'num_nom_sel' : $("#taxon").data("numNomSel"),
'nom_ret' : $("#taxon").data("nomRet"),
'num_nom_ret' : $("#taxon").data("numNomRet"),
'num_taxon' : $("#taxon").data("nt"),
'famille' : $("#taxon").data("famille"),
'referentiel' : ($("#taxon").data("numNomSel") == undefined ? '' : NOM_SCI_REFERENTIEL),
'latitude' : $("#latitude").val(),
'longitude' : $("#longitude").val(),
'commune_nom' : $("#commune-nom").text(),
'commune_code_insee' : $("#commune-code-insee").text(),
'lieudit' : $("#lieudit").val(),
'station' : $("#station").val(),
'milieu' : $("#milieu").val(),
//Ajout des champs images
'image_nom' : getNomsImgsOriginales(),
'image_b64' : getB64ImgsOriginales()
});
}
 
function surChangementReferentiel() {
NOM_SCI_PROJET = $('#referentiel').val();
NOM_SCI_REFERENTIEL = NOM_SCI_PROJET+':'+PROJETS_VERSIONS[NOM_SCI_PROJET];
$('#taxon').val('');
}
 
function surChangementNbreObs() {
if (obsNbre == 0) {
$("#transmettre-obs").attr('disabled', 'disabled');
$("#ajouter-obs").removeAttr('disabled');
} else if (obsNbre > 0 && obsNbre < OBS_MAX_NBRE) {
$("#transmettre-obs").removeAttr('disabled');
$("#ajouter-obs").removeAttr('disabled');
} else if (obsNbre >= OBS_MAX_NBRE) {
$("#ajouter-obs").attr('disabled', 'disabled');
afficherPanneau("#dialogue-bloquer-creer-obs");
}
}
 
function transmettreObs() {
var observations = $("#liste-obs").data();
console.log(observations);
if (observations == undefined || jQuery.isEmptyObject(observations)) {
afficherPanneau("#dialogue-zero-obs");
} else {
observations['projet'] = TAG_PROJET;
observations['tag-obs'] = TAG_OBS;
observations['tag-img'] = TAG_IMG;
var utilisateur = new Object();
utilisateur.id_utilisateur = $("#id_utilisateur").val();
utilisateur.prenom = $("#prenom").val();
utilisateur.nom = $("#nom").val();
utilisateur.courriel = $("#courriel").val();
observations['utilisateur'] = utilisateur;
envoyerObsAuCel(observations);
}
return false;
}
 
function envoyerObsAuCel(observations) {
var erreurMsg = "";
$.ajax({
url : SERVICE_SAISIE_URL,
type : "POST",
data : observations,
dataType : "json",
beforeSend : function() {
$("#dialogue-obs-transaction-ko").hide();
$("#dialogue-obs-transaction-ok").hide();
$(".alert-txt .msg").remove();
$(".alert-txt .msg-erreur").remove();
$(".alert-txt .msg-debug").remove();
$("#chargement").show();
},
success : function(data, textStatus, jqXHR) {
$('#dialogue-obs-transaction-ok .alert-txt').append($("#tpl-transmission-ok").clone().html());
supprimerMiniatures();
},
statusCode : {
500 : function(jqXHR, textStatus, errorThrown) {
erreurMsg += "Erreur 500 :\ntype : "+textStatus+' '+errorThrown+"\n";
}
},
error : function(jqXHR, textStatus, errorThrown) {
erreurMsg += "Erreur Ajax :\ntype : "+textStatus+' '+errorThrown+"\n";
try {
reponse = jQuery.parseJSON(jqXHR.responseText);
if (reponse != null) {
$.each(reponse, function (cle, valeur) {
erreurMsg += valeur + "\n";
});
}
} catch(e) {
erreurMsg += "L'erreur n'était pas en JSON.";
}
},
complete : function(jqXHR, textStatus) {
$("#chargement").hide();
var debugMsg = extraireEnteteDebug(jqXHR);
if (erreurMsg != '') {
if (DEBUG) {
$("#dialogue-obs-transaction-ko .alert-txt").append('<pre class="msg-erreur">'+erreurMsg+'</pre>');
$("#dialogue-obs-transaction-ko .alert-txt").append('<pre class="msg-debug">Débogage : '+debugMsg+'</pre>');
}
var hrefCourriel = "mailto:cel@tela-botanica.org?"+
"subject=Disfonctionnement du widget de saisie "+TAG_PROJET+
"&body="+erreurMsg+"\nDébogage :\n"+debugMsg;
$('#dialogue-obs-transaction-ko .alert-txt').append($("#tpl-transmission-ko").clone()
.find('.courriel-erreur')
.attr('href', hrefCourriel)
.end()
.html());
$("#dialogue-obs-transaction-ko").show();
} else {
if (DEBUG) {
$("#dialogue-obs-transaction-ok .alert-txt").append('<pre class="msg-debug">Débogage : '+debugMsg+'</pre>');
}
$("#dialogue-obs-transaction-ok").show();
}
initialiserObs();
}
});
}
 
function validerFormulaire() {
$observateur = $("#form-observateur").valid();
$station = $("#form-station").valid();
$obs = $("#form-obs").valid();
return ($observateur == true && $station == true && $obs == true) ? true : false;
}
 
function getNomsImgsOriginales() {
var noms = new Array();
$(".miniature-img").each(function() {
noms.push($(this).attr('alt'));
});
return noms;
}
 
function getB64ImgsOriginales() {
var b64 = new Array();
$(".miniature-img").each(function() {
if ($(this).hasClass('b64')) {
b64.push($(this).attr('src'));
} else if ($(this).hasClass('b64-canvas')) {
b64.push($(this).data('b64'));
}
});
 
return b64;
}
 
function supprimerObs() {
var obsId = $(this).val();
// Problème avec IE 6 et 7
if (obsId == "Supprimer") {
obsId = $(this).attr("title");
}
obsNbre = obsNbre - 1;
$(".obs-nbre").text(obsNbre);
$(".obs-nbre").triggerHandler('changement');
$('.obs'+obsId).remove();
$("#liste-obs").removeData('obsId'+obsId);
}
 
function initialiserObs() {
obsNbre = 0;
$(".obs-nbre").text(obsNbre);
$(".obs-nbre").triggerHandler('changement');
$("#liste-obs").removeData();
$('.obs').remove();
$("#dialogue-bloquer-creer-obs").hide();
}
 
function ajouterImgMiniatureAuTransfert() {
var html = '';
var miniatures = '';
var premiere = true;
if ($("#miniatures img").length >= 1) {
$("#miniatures img").each(function() {
var visible = premiere ? 'miniature-selectionnee' : 'miniature-cachee';
premiere = false;
var css = $(this).hasClass('b64') ? 'miniature b64' : 'miniature';
var src = $(this).attr("src");
var alt = $(this).attr("alt");
miniature = '<img class="'+css+' '+visible+'" alt="'+alt+'"src="'+src+'" />';
miniatures += miniature;
});
visible = ($("#miniatures img").length > 1) ? '' : 'defilement-miniatures-cache';
var html =
'<div class="defilement-miniatures">'+
'<a href="#" class="defilement-miniatures-gauche '+visible+'">&#60;</a>'+
miniatures+
'<a href="#" class="defilement-miniatures-droite '+visible+'">&#62;</a>'+
'</div>';
} else {
html = '<img class="miniature" alt="Aucune photo"src="'+PAS_DE_PHOTO_ICONE_URL+'" />';
}
return html;
}
 
function defilerMiniatures(element) {
var miniatureSelectionne = element.siblings("img.miniature-selectionnee");
miniatureSelectionne.removeClass('miniature-selectionnee');
miniatureSelectionne.addClass('miniature-cachee');
var miniatureAffichee = miniatureSelectionne;
if(element.hasClass('defilement-miniatures-gauche')) {
if(miniatureSelectionne.prev('.miniature').length != 0) {
miniatureAffichee = miniatureSelectionne.prev('.miniature');
} else {
miniatureAffichee = miniatureSelectionne.siblings(".miniature").last();
}
} else {
if(miniatureSelectionne.next('.miniature').length != 0) {
miniatureAffichee = miniatureSelectionne.next('.miniature');
} else {
miniatureAffichee = miniatureSelectionne.siblings(".miniature").first();
}
}
console.log(miniatureAffichee);
miniatureAffichee.addClass('miniature-selectionnee');
miniatureAffichee.removeClass('miniature-cachee');
}
 
function ajouterNumNomSel() {
var nn = '';
if ($("#taxon").data("numNomSel") == undefined) {
nn = '<span class="alert-error">[non lié au référentiel]</span>';
} else {
nn = '<span class="nn">[nn'+$("#taxon").data("numNomSel")+']</span>';
}
return nn;
}
 
//+---------------------------------------------------------------------------------------------------------+
// AUTO-COMPLÉTION Noms Scientifiques
 
function ajouterAutocompletionNoms() {
$('#taxon').autocomplete({
source: function(requete, add){
// la variable de requête doit être vidée car sinon le parametre "term" est ajouté
requete = "";
var url = getUrlAutocompletionNomsSci();
$.getJSON(url, requete, function(data) {
var suggestions = traiterRetourNomsSci(data);
add(suggestions);
});
},
html: true
});
$( "#taxon" ).bind("autocompleteselect", function(event, ui) {
$("#taxon").data(ui.item);
if (ui.item.retenu == true) {
$("#taxon").addClass('ns-retenu');
} else {
$("#taxon").removeClass('ns-retenu');
}
});
}
 
function getUrlAutocompletionNomsSci() {
var mots = $('#taxon').val();
var url = SERVICE_AUTOCOMPLETION_NOM_SCI_URL_TPL.replace('{referentiel}',NOM_SCI_PROJET);
url = url.replace('{masque}', mots);
return url;
}
 
function traiterRetourNomsSci(data) {
var suggestions = [];
if (data.resultat != undefined) {
$.each(data.resultat, function(i, val) {
val.nn = i;
var nom = {label : '', value : '', nt : '', nomSel : '', nomSelComplet : '', numNomSel : '',
nomRet : '', numNomRet : '', famille : '', retenu : false
};
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) {
nom.label = "...";
nom.value = $('#taxon').val();
suggestions.push(nom);
return false;
} else {
nom.label = val.nom_sci_complet;
nom.value = val.nom_sci_complet;
nom.nt = val.num_taxonomique;
nom.nomSel = val.nom_sci;
nom.nomSelComplet = val.nom_sci_complet;
nom.numNomSel = val.nn;
nom.nomRet = val.nom_retenu_complet;
nom.numNomRet = val["nom_retenu.id"];
nom.famille = val.famille;
nom.retenu = (val.retenu == 'false') ? false : true;
suggestions.push(nom);
}
});
}
return suggestions;
}
 
/*
* jQuery UI Autocomplete HTML Extension
*
* Copyright 2010, Scott González (http://scottgonzalez.com)
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* http://github.com/scottgonzalez/jquery-ui-extensions
*
* Adaptation par Aurélien Peronnet pour la mise en gras des noms de taxons valides
*/
(function( $ ) {
var proto = $.ui.autocomplete.prototype,
initSource = proto._initSource;
function filter( array, term ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
return $.grep( array, function(value) {
return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() );
});
}
$.extend( proto, {
_initSource: function() {
if ( this.options.html && $.isArray(this.options.source) ) {
this.source = function( request, response ) {
response( filter( this.options.source, request.term ) );
};
} else {
initSource.call( this );
}
},
_renderItem: function( ul, item) {
if (item.retenu == true) {
item.label = "<strong>"+item.label+"</strong>";
}
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label ) )
.appendTo( ul );
}
});
})( jQuery );
/tags/widget-origin-mobile/modules/saisie/squelettes/florileges/florileges.tpl.html
New file
0,0 → 1,552
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Florilege</title>
<meta charset="utf-8">
<meta name="author" content="Jean-Pascal MILCENT, Aurélien PERONNET" />
<meta name="keywords" content="Florilege, Tela Botanica, CEL" />
<meta name="description" content="Widget de saisie du projet Florilege" />
 
<!-- Viewport Mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="<?=$url_base?>/modules/saisie/squelettes/florilege/img/favicon.ico" />
<!-- Javascript : bibliothèques -->
<!-- Google Map v3 -->
<!--<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>-->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&amp;language=fr&amp;region=FR"></script>
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.9.1/jquery-1.9.1.js"></script>
<!-- Jquery UI : nécessaire pour le minicalendrier et l'auto-complétion -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.10.2/js/jquery-ui-1.10.2.custom.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.10.2/js/jquery.ui.datepicker-fr.min.js"></script>
<!-- Jquery Plugins -->
<!-- Jquery Validate : nécessaire pour la validation des formulaires -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.11.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.11.1/messages_fr.js"></script>
<!-- Jquery Form :nécessaire pour l'upload des images -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/form/3.32/jquery.form.min.js"></script>
<!-- Bootstrap -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/bootstrap/2.3.1/js/bootstrap.min.js"></script>
<!-- Javascript : appli saisie -->
<script type="text/javascript">
//<![CDATA[
// La présence du parametre 'debug' dans l'URL enclenche le dégogage
var DEBUG = <?=isset($_GET['debug']) ? 'true' : 'false'?>;
// La présence du parametre 'html5' dans l'URL enclenche les fonctions avancées HTML5
var HTML5 = <?=isset($_GET['html5']) ? 'true' : 'false'?>;
// Mot-clé du widget/projet
var TAG_PROJET = "WidgetFlorileges";
// Mots-clés à ajouter aux images
var TAG_IMG = "<?=isset($_GET['tag-img']) ? $_GET['tag-img'] : ''?>";
TAG_IMG = <?=isset($_GET['motcle']) ? "'".$_GET['motcle']."'" : 'TAG_IMG' ?>;
// Mots-clés à ajouter aux observations
var TAG_OBS = "<?=isset($_GET['tag-obs']) ? $_GET['tag-obs'] : ''?>";
TAG_OBS = <?=isset($_GET['projet']) ? "'".$_GET['projet']."'" : 'TAG_OBS' ?>;
// URL du web service réalisant l'insertion des données dans la base du CEL.
var SERVICE_SAISIE_URL = "<?=$url_ws_saisie?>";
// Code du référentiel utilisé pour les nom scientifiques (de la forme nom:code).
var NOM_SCI_REFERENTIEL = "<?=$ns_referentiel?>";
// Nom du référentiel utilisé pour les nom scientifiques.
var NOM_SCI_PROJET = "<?=$ns_projet?>";
// Code de la version du référentiel utilisé pour les nom scientifiques.
var NOM_SCI_VERSION = "<?=$ns_version?>";
// Nombre d'élément dans les listes d'auto-complétion
var AUTOCOMPLETION_ELEMENTS_NBRE = 20;
// Indication de la présence d'un référentiel imposé
var REFERENTIEL_IMPOSE = "<?=$referentiel_impose; ?>";
// Indication des version utilisées de chaque référentiel
var PROJETS_VERSIONS = <?=json_encode($projets_versions)?>;
// URL du web service permettant l'auto-complétion des noms scientifiques.
var SERVICE_AUTOCOMPLETION_NOM_SCI_URL = "<?=$url_ws_autocompletion_ns?>?"+
"masque={masque}&"+
"recherche=etendue&"+
"retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
//"version.projet="+NOM_SCI_VERSION+"&"+
"ns.structure=au"+"&"+
"navigation.limite="+AUTOCOMPLETION_ELEMENTS_NBRE;
// URL du web service permettant l'auto-complétion des noms scientifiques.
var SERVICE_AUTOCOMPLETION_NOM_SCI_URL_TPL = "<?=$url_ws_autocompletion_ns_tpl?>?"+
"masque={masque}&"+
"recherche=etendue&"+
"retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
//"version.projet="+NOM_SCI_VERSION+"&"+
"ns.structure=au"+"&"+
"navigation.limite="+AUTOCOMPLETION_ELEMENTS_NBRE;
// Nombre d'observations max autorisé avant transmission
var OBS_MAX_NBRE = 10;
// Durée d'affichage en milliseconde des messages d'informations
var DUREE_MESSAGE = 15000;
// Squelette d'URL du web service d'eFlore fournissant les noms de communes.
var SERVICE_NOM_COMMUNE_URL = "http://www.tela-botanica.org/service:eflore:0.1/osm/nom-commune?lon={lon}&lat={lat}";
// Squelette d'URL du web service d'eFlore fournissant les noms de communes hors de France (localisation approximative).
var SERVICE_NOM_COMMUNE_URL_ALT = "http://www.tela-botanica.org/service:eflore:0.1/wikipedia/nom-commune?lon={lon}&lat={lat}&nbre=1";
// URL du marqueur à utiliser dans la carte Google Map
var GOOGLE_MAP_MARQUEUR_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/marqueurs/epingle.png";
// URL de l'icône du chargement en cours
var CHARGEMENT_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/chargement.gif";
// URL de l'icône du chargement en cours d'une image
var CHARGEMENT_IMAGE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/chargement-image.gif";
// URL de l'icône du calendrier
var CALENDRIER_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/calendrier.png";
// URL de l'icône du calendrier
var PAS_DE_PHOTO_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/defaut/img/icones/pasdephoto.png";
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/saisie/squelettes/defaut/js/defaut.js"></script>
<!-- CSS -->
<link href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.10.2/css/smoothness/jquery-ui-1.10.2.custom.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/bootstrap/2.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/bootstrap/2.3.1/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?=$url_base?>modules/saisie/squelettes/defaut/css/<?=isset($_GET['style']) ? $_GET['style'] : 'defaut'?>.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body data-spy="scroll">
<div class="container">
<div class="row-fluid">
<div class="span6 page-header">
<div class="row">
<div class="span6">
<h1>
<?php if($logo != 'defaut' && $logo != '0') { ?>
<img id="logo-titre" class="span1" src="<?= $logo ?>" alt="Logo" />
<?php } else if($logo == 'defaut') { ?>
<img id="logo-titre" class="span1" src="<?=$url_base?>/modules/saisie/squelettes/defaut/img/logos/tela_botanica.png" alt="Tela Botanica" />
<?php } ?>
<?php if($titre != 'defaut') { ?>
<?= $titre; ?>
<?php } else { ?>
Ajout rapide d'observations
<?php } ?>
</h1>
</div>
</div>
<div class="row">
<div class="span6">
<p>
Cet outil vous permet de partager simplement vos observations avec le
<a href="http://www.tela-botanica.org/site:accueil">réseau Tela Botanica</a> (sous <a href="http://www.tela-botanica.org/page:licence?langue=fr">licence CC-BY-SA</a>).
Identifiez-vous bien pour ensuite retrouver et gérer vos données dans
<a href="http://www.tela-botanica.org/appli:cel">votre Carnet en ligne</a>.
Créez jusqu'à 10 observations (avec 10Mo max d'images) puis partagez-les avec le bouton 'transmettre'.
Elles apparaissent immédiatement sur les <a href="http://www.tela-botanica.org/site:botanique?langue=fr">cartes et galeries photos </a> du site.
</p>
<p class="discretion">
Pour toute question contactez <a href="mailto:cel_remarques@tela-botanica.org">cel_remarques@tela-botanica.org</a>
</p>
<p class="discretion">
Une fois familiarisé avec l'interface vous pouvez cliquer sur ce bouton pour désactiver l'aide.
<button id="btn-aide" class="btn btn-mini btn-success">
<span class="icon-question-sign icon-white"></span>
<span id="btn-aide-txt" >Désactiver l'aide</span>
</button>
</p>
</div>
</div>
</div>
<div class="span6">
<div class="well">
<h2>Observateur</h2>
<form id="form-observateur" action="#" class="" autocomplete="on">
<div class="row-fluid">
<div class="span6" rel="tooltip" data-placement="right"
title="Saisissez le courriel avec lequel vous être inscrit à Tela Botanica.
Si vous n'êtes pas inscrit, ce n'est pas grave, vous pourrez le faire
ultérieurement. Des informations complémentaires vont vous être
demandées : prénom et nom.">
<label for="courriel"
title="Veuillez saisir votre adresse courriel.">
<strong class="obligatoire">*</strong> Courriel
</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-envelope"></i>
</span>
<input id="courriel" class="input-medium" name="courriel" type="text"/>
<input id="id_utilisateur" name="id_utilisateur" type="hidden"/>
</div>
</div>
<div id="zone-courriel-confirmation" class="span6 hidden">
<label for="courriel_confirmation"
title="Veuillez saisir confirmer le courriel.">
<strong class="obligatoire">*</strong> Courriel (confirmation)
</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-envelope"></i>
</span><input id="courriel_confirmation" class="input-medium" name="courriel_confirmation" type="text"/>
</div>
</div>
</div>
<div id="zone-prenom-nom" class="row-fluid hidden">
<div class="span6">
<label for="prenom">Prénom</label>
<div>
<input id="prenom" name="prenom" class="span3" type="text"/>
</div>
</div>
<div class="span6">
<label for="nom">Nom</label>
<div>
<input id="nom" name="nom" class="span3" type="text"/>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Messages d'erreur du formulaire-->
<div class="row">
<div class="zone-alerte span6 offset3">
<div id="dialogue-bloquer-copier-coller" class="alert alert-info alert-block" style="display:none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : copier/coller</h4>
<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-courriel-introuvable" class="alert alert-info alert-block" style="display:none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : courriel introuvable</h4>
<p>
Vous n'êtes pas inscrit à Tela Botanica avec ce courriel.<br/>
Veuillez compléter les champs supplémentaires ou indiquer votre courriel d'inscription.<br/>
Pour retrouver vos observations dans le <a href="http://www.tela-botanica.org/appli:cel">Carnet en ligne</a>,
il sera nécesaire de <a href="http://www.tela-botanica.org/page:inscription">vous inscrire à Tela Botanica</a>.
</p>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="well">
<div class="row-fluid">
<div class="span6">
<div>
<div class="row-fluid">
<div class="span12">
<h2>Lieu du relevé</h2>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<label for="map_canvas" title="Veuillez localiser l'observation">
Géolocalisation
</label>
</div>
<div class="span8 droite">
<form id="form-carte-recherche" class="form-search form-horizontal" action="#" >
<div class="control-group">
<label for="carte-recherche">Rechercher</label>
<input id="carte-recherche" class="search-query" type="text" value=""
rel="tooltip"
title="Permet de centrer la carte sur le lieu recherché."
placeholder="Centrer la carte sur un lieu..."/>
</div>
</form>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div id="map-canvas" rel="tooltip"
title="Vous pouvez cliquer sur la carte pour déplacer le marqueur
représentant votre station ou bien le glisser-déposer sur
le lieu souhaité."></div>
</div>
</div>
<div class="row-fluid">
<label for="coordonnees-geo" class="span7">
<a href="#" class="afficher-coord">Afficher</a>
<a href="#" class="afficher-coord" style="display:none;">Cacher</a>
les coordonnées géographiques
<span id="lat-lon-info" class="info"
rel="tooltip"
title="Système géodésique mondial, révision de 1984 - Coordonnées non projetées">
(WGS84)
</span>
</label>
<div id="info-commune" class="span5">
<span for="marqueur-commune">Commune : </span>
<span id="marqueur-commune">
<span id="commune-nom" class="commune-info"></span>
(<span id="commune-code-insee" class="commune-info"
rel="tooltip"
title="Code INSEE de la commune"></span>)
</span>
</div>
</div>
<form id="form-station" class="control-group" action="#" enctype="multipart/form-data" autocomplete="on">
<div id="coordonnees-geo" class="well" style="display:none;">
<div class="row-fluid form-inline">
<div id="coord-lat" class="span4">
<label for="latitude">Latitude</label>
<div>
<input id="latitude" class="input-mini" name="latitude" type="text" value=""/>
</div>
</div>
<div id="coord-lng" class="span4">
<label for="longitude">Longitude</label>
<div>
<input id="longitude" class="input-mini" name="longitude" type="text" value=""/>
</div>
</div>
<div class="span1">
<div>
<input id="geolocaliser" type="button" value="Voir sur la carte"
rel="tooltip"
title="Centre la carte sur les coordonnées de latitude et longitude saisies."/>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span4" rel="tooltip"
title="Toponyme plus précis que la commune, utilisé localement et se trouvant souvent sur les cartes au 1/25 000." >
<label for="lieudit">Lieu-dit</label>
<div>
<input type="text" id="lieudit" class="span2" name="lieudit"/>
</div>
</div>
<div class="span4" rel="tooltip"
title="Lieu précis de l'observation définissant une unité écologique homogène (ex: le pré derrière la maison)." >
<label for="station">Station</label>
<div>
<input type="text" id="station" class="span2" name="station"/>
</div>
</div>
<div class="span4" rel="tooltip"
title="Type d'habitat plus ou moins standardisé dans les codes Corine ou Catminat (ex: prairie humide).">
<label for="milieux">Milieu</label>
<div>
<input type="text" id="milieu" class="span2" name="milieu" />
</div>
</div>
</div>
</form>
</div>
</div>
<div class="span6">
<form id="form-obs" action="#" autocomplete="on">
<h2>Observations</h2>
<?php if ($referentiel_impose == false) : ?>
<div class="row-fluid">
<div rel="tooltip"
title="Sélectionnez le référentiel associé à votre relevé">
<label for="referentiel" title="Réferentiel">
Référentiel
</label>
<span class="input-prepend">
<span id="referentiel-icone" class="add-on"><i class="icon-book"></i></span>
<select id="referentiel" autocomplete="off">
<option value="bdtfx" selected="selected" title="Trachéophytes de France métropolitaine">Métropole (BDTFX)</option>
<option value="bdtxa" title="Trachéophytes des Antilles">Antilles françaises (BDTXA)</option>
</select>
</span>
</div>
</div>
<?php endif; ?>
<div class="row-fluid">
<div class="span4" rel="tooltip"
title="Vous pouvez cliquer sur l'icône de calendrier pour
sélectionner une date dans un calendrier.">
<label for="date" title="Veuillez indiquer la date du relevé au format jj/mm/aaaa">
Date du relevé
</label>
<div class="input-prepend">
<span id="date-icone" class="add-on"></span>
<input id="date"
class="input-small" name="date" type="text"
placeholder="jj/mm/aaaa" />
</div>
</div>
<div id="taxon-input-groupe" class="span8" rel="tooltip"
title="Sélectionnez une espèce dans la liste déroulante pour lier
votre nom au référentiel selectionné. Si vous
le désirez vous pouvez aussi saisir un nom absent du référentiel
(Ex. : 'fleur violette' ou 'viola sinensis???')." >
<label for="taxon" title="Choisissez une espèce">
<strong class="obligatoire">*</strong>
Espèce <?= $referentiel_impose ? '('.$ns_projet.')' : '' ?> <em>(ou indication sur la plante)</em>
</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-leaf"></i>
</span><input type="text" id="taxon" name="taxon" value="<?= $nom_sci_espece_defaut; ?>" />
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<label for="notes">Commentaires</label>
<div>
<textarea id="notes" class="span6" rows="7" name="notes"
placeholder="vous pouvez éventuellement ajouter des informations complémentaires à votre observation (altitude, taille de la plante...)"></textarea>
</div>
</div>
</div>
</form>
<form id="form-upload" class="form-horizontal" action="<?=$url_base?>saisie?projet=sauvages&amp;service=upload-image"
method="post" enctype="multipart/form-data">
<h2>Images</h2>
<strong>Cliquez sur l'icone pour ajouter une image</strong>
<p class="miniature-info" class="discretion help-inline">Les photos doivent être au format JPEG et ne doivent pas excéder 5Mo chacunes.</p>
<div id ="photos-conteneur">
<div id="photo-placeholder" rel="tooltip"
title="Cliquez pour ajouter une photo de votre observation. Elle doit être au
format JPEG et ne doit pas excéder 5Mo."></div>
<input type="file" id="fichier" name="fichier" accept="image/jpeg" />
<input type="hidden" name="MAX_FILE_SIZE" value="5242880"/>
<div id="miniatures">
</div>
<p class="miniature-msg" class="span12">&nbsp;</p>
</div>
</form>
</div>
<div class="row-fluid">
<div class="span12 centre" rel="tooltip"
title="Une fois les champs remplis, vous pouvez cliquer sur ce bouton pour
ajouter votre observation à la liste à transmettre.">
<button id="ajouter-obs" class="btn btn-primary btn-large" type="button">
Créer
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Messages d'erreur du formulaire-->
<div class="row">
<div class="zone-alerte span6 offset3">
<div id="dialogue-bloquer-creer-obs" class="alert alert-warning alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : 10 observations maximum</h4>
<p>
Vous venez d'ajouter votre 10ème observation.<br/>
Pour en ajouter de nouvelles, il est nécessaire de les transmettre en cliquant sur le bouton ci-dessous.
</p>
</div>
</div>
<div class="zone-alerte span6 offset3">
<div id="dialogue-form-invalide" class="alert alert-warning alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Information : champs en erreur</h4>
<p>
Certains champs du formulaire sont mal remplis.<br/>
Veuillez vérifier vos données.
</p>
</div>
</div>
</div>
<!-- Affiche le tableau récapitualif des observations ajoutées -->
<div id="zone-liste-obs" class="row-fluid">
<div class="span12">
<div class="well">
<div class="row-fluid">
<div class="span8">
<h2>Observations à transmettre : <span class="obs-nbre">0</span></h2>
</div>
<div class="span4 droite">
<button id="transmettre-obs" class="btn btn-primary btn-large"
type="button" disabled="disabled" rel="tooltip"
title="Ajoute les observations ci-dessous à votre Carnet en Ligne et les rend publiques.">
Transmettre
</button>
</div>
</div>
<div id="liste-obs" ></div>
<div class="row">
<div class="zone-alerte span6 offset3">
<div id="dialogue-zero-obs" class="alert alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Attention : aucune observation</h4>
<p>Veuillez saisir des observations pour les transmettres.</p>
</div>
<div id="dialogue-obs-transaction-ok" class="alert alert-success alert-block" style="display: none;"">
<a class="close">×</a>
<h4 class="alert-heading">Information : transmission des observations</h4>
<div class="alert-txt"></div>
</div>
<div id="dialogue-obs-transaction-ko" class="alert alert-error alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Erreur : transmission des observations</h4>
<div class="alert-txt"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="row-fluid">
<p class="span12">&copy; Tela Botanica 2012</p>
</footer>
<!-- Fenêtres modales -->
<div id="chargement" class="modal-fenetre" style="display:none;">
<div id="chargement-centrage" class="modal-contenu">
<img id="chargement-img"
src="<?=$url_base?>modules/saisie/squelettes/sauvages/images/chargement_arbre.gif"
alt="Transfert en cours..."/>
<p id="chargement-txt" style="color:white;font-size:1.5em;">
Transfert des observations en cours...<br />
Cela peut prendre plusieurs minutes en fonction de la taille des images et du nombre
d'observations à transférer.
</p>
</div>
</div>
<!-- Templates HTML -->
<div id="tpl-transmission-ok" style="display:none;">
<p class="msg">
Vos observations ont bien été transmises.<br />
Elles sont désormais consultables à travers les différents outils de visualisation
du réseau (<a href="http://www.tela-botanica.org/site:botanique">eFlore</a>,
<a href="http://www.tela-botanica.org/page:cel_galerie">galeries d'images</a>,
<a href="http://www.tela-botanica.org/appli:test:del">identiplante</a>,
<a href="http://www.tela-botanica.org/widget:cel:cartoPoint">cartographie (widget)</a>...)<br />
Si vous souhaitez les modifier ou les supprimer, vous pouvez les retrouver en vous
connectant à votre <a href="http://www.tela-botanica.org/appli:cel">Carnet en ligne</a>.<br />
N'oubliez pas qu'il est nécessaire de
<a href="http://www.tela-botanica.org/page:inscription">s'inscrire à Tela Botanica</a>
au préalable, si ce n'est pas déjà fait.
</p>
</div>
<div id="tpl-transmission-ko" style="display:none;">
<p class="msg">
Une erreur est survenue lors de la transmission de vos observations.<br />
Vous pouvez signaler le dysfonctionnement à
<a class="courriel-erreur" href="mailto:">cel_remarques@tela-botanica.org</a>.
</p>
</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>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/saisie/squelettes/florileges/img/favicon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/florileges/img/favicon.ico
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/sauvages_taxons.tpl.js
New file
0,0 → 1,0
var taxons = <?=$taxons?>;
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/chargement_arbre.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/chargement_arbre.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/favicon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/favicon.ico
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/icones/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/icones/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/icones/aide.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/icones/aide.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/icones/supprimer.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/icones/supprimer.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/logos/sdmr.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/logos/sdmr.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/classic.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/classic.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/debut.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/debut.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/relief.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/relief.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/panneau.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/panneau.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/fin.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/fin.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/fleur.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/images/marqueurs/fleur.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/css/sauvages.css
New file
0,0 → 1,392
@CHARSET "UTF-8";
body {
padding:0;
margin:0;
width:100%;
height:100%;
font-family:Arial;
font-size:12px;
background-color:#FFF;
color:#000;
}
h1 {
font-size:1.6em;
}
h2 {
font-size:1.4em;
text-transform:uppercase;
letter-spacing:0.3em;
padding:5px 10px;
background:#A1CA10;
width:250px;
margin-bottom:0;
margin-left:2px;
-webkit-border-radius: 10px 10px 0 0;-moz-border-radius: 10px 10px 0 0;border-radius: 10px 10px 0 0;
line-height:2em;
}
a, a:active, a:visited {
border-bottom:1px dotted #666;
color:#181;
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:#000;
text-transform:uppercase;
letter-spacing:0.2em;
padding:5px 10px;
}
 
.colonne_milieu {
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Générique */
.discretion {
color:grey;
font-family:arial;
font-size:11px;
}
.nettoyage{
clear:both;
}
hr.nettoyage{
visibility:hidden;
}
label[title]:after, th[title]:after, span[title]:after {
content: " " url("../images/icones/aide.png");
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Positionnement général */
#zone-appli {
margin:0 auto;
width:600px;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Formulaire générique */
fieldset {
background-color:#fff;
}
input[type="text"], select, textarea {
width:240px;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Formulaire spécifique */
#zone-fiche-terrain, #zone-fiche-terrain-photo{
background:#A1CA10;
width:600px;
margin-left:2px;
padding-bottom:10px;
}
#zone-fiche-terrain{
-webkit-border-radius: 0 10px 0 0;-moz-border-radius: 0 10px 0 0;border-radius: 0 10px 0 0;
}
#zone-fiche-terrain-photo{
-webkit-border-radius: 0 0 10px 10px;-moz-border-radius: 0 0 10px 10px;border-radius: 0 0 10px 10px;
margin-top:-10px;
}
#zone-liste-obs{
padding-bottom:25px;
margin-top:15px;
-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;
}
#saisie-obs fieldset{
display:block;
}
#saisie-obs label{
font-weight:bold;
}
 
#partie-observation, #partie-preview, #partie-station{
margin-top:10px;
}
#partie-date * {
position: relative;
z-index:50;
}
#partie-station, #partie-observation, #partie-photo, #partie-date{
width:550px;
margin-left:10px;
background:#E5E5E5;
-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;
}
#partie-station legend, #partie-observation legend, #partie-photo legend, #partie-date legend{
background:#E5E5E5;
-webkit-border-radius: 10px 10px 0 0 ;-moz-border-radius: 10px 10px 0 0;border-radius: 10px 10px 0 0;
}
#saisie-obs ul {
list-style-type:none;
margin:0;
padding:0;
}
#saisie-obs li {
margin:5px;
}
/*-------------------------------------------------------*/
/* Partie-identification */
#partie-identification, #partie-identification legend{
background:#A1CA10;
-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;
}
#partie-identification{
width:582px;
}
#partie-identification li{
float: left;
margin-left: 20px;
display:inline;
width:250px;
}
#partie-identification label{
/*display:block;*/
}
/*-------------------------------------------------------*/
/* Partie-station */
#partie-station fieldset{
margin-top:0;
}
#partie-station label {
width: 120px;
display:block;
float:left;
}
#latitude, #longitude {
width:70px;
float:left;
}
#latitude {
margin-right:5px;
}
#lat-lon-info {
margin-left:5px;
}
#partie-observation label{
width:120px;
float:left;
}
#partie-observation li{
margin :10px;
}
#partie-station #label_map_canvas {
width: 100%;
}
#map-canvas {
width:525px;
height: 340px;
}
#partie-station #partie-lat-lon label.error{
float:left;
width:80px;
}
#partie-observation li li, #rue_numeros li{
width :150px;
float:left;
margin :5px;
}
#rue_numeros li{
width :265px;
float:left;
margin:0;
}
#rue_numeros li label{
width:80px;
float:left;
}
#rue_numeros li input{
width:175px;
}
#partie-observation li li label.error{
position: relative;
margin-top: -42px;
margin-left:50px;
float:left;
}
label[for=milieu]{
display:block;
width:100%;
}
label[for=coordonnees-geo] {
display:block;
width:100% !important;
}
ul#coordonnees-geo {
list-style-type:none;
float:left;
width: 100%;
}
ul#coordonnees-geo li {
float: left;
margin: 5px;
width: 201px;
}
ul#coordonnees-geo #coord-lat,ul#coordonnees-geo #coord-lng {
width: 70px;
}
ul#coordonnees-geo #info-commune{
width: 150px;
}
ul#liste-milieux{
float:left;
}
ul#liste-milieux li{
display:inline;
width:100px;
}
#notes{
width:400px;
}
#rue{
/**width:440px;**/
left: 35px;
position: relative;
top: 35px;
width: 320px;
z-index: 45;
}
.indication_geolocalisation {
color:#118811;
font-style: italic;
font-weight: bold;
font-weight:0.9em;
}
.indication_geolocalisation {
height: 30px;
position: relative;
top: 15px;
}
/*-------------------------------------------------------*/
/* Photo */
#resultat,.resultat {
width:20%;
}
.resultat {
width:30px;
}
#form-upload{
margin-top:10px;
}
#miniature-info{
margin:0;
}
.b64{
max-width:100px;
max-height:100px;
}
/*-------------------------------------------------------*/
/* Partie-preview */
#partie-preview legend, #partie-preview{
background:#A1CA10;
-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;
}
#partie-preview {
width:582px;
border:none;
}
.supprimer-obs{
background-color:transparent;
border:none;
padding:0;
cursor:pointer;
}
.obs-miniature {
text-align:center;
}
.obligatoire {
color:red;
}
label.error {
display:inline;
float:none;
padding-left:.5em;
color:red;
}
#partie-observation label.error,#partie-station label.error {
width:150px;
float:right;
}
#ajouter-obs{
margin-left:407px;
margin-top:10px;
font-size:20px;
background:#181;
color:#FFF;
-webkit-border-radius: 5x;-moz-border-radius: 5px;border-radius: 5px;
height:35px;
width:137px;
}
#transmettre-obs{
margin-left:400px;
margin-top:5px;
font-size:20px;
background:#811;
color:#FFF;
-webkit-border-radius: 5x;-moz-border-radius: 5px;border-radius: 5px;
height:35px;
}
/*-------------------------------------------------------*/
/* Autocomplete */
.valeur-defaut-recherche {
color:#848484;
font-style:italic;
font-weight:0.9em;
}
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/js/sauvages.js
New file
0,0 → 1,707
//+---------------------------------------------------------------------------------------------------------+
// GÉNÉRAL
/**
* 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;
}
 
// TODO : voir si cette fonction est bien utile. Résoud le pb d'un warning sous chrome.
(function(){
// remove layerX and layerY
var all = $.event.props,
len = all.length,
res = [];
while (len--) {
var el = all[len];
if (el != 'layerX' && el != 'layerY') res.push(el);
}
$.event.props = res;
}());
 
//+----------------------------------------------------------------------------------------------------------+
//UPLOAD PHOTO : Traitement de l'image
$(document).ready(function() {
$("#effacer-miniature").click(function () {
supprimerMiniature();
});
if (HTML5 && window.File && window.FileReader && isCanvasSupported()) {
if (DEBUG) {
console.log("Support OK pour : API File et Canvas.");
}
$('#fichier').bind('change', function(e) {
afficherMiniatureHtml5(e);
});
} else {
$("#fichier").bind('change', function (e) {
arreter(e);
var options = {
success: afficherMiniature, // post-submit callback
dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
resetForm: true // reset the form after successful submit
};
$("#form-upload").ajaxSubmit(options);
return false;
});
}
});
function isCanvasSupported(){
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
}
 
function afficherMiniatureHtml5(evt) {
supprimerMiniature();
var selectedfiles = evt.target.files;
var f = selectedfiles[0];// Nous récupérons seulement le premier fichier.
if (f.type != 'image/jpeg') {
var message = "Seule les images JPEG sont supportées.";
$("#miniature-msg").append(message);
} else if (f.size > 5242880) {
var message = "Votre image à un poids supérieur à 5Mo.";
$("#miniature-msg").append(message);
} else {
var reader = new FileReader();
// Lit le fichier image commune url de données
reader.readAsDataURL(f);
var imgNom = f.name;
// Closure pour capturer les infos du fichier
reader.onload = (function(theFile) {
return function(e) {
// Rendre la miniature
var imageBase64 = e.target.result;
//$("#miniature").append('<img id="miniature-img" class="miniature b64" src="'+imageBase64+'" alt="'+imgNom+'"/>');
// HTML5 Canvas
var img = new Image();
img.src = imageBase64;
img.alt = imgNom;
img.onload = function() {
transformerImgEnCanvas(this, 100, 100, false, 'white');
};
};
})(f);
}
$("#effacer-miniature").show();
}
function transformerImgEnCanvas(img, thumbwidth, thumbheight, crop, background) {
var canvas = document.createElement('canvas');
canvas.width = thumbwidth;
canvas.height = thumbheight;
var dimensions = calculerDimenssions(img.width, img.height, thumbwidth, thumbheight);
if (crop) {
canvas.width = dimensions.w;
canvas.height = dimensions.h;
dimensions.x = 0;
dimensions.y = 0;
}
cx = canvas.getContext('2d');
if (background !== 'transparent') {
cx.fillStyle = background;
cx.fillRect(0, 0, thumbwidth, thumbheight);
}
cx.drawImage(img, dimensions.x, dimensions.y, dimensions.w, dimensions.h);
afficherMiniatureCanvas(img, canvas);
}
 
function calculerDimensions(imagewidth, imageheight, thumbwidth, thumbheight) {
var w = 0, h = 0, x = 0, y = 0,
widthratio = imagewidth / thumbwidth,
heightratio = imageheight / thumbheight,
maxratio = Math.max(widthratio, heightratio);
if (maxratio > 1) {
w = imagewidth / maxratio;
h = imageheight / maxratio;
} else {
w = imagewidth;
h = imageheight;
}
x = (thumbwidth - w) / 2;
y = (thumbheight - h) / 2;
return {w:w, h:h, x:x, y:y};
}
 
function afficherMiniatureCanvas(imgB64, canvas) {
var url = canvas.toDataURL('image/jpeg' , 0.8);
var alt = imgB64.alt;
var title = Math.round(url.length / 1000 * 100) / 100 + ' KB';
var miniature = '<img id="miniature-img" class="miniature b64-canvas" src="'+url+'" alt="'+alt+'" title="'+title+'" />';
$("#miniature").append(miniature);
$("#miniature-img").data('b64', imgB64.src);
}
 
function afficherMiniature(reponse) {
supprimerMiniature();
if (DEBUG) {
var debogage = $("debogage", reponse).text();
console.log("Débogage upload : "+debogage);
}
var message = $("message", reponse).text();
if (message != '') {
$("#miniature-msg").append(message);
} else {
var miniatureUrl = $("miniature-url", reponse).text();
var imgNom = $("image-nom", reponse).text();
$("#miniature").append('<img id="miniature-img" class="miniature" alt="'+imgNom+'" src="'+miniatureUrl+'"/>');
}
$("#effacer-miniature").show();
}
 
function supprimerMiniature() {
$("#miniature").empty();
$("#miniature-msg").empty();
$("#effacer-miniature").hide();
}
 
//+----------------------------------------------------------------------------------------------------------+
// GOOGLE MAP
var geocoder;
var map;
// marqueurs de début et fin de rue
var marker;
var markerFin;
// coordonnées de début et fin de rue
var latLng;
var latLngFin;
// ligne reliant les deux points de début et fin
var ligneRue;
// Booléen de test afin de ne pas faire apparaitre la fin de rue à la premiere localisation
var premierDeplacement = true;
 
function initialiserGoogleMap(){
// Carte
latLng = new google.maps.LatLng(48.8543, 2.3483);// Paris
if (VILLE == 'Marseille') {
latLng = new google.maps.LatLng(43.29545, 5.37458);
} else if (VILLE == 'Montpellier') {
latLng = new google.maps.LatLng(43.61077, 3.87672);
}
latLngFin = latLng;
var options = {
zoom: 16,
center: latLng,
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
});
// Création de la carte Google
map = new google.maps.Map(document.getElementById('map-canvas'), options); //affiche la google map dans la div map_canvas
map.mapTypes.set('OSM', osmMapType);
// Geocodeur
geocoder = new google.maps.Geocoder();
 
// Marqueur google draggable
marker = new google.maps.Marker({
map: map,
draggable: true,
title: 'Début de la portion de rue étudiée',
icon: MARQUEUR_ICONE_DEBUT_URL,
position: latLng
});
deplacerMarker(latLng);
// Tentative de geocalisation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
latLng = new google.maps.LatLng(latitude, longitude);
latLngFin = latLng;
// si l'utilisateur géolocalise sa ville alors le premier déplacement doit être réinitialisé
premierDeplacement = true;
deplacerMarker(latLng);
});
}
}
 
 
var valeurDefautRechercheLieu = "";
 
$(document).ready(function() {
initialiserGoogleMap();
gererAffichageValeursParDefaut();
 
// Autocompletion du champ adresse
$("#rue").autocomplete({
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
source: function(request, response) {
geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
response($.map(results, function(item) {
var rue = "";
$.each(item.address_components, function(){
if (this.types[0] == "route" || this.types[0] == "street_address" ) {
rue = this.short_name;
}
});
var retour = {
label: item.formatted_address,
value: rue,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
};
return retour;
}));
} else {
afficherErreurGoogleMap(status);
}
});
},
// Cette partie est executee a la selection d'une adresse
select: function(event, ui) {
latLng = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
deplacerMarker(latLng);
afficherEtapeGeolocalisation(2);
}
});
$("#geolocaliser").click(function() {
var latitude = $('#latitude').val();
var longitude = $('#longitude').val();
latLng = new google.maps.LatLng(latitude, longitude);
deplacerMarker(latLng);
});
google.maps.event.addListener(marker, 'dragend', function() {
trouverCommune(marker.getPosition());
mettreAJourMarkerPosition(marker.getPosition());
deplacerMarker(marker.getPosition());
});
google.maps.event.addListener(map, 'click', function(event) {
deplacerMarker(event.latLng);
});
});
 
function gererAffichageValeursParDefaut() {
afficherEtapeGeolocalisation(1);
}
 
function afficherEtapeGeolocalisation(numEtape) {
$(".liste_indication_geolocalisation").children().hide();
$(".liste_indication_geolocalisation :nth-child("+numEtape+")").show();
}
 
function afficherErreurGoogleMap(status) {
if (DEBUG) {
$("#dialogue-google-map").empty();
$("#dialogue-google-map").append('<pre class="msg-erreur">'+
"Le service de Géocodage de Google Map a échoué à cause de l'erreur : "+status+
'</pre>');
$("#dialogue-google-map").dialog();
}
}
 
function deplacerMarker(latLng) {
if (marker != undefined) {
marker.setPosition(latLng);
map.setCenter(latLng);
//map.setZoom(18);
trouverCommune(latLng);
if(!premierDeplacement) {
if(markerFin != undefined) {
markerFin.setMap(null);
}
latLngFin = new google.maps.LatLng(latLng.lat(), latLng.lng() + 0.0010);
// Marqueur google draggable
markerFin = new google.maps.Marker({
map: map,
draggable: true,
title: 'Fin de la portion de rue étudiée',
icon: MARQUEUR_ICONE_FIN_URL,
position: latLngFin
});
google.maps.event.addListener(markerFin, 'dragend', function() {
dessinerLigneRue(marker.getPosition(), markerFin.getPosition());
latLngFin = markerFin.getPosition();
latLngCentre = new google.maps.LatLng((latLngFin.lat() + latLng.lat())/2, (latLngFin.lng() + latLng.lng())/2);
mettreAJourMarkerPosition(latLngCentre);
afficherEtapeGeolocalisation(4);
});
dessinerLigneRue(latLng, latLngFin);
latLngCentre = new google.maps.LatLng((latLngFin.lat() + latLng.lat())/2, (latLngFin.lng() + latLng.lng())/2);
mettreAJourMarkerPosition(latLng);
afficherEtapeGeolocalisation(3);
} else {
mettreAJourMarkerPosition(latLng);
}
premierDeplacement = false;
}
}
 
function dessinerLigneRue(pointDebut, pointFin) {
if(ligneRue != undefined) {
ligneRue.setMap(null);
}
ligneRue = new google.maps.Polyline({
path: [pointDebut, pointFin],
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
 
ligneRue.setMap(map);
}
 
function mettreAJourMarkerPosition(latLng) {
var lat = latLng.lat().toFixed(5);
var lng = latLng.lng().toFixed(5);
remplirChampLatitude(lat);
remplirChampLongitude(lng);
}
 
function remplirChampLatitude(latDecimale) {
var lat = Math.round(latDecimale*100000)/100000;
$('#latitude').val(lat);
}
 
function remplirChampLongitude(lngDecimale) {
var lng = Math.round(lngDecimale*100000)/100000;
$('#longitude').val(lng);
}
 
function trouverCommune(pos) {
$(function() {
var urlNomCommuneFormatee = SERVICE_NOM_COMMUNE_URL.replace('{lat}', pos.lat()).replace('{lon}', pos.lng());
$.ajax({
url : urlNomCommuneFormatee,
type : "GET",
dataType : "jsonp",
beforeSend : function() {
$(".commune-info").empty();
$("#dialogue-erreur").empty();
},
success : function(data, textStatus, jqXHR) {
$(".commune-info").empty();
if(data != null) {
$("#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();
}
}
});
});
}
 
//+---------------------------------------------------------------------------------------------------------+
// FORMULAIRE
$(document).ready(function() {
$("#date").datepicker($.datepicker.regional['fr']);
$("form#saisie-obs").validate({
rules: {
courriel : {
required : true,
email : true},
courriel_confirmation : {
required : true,
equalTo: "#courriel"
},
rue_cote : "required",
"milieu[]" : {
required: true,
minlength: 1
},
latitude : {
required: true,
range: [-90, 90]},
longitude : {
required: true,
range: [-180, 180]},
date : {
required: true,
date: true},
taxon : "required"
},
messages: {
"milieu[]": "Vous devez sélectionner au moins un milieu"
}
});
$("#courriel_confirmation").bind('paste', function(e) {
$("#dialogue-bloquer-copier-coller").dialog();
return false;
});
//bascule le texte d'afficher à masquer
$("a.afficher-coord").click(function() {
$("a.afficher-coord").toggle();
$("#coordonnees-geo").toggle('slow');
//valeur false pour que le lien ne soit pas suivi
return false;
});
var obsNumero = 0;
$("#ajouter-obs").bind('click', function(e) {
if ($("#saisie-obs").valid() == false) {
$("#dialogue-form-invalide").dialog();
} else {
var milieux = [];
$('input:checked["name=milieux[]"]').each(function() {
milieux.push($(this).val());
});
var rue = ($("#rue").val() == valeurDefautRechercheLieu) ? 'non renseigné(e)' : $("#rue").val();
//rassemble les obs dans un tableau html
obsNumero = obsNumero + 1;
$("#liste-obs tbody").append(
'<tr id="obs'+obsNumero+'" class="obs">'+
'<td>'+obsNumero+'</td>'+
'<td>'+$("#date").val()+'</td>'+
'<td>'+rue+'</td>'+
'<td>'+$("#taxon option:selected").text()+'</td>'+
'<td>'+milieux.join(',<br />')+'</td>'+
'<td>'+$("#latitude").val()+' / '+$("#longitude").val()+'</td>'+
//Ajout du champ photo
'<td class="obs-miniature">'+ajouterImgMiniatureAuTransfert()+'</td>'+
'<td>'+$("#notes").val()+'</td>'+
'<td><button class="supprimer-obs" value="'+obsNumero+'" title="Supprimer l\'observation '+obsNumero+'">'+
'<img src="'+SUPPRIMER_ICONE_URL+'"/></button></td>'+
'</tr>');
//rassemble les obs dans #liste-obs
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' : milieux.join(','),
'latitude' : $("#latitude").val(),
'longitude' : $("#longitude").val(),
'commune_nom' : $("#commune-nom").text(),
'commune_code_insee' : $("#commune-code-insee").text(),
'lieudit' : rue,
'station' : latLng.lat().toFixed(5)+','+latLng.lng().toFixed(5)+';'+latLngFin.lat().toFixed(5)+','+latLngFin.lng().toFixed(5)+';'+$("#rue_cote").val(),
'notes' : $("#notes").val(),
//Ajout des champs images
'image_nom' : $("#miniature-img").attr('alt'),
'image_b64' : getB64ImgOriginal()
});
// retour à une sélection vide pour le taxon
$('#taxon option[value=""]').attr("selected", "selected");
}
});
$(".supprimer-obs").live('click', supprimerObs);
$("#transmettre-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'] = 'Sauvages';
var utilisateur = new Object();
utilisateur.prenom = $("#prenom").val();
utilisateur.nom = $("#nom").val();
utilisateur.courriel = $("#courriel").val();
observations['utilisateur'] = utilisateur;
var erreurMsg = "";
$.ajax({
url : SERVICE_SAISIE_URL,
type : "POST",
data : observations,
dataType : "json",
beforeSend : function() {
$(".msg").remove();
$(".msg-erreur").remove();
$(".msg-debug").remove();
$("#chargement").show();
},
success : function(data, textStatus, jqXHR) {
var message = 'Merci Beaucoup! Vos observations ont bien été transmises aux chercheurs.<br />'+
'Elles sont désormais affichées sur la carte Sauvages de ma rue, <br />'+
'et s\'ajoutent aux données du Carnet en ligne (<a href="http://www.tela-botanica.org/widget:cel:carto">voir la carte</a>) de Tela Botanica <br />'+
'<br /> '+
'Bonne continuation! <br />'+
'<br /> '+
'Si vous souhaitez modifier ou supprimer vos données, vous pouvez les retrouver en vous connectant au <a href="http://www.tela-botanica.org/page:cel">Carnet en ligne</a>. <br /> '+
'(Attention, il est nécessaire de s\'inscrire gratuitement à Tela Botanica au préalable, si ce n\'est pas déjà fait). <br /> '+
'<br /> '+
'Pour toute question, n\'hésitez pas: notre contact: sauvages@tela-botanica.org ';
$("#dialogue-obs-transaction").append('<p class="msg">'+message+'</p>');
supprimerMiniature();
},
statusCode : {
500 : function(jqXHR, textStatus, errorThrown) {
$("#chargement").hide();
erreurMsg += "Erreur 500 :\ntype : "+textStatus+' '+errorThrown+"\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";
try {
reponse = jQuery.parseJSON(jqXHR.responseText);
if (reponse != null) {
$.each(reponse, function (cle, valeur) {
erreurMsg += valeur + "\n";
});
}
} catch(e) {
erreurMsg += "L'erreur n'était pas en JSON.";
}
if (DEBUG) {
$("#dialogue-obs-transaction").append('<pre class="msg-erreur">'+erreurMsg+'</pre>');
}
},
complete : function(jqXHR, textStatus) {
$("#chargement").hide();
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;
});
});
 
function getB64ImgOriginal() {
var b64 = '';
if ($("#miniature-img").hasClass('b64')) {
b64 = $("#miniature-img").attr('src');
} else if ($("#miniature-img").hasClass('b64-canvas')) {
b64 = $("#miniature-img").data('b64');
}
return b64;
}
 
function supprimerObs() {
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);
}
 
function ajouterImgMiniatureAuTransfert() {
var miniature = '';
if ($("#miniature img").length == 1) {
var css = $("#miniature-img").hasClass('b64') ? 'miniature b64' : 'miniature';
var src = $("#miniature-img").attr("src");
var alt = $("#miniature-img").attr("alt");
miniature = '<img class="'+css+'" alt="'+alt+'"src="'+src+'" />';
}
return miniature;
}
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/sauvages_image.tpl.xml
New file
0,0 → 1,7
<?='<?xml version="1.0" encoding="UTF-8"?>'."\n";?>
<root>
<miniature-url><?=$urlMiniature?></miniature-url>
<image-nom><?=$imageNom?></image-nom>
<message><?=$message?></message>
<debogage><?=$debogage?></debogage>
</root>
/tags/widget-origin-mobile/modules/saisie/squelettes/sauvages/sauvages.tpl.html
New file
0,0 → 1,324
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sauvages de ma rue</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="Céline VIDAL, Jean-Pascal MILCENT" />
<meta name="keywords" content="Tela Botanica, Natural Solutions, MNHN, Sauvages de ma rue, CEL" />
<meta name="description" content="Widget de saisie simplifié pour le projet Sauvages de ma rue" />
 
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="<?=$url_base?>/modules/saisie/squelettes/sauvages/images/favicon.ico" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- Javascript : bibliothèques -->
<!-- Google Map v3 -->
<!--<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>-->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&amp;language=fr&amp;region=FR"></script>
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.7.1/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.17/js/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.9.0/jquery.validate.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.9.0/messages_fr.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/form/2.95/jquery.form.min.js"></script>
<script src="<?=$url_base?>saisie?projet=sauvages&amp;service=taxons" type="text/javascript"></script>
<!-- Javascript : appli saisie -->
<script type="text/javascript">
//<![CDATA[
// La présence du parametre 'debug' dans l'URL enclenche le dégogage
var DEBUG = <?=isset($_GET['debug']) ? 'true' : 'false'?>;
// La présence du parametre 'html5' dans l'URL enclenche les fonctions avancées HTML5
var HTML5 = <?=isset($_GET['html5']) ? 'true' : 'false'?>;
// La présence du parametre 'ville' dans l'URL géolocalise
var VILLE = "<?=isset($_GET['ville']) ? $_GET['ville'] : ''?>";
VILLE = <?= isset($_GET['commune']) ? "'".$_GET['commune']."'" : 'VILLE' ?>;
// URL du web service réalisant l'insertion des données dans la base du CEL.
var SERVICE_SAISIE_URL = "<?=$url_ws_saisie?>";
// Squelette d'URL du web service d'eFlore fournissant les noms de communes.
var SERVICE_NOM_COMMUNE_URL = "http://www.tela-botanica.org/service:eflore:0.1/osm/nom-commune?lon={lon}&lat={lat}";
// URL du marqueur à utiliser dans la carte Google Map
var MARQUEUR_ICONE_DEBUT_URL = "<?=$url_base?>/modules/saisie/squelettes/sauvages/images/marqueurs/debut.png";
// URL de l'icône du bouton supprimer
var SUPPRIMER_ICONE_URL = "<?=$url_base?>/modules/saisie/squelettes/sauvages/images/icones/supprimer.png";
// URL de l'icône du chargement en cours
var CHARGEMENT_ICONE_URL = "<?=$url_base?>/modules/saisie/squelettes/sauvages/images/icones/chargement.gif";
// URL de l'icône de fin de rue
var MARQUEUR_ICONE_FIN_URL = "<?=$url_base?>/modules/saisie/squelettes/sauvages/images/marqueurs/fin.png";
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/saisie/squelettes/sauvages/js/sauvages.js"></script>
<!-- CSS -->
<link href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.17/css/ui-darkness/jquery-ui-1.8.17.custom.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?=$url_base?>modules/saisie/squelettes/sauvages/css/<?=isset($_GET['style']) ? $_GET['style'] : 'sauvages'?>.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body>
<div id="zone-appli">
<?php if($titre == 'defaut' ) { ?>
<h1 id="widget-titre"><img src="<?=$url_base?>/modules/saisie/squelettes/sauvages/images/logos/sdmr.png" alt="Sauvages de ma rue : Saisie des observations"/></h1>
<?php } else { ?>
<h1 id="widget-titre"><?= $titre ?></h1>
<?php } ?>
<form id="saisie-obs" action="#" enctype="multipart/form-data" autocomplete="on">
<fieldset id="partie-identification">
<legend>Observateur</legend>
<ul>
<li>
<label for="prenom">Prénom</label>
<input id="prenom" name="prenom" type="text" value=""/>
</li>
<li>
<label for="nom">Nom</label>
<input id="nom" name="nom" type="text" value=""/>
</li>
<li>
<label for="courriel" class="oblig"
title="Saisissez votre adresse email. Elle vous permettra de retrouver vos données, et ne sera pas utilisée à des fins commerciales.">
<strong class="obligatoire">*</strong> Courriel
</label>
<input id="courriel" name="courriel" type="text" value=""/>
</li>
<li>
<label for="courriel_confirmation" class="oblig" title="Saisissez à nouveau votre adresse email pour la confirmer">
<strong class="obligatoire">*</strong> Courriel (confirmation)
</label>
<input id="courriel_confirmation" name="courriel_confirmation" type="text" value=""/>
</li>
</ul>
</fieldset>
<h2>Fiche de terrain</h2>
<div id="zone-fiche-terrain">
<fieldset id="partie-date">
<legend>Date du relevé</legend>
<ul>
<li>
<label for="date" title="Indiquez la date de votre relevé (au format jj/mm/aaaa) ou utilisez le calendrier">
<strong class="obligatoire">*</strong> Date du relevé
</label>
<input id="date" name="date" type="text" value="" />
</li>
</ul>
</fieldset>
<fieldset id="partie-station">
<legend>Lieu du relevé</legend>
<ul>
<li>
<label id="label_map_canvas" for="map_canvas" class="oblig" title="Sur la carte ci-dessous, retracez le parcours étudié, en placant d'abord le point de début de la rue, puis le point de fin">
<strong class="obligatoire">*</strong> Localisation de la rue étudiée
</label>
</li>
<li>
<ul class="liste_indication_geolocalisation">
<li class="indication_geolocalisation">1ere étape : Entrez le nom de la rue et de la ville dans l'espace de recherche ci-dessous</li>
<li class="indication_geolocalisation">2eme étape : Placez le drapeau vert au début de la portion de rue étudiée</li>
<li class="indication_geolocalisation">3eme étape : Placez le drapeau rouge à la fin de la portion de rue étudiée, si vous vous êtes trompé,
vous pouvez redéplacer le drapeau vert</li>
<li class="indication_geolocalisation">4eme étape : Voilà ! Votre zone d'étude est localisée ! Vous pouvez passer à la saisie de l'observation.</li>
</ul>
<input id="rue" name="rue" type="text" placeholder="Entrez un nom de ville, de lieu ou de rue..." value="" />
</li>
<li id="map-canvas"></li>
<li>
<label for="coordonnees-geo">
<a href="#" class="afficher-coord">Afficher</a>
<a href="#" class="afficher-coord" style="display:none;">Cacher</a>
Les coordonnées géographiques
<span id="lat-lon-info" class="info"
title="Système géodésique mondial, révision de 1984 - Coordonnées non projetées">
(WGS84)
</span>
</label>
<ul id="coordonnees-geo" style="display:none;">
<li id="coord-lat">
<label for="latitude">Latitude</label>
<input id="latitude" name="latitude" type="text" value=""/>
</li>
<li id="coord-lng">
<label for="longitude">Longitude</label>
<input id="longitude" name="longitude" type="text" value=""/>
</li>
<li id="info-commune">
<label for="marqueur-commune">Commune</label><br />
<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>
</li>
<li>
<input id="geolocaliser" type="button" value="Voir sur la carte"/>
</li>
</ul>
</li>
<li>
<hr class="nettoyage" />
</li>
<li>
<ul>
<li>
<label for="rue_cote" title="Choisissez le (ou les) côté(s) de la rue que vous avez étudié">
<strong class="obligatoire">*</strong>
Côté de la rue
</label>
<select id="rue_cote" name="rue_cote">
<option value="">Sélectionner un type de côté</option>
<option value="pair">Pair</option>
<option value="impair">Impair</option>
<option value="2cotes">Les deux</option>
</select>
</li>
</ul>
</li>
</ul>
</fieldset>
<fieldset id="partie-observation">
<legend>Observations</legend>
<ul>
<li>
<label for="taxon" title="Choisissez une espèce rencontrée. Si vous avez trouvé d'autres espèces non listées, n'hésitez pas à le signaler dans les notes">
<strong class="obligatoire">*</strong>
Espèce
</label>
<select id="taxon" name="taxon">
<option value="">Sélectionner une espèce</option>
<?php foreach ($taxons as $taxon) :?>
<option <?= $taxon['nom_ret']== $taxon['nom_fr'] ? 'style="font-style:italic;"' : '' ?> value="<?=$taxon['num_nom_sel']?>"
title="<?=$taxon['nom_ret'].($taxon['nom_fr_autre'] != '' ? ' - '.$taxon['nom_fr_autre'] : '' )?>">
<?=$taxon['nom_fr']?>
</option>
<?php endforeach; ?>
</select>
</li>
<li>
<label for="liste-milieux" title="Indiquez le (ou les) milieu(x) dans lequel (lesquels) vous avez rencontré cette espèce">
<strong class="obligatoire">*</strong>
Milieu
</label>
<ul id="liste-milieux">
<?php foreach ($milieux as $milieu => $description) : ?>
<li>
<input type="checkbox" class="milieu" name="milieu[]" value="<?=$milieu?>"
<?=($description != '') ? 'title="'.$description.'"': '' ?>/>
<?=$milieu?>
</li>
<?php endforeach; ?>
</ul>
<hr class="nettoyage" />
</li>
<li>
<label for="notes">Notes</label>
<textarea id="notes" name="notes" rows="3" cols="4" placeholder="Indiquez nous en particulier le ou les outils d'identification que vous avez utilisé, et toute autre information concernant le milieu ou l'espèce" ></textarea>
</li>
</ul>
</fieldset>
</div><!-- zone-fiche-terrain-->
</form>
<div id="zone-fiche-terrain-photo">
<form id="form-upload" action="<?=$url_base?>saisie?projet=sauvages&amp;service=upload-image"
method="post" enctype="multipart/form-data">
<fieldset id="partie-photo">
<legend>Ajouter une photo</legend>
<p id="miniature-info" class="discretion">Vous pouvez ajouter une photo correspondant à cette espèce. La photo doit être au format JPEG et ne doit pas excéder 5Mo.</p>
<input type="file" id="fichier" name="fichier" accept="image/jpeg"/>
<input type="hidden" name="MAX_FILE_SIZE" value="5242880"/>
<p id="miniature-msg">&nbsp;</p>
<div id="miniature"></div>
<button id="effacer-miniature" type="button" style="display:none;">Effacer</button>
</fieldset>
</form>
<div>
<button id="ajouter-obs" type="button">Ajouter</button>
</div>
</div><!-- zone-fiche-terrain-photo -->
<!-- Affiche le tableau récapitualif des observations ajoutées -->
<div id="zone-liste-obs">
<form action="#" >
<fieldset id="partie-preview">
<legend>Liste des observations à transmettre</legend>
<table id="liste-obs">
<thead>
<tr>
<th>N&deg;</th>
<th>Date</th>
<th>Adresse</th>
<th>Nom</th>
<th>Milieu(x)</th>
<th title="Latitude / Longitude">Lat./Long.</th>
<th>Photo</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
<button id="transmettre-obs" type="button">Transmettre</button>
</fieldset>
</form>
</div> <!-- zone-liste-obs : wrap3 -->
</div>
<!-- Messages d'erreur du formulaire-->
<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-google-map" style="display: none;" title="Information sur Google Map"></div>
<div id="dialogue-erreur" style="display: none;" title="Erreur"></div>
<div id="chargement" style="position:fixed;z-index:1000;top:0;left:0;height:100%;width:100%;background:#777;background:rgba(90,86,93,0.7);text-align:center;display:none;">
<div id="chargement-centrage" style="position:relative;width:30%;margin:0 auto;top:30%;">
<img id="chargement-img" src="<?=$url_base?>modules/saisie/squelettes/sauvages/images/chargement_arbre.gif" alt="Transfert en cours..."/>
<p id="chargement-txt" style="color:white;font-size:1.5em;">
Transfert des observations en cours...<br />
Cela peut prendre plusieurs minutes en fonction de la taille des images et du nombre d'observation à transférer.
</p>
</div>
</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/widget-origin-mobile/modules/saisie/squelettes/biodiversite34/biodiversite34.tpl.html
New file
0,0 → 1,213
<!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&amp;sensor=true&amp;language=fr&amp;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>
<!-- Javascript : appli saisie -->
<script type="text/javascript">
//<![CDATA[
// La présence du parametre 'debug' dans l'URL enclenche le dégogage
var DEBUG = <?=isset($_GET['debug']) ? 'true' : 'false'?>;
// URL du web service réalisant l'insertion des données dans la base du CEL.
var SERVICE_SAISIE_URL = "<?=$url_ws_saisie?>";
// Squelette d'URL du web service d'eFlore fournissant les noms de communes.
var SERVICE_NOM_COMMUNE_URL = "http://www.tela-botanica.org/service:eflore:0.1/osm/nom-commune?lon={lon}&lat={lat}";
//]]>
</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>
<div id="zone-appli">
<?php if($titre == 'defaut' ) { ?>
<h1>Biodiversité 34</h1>
<?php } else { ?>
<h1 id="widget-titre"><?= $titre ?></h1>
<?php } ?>
<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=""/>
<input id="id_utilisateur" name="id_utilisateur" type="hidden"/>
</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>
<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">&nbsp;</span></span> / <span title="Système géodésique RGF93 - Coordonnées en projection Lambert 93">Lambert 93 : <span id="marqueur-lambert93">&nbsp;</span></span></span>
</li>
<li>
<span class="champ">Commune</span>
<span id="marqueur-commune">
<span id="commune-nom" class="commune-info">&nbsp;</span>
(<span id="commune-code-insee" class="commune-info" title="Code INSEE de la commune">&nbsp;</span>)
</span>
<span class="champ">Adresse</span>
<span id="marqueur-adresse">&nbsp;</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/widget-origin-mobile/modules/saisie/squelettes/biodiversite34/biodiversite34_taxons.tpl.js
New file
0,0 → 1,0
var taxons = <?=$taxons?>;
/tags/widget-origin-mobile/modules/saisie/squelettes/biodiversite34/css/biodiversite34.css
New file
0,0 → 1,175
@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;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Positionnement général */
#zone-appli {
margin:0 auto;
width:600px;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* 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/widget-origin-mobile/modules/saisie/squelettes/biodiversite34/js/biodiversite34.js
New file
0,0 → 1,432
//+---------------------------------------------------------------------------------------------------------+
// GÉNÉRAL
/**
* 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.id_utilisateur = $("#id_utilisateur").val();
utilisateur.prenom = $("#prenom").val();
utilisateur.nom = $("#nom").val();
utilisateur.courriel = $("#courriel").val();
observations['utilisateur'] = utilisateur;
var erreurMsg = "";
$.ajax({
url : SERVICE_SAISIE_URL,
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 = SERVICE_NOM_COMMUNE_URL.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/widget-origin-mobile/modules/saisie/Saisie.php
New file
0,0 → 1,340
<?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 = 'defaut';
const WS_SAISIE = "CelWidgetSaisie";
const WS_NOM = "noms";
private $NS_PROJET_VERSION = "1.01";
const EFLORE_API_VERSION = "0.1";
private $NS_PROJET = "bdtfx";
 
private $projetsVersions = array();
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);
 
$this->projet = isset($projet) ? $projet : self::PROJET_DEFAUT;
$this->chargerConfigProjet();
$this->chargerProjetsVersion();
 
$service = isset($service) ? $service : 'widget';
$methode = $this->traiterNomMethodeExecuter($service);
if (method_exists($this, $methode)) {
$retour = $this->$methode();
} else {
$this->messages[] = "Ce type de service '$methode' n'est pas disponible.";
}
 
$contenu = null;
$mime = null;
if (is_array($retour) && array_key_exists('squelette', $retour)) {
$ext = (isset($retour['squelette_ext'])) ? $retour['squelette_ext'] : '.tpl.html';
if($this->projetASquelette()) {
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$this->projet.self::DS.$retour['squelette'].$ext;
} else {
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.'defaut'.self::DS.'defaut'.$ext;
}
$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
$mime = isset($retour['mime']) ? $retour['mime'] : null;
} else {
if (count($this->messages) == 0) {
$this->messages[] = "La méthode du sous-service ne renvoie pas les données dans le bon format.";
}
$contenu = 'Un problème est survenu : '.print_r($this->messages, true);
}
 
$this->envoyer($contenu, $mime);
}
 
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->debug[] = "Le fichier ini '$fichier_config' du projet n'existe pas.";
}
}
 
private function chargerProjetsVersion() {
if (isset($this->configProjet)) {
foreach ($this->configProjet as $config => $valeur) {
if(strstr($config,'.version')) {
$this->projetsVersions[str_replace('.version', '', $config)] = $valeur;
}
}
}
}
 
public function executerWidget() {
$referentiel_impose = false;
if (isset($_GET['referentiel']) && $_GET['referentiel'] != '') {
$this->NS_PROJET = isset($_GET['referentiel']) && $_GET['referentiel'] != '' ? $_GET['referentiel'] : $this->NS_PROJET;
$this->NS_PROJET_VERSION = $this->projetsVersions[$this->NS_PROJET];
$referentiel_impose = true;
}
 
$widget['squelette'] = $this->projet;
$widget['donnees'] = array();
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
$widget['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
 
$widget['donnees']['logo'] = isset($_GET['logo']) ? $_GET['logo'] : 'defaut';
$widget['donnees']['titre'] = isset($_GET['titre']) ? $_GET['titre'] : 'defaut';
$widget['donnees']['titre'] = ($widget['donnees']['titre'] == '0') ? '' : $widget['donnees']['titre'];
 
// cas du projet par défaut ou bien d'un projet n'ayant pas de squelette spécifique
if ($this->projet == 'defaut' || $this->projet == 'florileges' || !$this->projetASquelette()) {
$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
$urlWsNs = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, $this->NS_PROJET, self::WS_NOM);
$urlWsNsSansRef = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, '{referentiel}', self::WS_NOM);
$widget['donnees']['url_ws_autocompletion_ns'] = $urlWsNs;
$widget['donnees']['url_ws_autocompletion_ns_tpl'] = $urlWsNsSansRef;
$widget['donnees']['ns_referentiel'] = $this->NS_PROJET.':'.$this->NS_PROJET_VERSION;
$widget['donnees']['ns_projet'] = $this->NS_PROJET;
$widget['donnees']['ns_version'] = $this->NS_PROJET_VERSION;
$widget['donnees']['referentiel_impose'] = $referentiel_impose;
$widget['donnees']['projets_versions'] = $this->projetsVersions;
$widget['donnees']['espece_imposee'] = false;
$widget['donnees']['nn_espece_defaut'] = '';
$widget['donnees']['nom_sci_espece_defaut'] = '';
$widget['donnees']['infos_espece'] = array();
 
if ($this->especeEstImposee()) {
$nom = $this->executerChargementInfosTaxon($_GET['num_nom']);
$widget['donnees']['espece_imposee'] = true;
$widget['donnees']['nn_espece_defaut'] = $_GET['num_nom'];
$widget['donnees']['nom_sci_espece_defaut'] = $nom['nom_sci'];
$widget['donnees']['infos_espece'] = $this->array2js($nom, true);
}
} else {
$widget['donnees']['taxons'] = $this->recupererListeTaxon();
$widget['donnees']['milieux'] = $this->parserMilieux();
}
return $widget;
}
 
private function projetASquelette() {
// fonction très simple qui ne teste que si le dossier du projet courant
// existe, mais elle suffit pour le moment.
return file_exists(dirname(__FILE__).self::DS.'squelettes'.self::DS.$this->projet);
}
 
public function executerTaxons() {
$widget['squelette'] = $this->projet.'_taxons';
$widget['squelette_ext'] = '.tpl.js';
$widget['donnees'] = array();
$taxons = $this->recupererListeTaxon();
$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 recupererListeTaxon() {
$taxons = null;
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
$taxons = $this->decomposerFichierTsv($fichier_tsv);
$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
} else {
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
}
return $taxons;
}
 
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;
}
 
private function parserMilieux() {
$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 especeEstImposee() {
return isset($_GET['num_nom']) && $_GET['num_nom'] != '';
}
 
private function executerChargementInfosTaxon($num_nom) {
$url_service_infos = sprintf($this->config['chemins']['infosTaxonUrl'], $this->NS_PROJET, $num_nom);
$infos = json_decode(file_get_contents($url_service_infos));
$resultat = array();
if(isset($infos) && !empty($infos)) {
$infos = (array)$infos;
$resultat = (isset($infos['nom_sci']) && $infos['nom_sci'] != '') ? $infos : array();
}
return $resultat;
}
 
public function executerUploadImage() {
$retour = array(
'squelette' => $this->projet.'_image',
'squelette_ext' => '.tpl.xml',
'mime' => 'text/xml',
'donnees' => array(
'urlMiniature' => '',
'imageNom' => '',
'message' => '',
'debogage' => ''));
$message = '';
$debogage = '';
if ($_FILES['fichier']['error'] == UPLOAD_ERR_OK) {
if (is_uploaded_file($_FILES['fichier']['tmp_name'])) {
if ($this->verifierFormatJpeg($_FILES['fichier']['tmp_name'])) {
$dossierStockage = $this->config['chemins']['imagesTempDossier'];
 
$nomFichierOriginal = preg_replace('/[.](jpeg|jpg)$/i', '.jpg', strtolower($_FILES['fichier']['name']));
$originalChemin = $dossierStockage.$nomFichierOriginal;
$deplacementOk = move_uploaded_file($_FILES['fichier']['tmp_name'], $originalChemin);
 
if ($deplacementOk === true) {
$miniatureFichier = str_replace('.jpg', '_min.jpg', $nomFichierOriginal);
$miniatureChemin = $dossierStockage.$miniatureFichier;
 
// Parametres
$largeurIdeale = 100;
$hauteurIdeale = 100;
$qualite = 85;
 
// Calcul de la hauteur et de la largeur optimale de la miniature
$taillesImgOriginale = getimagesize($originalChemin);
$largeurOrigine = $taillesImgOriginale[0];
$hauteurOrigine = $taillesImgOriginale[1];
 
$largeurMin = $largeurIdeale;
$hauteurMin = (int) ($hauteurOrigine * ($largeurIdeale / $largeurOrigine));
if ($hauteurMin > $hauteurIdeale) {
$hauteurMin = $hauteurIdeale;
$largeurMin = (int)($largeurOrigine * ($hauteurMin / $hauteurOrigine));
}
 
// Création de la miniature
$imageOriginale = imagecreatefromjpeg($originalChemin);
$imageMiniature = imagecreatetruecolor($largeurMin, $hauteurMin);
$couleurFond = imagecolorallocate($imageMiniature, 255, 255, 255);
imagefill($imageMiniature, 0, 0, $couleurFond);
imagecopyresized($imageMiniature, $imageOriginale, 0, 0, 0, 0, $largeurMin, $hauteurMin, $largeurOrigine, $hauteurOrigine);
imagejpeg($imageMiniature, $miniatureChemin, $qualite);
imagedestroy($imageMiniature);
imagedestroy($imageOriginale);
 
// Retour des infos
$retour['donnees']['urlMiniature'] = sprintf($this->config['chemins']['imagesTempUrlTpl'], $miniatureFichier);
$retour['donnees']['imageNom'] = $nomFichierOriginal;
} else {
$message = "L'image n'a pu être déplacé sur le serveur.";
}
} else {
$message = "L'image n'est pas au format JPEG.";
}
} else {
$message = "L'image n'a pu être téléversée.";
$debogage = $message.print_r($_FILES, true);
}
} else {
if ($_FILES['fichier']['error'] == UPLOAD_ERR_FORM_SIZE) {
$message = "L'image téléversée excède la taille maximum autorisée.".
"Veuillez modifier votre image avant de la téléverser à nouveau.";
} else {
$message = "Une erreur de transfert a eu lieu (téléversement interrompu).";
}
$debogage = "Code erreur : {$_FILES['fichier']['error']}. ".
"Voir : http://php.net/manual/fr/features.file-upload.errors.php";
}
// Retour des infos
$retour['donnees']['message'] = $message;
$retour['donnees']['debogage'] = $debogage;
return $retour;
}
 
// Il ne faut pas utiliser l'index type du tableau files pour tester
// si une image est en jpeg car le type renvoyé par les navigateurs
// peut varier (ex. sous ie qui renvoie image/pjpeg
private function verifierFormatJpeg($chemin) {
// get imagesize renvoie un résultat consistant par contre
$infos = getimagesize($chemin, $infos);
return (isset($infos['mime']) && $infos['mime'] == 'image/jpeg');
}
 
private function array2js($array,$show_keys) {
$dimensions = array();
$valeurs = array();
 
$total = count($array) - 1;
$i = 0;
foreach ($array as $key => $value) {
if (is_array($value)) {
$dimensions[$i] = array2js($value,$show_keys);
if ($show_keys) {
$dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
}
} else {
$dimensions[$i] = '"'.addslashes($value).'"';
if ($show_keys) {
$dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
}
}
if ($i == 0) {
$dimensions[$i] = '{'.$dimensions[$i];
}
if ($i == $total) {
$dimensions[$i].= '}';
}
$i++;
}
return implode(',',$dimensions);
}
}
?>
/tags/widget-origin-mobile/modules/saisie
New file
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.5-cisaille/widget/modules/saisie:r798-1342
/tags/widget-origin-mobile/modules/stats/Stats.php
New file
0,0 → 1,220
<?php
/**
* Widget fournissant des stats graphiques du CEL.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* @author Jean-Pascal MILCENT <jpm@clapas.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 © 2010, Jean-Pascal MILCENT
*/
class Stats extends WidgetCommun {
const PAGE_DEFAUT = 'defaut';
const MODE_DEFAUT = 'defaut';
const MODE_UTILISATEUR = 'utilisateur';
private $page;
private $mode;
/**
* Méthode appelée avec une requête de type GET.
*/
public function executer() {
$retour = null;
extract($this->parametres);
$this->mode = (isset($mode)) ? $mode : self::MODE_DEFAUT;
$this->page = (isset($page)) ? $page : self::PAGE_DEFAUT;
$methode = $this->traiterNomMethodeExecuter($this->page);
if (method_exists($this, $methode)) {
$retour = $this->$methode();
} else {
$this->messages[] = "Ce type de carte '$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);
}
}
 
/**
* Stats par défaut
*/
public function executerDefaut() {
$widget = null;
switch ($this->mode) {
case self::MODE_DEFAUT :
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['squelette'] = 'stats';
break;
case self::MODE_UTILISATEUR :
if ($this->authentifierUtilisateur()) {
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['donnees']['utilisateur'] = $this->getAuthIdentifiant();
$widget['donnees']['utilisateur_nom_prenom'] = $this->recupererPrenomNomIdentifie();
$widget['squelette'] = 'stats_utilisateur';
}
break;
default :
$this->messages[] = "Le mode '{$this->mode}' est inconnu.";
}
if (!is_null($widget)) {
$widget['donnees']['url_service'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'CelStatistique');
$widget['donnees']['filtres'] = $this->parametres;
}
return $widget;
}
private function recupererPrenomNomIdentifie() {
$nom = '';
if ($this->getAuthIdentifiant() != null) {
$infos_utilisateur = $this->recupererUtilisateursNomPrenom(array($this->getAuthIdentifiant()));
if (array_key_exists($this->getAuthIdentifiant(), $infos_utilisateur)) {
$utilisateur = (array) $infos_utilisateur[$this->getAuthIdentifiant()];
$nom = $utilisateur['prenom'].' '.$utilisateur['nom'];
} else {
$nom = $this->getAuthIdentifiant();
}
}
return $nom;
}
public function executerNombres() {
$widget = null;
switch ($this->mode) {
case self::MODE_DEFAUT :
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
break;
case self::MODE_UTILISATEUR :
if ($this->authentifierUtilisateur()) {
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['donnees']['utilisateur_nom_prenom'] = $this->recupererPrenomNomIdentifie();
}
break;
default:
$this->messages[] = "Le mode '{$this->mode}' est inconnu.";
}
if (!is_null($widget)) {
$widget['squelette'] = 'stats_nbres';
$widget['donnees']['filtres'] = $this->parametres;
}
return $widget;
}
private function recupererStatsTxtNombres() {
// Récupération des données au format Json
$service = "CelStatistiqueTxt/Nombres";
$parametres = array();
if (isset($this->parametres['mode']) && $this->parametres['mode'] == self::MODE_UTILISATEUR && $this->getAuthIdentifiant() != null) {
$parametres[] = 'utilisateur='.$this->getAuthIdentifiant();
}
if (isset($this->parametres['num_taxon'])) {
$parametres[] = 'num_taxon='.$this->parametres['num_taxon'];
}
if (isset($this->parametres['taxon'])) {
$parametres[] = 'taxon='.$this->parametres['taxon'];
}
$service .= (count($parametres) > 0) ? '?'.implode('&', $parametres) : '';
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
public function executerListeTaxonsNbrePhotos() {
$widget = null;
$widget['donnees']['taxons'] = $this->recupererStatsTxtListeTaxonsNbrePhotos();
$widget['donnees']['utilisateur'] = $this->getAuthIdentifiant();
$widget['donnees']['filtres'] = $this->parametres;
$widget['squelette'] = 'liste_taxons_nbre_photos';
return $widget;
}
private function recupererStatsTxtListeTaxonsNbrePhotos() {
// Récupération des données au format Json
$service = "CelStatistiqueTxt/ListeTaxonsNbrePhotos";
$parametres = array();
if (isset($this->parametres['mode']) && $this->parametres['mode'] == self::MODE_UTILISATEUR && $this->getAuthIdentifiant() != null) {
$parametres[] = 'utilisateur='.$this->getAuthIdentifiant();
}
if (isset($this->parametres['num_taxon'])) {
$parametres[] = 'num_taxon='.$this->parametres['num_taxon'];
}
if (isset($this->parametres['taxon'])) {
$parametres[] = 'taxon='.$this->parametres['taxon'];
}
if (isset($this->parametres['start'])) {
$parametres[] = 'start='.$this->parametres['start'];
}
if (isset($this->parametres['limit'])) {
$parametres[] = 'limit='.$this->parametres['limit'];
}
$service .= (count($parametres) > 0) ? '?'.implode('&', $parametres) : '';
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
public function executerListeUtilisateursNbrePhotos() {
$widget = null;
$utilisateurs = $this->recupererStatsTxtListeUtilisateursNbrePhotos();
if (isset($utilisateurs)) {
$noms = $this->recupererUtilisateursNomPrenom(array_keys($utilisateurs));
foreach ($utilisateurs as $courriel => $infos) {
if (array_key_exists($courriel, $noms)) {
$nom_infos = (array) $noms[$courriel];
$nom_fmt = $nom_infos['prenom'].' '.$nom_infos['nom'];
$widget['donnees']['utilisateurs'][$nom_fmt] = $infos;
}
}
}
$widget['donnees']['filtres'] = $this->parametres;
$widget['squelette'] = 'liste_utilisateurs_nbre_photos';
return $widget;
}
private function recupererStatsTxtListeUtilisateursNbrePhotos() {
// Récupération des données au format Json
$service = "CelStatistiqueTxt/ListeUtilisateursNbrePhotos";
if (isset($this->parametres['mode']) && $this->parametres['mode'] == self::MODE_UTILISATEUR && $this->getAuthIdentifiant() != null) {
$this->getDao()->ajouterParametre('utilisateur', $this->getAuthIdentifiant());
}
if (isset($this->parametres['num_taxon'])) {
$this->getDao()->ajouterParametre('num_taxon', $this->parametres['num_taxon']);
}
if (isset($this->parametres['taxon'])) {
$this->getDao()->ajouterParametre('taxon', $this->parametres['taxon']);
}
if (isset($this->parametres['start'])) {
$this->getDao()->ajouterParametre('start', $this->parametres['start']);
}
if (isset($this->parametres['limit'])) {
$this->getDao()->ajouterParametre('limit', $this->parametres['limit']);
}
if (isset($this->parametres['tag'])) {
$this->getDao()->ajouterParametre('tag', $this->parametres['tag']);
}
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
}
?>
/tags/widget-origin-mobile/modules/stats/squelettes/liste_taxons_nbre_photos.tpl.html
New file
0,0 → 1,52
<!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" xml:lang="fr" lang="fr">
<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" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, photo, liste, taxon" />
<meta name="description" content="Liste des taxons possédant le plus grand nombre de photographies publiques dans le Carnet en Ligne (CEL)" />
<title>Liste des taxons possédant le plus grand nombre de photographies publiques</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</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>
<h1>Liste des taxons possédant le plus grand nombre de photographies publiques</h1>
<div class="flottant-gauche">
<?php include('filtres.tpl.html') ?>
<p>Classement / Nom retenu du taxon / Nombre de photographies</p>
<ol>
<?php foreach ($taxons as $taxon => $nbre) : ?>
<li><?=$taxon?> : <?=$nbre?></li>
<?php endforeach; ?>
</ol>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/stats/squelettes/stats.tpl.html
New file
0,0 → 1,87
<!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" xml:lang="fr" lang="fr">
<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" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, graphiques" />
<meta name="description" content="Graphiques et statistiques sur les observations et images du Carnet en Ligne (CEL)" />
<title>Statistiques du Carnet En Ligne</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</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>
<?php $i=0;?>
<h1>Statistiques du CEL</h1>
<?php include('filtres.tpl.html') ?>
<div class="flottant-gauche">
<?php include('nbres.tpl.html') ?>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<h2>Observations - Activité</h2>
<img src="<?=$url_service?>/UtilisationJournaliere?serveur=<?=$i++?>/<?=date("Y-m-d", (time() - 86400))?>" alt="Intensité d'utilisation pour la journée d'hier" />
<img src="<?=$url_service?>/UtilisationJournaliere?serveur=<?=$i++?>" alt="Intensité d'utilisation pour aujourd'hui" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<h2>Observations - Données</h2>
<img src="<?=$url_service?>/NbreObsIdVsTest?serveur=<?=$i++?>" alt="Nombre d'observations identifiées versus tests" />
<img src="<?=$url_service?>/NbreObsPublicVsPrivee?serveur=<?=$i++?>" alt="Nombre d'observations publiques versus privées" />
<img src="<?=$url_service?>/NbreObsDetermineeVsInconnue?serveur=<?=$i++?>" alt="Nombre d'observations déterminées versus inconnues" />
<hr class="nettoyeur" />
<img src="<?=$url_service?>/NbreObsAvecIndicationGeo?serveur=<?=$i++?>" alt="Nombre d'observations avec indications géographiques" />
</div>
<hr class="nettoyeur" />
<div>
<h2>Observations - Évolution</h2>
<img src="<?=$url_service?>/EvolObsParMoisGlissant?serveur=<?=$i++?>" alt="Évolutions des observation sur le dernier mois glissant" />
<img src="<?=$url_service?>/EvolObsParMois?serveur=<?=$i++?>" alt="Évolutions des observation par mois" />
<img src="<?=$url_service?>/EvolObsParAn?serveur=<?=$i++?>" alt="Évolutions des observation par an" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<h2>Utilisateurs</h2>
<img src="<?=$url_service?>/NuagePointsObsParHeureEtJourSemaine?serveur=<?=$i++?>" alt="Nuage de points d'observation par heure et jour de la semaine" />
<img src="<?=$url_service?>/NuagePointsObsAnciennete?serveur=<?=$i++?>" alt="Répartition des utilisateurs en fonction du nombre d'observations et de l'ancienneté" />
<hr class="nettoyeur" />
<img src="<?=$url_service?>/NbreObsParUtilisateur?serveur=<?=$i++?>" alt="Nombre d'observations par utilisateur" />
<img src="<?=$url_service?>/NbreObsParUtilisateurEtTest?serveur=<?=$i++?>" alt="Nombre d'observations par utilisateur et test" />
<hr class="nettoyeur" />
<img src="<?=$url_service?>/EvolUtilisateurParMois?serveur=<?=$i++?>" alt="Nombre d'observations par utilisateur et test" />
</div>
<hr class="nettoyeur" />
<div>
<h2>Images</h2>
<img src="<?=$url_service?>/EvolImgParMois?serveur=<?=$i++?>" alt="Évolutions du dépôt d'images par mois" />
<img src="<?=$url_service?>/EvolImgLieesParMois?serveur=<?=$i++?>" alt="Évolutions des images liées aux observations par mois" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/stats/squelettes/liste_utilisateurs_nbre_photos.tpl.html
New file
0,0 → 1,56
<!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" xml:lang="fr" lang="fr">
<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" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, photo, liste, utilisateurs" />
<meta name="description" content="Liste des utilisateurs possédant le plus grand nombre de photographies publiques dans le Carnet en Ligne (CEL)" />
<title>Liste des utilisateurs possédant le plus grand nombre de photographies publiques</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</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>
<h1>Liste des utilisateurs possédant le plus grand nombre de photographies publiques</h1>
<div class="flottant-gauche">
<?php include('filtres.tpl.html') ?>
<?php if (isset($utilisateurs)) : ?>
<p>Classement / Utilisateur / Nombre de photographies</p>
<ol>
<?php foreach ($utilisateurs as $nomPrenom => $nbre) : ?>
<li><?=$nomPrenom?> : <?=$nbre?></li>
<?php endforeach; ?>
</ol>
<?php else : ?>
<p>Aucun résultat ne correspond à vos filtres</p>
<?php endif; ?>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/stats/squelettes/navigation.tpl.html
New file
0,0 → 1,6
<ul>
<li><a href="/widget:cel:stats">Stats globales</a> (<a href="/widget:cel:stats?mode=<?=Stats::MODE_UTILISATEUR?>">les miennes</a>)</li>
<li><a href="/widget:cel:stats?page=nombres">Nombres</a> (<a href="/widget:cel:stats?page=nombres&mode=<?=Stats::MODE_UTILISATEUR?>">les miens</a>)</li>
<li><a href="/widget:cel:stats?page=liste-utilisateurs-nbre-photos">Liste des utilisateurs ayant le plus de photographies publiques</a></li>
<li><a href="/widget:cel:stats?page=liste-taxons-nbre-photos">Liste des taxons ayant le plus de photographies publiques</a></li>
</ul>
/tags/widget-origin-mobile/modules/stats/squelettes/stats_nbres.tpl.html
New file
0,0 → 1,48
<!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" xml:lang="fr" lang="fr">
<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" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, graphiques" />
<meta name="description" content="Graphiques et statistiques sur les observations et images du Carnet en Ligne (CEL)" />
<title>Statistiques du Carnet En Ligne</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</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>
<?php $i=0;?>
<h1>Statistiques du CEL <?=(isset($utilisateur_nom_prenom) ? '- '.$utilisateur_nom_prenom : '')?> <?=(isset($taxon) ? '- '.$taxon : '')?></h1>
<?php include('filtres.tpl.html') ?>
<div class="flottant-gauche">
<?php include('nbres.tpl.html')?>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/stats/squelettes/filtres.tpl.html
New file
0,0 → 1,14
<?php if (array_key_exists('taxon', $filtres) || array_key_exists('num_taxon', $filtres) || array_key_exists('tag', $filtres)) : ?>
<h2>Filtes actifs</h2>
<ul>
<?php if (array_key_exists('taxon', $filtres)) : ?>
<li>nom du taxon=<?=$filtres['taxon']?></li>
<?php endif; ?>
<?php if (array_key_exists('num_taxon', $filtres)) : ?>
<li>numéro du taxon=<?=$filtres['num_taxon']?></li>
<?php endif; ?>
<?php if (array_key_exists('tag', $filtres)) : ?>
<li>Mots-clés des images=<?=$filtres['tag']?></li>
<?php endif; ?>
</ul>
<?php endif; ?>
/tags/widget-origin-mobile/modules/stats/squelettes/stats_utilisateur.tpl.html
New file
0,0 → 1,78
<!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" xml:lang="fr" lang="fr">
<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" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, graphiques" />
<meta name="description" content="Graphiques et statistiques sur les observations et images du Carnet en Ligne (CEL)" />
<title>Statistiques du Carnet En Ligne</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</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>
<?php $i=0;?>
<h1>Statistiques du CEL de <?=$utilisateur_nom_prenom?></h1>
<div class="flottant-gauche">
<?php include('nbres.tpl.html')?>
</div>
<div class="flottant-gauche">
<h2>Observations - Activité</h2>
<img src="<?=$url_service?>/UtilisationJournaliere/<?=date("Y-m-d", (time() - 86400))?>?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Intensité d'utilisation pour la journée d'hier" />
<img src="<?=$url_service?>/UtilisationJournaliere?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Intensité d'utilisation pour aujourd'hui" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<h2>Observations - Données</h2>
<img src="<?=$url_service?>/NbreObsPublicVsPrivee?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Nombre d'observations publiques versus privées" />
<img src="<?=$url_service?>/NbreObsDetermineeVsInconnue?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Nombre d'observations déterminées versus inconnues" />
<hr class="nettoyeur" />
<img src="<?=$url_service?>/NbreObsAvecIndicationGeo?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Nombre d'observations avec indications géographiques" />
</div>
<hr class="nettoyeur" />
<div>
<h2>Observations - Évolution</h2>
<img src="<?=$url_service?>/EvolObsParMoisGlissant?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Évolutions des observation sur le dernier mois glissant" />
<img src="<?=$url_service?>/EvolObsParMois?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Évolutions des observation par mois" />
<img src="<?=$url_service?>/EvolObsParAn?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Évolutions des observation par an" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<h2>Utilisateurs</h2>
<img src="<?=$url_service?>/NuagePointsObsParHeureEtJourSemaine?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Nuage de points d'observation par heure et jour de la semaine" />
</div>
<hr class="nettoyeur" />
<div>
<h2>Images</h2>
<img src="<?=$url_service?>/EvolImgParMois?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Évolutions du dépôt d'images par mois" />
<img src="<?=$url_service?>/EvolImgLieesParMois?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Évolutions des images liées aux observations par mois" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/stats/squelettes/nbres.tpl.html
New file
0,0 → 1,10
<h2>Nombres</h2>
<ul>
<li>Nombre d'observations publiques / total : <strong><?=number_format($observationsPubliques, 0, ',', ' ')?></strong> / <strong><?=number_format($observations, 0, ',', ' ')?></strong></li>
<li>Nombre d'images : <strong><?=number_format($images, 0, ',', ' ')?></strong></li>
<li>Nombre d'images liées aux observations : <strong><?=number_format($imagesLiees, 0, ',', ' ')?></strong></li>
<li>Nombre d'observations liées aux images : <strong><?=number_format($observationsLiees, 0, ',', ' ')?></strong></li>
<li>Moyenne images par observation : <strong><?=number_format($moyImagesParObs, 2, ',', ' ')?></strong></li>
<li title="Hors observations géoréférencées mais non liées à une commune.">Nombre de communes possédant des observations : <strong><?=number_format($communes, 0, ',', ' ')?></strong></li>
<li>Nombre d'observations par communes (mini / moyenne / maxi) : <strong><?=number_format($observationsParCommunesMin, 0, ',', ' ')?></strong> / <strong><?=number_format($observationsParCommunesMoyenne, 2, ',', ' ')?></strong> / <strong><?=number_format($observationsParCommunesMax, 0, ',', ' ')?></strong></li>
</ul>
/tags/widget-origin-mobile/modules/export/config.defaut.ini
New file
0,0 → 1,18
[observation]
; Chemin pour l'autoload à ajouter
autoload = "bibliotheque/;bibliotheque/xml_feed_parser/1.0.4/;bibliotheque/xml_feed_parser/1.0.4/parsers/"
; URL ou chemin du flux RSS contenant les liens vers les photos
fluxRssUrl = "http://www.tela-botanica.org/service:cel:CelSyndicationObservation/multicriteres/atom"
; Squelette d'url pour accéder à la fiche eFlore
efloreUrlTpl = "http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/%s/cel"
; Nombre de vignette à afficher : nombre de vignettes par ligne et nombre de lignes séparés par une vigule (ex. : 4,3).
vignette = 4,3
 
 
[observation.cache]
; Active/Désactive le cache
activation = true
; Dossier où stocker les fichiers de cache du widget
stockageDossier = "/tmp"
; Durée de vie du fichier de cache
dureeDeVie = 86400
/tags/widget-origin-mobile/modules/export/squelettes/css/export.css
New file
0,0 → 1,121
@CHARSET "UTF-8";
/*+--------------------------------------------------------------------------------------------------------+*/
/* Balises */
footer p{
text-align:center;
}
button img {
display:block;
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* Générique */
#zone-appli {
width:260px;
}
 
.discretion {
color:grey;
font-family:arial;
font-size:11px;
line-height: 13px;
}
 
.droite {
float:right;
}
 
.texte_droite {
text-align:right;
}
.texte_centre {
text-align:center;
}
.modal-fenetre{
position:fixed;
z-index:1000;
top:0;
left:0;
height:100%;
width:100%;
background:#777;
background:rgba(90,86,93,0.7);
text-align:center;
}
.modal-contenu{
position:relative;
width:30%;
margin:0 auto;
top:30%;
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* Formulaire spécifique */
 
h1#widget-titre {
font-size: 18px;
}
 
#date_debut, #date_fin {
width: 67px;
}
 
.conteneur_date_fin {
float: right;
padding-right: 35px;
}
 
.conteneur_date_debut {
padding-left: 20px;
}
 
.conteneur_date {
width: 80px;
}
 
input.error {
border: 1px solid red;
}
 
label.error {
color: red;
}
 
#form-export-obs input.large {
width: 230px;
}
 
.label_selection_format, .selection_format {
display: inline;
}
 
label.titre_format_export {
margin-bottom: 0px;
}
 
#format_xls, #format_csv {
margin-left: 30px;
}
 
.conteneur_selection_format {
margin-bottom: 10px;
}
 
.attention {
background-color:#e7ebfd;
background-image:url("../images/information.png");
}
.attention {
display:inline-block;
background-repeat:no-repeat;
background-position:5px 50%;
padding:10px 5px 5px 40px;
background-size:24px 24px; -webkit-background-size:24px 24px; -o-background-size:24px 24px; -moz-background-size:24px 24px;
max-width:600px;
min-height:20px;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Correction style CSS Bootstrap */
.well {
margin-bottom: 5px;
padding: 4px;
}
/tags/widget-origin-mobile/modules/export/squelettes/js/export.js
New file
0,0 → 1,168
//+---------------------------------------------------------------------------------------------------------+
// AUTO-COMPLÉTION Noms Scientifiques
function ajouterAutocompletionNomSci() {
$('#taxon').autocomplete({
source: function(requete, add){
// la variable de requête doit être vidée car sinon le parametre "term" est ajouté
requete = "";
var url = getUrlAutocompletionNomSci()+"/"+formaterRequeteNomSci($('#taxon').val());
$.getJSON(url, requete, function(data) {
var suggestions = traiterRetourNomSci(data);
add(suggestions);
});
},
html: true
});
}
 
function formaterRequeteNomSci(nomSci) {
var nomSciCoupe = nomSci.split(' ');
if(nomSciCoupe.length >= 2) {
nomSci = nomSciCoupe[0]+'/'+nomSciCoupe[1];
} else {
nomSci = nomSciCoupe[0]+'/*';
}
return nomSci;
}
 
function traiterRetourNomSci(data) {
var suggestions = [];
if (data != undefined) {
$.each(data, function(i, val) {
var nom = {label : '', value : ''};
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) {
nom.label = "...";
nom.value = val[0];
suggestions.push(nom);
return false;
} else {
nom.label = val[0];
nom.value = val[0];
suggestions.push(nom);
}
});
}
return suggestions;
}
 
function ajouterAutocompletionCommunes() {
$('#commune').autocomplete({
source: function(requete, add){
// la variable de requête doit être vidée car sinon le parametre "term" est ajouté
requete = "";
var url = getUrlAutocompletionCommunes()+"/"+$('#commune').val();
$.getJSON(url, requete, function(data) {
var suggestions = traiterRetourCommune(data);
add(suggestions);
});
},
html: true
});
$( "#commune" ).bind("autocompleteselect", function(event, ui) {
console.log(ui.item);
$("#commune").data(ui.item.value);
$("#dept").data(ui.item.code);
$("#dept").val(ui.item.code);
});
}
 
function getUrlAutocompletionNomSci() {
var url = SERVICE_AUTOCOMPLETION_NOM_SCI_URL;
return url;
}
 
function separerCommuneDepartement(chaine) {
var deptCommune = chaine.split(' (');
if(deptCommune[1] != null && deptCommune[1] != undefined) {
deptCommune[1] = deptCommune[1].replace(')', '');
} else {
deptCommune[1] = '';
}
return deptCommune;
}
 
function traiterRetourCommune(data) {
var suggestions = [];
if (data != undefined) {
$.each(data, function(i, val) {
var nom = {label : '', value : ''};
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) {
nom.label = "...";
nom.value = val[0];
suggestions.push(nom);
return false;
} else {
nom.label = val[0];
var deptCommune = separerCommuneDepartement(val[0]);
nom.value = deptCommune[0];
nom.code = deptCommune[1];
suggestions.push(nom);
}
});
}
return suggestions;
}
 
function getUrlAutocompletionCommunes() {
var url = SERVICE_AUTOCOMPLETION_COMMUNE_URL;
return url;
}
 
function configurerValidationFormulaire() {
$("#form-export-obs").validate({
rules: {
utilisateur: {
email: true
},
date_debut: {
date: true,
date_valid : $('#date_debut')
},
date_fin: {
date: true,
date_valid : $('#date_fin')
},
dept: {
dept_valid : $('#dept')
},
num_taxon: {
number: true
}
},
messages: {
email: "L'email de l'utilisateur doit être valide",
num_taxon: "Le numéro taxonomique doit être un entier"
}
});
$.validator.addMethod("dept_valid", function(valeur) {
return valeur == "" || valeur.match(/^\d+(?:,\d+)*$/);
}, "Le ou les département(s) doivent être sur deux chiffres, séparés par des virgules"
);
$.validator.addMethod("date_valid", function(element) {
var valid = true;
var dateDebut = $('#date_debut').datepicker("getDate");
var dateFin = $('#date_fin').datepicker("getDate");
if($('#date_debut').val() != "" && $('#date_fin').val() != "") {
if(dateDebut != null && dateFin != null) {
valid = dateDebut <= dateFin;
} else {
valid = dateDebut == null || dateFin == null;
}
}
return valid;
}, "Les dates de début et de fin doivent être au format jj/mm/aaaa et la première inférieur à la dernière, si les deux sont présentes"
);
}
 
$(document).ready(function() {
ajouterAutocompletionNomSci();
ajouterAutocompletionCommunes();
$("#date_debut").datepicker($.datepicker.regional['fr']);
$("#date_fin").datepicker($.datepicker.regional['fr']);
configurerValidationFormulaire();
});
/tags/widget-origin-mobile/modules/export/squelettes/export.tpl.html
New file
0,0 → 1,112
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Export des observations du CEL</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="Aurélien Peronnet" />
<meta name="keywords" content="Tela Botanica, CEL" />
<meta name="description" content="Widget d'export du carnet en ligne" />
 
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="http://www.tela-botanica.org/favicon.ico" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.7.1/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.17/js/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.9.0/jquery.validate.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.9.0/messages_fr.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/form/2.95/jquery.form.min.js"></script>
<!-- Javascript : appli saisie -->
<script type="text/javascript">
//<![CDATA[
// Nombre d'élément dans les listes d'auto-complétion
var AUTOCOMPLETION_ELEMENTS_NBRE = 20;
// URL du web service permettant l'auto-complétion des noms scientifiques.
var SERVICE_AUTOCOMPLETION_NOM_SCI_URL = "<?= $url_ws_autocompletion_nom_sci; ?>";
// URL du web service permettant l'auto-complétion des communes.
var SERVICE_AUTOCOMPLETION_COMMUNE_URL = "<?= $url_ws_autocompletion_commune; ?>";
//]]>
</script>
<script type="text/javascript" src="<?= $url_base; ?>modules/export/squelettes/js/export.js"></script>
<!-- CSS -->
<!-- CSS -->
<link href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.18/css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/bootstrap/2.0.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/bootstrap/2.0.2/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.17/css/ui-darkness/jquery-ui-1.8.17.custom.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?= $url_base; ?>modules/export/squelettes/css/export.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body>
<div id="zone-appli" class="container">
<form id="form-export-obs" class="well" action="<?= $url_export.'/csv' ?>" method="get" >
<h1 id="widget-titre"> Export des données du CEL</h1>
<div class="row-fluid">
<label for="utilisateur">Email de la source des données </label><input id="utilisateur" class="large" name="utilisateur" type="text" placeholder="ex: accueil@tela-botanica.org" />
</div >
<div class="row-fluid">
<label for="commune">Commune </label><input id="commune" class="large" name="commune" type="text" placeholder="ex: Montpellier" />
</div>
<div class="row-fluid">
<label for="dept">Département(s) </label><input id="dept" class="large" name="dept" type="text" placeholder="ex: 34 OU 26,84,34..." />
</div>
<div class="row-fluid">
<label for="projet">Projet </label><input id="projet" class="large" name="projet" type="text" placeholder="ex: sauvages" />
</div>
<div class="row-fluid">
<label for="num_taxon">Taxon </label><input id="taxon" class="large" name="taxon" type="text" placeholder="ex: Viola OU Viola alba OU Violaceae" />
</div>
<div class="row-fluid">
<div class="span conteneur_date_debut">
<label for="date_debut">Date de début </label><input id="date_debut" name="date_debut" type="text" placeholder="jj/mm/aaaa" />
</div>
<div class="span conteneur_date_fin">
<label for="date_fin">Date de fin </label><input id="date_fin" name="date_fin" type="text" placeholder="jj/mm/aaaa" />
</div>
</div>
<div class="row-fluid conteneur_selection_format">
<label class="titre_format_export">Format d'export</label>
<input type="radio" class="selection_format" name="format" value="xls" id="format_xls" checked="checked" />
<label class="label_selection_format" for="format_xls">excel (.xls)</label>
<input type="radio" class="selection_format" name="format" value="csv" id="format_csv"/>
<label class="label_selection_format" for="format_csv">csv (.csv)</label>
</div>
<div>
<input class="btn" value="Télécharger les données" type="submit" />
</div>
<div class="attention">
Si le volume de données est trop important, l'export peut échouer, dans ce cas là,
essayez de privilégier le format csv ou bien de choisir des critères plus restrictifs.
</div>
</form>
</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/widget-origin-mobile/modules/export/squelettes/images/information.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/export/squelettes/images/information.png
New file
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/export/squelettes/images/favicon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/export/squelettes/images/favicon.ico
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/export/config.ini
New file
0,0 → 1,3
[export]
; URL ou chemin du flux RSS contenant les liens vers les photos
fluxRssUrl = "http://localhost/service:cel:CelWidgetExport/"
/tags/widget-origin-mobile/modules/export/Export.php
New file
0,0 → 1,92
<?php
// declare(encoding='UTF-8');
/**
* Service exportant les dernières observations 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=AideCELWidget
*
* Paramètres :
* //TODO: décider des paramètres
*
* @author Aurélien Peronnet <aurelien@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) 2011, Tela Botanica (accueil@tela-botanica.org)
*/
class Export extends WidgetCommun {
const DS = DIRECTORY_SEPARATOR;
const SERVICE_DEFAUT = 'export';
private $export_url = null;
private $eflore_url_tpl = null;
/**
* Méthode appelée par défaut pour charger ce widget.
*/
public function executer() {
$retour = null;
extract($this->parametres);
 
if (!isset($mode)) {
$mode = self::SERVICE_DEFAUT;
}
$methode = $this->traiterNomMethodeExecuter($mode);
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 {
$urlWsCommune = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'LocationSearch');
$retour['donnees']['url_ws_autocompletion_commune'] = $urlWsCommune;
$urlWsNomSci = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'NameSearch');
$retour['donnees']['url_ws_autocompletion_nom_sci'] = $urlWsNomSci;
$retour['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
$retour['donnees']['url_export'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'CelWidgetExport');
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].'.tpl.html';
$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
}
 
$this->envoyer($contenu);
}
private function executerAjax() {
$widget = $this->executerObservation();
$widget['squelette'] = 'export_ajax';
return $widget;
}
private function executerExport() {
$widget = array('squelette' => 'export', 'donnees' => array());
extract($this->parametres);
$max_obs = (isset($max_obs) && preg_match('/^[0-9]+,[0-9]+$/', $max_obs)) ? $max_obs : '10';
return $widget;
}
private function traiterParametres() {
$parametres_export = '?';
$criteres = array('utilisateur', 'commune', 'dept', 'taxon', 'commentaire', 'date', 'projet');
foreach($this->parametres as $nom_critere => $valeur_critere) {
if (in_array($nom_critere, $criteres)) {
$valeur_critere = str_replace(' ', '%20', $valeur_critere);
$parametres_export .= $nom_critere.'='.$valeur_critere.'&';
}
}
if ($parametres_export == '?') {
$parametres_export = '';
} else {
$parametres_export = rtrim($parametres_export, '&');
}
return $parametres_export;
}
}
?>
/tags/widget-origin-mobile/modules/cartopoint/CartoPoint.php
New file
0,0 → 1,239
<?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 Cartopoint extends WidgetCommun {
const DS = DIRECTORY_SEPARATOR;
const SERVICE_CARTO_NOM = 'CelWidgetMapPoint';
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
private $titre = null; // Indication s'il faut le titre par défaut, personnalisé ou bien sans titre
private $logo = null; // url du logo à ajouter si nécessaire
private $url_site = null; // url du site auquel le logo est lié
private $image = null; // url d'une image à ajouter dans l'interface
private $nbjours = null; // nombre de jour à partir de la date courate pour lesquels on affiche les points
private $referentiel = null; // nombre de jour à partir de la date courate pour lesquels on affiche les points
/**
* 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->titre = (isset($titre) ? urldecode($titre) : null);
$this->logo = (isset($logo) ? urldecode($logo) : null);
$this->url_site = (isset($url_site) ? urldecode($url_site) : null);
$this->image = (isset($image) ? urldecode($image) : null);
$this->nbjours = (isset($nbjours) ? urldecode($nbjours) : null);
$this->referentiel = (isset($referentiel) ? urldecode($referentiel) : 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']['titre'] = $this->titre;
$widget['donnees']['logo'] = $this->logo;
$widget['donnees']['url_site'] = $this->url_site;
$widget['donnees']['image'] = $this->image;
$widget['donnees']['nbjours'] = $this->nbjours;
$widget['donnees']['referentiel'] = $this->referentiel;
$widget['donnees']['url_limites_communales'] = $this->obtenirUrlsLimitesCommunales();
$widget['donnees']['communeImageUrl'] = $this->config['carto']['communeImageUrl'];
$widget['donnees']['pointImageUrl'] = $this->config['carto']['pointImageUrl'];
$widget['donnees']['groupeImageUrlTpl'] = $this->config['carto']['groupeImageUrlTpl'];
$widget['squelette'] = 'carte_defaut';
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', 'nbjours', 'referentiel',
'start', 'limit');
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']['contenu_aide'] = $this->chargerAideWiki();
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
$widget['squelette'] = 'avertissement';
return $widget;
}
/**
* Charge le contenu du wikini demandé
*/
function chargerAideWiki() {
$url = str_replace('{page}','AideCarto',$this->config['chemins']['aideWikiniUrl']);
$infos_aide = file_get_contents($url);
$aide = '';
if($infos_aide != null && $infos_aide != '') {
$infos_aide = json_decode($infos_aide);
$infos_aide = (is_a($infos_aide, 'StdClass') && $infos_aide->texte != null) ? $infos_aide->texte : '';
}
return $infos_aide;
}
}
?>
/tags/widget-origin-mobile/modules/cartopoint/config.defaut.ini
New file
0,0 → 1,8
[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 = "http://www.tela-botanica.org/eflore/cel2/widget/modules/carto/squelettes/kml/%s/%s"
communeImageUrl = "http://www.tela-botanica.org/commun/icones/carto/commune.png"
pointImageUrl = "http://www.tela-botanica.org/commun/icones/carto/point2.png"
groupeImageUrlTpl = "http://www.tela-botanica.org/service:cel:CelWidgetMapPoint/icone-groupe?type={type}&nbre={nbre}"
/tags/widget-origin-mobile/modules/cartopoint/squelettes/css/carto.css
New file
0,0 → 1,697
@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:#CCC;
text-decoration:none;
}
a:active {
outline:none;
}
a:focus {
outline:thin dotted;
}
a:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
}
img {
border:none;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* 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;
}
 
.element-overlay {
background-color: #DDDDDD;
border:1px solid grey;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Carte */
#carte {
padding:0;
margin:0;
position:absolute;
right:0;
bottom:0;
overflow:auto;
width: 100%;
height: 100%;
}
 
.carte_titree {
top:35px;
}
 
.carte_non_titre {
top:0px;
}
 
.bouton {
background-color:white;
border:2px solid black;
cursor:pointer;
text-align:center;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Message de chargement */
 
#zone-chargement-point {
display: none;
background-color: white;
height: 70px;
padding: 10px;
position: fixed;
text-align: center;
width: 230px;
z-index: 3000;
}
 
#chargement {
margin:25px;
text-align:center;
 
}
#chargement img{
display:block;
margin:auto;
}
 
#message-aucune-obs p {
padding-top : 25px;
font-weight: bold;
}
 
#message-aucune-obs {
background-image: url("../images/attention.png");
background-position: 50% 10px;
background-repeat: no-repeat;
display: none;
height: 70px;
padding: 10px;
position: fixed;
text-align: center;
width: 230px;
z-index: 3000;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Avertissement */
#zone-avertissement {
background-color:#DDDDDD;
color: black;
padding:12px;
text-align:justify;
line-height:16px;
}
#zone-avertissement h1{
margin:0;
}
#zone-avertissement a {
border-bottom:1px dotted gainsboro;
}
 
#zone-avertissement a, a:active, a:visited {
color: #666666;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Carte titre */
 
#zone-titre {
top: 30px;
}
 
#zone-titre, #zone_stats {
padding:0;
position:absolute;
height:25px;
overflow:hidden;
border-radius: 4px;
z-index: 3000;
display: inline-block;
padding:8px;
color: black;
font-family: inherit;
font-size: 1.1em;
font-weight: bold;
text-rendering: optimizelegibility;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;
}
 
#zone-info {
position:absolute;
top:26px;
z-index:3001;
right:8px;
width: 25px;
text-align:right;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;
border-radius: 5px 5px 5px 5px;
}
 
#zone-info a {
border: none;
}
 
 
#logo {
left: 2px;
padding: 4px;
position: absolute;
top: 5px;
z-index: 3002;
width: 60px;
}
 
#logo a {
border-bottom: none;
}
 
#carte-titre {
display:inline-block;
margin:0;
padding:0em;
}
#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 */
}
 
#image-utilisateur {
position: absolute;
right: 5px;
top: 40%;
}
 
#lien-affichage-filtre-utilisateur {
right: 5px;
float: right;
padding-bottom: 1px;
cursor: pointer;
font-weight: bold;
margin-left: 25px;
padding: 3px;
position: relative;
top: 3px;
width: 117px;
height: 30px;
}
 
#conteneur-filtre-utilisateur.ferme:hover {
color: #222222;
background-color: #AAAAAA;
text-decoration: none;
cursor: pointer;
border: 1px solid #222222;
}
 
#conteneur-filtre-utilisateur {
float: right;
padding: 3px;
position: absolute;
right: 5px;
top: 31px;
border-radius: 5px 5px 5px 5px;
width: 117px;
max-width: 350px;
}
 
.largeurAuto {
width: auto;
}
 
#raz-filtre-utilisateur {
color: red;
padding-left: 1px;
word-wrap: break-word;
width: 110px;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Panneau latéral */
#panneau-lateral {
padding:0;
margin:0;
position:absolute;
top: 75px;
left:0;
bottom:0;
width: 83px;
overflow:hidden;
height: 25px;
z-index: 3001;
border-top-right-radius : 10px;
border-bottom-right-radius : 10px;
}
#pl-indication-filtre {
margin-left : 25px;
padding : 3px;
font-weight: bold;
padding: 3px;
position: relative;
top: 3px;
}
#pl-contenu {
display:none;
}
#pl-entete {
height:95px;
}
#pl-corps {
bottom:0;
overflow:auto;
padding:5px;
width:290px;
}
#pl-ouverture, #pl-fermeture {
position:absolute;
top:0;
height:60px;
width:24px;
text-align:center;
cursor:pointer;
}
#pl-ouverture {
left:0;
background:url(../images/ouverture.png) no-repeat top left #4A4B4C;
height:100%;
}
#pl-fermeture {
display:none;
right: 0;
background:url(../images/fermeture.png) no-repeat top right #4A4B4C;
}
#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, .raz-filtre-taxons.taxon-actif {
color:#56B80E;
}
#taxons li span, .raz-filtre-taxons {
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;
}
.raz-filtre-taxons {
cursor:pointer;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Zone des stats en bas */
#zone-stats {
padding:0;
position:absolute;
height:25px;
bottom:20px;
overflow:hidden;
border-radius: 4px;
z-index: 3000;
display: inline-block;
padding:8px;
color: black;
font-family: inherit;
font-size: 1.1em;
font-weight: bold;
text-rendering: optimizelegibility;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;
}
 
#zone-stats h1 {
margin-top: 0;
}
 
#lien_plein_ecran, #lien-voir-cc {
position: absolute;
z-index: 3000;
border-radius: 4px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;
padding: 8px 8px 4px;
font-size: 1.1em;
font-weight: bold;
}
 
#lien_plein_ecran {
bottom: 20px;
left: 5px;
}
 
#lien_plein_ecran a, #lien-voir-cc a {
color: black;
padding: 2px;
border-bottom: none;
}
 
#lien_plein_ecran img {
height: 20px;
}
 
#lien-voir-cc {
bottom: 3px;
right: 5px;
bottom: 20px;
height: 20px;
}
 
#origine-donnees {
-moz-user-select: none;
background: -moz-linear-gradient(center , rgba(255, 255, 255, 0) 0pt, rgba(255, 255, 255, 0.5) 50px) repeat scroll 0 0 transparent;
color: #444444;
direction: ltr;
font-family: Arial,sans-serif;
font-size: 10px;
font-weight: bold;
height: 19px;
line-height: 19px;
padding-left: 50px;
padding-right: 2px;
bottom: 0px;
position: absolute;
text-align: right;
white-space: nowrap;
z-index: 3001;
}
 
#origine-donnees a {
color: #444444;
cursor: pointer;
text-decoration: underline;
border-bottom: none;
}
#origine-donnees a:active, #origine-donnees a:visited {
border-bottom: 1px dotted #666666;
color: #CCCCCC;
text-decoration: none;
}
 
#origine-donnees a:visited {
border-bottom: 1px dotted #666666;
color: #444444;
text-decoration: none;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Pop-up observations */
#info-bulle{
min-height:500px;
width:500px;
}
#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;
}
 
.lien-widget-saisie {
background: url("../images/saisie.png") no-repeat scroll left center transparent;
border: 1px solid #AAAAAA;
background-color: #EEE;
padding: 5px 5px 5px 25px;
text-decoration: none;
border-radius : 5px;
}
 
.lien-widget-saisie:hover {
color: #222222;
background-color: #AAAAAA;
text-decoration: none;
cursor: pointer;
border: 1px solid #222222;
}
 
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* 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{
width:50px;
float:right;
}
#form-contact #fc_annuler{
width:50px;
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;
}
/tags/widget-origin-mobile/modules/cartopoint/squelettes/avertissement.tpl.html
New file
0,0 → 1,39
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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="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" />
 
<!-- CSS -->
<link href="<?=$url_base?>modules/cartopoint/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
<style>
html {
overflow:auto;
}
body {
overflow:auto;
}
</style>
</head>
<body>
<div id="zone-avertissement">
<?= $contenu_aide; ?>
</div>
</body>
</html>
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/fermeture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/fermeture.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/plein_ecran.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/plein_ecran.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/ouverture.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/ouverture.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/trie_decroissant.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/trie_decroissant.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/logo_telabotanica.jpg
Cannot display: file marked as a binary type.
svn:mime-type = image/jpeg
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/logo_telabotanica.jpg
New file
Property changes:
Added: svn:mime-type
+image/jpeg
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/trie.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/trie.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/attention.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/attention.png
New file
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/information.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/information.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/trie_croissant.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/trie_croissant.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/saisie.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/widget-origin-mobile/modules/cartopoint/squelettes/images/saisie.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/widget-origin-mobile/modules/cartopoint/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>
/tags/widget-origin-mobile/modules/cartopoint/squelettes/carte_defaut.tpl.html
New file
0,0 → 1,406
<!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="Delphine CAUQUIL, Jean-Pascal MILCENT" />
<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)" />
 
<!-- Spécial mobile -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- 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" />
<!-- Javascript : bibliothèques -->
<!-- Google Map v3 -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=true&amp;language=fr&amp;region=FR"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/google/map/3/markermanager/1.0/markermanager-1.0.pack.js"></script>
<!-- Jquery -->
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/1.6.2/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.15/js/jquery-ui-1.8.15.custom.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/tablesorter/2.0.5/jquery.tablesorter.min.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/pagination/2.2/jquery.pagination.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="http://www.tela-botanica.org/commun/jquery/validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/validate/1.8.1/messages_fr.js"></script>
<!-- Javascript : appli carto -->
<script type="text/javascript">
//<![CDATA[
var urlsLimitesCommunales = <?= $url_limites_communales; ?>;
var nt = '<?=$num_taxon?>';
var filtreCommun =
'&taxon=<?=rawurlencode($taxon)?>'+
'&utilisateur=<?=$utilisateur?>'+
'&projet=<?=rawurlencode($projet)?>'+
'&tag=<?=rawurlencode($tag)?>'+
'&date=<?=$date?>'+
'&dept=<?=$dept?>'+
'&commune=<?=rawurlencode($commune)?>'+
'&commentaire=<?=rawurlencode($commentaire)?>';
var utilisateur = '<?=$utilisateur?>';
var photos = '<?= ($photos != null) ? $photos : null; ?>';
if(photos != null) {
filtreCommun += '&photos=<?=rawurlencode($photos)?>';
}
var nbJours = '<?= ($nbjours != null) ? $nbjours : null; ?>';
if(nbJours != null) {
filtreCommun += '&nbjours=<?=rawurlencode($nbjours)?>';
}
var referentiel = '<?= ($referentiel != null) ? $referentiel : null; ?>';
if(referentiel != null) {
filtreCommun += '&referentiel=<?=rawurlencode($referentiel)?>';
}
var titreCarte = '<?= ($titre != null) ? addslashes($titre) : "null"; ?>';
var urlLogo = '<?= ($logo != null) ? $logo : "null"; ?>';
var urlSite = '<?= ($url_site != null) ? $url_site : "null"; ?>';
var urlImage = '<?= ($image != null) ? $image : "null"; ?>';
var stationsUrl = '<?=$url_cel_carto?>/tout'+'?'+
'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;
var communeImageUrl = '<?= $communeImageUrl; ?>';
var pointImageUrl = '<?= $pointImageUrl; ?>';
var groupeImageUrlTpl = '<?= $groupeImageUrlTpl; ?>';
//]]>
</script>
<script type="text/javascript" src="<?=$url_base?>modules/cartopoint/squelettes/scripts/carto.js"></script>
<!-- CSS -->
<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" />
<link rel="stylesheet" href="http://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/cartopoint/squelettes/css/<?=isset($_GET['style']) ? $_GET['style'] : 'carto'?>.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body>
<div id="zone-chargement-point" class="element-overlay" class="element-overlay">
<img src="<?=$url_base?>modules/cartopoint/squelettes/images/chargement.gif" alt="Chargement en cours..." />
<p> Chargement des points en cours... </p>
</div>
<?php if($logo != null) { ?>
<div id="logo">
<?php if($url_site != null) { ?>
<a href="<?= $url_site; ?>"
title="<?= $url_site; ?>"
onclick="ouvrirNouvelleFenetre(this, event)">
<img height="60px" class="image-logo" src="<?= $logo ?>" alt="logo" />
</a>
<?php } else { ?>
<img class="image-logo" src="<?= $logo ?>" alt="logo" />
<?php } ?>
</div>
<?php } else { ?>
<div id="logo">
<a href="http://www.tela-botanica.org/site:accueil"
title="Aller à l'accueil de Tela Botanica"
onclick="ouvrirNouvelleFenetre(this, event)">
<img height="60px" class="image-logo" src="http://www.tela-botanica.org/sites/commun/generique/images/logos/logo_tela.gif" alt="TB" />
</a>
</div>
<?php } ?>
<?php if($titre !== "0" && $titre != null) : ?>
<div id="zone-titre" class="element-overlay">
<h1 id="carte-titre">
<span id="carte-titre-infos"><?= htmlspecialchars($titre); ?></span>
</h1>
</div>
<?php endif; ?>
<? if ($num_taxon == '*') : ?>
<div id="panneau-lateral" class="element-overlay <?= ($titre != 0) ? 'carte_titree"': 'carte_non_titree"'; ?>>
<div id="pl-ouverture" title="Filtrer les observations par espèce">
<span>Panneau >></span>
<div id="pl-indication-filtre"> Filtrer
</div>
</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>
<hr class="nettoyage" />
<div id="pl-corps" onMouseOver="map.setOptions({'scrollwheel':false});" onMouseOut="map.setOptions({'scrollwheel':true});">
<hr class="nettoyage" />
<!-- Insertion des lignes à partir du squelette tpl-taxons-liste -->
<span class="raz-filtre-taxons taxon-actif" title="Voir tous les taxons">
Voir tous les taxons
</span>
<ol id="taxons">
</ol>
</div>
</div>
</div>
<? endif ?>
<div id="carte" <?= ($titre != 0) ? 'class="carte_titree"': 'class="carte_non_titree"'; ?>></div>
<div id="lien_plein_ecran" class="element-overlay">
<a href="#" title="Voir en plein écran (s'ouvre dans une nouvelle fenêtre)">
<img class="icone" src="<?=$url_base?>modules/cartopoint/squelettes/images/plein_ecran.png" alt="Voir en plein écran" />
</a>
</div>
<div id="zone-stats" style="display:none" class="element-overlay">
<h1>
</h1>
</div>
<div id="conteneur-filtre-utilisateur" class="ferme element-overlay">
<div id="lien-affichage-filtre-utilisateur">Ma carte</div>
<div id="formulaire-filtre-utilisateur">
<span class="indication-filtre-utilisateur">Affichez la carte
de vos observations</span>
<input type="text" id="filtre-utilisateur" placeholder="entrez votre email" value="<?= ($utilisateur != '*') ? $utilisateur : '' ?>" title="entrez l'email d'un utilisateur pour voir ses données" />
<input id="valider-filtre-utilisateur" type="button" value="ok" />
<a href="#" id="raz-filtre-utilisateur">Voir la carte globale</a>
</div>
</div>
<?php if($image != null) { ?>
<div id="image-utilisateur">
<img width="155px" src="<?= $image ?>" alt="image" />
</div>
<?php } ?>
<div id="origine-donnees">
Observations du réseau <a href="http://www.tela-botanica.org/site:botanique"
onClick="ouvrirNouvelleFenetre(this, event)">
Tela Botanica
</a>
</div>
<div id="lien-voir-cc" class="element-overlay">
<a href="<?=$url_base?>cartoPoint?carte=avertissement" title="Voir les informations et conditions d'utilisation de ce widget">
?
</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:300px;">
<img src="<?=$url_base?>modules/cartopoint/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 id="obs-station-titre">Station</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 id="obs-pieds-page">
<p>Id : <span id="obs-station-id">&nbsp;</span></p>
</div>
<div class="navigation">&nbsp;</div>
<div class="conteneur-lien-saisie">
<a href="http://www.tela-botanica.org/widget:cel:saisie{parametres-lien-saisie}" class="lien-widget-saisie">
Ajouter une observation pour ce site
</a>
</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 != null && nn != 0 && nn != ''}}
<a href="http://www.tela-botanica.org/bdtfx-nn-${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
${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}}
<a class="contact obs-${idObs}"
href="#form-contact"
title="Contactez ce contributeur">
${observateur}
</a>
{{/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 != null && nn != 0 && 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="http://www.tela-botanica.org/bdtfx-nn-${nn}"
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 != null && nn != 0 && nn != ''}}
<a href="http://www.tela-botanica.org/bdtfx-nn-${nn}"
onclick="ouvrirNouvelleFenetre(this, event)">
${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}}
<a class="contact obs-${idObs}"
href="#form-contact"
title="Contactez ce contributeur">
${observateur}
</a>
{{/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">
{{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" />
<input type="hidden" name="fc_type_envoi" id="fc_type_envoi" value="inscrit" />
<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>
<!-- 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/widget-origin-mobile/modules/cartopoint/squelettes/scripts/carto.js
New file
0,0 → 1,1417
/*+--------------------------------------------------------------------------------------------------------+*/
// PARAMÊTRES et CONSTANTES
// Mettre à true pour afficher les messages de débogage
var DEBUG = false;
/**
* Indication de certaines variables ajoutée par php
* var communeImageUrl ;
* var pointImageUrl ;
* var groupeImageUrlTpl ;
*/
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
var map = null;
var infoBulle = new google.maps.InfoWindow();
var stations = null;
var pointClique = null;
var carteCentre = new google.maps.LatLng(25, 10);
var carteOptions = {
zoom: 3,
center:carteCentre,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
mapTypeIds: ['OSM',
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.HYBRID,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.TERRAIN]
},
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.LEFT_CENTER
},
panControl: false
};
var 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
});
var ctaLayer = null;
var pagineur = {'limite':300, 'start':0, 'total':0, 'stationId':null, 'format':'tableau'};
var station = {'commune':'', 'obsNbre':0};
var obsStation = new Array();
var obsPage = new Array();
var taxonsCarte = new Array();
var mgr = null;
var marqueursCache = new Array();
var zonesCache = new Array();
var requeteChargementPoints;
var urlVars = null;
/*+--------------------------------------------------------------------------------------------------------+*/
// INITIALISATION DU CODE
 
//Déclenchement d'actions quand JQuery et le document HTML sont OK
$(document).ready(function() {
initialiserWidget();
});
 
function initialiserWidget() {
urlVars = getUrlVars();
dimensionnerCarte();
definirTailleOverlay();
initialiserCarte();
attribuerListenersOverlay();
centrerTitreEtStats();
initialiserAffichagePanneauLateral();
initialiserGestionnaireMarqueurs()
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
attribuerListenerCarte();
}
 
function getUrlVars()
{
var vars = [], hash;
if(window.location.href.indexOf('?') != -1) {
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
}
return vars;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// AFFICHAGE GÉNÉRAL
 
function afficherTitreCarteEtStats() {
if (stations != null && taxonsCarte.length > 0) {
var obsNbre = stations.stats.observations;
var obsNbreFormate = obsNbre;
if(obsNbre != 0) {
obsNbreFormate = stations.stats.observations.formaterNombre();
}
var plteNbre = taxonsCarte.length;
var plteNbreFormate = plteNbre;
if(plteNbre != 0) {
plteNbreFormate = taxonsCarte.length.formaterNombre();
}
var communeNbre = stations.stats.communes;
var communeNbreFormate = communeNbre;
if(communeNbre != 0) {
communeNbreFormate = stations.stats.communes.formaterNombre();
}
var stationNbre = stations.stats.stations;
var stationNbreFormate = stationNbre;
if(stationNbre != 0) {
stationNbreFormate = stations.stats.stations.formaterNombre();
}
var stats = obsNbreFormate+' observation';
stats += (obsNbre > 1) ? 's' : '' ;
 
if(photos != null && photos == 1) {
stats += ' avec photos ';
}
stats += ' sur '+(stationNbre+ communeNbre)+' station';
stats += (stationNbre > 1) ? 's' : '' ;
if (nt == '*') {
stats += ' parmi '+plteNbreFormate+' plante';
stats += (plteNbre > 1) ? 's' : '' ;
} else {
if($('.taxon-actif .taxon').text() != '') {
var element = $('.taxon-actif .taxon').clone();
element.children().remove();
var taxon = element.text();
stats += ' pour '+taxon;
} else {
if (taxonsCarte[0]) {
var taxon = taxonsCarte[0];
stats += ' pour '+taxon.nom;
}
}
}
if(utilisateur != '*') {
stats += ' pour l\'utilisateur '+utilisateur+' ';
}
$('#zone-stats').show();
} else {
stats = "Aucune observation pour ces critères ou pour cette zone";
}
$('#zone-stats > h1').text(stats);
centrerTitreEtStats();
}
 
function attribuerListenersOverlay() {
$(window).resize(function() {
dimensionnerCarte();
definirTailleOverlay();
centrerTitreEtStats();
programmerRafraichissementCarte();
google.maps.event.trigger($('#carte'), 'resize');
});
$('#lien_plein_ecran a').click(function(event) {
window.open(window.location.href);
event.preventDefault();
});
$('#lien-voir-cc a').click(function(event) {
ouvrirPopUp(this, 'Avertissement', event);
event.preventDefault();
});
}
 
var tailleMaxFiltreUtilisateur;
function definirTailleOverlay() {
var largeurViewPort = $(window).width();
var taille = '1.6';
var tailleMaxLogo = 60;
var tailleMaxIcones = 10;
var padding_icones = 8;
var tailleFiltre = 80;
tailleMaxFiltreUtilisateur = 350;
$('#raz-filtre-utilisateur').css('display', 'block');
if (largeurViewPort <= 450) {
taille = '1';
tailleMaxIcones = 10;
tailleFiltre = 65;
padding_icones = 2;
var tailleMaxLogo = 50;
$('#raz-filtre-utilisateur').css('display', 'inline');
} else if (largeurViewPort <= 500) {
taille = '1.2';
tailleMaxIcones = 10;
tailleFiltre = 65;
padding_icones = 2;
var tailleMaxLogo = 50;
tailleMaxFiltreUtilisateur = 200;
$('#raz-filtre-utilisateur').css('display', 'inline');
} else if (largeurViewPort > 500 && largeurViewPort <= 800) {
taille = '1.4';
tailleMaxIcones = 15;
padding_icones = 6;
tailleFiltre = 65;
var tailleMaxLogo = 55;
tailleMaxFiltreUtilisateur = 250;
} else if (largeurViewPort > 800) {
taille = '1.6';
tailleMaxIcones = 20;
padding_icones = 8;
tailleFiltre = 80;
tailleMaxFiltreUtilisateur = 350;
}
// Aménagement de la taille de police selon l'écran
$("#carte-titre").css('font-size', taille+'em');
$("#zone-stats h1").css('font-size', Math.round((taille*0.75*100))/100+'em');
$("#zone-stats").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");
$('#zone-stats').height(tailleMaxIcones*1.5);
$("#zone-titre h1").css('font-size', (taille)+'em');
$("#zone-titre").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");
$('#zone-titre').height(tailleMaxIcones*2);
$('.icone').height(tailleMaxIcones);
$('#lien_plein_ecran').css("padding", padding_icones+"px "+padding_icones+"px "+Math.ceil(padding_icones/2)+"px");
$('#lien-voir-cc').css("font-size", taille+"em");
$('#lien-voir-cc').css("padding", padding_icones+"px");
$("#panneau-lateral").css('font-size', (taille*0.9)+'em');
$("#pl-contenu").css('font-size', (taille/2)+'em');
$("#panneau-lateral").css('padding', padding_icones+"px "+padding_icones+"px "+Math.round(padding_icones/4)+"px");
$('#pl-ouverture').height(((padding_icones*2)+$('#panneau-lateral').height())+"px");
$("#panneau-lateral").width(tailleFiltre);
$('#lien-affichage-filtre-utilisateur').width(tailleFiltre);
$('#lien-affichage-filtre-utilisateur').height(tailleFiltre*0.35);
$('#lien-affichage-filtre-utilisateur').css('font-size', (taille*0.9)+'em');
$('#conteneur-filtre-utilisateur').css('max-width',tailleMaxFiltreUtilisateur);
dimensionnerLogo(tailleMaxLogo);
dimensionnerImage(largeurViewPort);
redimensionnerControleTypeCarte(largeurViewPort);
}
 
function dimensionnerLogo(tailleMaxLogo) {
// Dimensionnement du logo
hauteurLogo = $('.image-logo').height();
// Redimensionnement du logo s'il est trop grand
// on perd en qualité mais ça vaut mieux que de casser l'affichage
if(hauteurLogo > tailleMaxLogo) {
hauteurLogo = tailleMaxLogo;
$('.image-logo').css("top", "5px");
$('.image-logo').height(tailleMaxLogo);
}
if(hauteurLogo == 0) {
$('.image-logo').load(function(event) {
definirTailleOverlay();
});
return;
}
largeurLogo = $('#logo img').width();
}
 
function dimensionnerImage(largeurViewPort) {
// Dimensionnement de l'image
if(largeurViewPort > 500) {
largeurLogo = 155;
} else {
largeurLogo = 70;
}
$('#image-utilisateur img').width(largeurLogo);
}
 
function redimensionnerControleTypeCarte(largeurViewPort) {
if (largeurViewPort <= 500) {
carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DROPDOWN_MENU;
} else {
carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DEFAULT;
}
if(map != null) {
map.setOptions(carteOptions);
}
}
 
function centrerTitreEtStats() {
centrerTitre();
centrerStats();
}
 
function centrerTitre() {
var largeurViewPort = $(window).width();
var largeurTitre = $('#zone-titre').width();
var marge = (largeurViewPort - largeurTitre)/2;
$('#zone-titre').css("margin-left",marge);
var tailleRestante = largeurViewPort - (marge + largeurTitre);
if(tailleRestante <= 170) {
$('#zone-titre').css("top", "25px");
} else {
$('#zone-titre').css("top", "5px");
}
}
 
function centrerStats() {
var largeurViewPort = $(window).width();
var largeurStats = $('#zone-stats').width();
var marge = ((largeurViewPort - largeurStats)/2);
$('#zone-stats').css("margin-left",marge);
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// CARTE
 
function dimensionnerCarte() {
var largeurViewPort = $(window).width();
var hauteurViewPort = $(window).height();
$('#carte').height(hauteurViewPort);
$('#carte').width(largeurViewPort);
}
 
function initialiserCarte() {
map = new google.maps.Map(document.getElementById('carte'), carteOptions);
// Ajout de la couche OSM à la carte
map.mapTypes.set('OSM', osmMapType);
}
 
function initialiserGestionnaireMarqueurs() {
mgr = new MarkerManager(map);
}
 
function chargerLimitesCommunales() {
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: true});
ctaLayer.setMap(map);
}
}
}
 
var listener = null;
var timer = null;
function attribuerListenerCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', function(){
programmerRafraichissementCarte();
});
listener = google.maps.event.addListener(map, 'zoom_changed', function(){
programmerRafraichissementCarte();
});
}
function programmerRafraichissementCarte() {
if(timer != null) {
window.clearTimeout(timer);
}
if(requeteChargementPoints != null) {
requeteChargementPoints.abort();
}
timer = window.setTimeout(function() {
if(map.getBounds() != undefined) {
var zoom = map.getZoom();
var lngNE = map.getBounds().getNorthEast().lng();
var lngSW = map.getBounds().getSouthWest().lng()
if(map.getBounds().getNorthEast().lng() < map.getBounds().getSouthWest().lng()) {
lngNE = 176;
lngSW = -156;
}
var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(lngNE);
var SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(lngSW);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
} else {
programmerRafraichissementCarte();
}
}, 400);
}
 
var marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
cacherMessageAucuneObs()
var url = stationsUrl+
'&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
if(infoBulleOuverte) {
return;
}
if(requeteChargementPoints != null) {
requeteChargementPoints.abort();
cacherMessageChargementPoints();
}
afficherMessageChargementPoints();
requeteChargementPoints = $.getJSON(url, function(data) {
rafraichirMarqueurs(data);
cacherMessageChargementPoints();
});
}
 
function centrerDansLaPage(selecteur) {
var largeurViewport = $(window).width();
var hauteurViewport = $(window).height();
selecteur.css('display','block');
var left = (largeurViewport/2) - (selecteur.width())/2;
var top = (hauteurViewport/2) - (selecteur.height())/2
selecteur.css('left',left);
selecteur.css('top',top);
}
 
function afficherMessageChargementPoints() {
centrerDansLaPage($('#zone-chargement-point'));
$('#zone-chargement-point').css('display','block');
}
 
function cacherMessageChargementPoints() {
$('#zone-chargement-point').css('display','none');
}
 
function afficherMessageAucuneObs() {
centrerDansLaPage($('#message-aucune-obs'));
$('#message-aucune-obs').show();
}
 
function cacherMessageAucuneObs() {
centrerDansLaPage($('#message-aucune-obs'));
$('#message-aucune-obs').hide();
}
 
premierChargement = true;
function doitCentrerCarte() {
return premierChargement && urlVars != null && urlVars.length > 0;
}
 
function rafraichirMarqueurs(data) {
$.each(marqueurs, function(index, marqueur) {
marqueur.setMap(null);
});
 
marqueurs = new Array();
stations = null;
if(data.points.length > 0) {
marqueurs = new Array();
stations = data;
$.each(stations.points, function (index, station) {
if(station != null) {
var nouveauMarqueur = creerMarqueur(station);
marqueurs.push(nouveauMarqueur);
}
});
if(doitCentrerCarte()) {
premierChargement = false;
var bounds = new google.maps.LatLngBounds();
var latMax = new google.maps.LatLng(data.stats.coordmax.latMax, data.stats.coordmax.lngMax);
var latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
bounds.extend(latMax);
bounds.extend(latMin);
rendrePointsVisibles(bounds);
}
}
afficherTitreCarteEtStats();
}
 
function creerMarqueur(station) {
var titre = '';
if(station.nbreMarqueur) {
titre = station.nbreMarqueur+' points renseignés';
} else {
if(station.nom) {
titre = station.nom;
}
}
var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']);
var latLng = new google.maps.LatLng(station['lat'], station['lng']);
var marqueur = new google.maps.Marker({
position: latLng,
icon: icone,
title: ''+titre,
map: map,
stationInfos: station
});
attribuerListenerClick(marqueur, station['id']);
marqueur.setMap(map);
return marqueur;
}
 
function rendrePointsVisibles(bounds) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
}
 
function attribuerImageMarqueur(id, nbreMarqueur) {
var marqueurImage = null;
if (etreMarqueurCommune(id)) {
marqueurImage = new google.maps.MarkerImage(communeImageUrl, new google.maps.Size(24, 32));
} else if (etreMarqueurStation(id)) {
marqueurImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(16, 16));
} else if (etreMarqueurGroupe(id)) {
var type = 0;
var largeur = 0;
var hauteur = 0;
if (nbreMarqueur != null) {
if (nbreMarqueur >= 2 && nbreMarqueur < 100 ) {
type = '1';
largeur = 53;
hauteur = 52;
} else if (nbreMarqueur >= 100 && nbreMarqueur < 1000 ) {
type = '2';
largeur = 56;
hauteur = 55;
} else if (nbreMarqueur >= 1000 && nbreMarqueur < 10000 ) {
type = '3';
largeur = 66;
hauteur = 65;
} else if (nbreMarqueur >= 10000 && nbreMarqueur < 20000 ) {
type = '4';
largeur = 78;
hauteur = 77;
} else if (nbreMarqueur >= 20000) {
type = '5';
largeur = 66;
hauteur = 65;
}
}
groupeImageUrl = groupeImageUrlTpl.replace(/\{type\}/, type);
groupeImageUrl = groupeImageUrl.replace(/\{nbre\}/, nbreMarqueur);
marqueurImage = new google.maps.MarkerImage(groupeImageUrl, new google.maps.Size(largeur, hauteur));
}
return marqueurImage
}
 
function attribuerListenerClick(marqueur, id) {
if (etreMarqueurCommune(id) || etreMarqueurStation(id)) {
google.maps.event.addListener(marqueur, 'click', surClickMarqueur);
} else if (etreMarqueurGroupe(id)) {
google.maps.event.addListener(marqueur, 'click', surClickGroupe);
}
}
 
var pointCentreAvantAffichageInfoBulle = null;
function surClickMarqueur(event) {
pointCentreAvantAffichageInfoBulle = map.getCenter();
if(infoBulleOuverte) {
infoBulle.close();
}
pointClique = this;
infoBulle.open(map, this);
actualiserPagineur();
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
afficherInfoBulle();
}
 
function surClickGroupe() {
map.setCenter(this.getPosition());
var nouveauZoom = map.getZoom() + 2;
map.setZoom(nouveauZoom);
mgr.clearMarkers();
}
 
function etreMarqueurGroupe(id) {
var groupe = false;
var motif = /^GROUPE/;
if (motif.test(id)) {
groupe = true;
}
return groupe;
}
 
function etreMarqueurCommune(id) {
var commune = false;
var motif = /^COMMUNE:/;
if (motif.test(id)) {
commune = true;
}
return commune;
}
 
function etreMarqueurStation(id) {
var station = false;
var motif = /^STATION:/;
if (motif.test(id)) {
station = true;
}
return station;
}
 
function deplacerCarteSurPointClique() {
map.panTo(pointClique.position);
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
var infoBulleOuverte = false;
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
google.maps.event.addListener(infoBulle, 'content_changed', definirLargeurInfoBulle);
attribuerListenerLienSaisie();
}
 
function attribuerListenerLienSaisie() {
$('.lien-widget-saisie').live('click', function(event) {
event.preventDefault();
window.open($(this).attr('href'), '_blank');
return false;
});
}
 
function surFermetureInfoBulle() {
infoBulleOuverte = false;
map.panTo(pointCentreAvantAffichageInfoBulle);
programmerRafraichissementCarte();
}
 
function centrerInfoBulle() {
var limites = map.getBounds();
var centre = limites.getCenter();
var nordEst = limites.getNorthEast();
var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
map.panTo(centreSudLatLng);
}
 
function afficherInfoBulle() {
var obsHtml = $("#tpl-obs").html();
var largeur = definirLargeurInfoBulle();
var taillePolice = definirTaillePoliceInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
obsHtml = mettreAJourUrlSaisie(obsHtml);
infoBulle.setContent(obsHtml);
$('#observations').css('font-size',taillePolice+'em');
chargerObs(0, 0);
infoBulleOuverte = true;
}
 
//TODO utiliser cette fonction lors des remplacements de
//paramètres url sur changement de filtre
function parserFiltre(filtre) {
var nvpair = {};
var qs = filtre.replace('?', '');
var pairs = qs.split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
nvpair[pair[0]] = pair[1];
});
return nvpair;
}
 
function mettreAJourUrlSaisie(obsHtml) {
var filtreTableau = parserFiltre(filtreCommun);
var filtresGardes = new Array();
filtre = '';
for(i in filtreTableau) {
if(filtreTableau[i] != undefined && filtreTableau[i] != '' && decodeURIComponent(filtreTableau[i]) != '*') {
console.log(i+" "+filtreTableau[i]);
filtresGardes.push(i+'='+filtreTableau[i]);
}
}
if(filtresGardes.length > 0) {
filtre = '?'+filtresGardes.join('&');
}
obsHtml = obsHtml.replace(/\{parametres-lien-saisie\}/, filtre);
return obsHtml;
}
 
function definirLargeurInfoBulle() {
var largeurViewPort = $(window).width();
var largeurInfoBulle = null;
if (largeurViewPort < 400) {
largeurInfoBulle = 300;
} else if (largeurViewPort < 800) {
largeurInfoBulle = 400;
} else if (largeurViewPort >= 800 && largeurViewPort < 1200) {
largeurInfoBulle = 500;
} else if (largeurViewPort >= 1200) {
largeurInfoBulle = 600;
}
return largeurInfoBulle;
}
 
function definirTaillePoliceInfoBulle() {
var largeurViewPort = $(window).width();
var taillePolice = null;
if (largeurViewPort < 400) {
taillePolice = 0.8;
} else if (largeurViewPort < 800) {
taillePolice = 1;
}
return taillePolice;
}
 
function afficherMessageChargement(element) {
if ($('#chargement').get() == '') {
$('#tpl-chargement').tmpl().appendTo(element);
}
}
 
function afficherMessageChargementTitreInfoBulle() {
$("#obs-station-titre").text("Chargement des observations");
}
 
function supprimerMessageChargement() {
$('#chargement').remove();
}
 
function chargerObs(depart, total) {
if (depart == 0 || depart < total) {
var limite = 300;
if (depart == 0) {
viderTableauObs();
}
var urlObs = observationsUrl+'&start={start}&limit='+limite;
urlObs = urlObs.replace(/\{stationId\}/g, encodeURIComponent(pointClique.stationInfos.id));
if (pointClique.stationInfos.type_emplacement == 'communes') {
urlObs = urlObs.replace(/commune=%2A/g, formaterParametreCommunePourRequete(pointClique.stationInfos.nom));
}
urlObs = urlObs.replace(/\{nt\}/g, nt);
urlObs = urlObs.replace(/\{start\}/g, depart);
$.getJSON(urlObs, function(observations){
surRetourChargementObs(observations, depart, total);
chargerObs(depart+limite, observations.total);
});
}
}
 
function formaterParametreCommunePourRequete(nomCommune) {
var chaineRequete = "";
if(nomCommune.indexOf("(", 0) !== false) {
var infosCommune = nomCommune.split("(");
var commune = infosCommune[0];
chaineRequete = 'commune='+encodeURIComponent($.trim(commune));
} else {
chaineRequete = 'commune='+encodeURIComponent($.trim(nomCommune));
}
return chaineRequete;
}
 
function viderTableauObs() {
obsStation = new Array();
surClicPagePagination(0, null);
}
 
function surRetourChargementObs(observations, depart, total) {
obsStation = obsStation.concat(observations.observations);
if (depart == 0) {
actualiserInfosStation(observations);
creerTitreInfoBulle();
surClicPagePagination(0, null);
}
afficherPagination();
actualiserPagineur();
selectionnerOnglet("#obs-vue-"+pagineur.format);
}
 
function actualiserInfosStation(infos) {
pointClique.stationInfos.commune = infos.commune;
pointClique.stationInfos.obsNbre = infos.total;
}
 
function creerTitreInfoBulle() {
$("#obs-total").text(station.obsNbre);
$("#obs-commune").text(station.commune);
var titre = '';
titre += pointClique.stationInfos.obsNbre+' observation';
titre += (pointClique.stationInfos.obsNbre > 1) ? 's': '' ;
titre += ' pour ';
if (etreMarqueurCommune(pointClique.stationInfos.id)) {
nomStation = 'la commune : ';
} else {
nomStation = 'la station : ';
}
titre += pointClique.stationInfos.nom;
$("#obs-station-titre").text(titre);
}
 
function actualiserPagineur() {
pagineur.stationId = pointClique.stationInfos.id;
pagineur.total = pointClique.stationInfos.obsNbre;
// Si on est en mode photo on reste en mode liste quelque soit le
// nombre de résultats
if (pagineur.total > 4 && photos != 1) {
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
ajouterFormulaireContact("a.contact");
if (pagineur.format == 'liste') {
ajouterGaleriePhoto("a.cel-img");
}
}
 
function initialiserContenuInfoBulle() {
afficherMessageChargement('#observations');
cacherContenuOnglets();
afficherOnglets();
ajouterTableauTriable("#obs-tableau");
afficherTextStationId();
corrigerLargeurInfoWindow();
}
 
function cacherContenuOnglets() {
$("#obs-vue-tableau").css("display", "none");
$("#obs-vue-liste").css("display", "none");
}
 
function afficherOnglets() {
var $tabs = $('#obs').tabs();
$('#obs').bind('tabsselect', function(event, ui) {
if (ui.panel.id == 'obs-vue-tableau') {
surClicAffichageTableau();
} else if (ui.panel.id == 'obs-vue-liste') {
surClicAffichageListe();
}
});
if (pointClique.stationInfos.nbre > 4) {
$tabs.tabs('select', "#obs-vue-tableau");
} else {
$tabs.tabs('select', "#obs-vue-liste");
}
}
 
function selectionnerOnglet(onglet) {
$(onglet).css('display', 'block');
$('#obs').tabs('select', onglet);
}
 
function afficherTextStationId() {
$('#obs-station-id').text(pointClique.stationInfos.id);
}
 
function corrigerLargeurInfoWindow() {
$("#info-bulle").width($("#info-bulle").width() - 17);
}
 
function surClicAffichageTableau(event) {
pagineur.format = 'tableau';
mettreAJourObservations();
mettreAJourTableauTriable("#obs-tableau");
}
 
function surClicAffichageListe(event) {
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 ajouterFormulaireContact(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'));
// si la classe ne contient pas d'id contributeur
// alors il faut stocker le numéro d'observation
var id = RegExp.$1;
if(id == "") {
$("#fc_type_envoi").attr('value', 'non-inscrit');
var motif = / obs-([0-9]+)$/;
motif.exec($(element).attr('class'));
var id = RegExp.$1;
} else {
$("#fc_type_envoi").attr('value', 'inscrit');
}
 
$("#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 = jQuery.trim($(".cel-obs-"+idObs+" .nom-sci:eq(0)").text());
var date = jQuery.trim($(".cel-obs-"+idObs+" .date:eq(0)").text());
var lieu = jQuery.trim($(".cel-obs-"+idObs+" .lieu:eq(0)").text());
var sujet = "Observation #"+idObs+" de "+nomSci;
var message = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de \""+nomSci+'" du "'+date+'" au lieu "'+lieu+'".';
$("#fc_sujet").attr('value', sujet);
$("#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 typeEnvoi = $("#fc_type_envoi").attr('value');
if(typeEnvoi == "non-inscrit") {
// l'envoi au non inscrits passe par le service intermédiaire du cel
// qui va récupérer le courriel associé à l'obs indiquée
var urlMessage = "http://www.tela-botanica.org/service:cel:celMessage/obs/"+destinataireId;
} else {
var urlMessage = "http://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 carto "+
"du Carnet en Ligne du réseau Tela Botanica.\n"+
"http://www.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 carto'+
"&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
var nbTaxons = 0;
function initialiserAffichagePanneauLateral() {
if (nt == '*') {
$('#pl-ouverture').bind('click', afficherPanneauLateral);
$('#pl-fermeture').bind('click', cacherPanneauLateral);
} else {
$('#panneau-lateral').width(0);
$('#carte').width('100%');
}
attribuerListenersFiltreUtilisateur();
chargerTaxons(0, 0);
}
 
function attribuerListenersFiltreUtilisateur() {
$('#valider-filtre-utilisateur').click(function() {
var utilisateur = $('#filtre-utilisateur').val();
filtrerParUtilisateur(utilisateur);
$('#raz-filtre-utilisateur').show();
});
$('#filtre-utilisateur').keypress(function(e) {
if(e.which == 13) {
var utilisateur = $('#filtre-utilisateur').val();
filtrerParUtilisateur(utilisateur);
$('#raz-filtre-utilisateur').show();
}
});
$('#raz-filtre-utilisateur').click(function() {
$('#filtre-utilisateur').val('');
filtrerParUtilisateur('*');
afficherCacherFiltreUtilisateur();
$('#raz-filtre-utilisateur').hide();
});
$('#lien-affichage-filtre-utilisateur').click(function() {
afficherCacherFiltreUtilisateur();
});
$('#raz-filtre-utilisateur').hide();
$('#formulaire-filtre-utilisateur').hide();
}
 
function afficherCacherFiltreUtilisateur() {
$('#formulaire-filtre-utilisateur').slideToggle();
$('#conteneur-filtre-utilisateur').toggleClass('ferme');
if(!$('#conteneur-filtre-utilisateur').hasClass('ferme')) {
$('#conteneur-filtre-utilisateur').width(tailleMaxFiltreUtilisateur);
} else {
$('#conteneur-filtre-utilisateur').width('auto');
}
}
 
function filtrerParUtilisateur(utilisateurFiltre) {
if(utilisateurFiltre == '') {
utilisateurFiltre = '*';
}
utilisateur = utilisateurFiltre;
var pattern = /utilisateur=[^&]*/i;
var utilisateurCourant = pattern.exec(stationsUrl);
stationsUrl = stationsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
taxonsUrl = taxonsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
observationsUrl = observationsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
filtreCommun = filtreCommun.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
$("#taxons").html('');
chargerTaxons(0,0);
programmerRafraichissementCarte();
}
 
function chargerTaxons(depart, total) {
if (depart == 0 || depart < total) {
if(depart == 0) {
nbTaxons = 0;
taxonsCarte = new Array();
}
var limite = 2000;
//console.log("Chargement des taxons de "+depart+" à "+(depart+limite));
var urlTax = taxonsUrl+'&start={start}&limit='+limite;
urlTax = urlTax.replace(/\{start\}/g, depart);
//console.log(urlTax);
$.getJSON(urlTax, function(infos) {
nbTaxons += infos.taxons.length;
$(".plantes-nbre").text(nbTaxons);
$("#tpl-taxons-liste").tmpl({'taxons':infos.taxons}).appendTo("#taxons");
taxonsCarte = taxonsCarte.concat(infos.taxons);
//console.log("Nbre taxons :"+taxonsCarte.length);
chargerTaxons(depart+limite, infos.total);
});
} else {
if (nt == '*') {
afficherTaxons();
}
afficherTitreCarteEtStats();
}
}
 
function afficherTaxons() {
$('.taxon').live('click', filtrerParTaxon);
$('.raz-filtre-taxons').live('click', viderFiltreTaxon);
}
 
var largeurPanneauLateralFerme = null;
function afficherPanneauLateral() {
// fixer la hauteur
$('#panneau-lateral').height($(window).height() - $('#panneau-lateral').offset().top);
largeurPanneauLateralFerme = $('#panneau-lateral').width();
$('#panneau-lateral').width(300);
$('#pl-contenu').css('display', 'block');
$('#pl-ouverture').css('display', 'none');
$('#pl-fermeture').css('display', 'block');
// correction pour la taille de la liste des taxons
$('#pl-corps').height($(window).height() - $('#pl-corps').offset().top);
 
google.maps.event.trigger(map, 'resize');
};
 
function cacherPanneauLateral() {
$('#panneau-lateral').height(25+"px");
$('#panneau-lateral').width(largeurPanneauLateralFerme+"px");
$('#pl-contenu').css('display', 'none');
$('#pl-ouverture').css('display', 'block');
$('#pl-fermeture').css('display', 'none');
google.maps.event.trigger(map, 'resize');
};
 
function viderFiltreTaxon() {
$('.taxon-actif .taxon').click();
}
 
function filtrerParTaxon() {
var ntAFiltrer = $('.nt', this).text();
infoBulle.close();
var zoom = map.getZoom();
var NELatLng = map.getBounds().getNorthEast().lat()+'|'+map.getBounds().getNorthEast().lng();
var SWLatLng = map.getBounds().getSouthWest().lat()+'|'+map.getBounds().getSouthWest().lng();
$('.raz-filtre-taxons').removeClass('taxon-actif');
$('#taxon-'+nt).removeClass('taxon-actif');
if (nt == ntAFiltrer) {
nt = '*';
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+nt);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
} else {
stationsUrl = stationsUrl.replace(/num_taxon=[*0-9]+/, 'num_taxon='+ntAFiltrer);
url = stationsUrl;
url += '&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
requeteChargementPoints = $.getJSON(url, function (stationsFiltrees) {
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirMarqueurs(stations);
});
}
};
 
/*+--------------------------------------------------------------------------------------------------------+*/
// FONCTIONS UTILITAIRES
 
function ouvrirPopUp(element, nomPopUp, event) {
var options =
'width=650,'+
'height=600,'+
'scrollbars=yes,'+
'directories=no,'+
'location=no,'+
'menubar=no,'+
'status=no,'+
'toolbar=no';
var popUp = window.open(element.href, nomPopUp, options);
if (window.focus) {
popUp.focus();
}
return arreter(event);
};
 
function ouvrirNouvelleFenetre(element, event) {
window.open(element.href);
return arreter(event);
}
 
function arreter(event) {
if (event.stopPropagation) {
event.stopPropagation();
} else if (window.event) {
window.event.cancelBubble = true;
}
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
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);
}
/tags/widget-origin-mobile/modules/cartopoint
New file
Property changes:
Added: svn:ignore
+config.ini
/tags/widget-origin-mobile/Widget.php
New file
0,0 → 1,161
<?php
// In : utf8 url_encoded (get et post)
// Out : utf8
/**
* La classe Widget analyser l'url et chage le widget correspondant.
* Format d'url :
* /widget/nom_du_widget?parametres1=ma_valeur1&parametre2=ma_valeur2
* Les widget sont dans des dossiers en minuscule correspondant au nom de la classe du widget.
* Exemple : /widget/carto avec la classe Carto.php dans le dossier carto.
*
*
* @author jpm
*
*/
class Widget {
 
/** Les paramètres de configuration extrait du fichier .ini */
private static $config;
 
/** Le nom du widget demandé. */
private $widget = null;
/** Les chemins où l'autoload doit chercher des classes. */
private static $autoload_chemins = array();
/** Les paramètres de l'url $_GET nettoyés. */
private $parametres = null;
 
/**
* Constructeur.
* Parse le fichier de configuraion "widget.ini" et parse l'url à la recherche du widget demandé.
* @param str iniFile Configuration file to use
*/
public function __construct($fichier_ini = 'widget.ini.php') {
// Chargement de la configuration
self::$config = parse_ini_file($fichier_ini, TRUE);
// Paramêtres de config dynamiques
self::$config['chemins']['baseURLAbsoluDyn'] = 'http://'.$_SERVER['SERVER_NAME'].self::$config['chemins']['baseURL'].'%s';
// Gestion de la mémoire maximum allouée aux services
ini_set('memory_limit', self::$config['parametres']['limiteMemoire']);
// Réglages de PHP
setlocale(LC_ALL, self::$config['parametres']['locale']);
date_default_timezone_set(self::$config['parametres']['fuseauHoraire']);
// Gestion des erreurs
error_reporting(self::$config['parametres']['erreurNiveau']);
if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['QUERY_STRING'])) {
$url_morceaux = $this->parserUrl();
if (isset($url_morceaux[0])) {
$this->widget = $url_morceaux[0];
self::$config['chemins']['widgetCourantDossier'] = self::$config['chemins']['widgetsDossier'].strtolower($this->widget).DIRECTORY_SEPARATOR;
$this->chargerWidgetConfig();
}
// Chargement des chemins pour l'autoload
$this->chargerCheminAutoload();
// Enregistrement de la méthode gérant l'autoload des classes
spl_autoload_register(array('Widget', 'chargerClasse'));
// Nettoyage du $_GET (sécurité)
$this->collecterParametres();
} else {
$e = 'Les widget nécessite les variables serveurs suivantes pour fonctionner : REQUEST_URI et QUERY_STRING.';
trigger_error($e, E_USER_ERROR);
}
}
private function parserUrl() {
if (strlen($_SERVER['QUERY_STRING']) == 0) {
$len = strlen($_SERVER['REQUEST_URI']);
} else {
$len = -(strlen($_SERVER['QUERY_STRING']) + 1);
}
$url = substr($_SERVER['REQUEST_URI'], strlen(self::$config['chemins']['baseURL']), $len);
$url_morceaux = explode('/', $url);
return $url_morceaux;
}
private function collecterParametres() {
if (isset($_GET) && $_GET != '') {
$this->nettoyerGet();
$this->parametres = $_GET;
}
}
private function nettoyerGet() {
foreach ($_GET as $cle => $valeur) {
$verifier = array('NULL', "\n", "\r", "\\", '"', "\x00", "\x1a", ';');
$_GET[$cle] = strip_tags(str_replace($verifier, '', $valeur));
}
}
private function chargerCheminAutoload() {
$chemins_communs = explode(';', self::$config['chemins']['autoload']);
$chemins_communs = array_map('trim', $chemins_communs);
array_unshift($chemins_communs, '');
$chemins_widget = array();
if (isset(self::$config[$this->widget]['autoload'])) {
$chemins_widget = explode(';', self::$config[$this->widget]['autoload']);
foreach ($chemins_widget as $cle => $chemin) {
$chemins_widget[$cle] = self::$config['chemins']['widgetCourantDossier'].trim($chemin);
}
}
self::$autoload_chemins = array_merge($chemins_communs, $chemins_widget);
}
/**
* La méthode chargerClasse() charge dynamiquement les classes trouvées dans le code.
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
*
*@param string le nom de la classe appelée.
*@return void le fichier contenant la classe doit être inclu par la fonction.
*/
public static function chargerClasse($classe) {
if (class_exists($classe)) {
return null;
}
foreach (self::$autoload_chemins as $chemin) {
$chemin = $chemin.$classe.'.php';
if (file_exists($chemin)) {
require_once $chemin;
}
}
}
/**
* Execute le widget.
*/
function executer() {
if (!is_null($this->widget)) {
$classe_widget = ucfirst($this->widget);
$fichier_widget = self::$config['chemins']['widgetCourantDossier'].$classe_widget.'.php';
if (file_exists($fichier_widget)) {
include_once $fichier_widget;
if (class_exists($classe_widget)) {
$widget = new $classe_widget(self::$config, $this->parametres);
$widget->executer();
}
}
}
}
/**
* Charge le fichier de config spécifique du wiget et fusionne la config avec celle partagés par l'ensemble des widgets.
*/
private function chargerWidgetConfig() {
$widget_config_ini_fichier = self::$config['chemins']['widgetCourantDossier'].'config.ini';
if (file_exists($widget_config_ini_fichier)) {
$widget_config = parse_ini_file($widget_config_ini_fichier, TRUE);
self::$config = array_merge(self::$config, $widget_config);
}
}
}
?>
/tags/widget-origin-mobile/.htaccess
New file
0,0 → 1,13
<files *.ini>
order deny,allow
deny from all
</files>
 
#AddHandler x-httpd-php5 .php
AddDefaultCharset UTF-8
 
RewriteEngine On
# Redirections générale vers le fichier principal de Widget.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php/
/tags/widget-origin-mobile/bibliotheque/WidgetCommun.php
New file
0,0 → 1,431
<?php
abstract class WidgetCommun {
protected $config = null;
protected $parametres = null;
protected $messages = array();
protected $debug = array();
public function __construct($config, $parametres) {
$this->config = $config;
$this->parserFichierIni($config['chemins']['widgetCourantDossier'].'config.ini');
$this->parametres = $parametres;
}
/**
* Parse le fichier ini donné en paramètre
* @param string $fichier_ini nom du fichier ini à parser
* @return boolean true si le fichier ini a été trouvé.
*/
private function parserFichierIni($fichier_ini) {
$retour = false;
if (file_exists($fichier_ini)) {
$ini = parse_ini_file($fichier_ini, true);
$this->fusionner($ini);
$retour = true;
}
return $retour;
}
 
/**
* fusionne un tableau de paramètres avec le tableau de config global
* @param array $ini le tableau à fusionner
*/
private function fusionner(array $ini) {
$this->config = array_merge($this->config, $ini);
}
protected function traiterNomMethodeExecuter($nom) {
$methode = 'executer';
$methode .= str_replace(' ', '', ucwords(str_replace('-', ' ', strtolower($nom))));
return $methode;
}
//+----------------------------------------------------------------------------------------------------------------+
// GESTION des CLASSES CHARGÉES à la DEMANDE
protected function getDao() {
if (! isset($this->dao)) {
$this->dao = new Dao();
}
return $this->dao;
}
//+----------------------------------------------------------------------------------------------------------------+
// GESTION DE MÉTHODES COMMUNES ENTRE LES SERVICES
protected function getUrlImage($id, $format = 'L') {
$url_tpl = $this->config['chemins']['celImgUrlTpl'];
$id = sprintf('%09s', $id).$format;
$url = sprintf($url_tpl, $id);
return $url;
}
protected function encoderMotCle($mot_cle) {
return md5(mb_strtolower($mot_cle));
}
private function protegerMotsCles($mots_cles, $type) {
$separateur = ($type == self::TYPE_IMG) ? ',' : ';' ;
$mots_cles_a_proteger = explode($separateur,rtrim(trim($mots_cles), $separateur));
foreach ($mots_cles_a_proteger as $mot) {
$mots_cles_proteges[] = $this->bdd->quote($mot);
}
$mots_cles = implode(',', $mots_cles_proteges);
return $mots_cles;
}
protected function tronquerCourriel($courriel) {
$courriel = preg_replace('/[^@]+$/i', '...', $courriel);
return $courriel;
}
protected function nettoyerTableau($tableau) {
foreach ($tableau as $cle => $valeur) {
if (is_array($valeur)) {
$valeur = $this->nettoyerTableau($valeur);
} else {
$valeur = $this->nettoyerTexte($valeur);
}
$tableau[$cle] = $valeur;
}
return $tableau;
}
protected function nettoyerTexte($txt) {
$txt = preg_replace('/&(?!([a-z]+|#[0-9]+|#x[0-9][a-f]+);)/i', '&amp;', $txt);
$txt = preg_replace('/^(?:000null|null)$/i', '', $txt);
return $txt;
}
protected function etreVide($valeur) {
$vide = false;
if ($valeur == '' || $valeur == 'null'|| $valeur == '000null' || $valeur == '0') {
$vide = true;
}
return $vide;
}
protected function formaterDate($date_heure_mysql, $format = '%A %d %B %Y à %H:%M') {
$date_formatee = '';
if (!$this->etreVide($date_heure_mysql)) {
$timestamp = $this->convertirDateHeureMysqlEnTimestamp($date_heure_mysql);
$date_formatee = strftime($format, $timestamp);
}
return $date_formatee;
}
 
protected function convertirDateHeureMysqlEnTimestamp($date_heure_mysql){
$val = explode(' ', $date_heure_mysql);
$date = explode('-', $val[0]);
$heure = explode(':', $val[1]);
return mktime((int) $heure[0], (int) $heure[1], (int) $heure[2], (int) $date[1], (int) $date[2], (int) $date[0]);
}
//+----------------------------------------------------------------------------------------------------------------+
// GESTION DE L'IDENTIFICATION et des UTILISATEURS
protected function getAuthIdentifiant() {
$id = (isset($_SERVER['PHP_AUTH_USER'])) ? $_SERVER['PHP_AUTH_USER'] : null;
return $id;
}
protected function getAuthMotDePasse() {
$mdp = (isset($_SERVER['PHP_AUTH_PW'])) ? $_SERVER['PHP_AUTH_PW'] : null;
return $mdp;
}
protected function authentifierAdmin() {
$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
$message_echec = "Accès limité aux administrateurs du CEL.\n".
"Votre tentative d'identification a échoué.\n".
"Actualiser la page pour essayer à nouveau si vous êtes bien inscrit comme administrateur.";
return $this->authentifier($message_accueil, $message_echec, 'Admin');
}
protected function authentifierUtilisateur() {
$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
$message_echec = "Accès limité aux utilisateur du CEL.\n".
"Inscrivez vous http://www.tela-botanica.org/page:inscription pour le devenir.\n".
"Votre tentative d'identification a échoué.\n".
"Actualiser la page pour essayer à nouveau si vous êtes déjà inscrit ou contacter 'accueil@tela-botanica.org'.";
return $this->authentifier($message_accueil, $message_echec, 'Utilisateur');
}
private function authentifier($message_accueil, $message_echec, $type) {
$id = $this->getAuthIdentifiant();
if (!isset($id)) {
$this->envoyerAuth($message_accueil, $message_echec);
} else {
if ($type == 'Utilisateur' && $this->getAuthMotDePasse() == 'debug') {
$autorisation = true;
} else {
$methodeAutorisation = "etre{$type}Autorise";
$autorisation = $this->$methodeAutorisation();
}
if ($autorisation == false) {
$this->envoyerAuth($message_accueil, $message_echec);
}
}
return true;
}
protected function etreUtilisateurAutorise() {
$identifiant = $this->getAuthIdentifiant();
$mdp = md5($this->getAuthMotDePasse());
$url = sprintf($this->config['authentification']['serviceUrlTpl'], $identifiant, $mdp);
$json = $this->getDao()->consulter($url);
$existe = json_decode($json);
$autorisation = (isset($existe) && $existe) ? true :false;
return $autorisation;
}
protected function etreAdminAutorise($identifiant) {
$identifiant = $this->getAuthIdentifiant();
$autorisation = ($this->etreUtilisateurAutorise() && $this->etreAdminCel($identifiant)) ? true : false;
return $autorisation;
}
protected function etreAdminCel($courriel) {
$admins = $this->config['authentification']['administrateurs'];
$courriels_autorises = explode(',', $admins);
 
$autorisation = (in_array($courriel, $courriels_autorises)) ? true : false ;
return $autorisation;
}
/**
* Prend en paramêtre un tableau de courriels et retourne après avoir intérogé un service we de l'annuaire
* une tableau avec en clé le courriel et en valeur, un tableau associatif :
* - nom : le nom de l'utilisateur
* - prenom : le prénom de l'utilisateur.
* @param array $courriels un tableau de courriels pour lesquels il faut recherche le prénom et nom.
*/
protected function recupererUtilisateursNomPrenom(Array $courriels) {
// Récupération des données au format Json
$service = "utilisateur/prenom-nom-par-courriel/".implode(',', $courriels);
$url = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
protected function recupererUtilisateursIdentite(Array $courriels) {
// Récupération des données au format Json
$service = "utilisateur/identite-par-courriel/".implode(',', $courriels);
$url = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service);
$json = $this->getDao()->consulter($url);
$utilisateurs = json_decode($json);
foreach ($courriels as $courriel) {
$info = array('id' => null, 'intitule' => '');
if (isset($utilisateurs->$courriel)) {
$info['intitule'] = $utilisateurs->$courriel->intitule;
$info['id'] = $utilisateurs->$courriel->id;
} else {
$info['intitule'] = $this->tronquerCourriel($courriel);
}
$noms[$courriel] = $info;
}
return $noms;
}
//+----------------------------------------------------------------------------------------------------------------+
// GESTION de l'ENVOIE au NAVIGATEUR
 
protected function envoyerJsonp($donnees = null, $encodage = 'utf-8') {
$contenu = $_GET['callback'].'('.json_encode($donnees).');';
$this->envoyer($contenu, 'text/html', $encodage);
}
protected function envoyer($donnees = null, $mime = 'text/html', $encodage = 'utf-8') {
// Traitements des messages d'erreurs et données
if (count($this->messages) != 0) {
header('HTTP/1.1 500 Internal Server Error');
$mime = 'text/html';
$encodage = 'utf-8';
$sortie = '<html>'.
'<head><title>Messages</title></head>'.
'<body><pre>'.implode("\n", $this->messages).'</pre><body>'.
'</html>';
} else {
$sortie = $donnees;
if (is_null($donnees)) {
$sortie = 'OK';
}
}
 
// Gestion de l'envoie du déboguage
$this->envoyerDebogage();
 
// Envoie sur la sortie standard
$this->envoyerContenu($encodage, $mime, $sortie);
}
 
private function envoyerDebogage() {
if (!is_array($this->debug)) {
$this->debug[] = $this->debug;
}
if (count($this->debug) != 0) {
foreach ($this->debug as $cle => $val) {
if (is_array($val)) {
$this->debug[$cle] = print_r($val, true);
}
}
header('X-DebugJrest-Data:'.json_encode($this->debug));
}
}
 
private function envoyerContenu($encodage, $mime, $contenu) {
if (!is_null($mime) && !is_null($encodage)) {
header("Content-Type: $mime; charset=$encodage");
} else if (!is_null($mime) && is_null($encodage)) {
header("Content-Type: $mime");
}
print_r($contenu);
}
private function envoyerAuth($message_accueil, $message_echec) {
header('HTTP/1.0 401 Unauthorized');
header('WWW-Authenticate: Basic realm="'.mb_convert_encoding($message_accueil, 'ISO-8859-1', 'UTF-8').'"');
header('Content-type: text/plain; charset=UTF-8');
print $message_echec;
exit(0);
}
//+----------------------------------------------------------------------------------------------------------------+
// GESTION DES SQUELETTES (PHP, TXT...)
/**
* Méthode prenant en paramètre un tableau associatif, les clés seront recherchées dans le texte pour être
* remplacer par la valeur. Dans le texte, les clés devront être entre accolades : {}
*
* @param String $txt le texte où chercher les motifs.
* @param Array $donnees un tableau associatif contenant les motifs à remplacer.
*
* @return String le texte avec les motifs remplacer par les valeurs du tableau.
*/
protected static function traiterSqueletteTxt($txt, Array $donnees = array()) {
$motifs = array();
$valeurs = array();
foreach ($donnees as $cle => $valeur) {
if (strpos($cle, '{') === false && strpos($cle, '}') === false) {
$motifs = '{'.$cle.'}';
$valeurs = $valeur;
}
}
$txt = str_replace($motifs, $valeurs, $txt);
return $txt;
}
 
/**
* Méthode prenant en paramètre un chemin de fichier squelette et un tableau associatif de données,
* en extrait les variables, charge le squelette et retourne le résultat des deux combinés.
*
* @param String $fichier le chemin du fichier du squelette
* @param Array $donnees un tableau associatif contenant les variables a injecter dans le squelette.
*
* @return boolean false si le squelette n'existe pas, sinon la chaine résultat.
*/
protected static function traiterSquelettePhp($fichier, Array $donnees = array()) {
$sortie = false;
if (file_exists($fichier)) {
// Extraction des variables du tableau de données
extract($donnees);
// Démarage de la bufferisation de sortie
ob_start();
// Si les tags courts sont activés
if ((bool) @ini_get('short_open_tag') === true) {
// Simple inclusion du squelette
include $fichier;
} else {
// Sinon, remplacement des tags courts par la syntaxe classique avec echo
$html_et_code_php = self::traiterTagsCourts($fichier);
// Pour évaluer du php mélangé dans du html il est nécessaire de fermer la balise php ouverte par eval
$html_et_code_php = '?>'.$html_et_code_php;
// Interprétation du html et du php dans le buffer
echo eval($html_et_code_php);
}
// Récupèration du contenu du buffer
$sortie = ob_get_contents();
// Suppression du buffer
@ob_end_clean();
} else {
$msg = "Le fichier du squelette '$fichier' n'existe pas.";
trigger_error($msg, E_USER_WARNING);
}
// Retourne le contenu
return $sortie;
}
 
/**
* Fonction chargeant le contenu du squelette et remplaçant les tags court php (<?= ...) par un tag long avec echo.
*
* @param String $chemin_squelette le chemin du fichier du squelette
*
* @return string le contenu du fichier du squelette php avec les tags courts remplacés.
*/
private static function traiterTagsCourts($chemin_squelette) {
$contenu = file_get_contents($chemin_squelette);
// Remplacement de tags courts par un tag long avec echo
$contenu = str_replace('<?=', '<?php echo ', $contenu);
// Ajout systématique d'un point virgule avant la fermeture php
$contenu = preg_replace("/;*\s*\?>/", "; ?>", $contenu);
return $contenu;
}
//+----------------------------------------------------------------------------------------------------------------+
// UTILITAIRES
/**
* Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés.
*
* @param Array $array le tableau à trier
* @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC
* @author cagret at gmail dot com
* @see http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38
*/
public static function trierTableauMd($array, $cols) {
$colarr = array();
foreach ($cols as $col => $order) {
$colarr[$col] = array();
foreach ($array as $k => $row) {
$colarr[$col]['_'.$k] = strtolower(self::supprimerAccents($row[$col]));
}
}
$params = array();
foreach ($cols as $col => $order) {
$params[] =& $colarr[$col];
$params = array_merge($params, (array)$order);
}
call_user_func_array('array_multisort', $params);
$ret = array();
$keys = array();
$first = true;
foreach ($colarr as $col => $arr) {
foreach ($arr as $k => $v) {
if ($first) {
$keys[$k] = substr($k,1);
}
$k = $keys[$k];
if (!isset($ret[$k])) {
$ret[$k] = $array[$k];
}
$ret[$k][$col] = $array[$k][$col];
}
$first = false;
}
return $ret;
}
private static function supprimerAccents($str, $charset='utf-8')
{
$str = htmlentities($str, ENT_NOQUOTES, $charset);
$str = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); // pour les ligatures e.g. '&oelig;'
$str = preg_replace('#&[^;]+;#', '', $str); // supprime les autres caractères
return $str;
}
}
?>
/tags/widget-origin-mobile/bibliotheque/Dao.php
New file
0,0 → 1,155
<?php
// declare(encoding='UTF-8');
/**
* Classe modèle spécifique à l'application, donc d'accés au données, elle ne devrait pas être appelée de l'extérieur.
*
* @category php5
* @package Widget
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version SVN: $Id$
*/
class Dao {
const HTTP_URL_REQUETE_SEPARATEUR = '&';
const HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR = '=';
private $http_methodes = array('GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE');
protected $parametres = null;
private $url = null;
private $reponse_entetes = null;
//+----------------------------------------------------------------------------------------------------------------+
// ACCESSEURS
public function getReponseEntetes($cle) {
return $this->reponse_entetes;
}
public function getParametre($cle) {
$valeur = (isset($this->parametres[$cle])) ? $this->parametres[$cle] : null;
return $valeur;
}
public function ajouterParametre($cle, $valeur) {
$this->parametres[$cle] = $valeur;
}
public function supprimerParametre($cle) {
unset($this->parametres[$cle]);
}
public function nettoyerParametres() {
$this->parametres = null;
}
//+----------------------------------------------------------------------------------------------------------------+
// MÉTHODES
public function consulter($url) {
$retour = $this->envoyerRequete($url, 'GET');
return $retour;
}
public function ajouter($url, Array $donnees) {
$retour = $this->envoyerRequete($url, 'PUT', $donnees);
return $retour;
}
public function modifier($url, Array $donnees) {
$retour = $this->envoyerRequete($url, 'POST', $donnees);
return $retour;
}
public function supprimer($url) {
$retour = $this->envoyerRequete($url, 'DELETE');
return $retour;
}
public function envoyerRequete($url, $mode, Array $donnees = array()) {
$this->url = $url;
$contenu = false;
if (! in_array($mode, $this->http_methodes)) {
$e = "Le mode de requête '$mode' n'est pas accepté!";
trigger_error($e, E_USER_WARNING);
} else {
if ($mode == 'GET') {
$this->traiterUrlParametres();
}
$contexte = stream_context_create(array(
'http' => array(
'method' => $mode,
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($donnees, null, self::HTTP_URL_REQUETE_SEPARATEUR))));
$flux = @fopen($this->url, 'r', false, $contexte);
if (!$flux) {
$this->reponse_entetes = $http_response_header;
$e = "L'ouverture de l'url '{$this->url}' par la méthode HTTP '$mode' a échoué!";
trigger_error($e, E_USER_WARNING);
} else {
// Informations sur les en-têtes et métadonnées du flux
$this->reponse_entetes = stream_get_meta_data($flux);
// Contenu actuel de $url
$contenu = stream_get_contents($flux);
fclose($flux);
}
$this->traiterEntete();
}
$this->reinitialiser();
return $contenu;
}
private function traiterUrlParametres() {
$parametres = array();
if (count($this->parametres) > 0) {
foreach ($this->parametres as $cle => $valeur) {
$cle = rawurlencode($cle);
$valeur = rawurlencode($valeur);
$parametres[] = $cle.self::HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR.$valeur;
}
$url_parametres = implode(self::HTTP_URL_REQUETE_SEPARATEUR, $parametres);
$this->url = $this->url.'?'.$url_parametres;
}
}
private function traiterEntete() {
$infos = $this->analyserEntete();
$this->traiterEnteteDebogage($infos);
}
private function analyserEntete() {
$entetes = $this->reponse_entetes;
$infos = array('date' => null, 'uri' => $this->url, 'debogages' => null);
if (isset($entetes['wrapper_data'])) {
$entetes = $entetes['wrapper_data'];
}
foreach ($entetes as $entete) {
if (preg_match('/^X_REST_DEBOGAGE_MESSAGES: (.+)$/', $entete, $match)) {
$infos['debogages'] = json_decode($match[1]);
}
if (preg_match('/^Date: .+ ([012][0-9]:[012345][0-9]:[012345][0-9]) .*$/', $entete, $match)) {
$infos['date'] = $match[1];
}
}
return $infos;
}
private function traiterEnteteDebogage($entetes_analyses) {
if (isset($entetes['debogages'])) {
$date = $entetes['date'];
$uri = $entetes['uri'];
$debogages = $entetes['debogages'];
foreach ($debogages as $debogage) {
$e = "DEBOGAGE : $date - $uri :\n$debogage";
trigger_error($e, E_USER_NOTICE);
}
}
}
private function reinitialiser() {
$this->nettoyerParametres();
}
}
/tags/widget-origin-mobile/index.php
New file
0,0 → 1,5
<?php
require 'Widget.php';
$widget = new Widget();
$widget->executer();
?>
/tags/widget-origin-mobile/widget.ini.defaut.php
New file
0,0 → 1,47
;<?/*
[parametres]
;Memoire maxi pour les services : 128Mo = 134217728 ; 256Mo = 268435456 ; 512Mo = 536870912 ; 1Go = 1073741824
limiteMemoire = "512M"
; Niveau d'erreur PHP
erreurNiveau = 30719 ; E_ALL = 30719
; Séparateur d'url en entrée
argSeparatorInput = "&"
; Indication de la locale (setLocale(LC_ALL, ?)) pour les classes appelées par Widget.php
locale = "fr_FR.UTF-8"
; Indication du fuseau horraire par défaut date_default_timezone_set(?)pour les classes appelées par Widget.php
fuseauHoraire = "Europe/Paris"
 
[chemins]
; Chemins à utiliser dans la méthode autoload des widgets
autoload = "bibliotheque/"
; Dossier contenant les widgets
widgetsDossier = "modules/"
; Dossier contenant le widget demandé construit dynamiquement dans le fichier Widget.php
widgetCourantDossier = ""
; Dossier contenant les fichiers des bibliothèques tierces
bibliothequeDossier = "bibliotheque/"
; Base de l'url servant à appeler les widgets
baseURL = "/widget:cel:"
; URL de base absolue des Widgets du CEL construit dynamiquement dans le fichier WidgetCommun.php
baseURLAbsoluDyn = ""
; URL des services web du CEL sous forme de template à utiliser avec sprintf
baseURLServicesCelTpl = "http://www.tela-botanica.org/service:cel:%s"
; 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)
celImgUrlTpl = "http://www.tela-botanica.org/appli:cel-img:%s.jpg"
; Squelette d'URL pour les services web d'eFlore.
baseURLServicesEfloreTpl = "http://www.tela-botanica.org/service:eflore:%s/%s/%s"
; Dossier de stockage temporaire des images (ATTENTION : mettre le slash à la fin)
imagesTempDossier = "/home/telabotap/www/eflore/cel/cache/images/"
; Squelette d'URL pour les images temporaires sotckées sur le serveur
imagesTempUrlTpl = "http://www.tela-botanica.org/eflore/cel/cache/images/%s"
; 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';
 
[authentification]
serviceUrlTpl = "http://www.tela-botanica.org/service:annuaire:TestLoginMdp/%s/%s"
administrateurs = aurelien@tela-botanica.org,david.delon@clapas.net,jpm@tela-botanica.org,marie@tela-botanica.org
;*/?>
/tags/widget-origin-mobile/generateur.html
New file
0,0 → 1,221
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Générateur de widgets</title>
<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">
//<![CDATA[
var url_base_widget = 'http://localhost/widget:cel:';
var timer = null;
var criteresPourWidget = new Object();
criteresPourWidget['carto'] = new Array('utilisateur', 'dept', 'commune', 'projet', 'taxon');
criteresPourWidget['cartoPoint'] = new Array('utilisateur', 'dept', 'commune', 'projet', 'taxon', 'titre', 'logo', 'url_site','image', 'photos');
criteresPourWidget['observation'] = new Array('utilisateur', 'dept', 'commune', 'projet', 'taxon');
criteresPourWidget['photo'] = new Array('utilisateur', 'dept', 'commune', 'projet', 'taxon', 'titre');
$(document).ready(function() {
$('#mise_a_jour_auto').change(function() {
if($('#mise_a_jour_auto').val() == 'on') {
activerTimerMaj();
} else {
desactiverTimerMaj();
}
});
$('#mise_a_jour').click(function(event) {
mettreAjourApercu();
});
$("#formulaire_widget_carto_point input").keypress(function (event) {
if (event.which == 13) {
mettreAjourApercu();
}
});
$('input[name=type_widget]').change(function(event){
afficherCriteresPourWidget();
mettreAjourApercu();
});
$('#options').hide();
$('#options_secondaires').hide();
});
function htmlEncode(value){
if (value) {
return jQuery('<div />').text(value).html();
} else {
return '';
}
}
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
 
function genererIFrame(url, hauteur, largeur) {
return '<iframe src="'+url+'" width="'+largeur+'" height="'+hauteur+'">';
}
function afficherCriteresPourWidget() {
var type_widget = $('input[name=type_widget]:checked').val();
$('#options .critere').each(function() {
var nom = $(this).find('.modificateur').attr("name");
if(critereExistePourWidget(type_widget, nom)) {
$(this).fadeIn();
} else {
$(this).fadeOut();
}
});
$('#options').show();
$('#options_secondaires').show();
}
function critereExistePourWidget(type_widget, nom) {
var champsAffiches = criteresPourWidget[type_widget];
return (champsAffiches.indexOf(nom) != -1);
}
function activerTimerMaj() {
$('.modificateur').change(function(event) {
if(timer != null) {
clearTimeout(timer);
}
timer = setTimeout(function(){mettreAjourApercu();},500);
});
}
function desactiverTimerMaj() {
if(timer != null) {
clearTimeout(timer);
}
$('.modificateur').unbind('change');
}
function mettreAjourApercu() {
var valeurs_form = new Object();
var type_widget = $('input[name=type_widget]:checked').val();
$('#options .critere').each(function() {
var nom = $(this).find('.modificateur').attr("name");
var valeur = $(this).find('.modificateur').val();
if(critereExistePourWidget(type_widget, nom) && valeur != "") {
valeurs_form[nom] = valeur;
};
});
 
var url_widget = url_base_widget+type_widget;
if(Object.keys(valeurs_form).length > 0) {
params_iframe = $.param(valeurs_form);
url_widget += "?"+params_iframe;
}
var hauteur = $('#hauteur').val();
var largeur = $('#largeur').val();
var lien_widget = '<a href="'+url_widget+'">'+url_widget+'</a>';
$('#code_widget').html("Vous pouvez voir ce widget en plein écran en cliquant sur ce lien "+lien_widget);
$('#code_widget').show();
var code_widget_apercu = genererIFrame(url_widget, hauteur, largeur);
$('#apercu').html(code_widget_apercu);
$('#apercu').show();
var code_widget_inclure = genererIFrame(url_widget, hauteur, largeur);
$('#code_widget').html("Copiez-collez ce code pour inclure le widget sur votre site "+"<pre>"+htmlEncode(code_widget_inclure)+"</pre>");
$('#code_widget').show();
}
//]]>
</script>
<style>
#formulaire_widget_carto_point {
padding:10px;
border:1px solid grey;
width: 30%;
float:left;
}
.critere {
padding:5px;
}
.modificateur.droite {
float: right;
width: 420px;
}
#url_widget {
border: 1px solid grey;
background-color : #F5F5F5;
padding: 10px;
display: none;
}
#apercu {
border: 1px solid grey;
background-color : #F5F5F5;
padding: 10px;
display: none;
float: right;
width: 60%;
}
#contenu_widget_apercu {
width: 100%;
}
.nettoyage {
visibility: hidden;
clear: both;
}
</style>
</head>
<body>
<div id="formulaire_widget_carto_point">
<div class="critere"><label for="utilisateur">Type de widget : </label><br />
<input autocomplete="off" class="modificateur" type="radio" name="type_widget" value="carto">Carto à la commune<br />
<input autocomplete="off" class="modificateur" type="radio" name="type_widget" value="cartoPoint">Carto au point précis <br />
<input autocomplete="off" class="modificateur" type="radio" name="type_widget" value="observation">Observations <br />
<input autocomplete="off" class="modificateur" type="radio" name="type_widget" value="photo">Photos <br />
</div>
<div id="options">
<div class="critere"><label for="utilisateur">Utilisateur : </label><input class="modificateur droite" type="text" name="utilisateur" id="utilisateur" /></div>
<div class="critere"><label for="dept">Département : </label><input type="text" class="modificateur droite" name="dept" id="dept" /></div>
<div class="critere"><label for="commune">Commune : </label><input type="text" class="modificateur droite" name="commune" id="commune" /></div>
<div class="critere"><label for="projet">Projet : </label><input type="text" class="modificateur droite" name="projet" id="projet" /></div>
<div class="critere"><label for="taxon">Taxon : </label><input type="text" class="modificateur droite" name="taxon" id="taxon" /></div>
<div class="critere"><label for="titre">Titre : </label><input type="text" class="modificateur droite" name="titre" id="titre" /></div>
<div class="critere"><label for="logo">Url du logo : </label><input type="text" class="modificateur droite" name="logo" id="logo" /></div>
<div class="critere"><label for="image">Url de l'image : </label><input type="text" class="modificateur droite" name="image" id="image" /></div>
<div class="critere"><label for="url_site">Url du site : </label><input type="text" class="modificateur droite" name="url_site" id="url_site" /></div>
<div class="critere"><label for="photos">Présence de photos : </label>
<select class="modificateur" name="photos" id="photos">
<option selected="selected" value="">Toutes les observations</option>
<option value="1">Uniquement avec photos</option>
</select>
</div>
</div>
<div id="options_secondaires">
<div class="critere"><label for="largeur">Largeur : </label>
<input type="text" class="modificateur" size="10" name="largeur" id="largeur" value="700"/>
<label for="hauteur">Hauteur : </label>
<input type="text" class="modificateur" size="10" name="hauteur" id="hauteur" value="700"/>
</div>
<div>
<label for="mise_a_jour_auto">Maj auto de la carte à chaque changement : </label>
<input type="checkbox" id="mise_a_jour_auto" name="mise_a_jour_auto" />
</div>
</div>
<button id="mise_a_jour" name="mise_a_jour">Rafraichir</button>
</div>
<div id="apercu">Aperçu en temps réel
<div id="contenu_widget_apercu"></div>
</div>
<hr class="nettoyage" />
<div id="code_widget"></div>
</body>
</html>
/tags/widget-origin-mobile
New file
Property changes:
Added: svn:ignore
+.settings
+.buildpath
+.project
+widget.ini.php
+documents