Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 582 → Rev 583

/trunk/widget/modules/photo/config.defaut.ini
1,8 → 1,12
[photo]
; Chemin du flux RSS contenant les liens vers les photos
; 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/complet/atom"
; Nombre de vignette à afficher (doit être un multiple de 4 pour un affichage correcte)
vignetteNbre = 12
; Squelette d'url pour accéder à la fiche eFlore
efloreUrlTpl = "http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/%s/illustration"
; 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
 
/trunk/widget/modules/photo/squelettes/photo.tpl.html
28,6 → 28,14
<!-- Feuilles de styles -->
<link rel="stylesheet" type="text/css" href="http://www.tela-botanica.org/commun/jquery/fancybox/1.3.2/jquery.fancybox-1.3.2.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?=$url_css?>photo.css" media="screen" />
<style type="text/css">
#contenu, #galerie-photo{
width:<?=($colonne * 69)?>px;
}
#galerie-photo #photo-extra img{
width:<?=(($colonne * 63) + 18)?>px;
}
</style>
</head>
<body>
<!-- WIDGET:CEL:PHOTO - DEBUT -->
53,61 → 61,73
<a href="http://www.tela-botanica.org/appli:cel" title="Carnet en Ligne" onclick="window.open(this.href);return false;">
CEL
</a>
</h1>
<p>
<a href="http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationImage/complet/atom"
<a href="<?=$flux_rss_url?>"
id="flux-suivre"
title="Suivre les images"
onclick="window.open(this.href);return false;">
Suivre les images
</a>
</p>
</h1>
<div id="galerie-photo">
<?php foreach ($items as $item) : ?>
<div class="photo">
<a href="<?=$item['lien']?>" class="cel-img" title="<?=sprintf($item['url_tpl'], 'L')?>" rel="galerie-princ">
<img src="<?=sprintf($item['url_tpl'], 'M')?>" alt="<?=$item['titre']?>"/>
<a href="<?=$item['lien']?>" class="cel-img" title="<?=$item['titre']?> - Publiée le <?=$item['date']?> - GUID : <?=$item['guid']?>" rel="galerie-princ">
<img src="<?=sprintf($item['url_tpl'], 'S')?>" alt="<?=$item['titre']?>"/>
</a>
<div style="display: none;">
<div id="cel-obs-<?=$item['guid']?>" class="infos">
<a href="<?=$item['lien']?>">
<span class="img-titre"><?=$item['titre']?></span><br />
<span class="img-date">Publiée le <?=$item['date']?></span><br />
Cliquez pour voir le détail
</a>
</div>
</div>
<div id="cel-info-<?=$item['guid']?>" class="infos">
<strong>
<a class="img-titre" href="<?=$item['eflore_url']?>"
onclick="window.open(this.href);return false;"
title="Cliquez pour accéder à la fiche eFlore">
<?=$item['titre']?>
</a>
</strong><br />
<span class="img-date">Publiée le <?=$item['date']?></span>
</div>
</div>
<?php endforeach; ?>
<?php if ($extra_actif) : ?>
<div id="photo-extra" class="photo">
<a href="<?=$extra['lien']?>" class="cel-img" title="<?=sprintf($extra['url_tpl'], 'L')?>" rel="galerie-princ">
<a href="<?=$extra['lien']?>" class="cel-img" title="<?=$extra['titre']?> - Publiée le <?=$extra['date']?> - GUID : <?=$extra['guid']?>" rel="galerie-princ">
<img src="<?=sprintf($extra['url_tpl'], 'M')?>" alt="<?=$extra['titre']?>"/>
</a>
<div style="display: none;">
<div id="cel-obs-extra" class="infos">
<a href="<?=$extra['lien']?>">
<span class="img-titre"><?=$extra['titre']?></span><br />
<span class="img-date">Publiée le <?=$extra['date']?></span><br />
Cliquez pour voir le détail
</a>
</div>
</div>
</div>
</div>
<?php endif ?>
<p id="date-generation" class="discretion">Au <?=strftime('%A %d %B %Y à %H:%M:%S')?></p>
<p id="date-generation" class="discretion nettoyage">Au <?=strftime('%A %d %B %Y à %H:%M:%S')?></p>
<script type="text/Javascript">
//<![CDATA[
$(document).ready(function() {
$("a.cel-img").fancybox({
transitionIn : 'elastic',
transitionOut : 'elastic',
speedIn : 600,
speedOut : 200,
overlayShow : true
//<![CDATA[
var $doc = window.document;
function formaterTitre(titre, currentArray, currentIndex, currentOpts) {
var motif = /GUID : ([0-9]+)$/;
motif.exec(titre);
var guid = 'cel-info-'+RegExp.$1;
var info = $('#'+guid, $doc).html();
var tpl =
'<div id="legende">'+
'<p id="legende-vei">'+'Image n°' + (currentIndex + 1) + ' sur ' + currentArray.length +'<\/p>'+
(titre && titre.length ? '<p>'+info+'<\/p>' : '' )+
'<\/div>';
return tpl;
}
(function($, originalInit) {
parent.jQuery.fn.init = function(selector, context) {
//alert('hello: ' + originalInit);
return new originalInit(selector, context || $doc);
};
$(window).load(function() {
$('a.cel-img', $doc).attr('rel', 'galerie-princ').fancybox({
transitionIn : 'elastic',
transitionOut : 'elastic',
speedIn : 600,
speedOut : 200,
overlayShow : true,
titlePosition : 'inside',
titleFormat : formaterTitre
});
});
});
}(parent.jQuery, parent.jQuery.fn.init));
//]]>
</script>
<?php endif; ?>
/trunk/widget/modules/photo/squelettes/css/photo.css
41,17 → 41,22
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Général */
.discretion {
color:#3a3633;
color:grey;
font-family:arial;
font-size:11px;
font-weight:bold;
}
.nettoyage {
clear:both;
}
hr.nettoyage {
visibility:hidden;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Widget */
#contenu{
position:relative;
margin:5px auto;
width:270px;
}
#date-generation{
text-align:right;
62,9 → 67,6
width:16px;
height:20px;
overflow:hidden;
position:absolute;
left:257px;
top:4px;
}
#flux-suivre:hover {
color:rgba(0,0,0,0);
71,9 → 73,6
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Galerie Photos CEL */
#galerie-photo{
width:276px;
}
#galerie-photo .photo a{
float:left;
padding:2px;
84,14 → 83,31
}
#galerie-photo .photo a img{
float:left;
width:63px;
height:63px;
}
#galerie-photo #photo-extra img{
width:270px;
height:auto;
}
/*+-----------------------------------------------------------------------------------------------------------------+*/
/* Fancybox */
#lightbox-nav-btnPrev, #lightbox-nav-btnNext {
border:none;
.infos {
display:none;
}
#legende{
text-align:left;
}
#legende-vei{
float:right;
}
#legende p{
color:black;
font-size:12px;
margin:5px 0;
}
#legende a {
color:#333;
border-bottom:1px dotted gainsboro;
}
#legende a:hover {
color:#56B80E;
border-bottom:1px dotted #56B80E;
}
/trunk/widget/modules/photo/Photo.php
9,6 → 9,10
* @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>
20,6 → 24,8
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.
32,12 → 38,14
$mode = self::SERVICE_DEFAUT;
}
$flux_rss_url = $this->config['photo']['fluxRssUrl'];
$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-'.md5("$mode-$flux_rss_url");
$id_cache = 'photo-'.md5("$mode-{$this->flux_rss_url}");
if (! $contenu = $cache->charger($id_cache)) {
$methode = $this->traiterNomMethodeExecuter($mode);
if (method_exists($this, $methode)) {
59,44 → 67,58
private function executerPhoto() {
$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';
list($colonne, $ligne) = explode(',', $vignette);
$xml = file_get_contents($this->config['photo']['fluxRssUrl']);
$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/photo/squelettes/css/');
$widget['donnees']['colonne'] = $colonne;
$widget['donnees']['extra_actif'] = $extra;
$max_photo = $colonne * $ligne;
$num = 0;
foreach ($flux as $entree) {
if ($num == $max_photo) {
break;
}
$item = array();
// Formatage date
$item['date'] = strftime('%A %d %B %Y', $entree->pubDate);
$item['lien'] = $entree->link;
$item['url_tpl'] = preg_replace('/[SML]\.jpg$/', '%s.jpg', $entree->guid);
// 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('/appli:cel-img:([0-9]+)[SML]\.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;
}
$widget['squelette'] = 'photo';
} catch (XmlFeedParserException $e) {
trigger_error('Feed invalid: '.$e->getMessage(), E_USER_WARNING);
trigger_error('Flux invalide : '.$e->getMessage(), E_USER_WARNING);
}
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/photo/squelettes/css/');
$widget['donnees']['extra_actif'] = ($this->config['photo']['extraActif']) ? true : false;
$max_photo = $this->config['photo']['vignetteNbre'];
$num = 0;
foreach ($flux as $entree) {
if ($num == $max_photo) {
break;
}
 
$item = array();
// Formatage date
$item['date'] = strftime('%A %d %B %Y', $entree->pubDate);
$item['lien'] = $entree->link;
$item['url_tpl'] = preg_replace('/[SML]\.jpg$/', '%s.jpg', $entree->guid);
// Formatage titre
$item['titre'] = preg_replace('/^\d+-\d+&nbsp;:/', '', $entree->title);
// Récupération du GUID
if (preg_match('/appli:cel-img:([0-9]+)[SML]\.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;
}
$widget['squelette'] = 'photo';
}
return $widget;
}
/trunk/widget/modules/photo/config.ini
1,10 → 1,12
[photo]
; Chemin pour l'autoload à ajouter
autoload = "bibliotheque/;bibliotheque/xml_feed_parser/1.0.4/;bibliotheque/xml_feed_parser/1.0.4/parsers/"
; Chemin du flux RSS contenant les liens vers les photos
fluxRssUrl = "http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationImage/complet/rss2"
; Nombre de vignette à afficher (doit être un multiple de 4 pour un affichage correcte)
vignetteNbre = 12
; URL ou chemin du flux RSS contenant les liens vers les photos
fluxRssUrl = "http://www.tela-botanica.org/service:cel:CelSyndicationImage/complet/atom"
; Squelette d'url pour accéder à la fiche eFlore
efloreUrlTpl = "http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/%s/illustration"
; 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