Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3121 → Rev 3122

/trunk/widget/modules/manager/config.defaut.ini
New file
0,0 → 1,6
[manager]
; Chemin pour l'autoload à ajouter
autoload = "bibliotheque/;bibliotheque/xml_feed_parser/1.0.4/;bibliotheque/xml_feed_parser/1.0.4/parsers/"
; Squelette d'url pour accéder à la fiche eFlore
celUrlTpl = "http://localhost/service:cel:CelWidgetManager/Widget"
languesUrl = "http://localhost/service:eflore:0.1/iso-639-1/langues"
/trunk/widget/modules/manager/squelettes/creation.tpl.html
New file
0,0 → 1,168
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?= $mode; ?> de widget de saisie 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="Tela Botanica" />
<meta name="keywords" content="Tela Botanica, CEL" />
<meta name="description" content="Gestion des widgets de saisie du carnet en ligne" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
 
<!-- OpenGraph pour Facebook, Pinterest, Google+ -->
<meta property="og:type" content="website" />
<meta property="og:title" content="Gestion des widgets de saisie du CeL" />
<meta property="og:site_name" content="Tela Botanica" />
<meta property="og:description" content="Gestion des widgets de saisie du Carnet en Ligne" />
<meta property="og:image" content="http://resources.tela-botanica.org/tb/img/256x256/carre_englobant.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="256" />
<meta property="og:image:height" content="256" />
<meta property="og:locale" content="fr_FR" />
 
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="http://resources.tela-botanica.org/tb/img/16x16/favicon.ico" />
<!-- 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="http://resources.tela-botanica.org/bootstrap/3.1.0/js/bootstrap.min.js"></script>
 
<!-- Barre de navigation -->
<?php if ($bar !== false): ?>
<script src="<?=$url_script_navigation?>"></script>
<?php endif; ?>
<!-- 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 rel="stylesheet" type="text/css" href="http://resources.tela-botanica.org/bootstrap/3.1.0/css/bootstrap.min.css" />
-->
<link id="telabotanica-style-css" rel="stylesheet" href="https://beta.tela-botanica.org/preprod/wp-content/themes/telabotanica/dist/bundle.css?ver=4.7.5" type="text/css" media="all">
<link href="<?= $url_base; ?>modules/manager/squelettes/css/manager.css" rel="stylesheet" type="text/css" media="screen" />
<!-- Google Analytics -->
<?php if($prod): ?>
<?php include "analytics.html"; ?>
<?php endif; ?>
</head>
 
<body>
<div id="zone-appli" class="container">
<?php if ($bar !== false): ?>
<div id="tb-navigation" data-courant="widget-cel-export" data-squelette="bootstrap3" data-mode="prod">
</div>
<br/>
<?php endif; ?>
<h1 id="widget-titre" class="widget-titre"><?= $mode; ?> de widget de saisie du CEL</h1>
<div id="register-page" class="layout-wrapper page">
<div class="droite">
<?php if ($mode === 'modification') { ?>
Attention vous modifiez un widget déjà existant, le tag et la langue ne peuvent pas être changer.
S'il s'agit d'un projet type, en modifiant ce widget vous modifiez tous les widgets de ce type.
<?php } else { ?>
Vous créez un widget, si vous choississez de le mettre dans un type, certains champs deviendront
obligatoires et la localisation (point ou rue) sera automatiquement déterminée.
<? } ?>
</div>
<form action="http://localhost/cel/widget/manager?mode=<?= $mode; ?>" name="" id="" class="standard-form component component-text" method="post" enctype="multipart/form-data">
<div class="register-section" id="basic-details-section">
<h2>Meta-données</h2>
<label for="projet">Projet</label>
<input type="text" name="projet" id="projet" pattern="[a-z]*" <?= ($mode === 'modification') ? 'value="'.$widget['projet'].'" readonly' : 'required'; ?> title="Champ obligatoire : pas d'espace" />
<label for="motscles">Autres mots-clés</label>
<input type="text" name="motscles" id="motscles" value="" />
<label for="type">Type de widget</label>
<select id="type" name="type" >
<?php foreach ($type as $id => $projet) { ?>
<option <?= (isset($widget['projet']) && $projet['projet']== $widget['projet']) ? 'selected="selected"' : ''; ?> value="<?= $projet['projet']; ?>"><?= $projet['projet']; ?></option>
<?php } ?>
<option value=""> ----</option>
</select>
<label for="est_type">Ce widget est un widget type</label>
<input type="radio" name="est_type" id="est_type" <?= (isset($widget['est_type']) && $projet['est_type']=== '1') ? 'checked="checked"' : ''; ?>/>
<label for="langue">Langue</label>
<?php if ($mode === 'modification') { ?>
<input id="langue" name="langue" readonly value="<?= $widget['langue']; ?>" />
<?php } else { ?>
<input id="langue" name="langue" list="langues" >
<datalist id="langues" >
<?php foreach ($langues as $code => $langue) { ?>
<option value="<?= $code; ?>"><?= $langue['nom']; ?></option>
<?php } ?>
</datalist>
<?php } ?>
</div><!-- #basic-details-section -->
<div class="register-section" id="profile-details-section">
<h2>Description</h2>
<label for="titre">Titre</label>
<input type="text" name="titre" id="titre" value="<?= isset($widget['titre']) ? $widget['titre'] : ''; ?>" />
<label for="description">Description</label>
<textarea name="description" id="description"><?= isset($widget['description']) ? $widget['description'] : ''; ?></textarea>
<label for="logo">Logo</label><?= isset($widget['logo']) ? '<img src="'.$widget['logo'].'" /><br />Pour changer, télécharger un nouveau fichier.': ''; ?>
<input type="file" name="logo" id="logo" accept="image" />
<label for="fond">Image de fond</label>
<input type="file" name="fond" id="fond" value="<?= $widget['titre']; ?>" />
</div><!-- #profile-details-section -->
<div class="register-section" id="profile-details-section">
<h2>Champs</h2>
<label for="type_localisation">Type de localisation</label>
<select id="type_localisation" name="type_localisation" >
<option value="<?= (isset($widget['type_localisation'])) ? $widget['type_localisation'] : 'point'; ?>"><?= (isset($widget['type_localisation'])) ? $widget['type_localisation'] : 'point'; ?></option>
<option value="<?= (isset($widget['type_localisation']) && $widget['type_localisation'] == 'rue') ? 'point' : 'rue'; ?>"><?= (isset($widget['type_localisation']) && $widget['type_localisation'] == 'rue') ? 'point' : 'rue'; ?></option>
</select>
<label for="localisation">Zoom</label>
<input type="text" name="localisation" id="localisation" value="<?= isset($widget['localisation']) ? $widget['localisation'] : ''; ?>" />
<label for="milieux">Milieux</label>
<input type="text" name="milieux" id="milieux" value="<?= isset($widget['milieux']) ? $widget['milieux'] : ''; ?>" />
<label for="type_especes">Type liste espèce</label>
<select id="type_especes" name="type_especes" required>
<option selected="selected" value="referentiel">Référentiel</option>
<option value="liste">Liste</option>
<option value="liste" title="remplir référentiel + envoyer csv">Liste + autres</option>
<option value="fixe">Espèce fixée</option>
</select>
<label for="referentiel"></label>
<input type="text" name="referentiel" id="referentiel" required pattern="([a-z]+?)*"
title="Nom du référentiel ex. bdtfx"
value="<?= isset($widget['referentiel']) ? $widget['referentiel'] : ''; ?>"/>
<label for="especes"></label>
<input type="file" name="especes" id="especes" />
fichier type
</div><!-- #profile-details-section -->
<div class="submit complete-registration">
<button href="#" type="submit" name="signup_submit" id="signup_submit" class="button" target="" title=""><span class="button-text">Terminer </span></button>
</div>
</form>
</div>
</div>
</body>
</html>
/trunk/widget/modules/manager/squelettes/css/manager.css
New file
0,0 → 1,61
@CHARSET "UTF-8";
 
form {
font-family: Muli,sans-serif;
float: none;
width: 48%;
}
h2 {
font-family: Muli,sans-serif;
font-size: 21.5px;
font-weight: 700;
line-height: 1.15;
}
 
label {
color: #606060;
display: block;
font-size: 1.5rem;
margin-bottom: 0.4rem;
margin-top: 2rem;
font-weight: 700;
}
 
h1#widget-titre::before {
content: "";
display: block;
height: 100%;
left: -5rem;
position: absolute;
width: 0.4rem;
}
 
h1#widget-titre {
font-size: 2.6rem;
font-weight: 700;
line-height: 3.2rem;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
position: relative;
color: #232323;
font-family: Ubuntu,sans-serif;
}
 
.droite {
background-color: #f8f5ef;
color: #232323;
float: right;
padding-bottom: 1rem;
padding-left: 1rem;
padding-right: 1rem;
padding-top: 1rem;
width: 48%;
}
 
.clear {
clear: both;
height: 0; overflow: hidden; /* Précaution pour IE 7 */
}
/trunk/widget/modules/manager/squelettes/manager.tpl.html
New file
0,0 → 1,121
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Gestion des widgets de saisie 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="Tela Botanica" />
<meta name="keywords" content="Tela Botanica, CEL" />
<meta name="description" content="Gestion des widgets de saisie du carnet en ligne" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
 
<!-- OpenGraph pour Facebook, Pinterest, Google+ -->
<meta property="og:type" content="website" />
<meta property="og:title" content="Gestion des widgets de saisie du CeL" />
<meta property="og:site_name" content="Tela Botanica" />
<meta property="og:description" content="Gestion des widgets de saisie du Carnet en Ligne" />
<meta property="og:image" content="http://resources.tela-botanica.org/tb/img/256x256/carre_englobant.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="256" />
<meta property="og:image:height" content="256" />
<meta property="og:locale" content="fr_FR" />
 
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="http://resources.tela-botanica.org/tb/img/16x16/favicon.ico" />
<!-- 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="http://resources.tela-botanica.org/bootstrap/3.1.0/js/bootstrap.min.js"></script>
 
<!-- Barre de navigation -->
<?php if ($bar !== false): ?>
<script src="<?=$url_script_navigation?>"></script>
<?php endif; ?>
<!-- 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 rel="stylesheet" type="text/css" href="http://resources.tela-botanica.org/bootstrap/3.1.0/css/bootstrap.min.css" />
<link id="telabotanica-style-css" rel="stylesheet" href="https://beta.tela-botanica.org/preprod/wp-content/themes/telabotanica/dist/bundle.css?ver=4.7.5" type="text/css" media="all">
<link href="<?= $url_base; ?>modules/manager/squelettes/css/manager.css" rel="stylesheet" type="text/css" media="screen" />
<!-- Google Analytics -->
<?php if($prod): ?>
<?php include "analytics.html"; ?>
<?php endif; ?>
</head>
 
<body>
<?php if ($bar !== false): ?>
<div id="tb-navigation" data-courant="widget-cel-export" data-squelette="bootstrap3" data-mode="prod">
</div>
<br/>
<?php endif; ?>
 
<div id="zone-appli" class="container">
<h1 id="widget-titre" class="widget-titre"> Gestion des widgets de saisie du CEL</h1>
<ul>
<?php foreach ($donnees['widget'] as $donnee) { ?>
<li class="component-tools-item">
<?= '<img class="component-tools-item-icon" src="'.$donnee['logo'].'" alt="'.$donnee['projet'].'" style="width:10rm;height:100%">';?>
<div style="">
<h4 class="component-tools-item-title">
<a href="https://beta.tela-botanica.org/preprod/flore/" target=""><?= $donnee['projet']." : ".$donnee['titre']; ?></a>
</h4>
<div class="component component-buttons as-seamless" style="float:right;">
<a class="button orange" href="http://localhost/cel/widget/manager?mode=modification&projet=<?= $donnee['projet']; ?>&langue=<?= $donnee['langue']; ?>" target="" title="Espace projets">
<span class="button-text">Modifier le widget</span>
</a>
<a class="button standard" href="http://localhost/cel/widget/manager?mode=creation&projet=<?= $donnee['projet']; ?>&langue=<?= $donnee['langue']; ?>" target="" title="Créer un projet">
<span class="button-text">Créer à partir</span>
</a>
</div>
</div>
<div class="component-tools-item-description"><?= $donnee['description']; ?></div>
<div class="component-tools-item-link">
<a href="http://www.tela-botanica.org/widget:cel:saisie?projet=<?= $donnee['projet']; ?>" target="" style="color: #e16e37">
<span>Saisie</span>
</a>
<a href="http://www.tela-botanica.org/widget:cel:cartoPoint?projet=<?= $donnee['projet']; ?>" target="" style="color: #918a6f">
<span>Carto</span>
</a>
<a href="http://www.tela-botanica.org/widget:cel:photo?projet=<?= $donnee['projet']; ?>" target="" style="color: #964e75">
<span>Photo</span>
</a>
<a href="http://www.tela-botanica.org/widget:cel:observation?projet=<?= $donnee['projet']; ?>" target="" style="color: #b2cb43">
<span>Observation</span>
</a>
<a href="http://www.tela-botanica.org/widget:cel:export?projet=<?= $donnee['projet']; ?>" target="" style="color: #009fb8">
<span>Export</span>
</a>
<a href="http://www.tela-botanica.org/appli:pictoflora?projet=<?= $donnee['projet']; ?>" target="" style="color: #927fa2">
<span>PictoFlora</span>
</a>
<a href="http://www.tela-botanica.org/appli:identiplante?projet=<?= $donnee['projet']; ?>" target="" style="color: #f25a52">
<span>IdentiPlante</span>
</a>
</div>
</li>
<?php } ?>
</ul>
<div class="component component-buttons as-seamless">
<a class="button standard" href="http://localhost/cel/widget/manager?mode=creation" target="_blank" title="">
<span class="button-text">Créer un nouveau widget</span>
</a>
</div>
</div>
</body>
</html>
/trunk/widget/modules/manager/Manager.php
New file
0,0 → 1,184
<?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 Manager extends WidgetCommun {
const DS = DIRECTORY_SEPARATOR;
const SERVICE_DEFAUT = 'manager';
private $cel_url_tpl = null;
/** Si spécifié, on ajoute une barre de navigation inter-applications */
private $bar;
//private $parametres_autorises = array('projet', 'type', 'langue', 'order');
private $parametres_autorises = array(
'projet' => 'projet',
'type' => 'type',
'langue' => 'langue',
'order' => 'order'
);
/**
* 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);
$this->bar = (isset($bar)) ? $bar : false;
 
if (!isset($mode)) {
$mode = self::SERVICE_DEFAUT;
}
$this->cel_url_tpl = $this->config['manager']['celUrlTpl'];
if ($_POST != array()) {
$this->parametres['projet'] = $_POST['projet'];
$this->parametres['langue'] = $_POST['langue'];
if ($mode == 'modification') {
$parametres = $this->traiterParametresModif();
$json = $this->getDao()->modifier($this->cel_url_tpl, $parametres);
} else {
$json = $this->getDao()->ajouter($this->cel_url_tpl, $_POST);
$this->parametres['mode'] = $mode = 'modification';
}
}
$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'])) {
$retour['donnees']['prod'] = ($this->config['parametres']['modeServeur'] == "prod");
$retour['donnees']['bar'] = $this->bar;
$retour['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
$retour['donnees']['mode'] = $mode;
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].'.tpl.html';
$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
} else {
$this->messages[] = 'Les données à transmettre au squelette sont nulles.';
}
}
$this->envoyer($contenu);
}
private function executerManager() {
$params = array();
$retour['squelette'] = 'manager';
foreach ($this->parametres_autorises as $id=>$pa) {
if (isset($this->parametres[$pa])) {
$params[] = $pa."=".$this->parametres[$pa];
}
}
$param = implode($params, '&');
$url = $this->cel_url_tpl;
if ($param != "") $url .= '?'.$param;
$json = $this->getDao()->consulter($url);
$retour['donnees']['widget'] = (array) json_decode($json, true);
return $retour;
}
private function executerCreation() {
//https://api.tela-botanica.org/service:cel:NomsChampsEtendus/cle
$retour['squelette'] ='creation';
$jsonlangue = $this->getDao()->consulter($this->config['manager']['languesUrl']);
$tableaulangue= (array) json_decode($jsonlangue, true);
$retour['donnees']['langues'] = $tableaulangue['resultat'] ;
$retour['donnees']['widget'] = array();
if (isset($this->parametres['projet'])) {
$url = $this->cel_url_tpl.'?projet='.$this->parametres['projet'];
$json = $this->getDao()->consulter($url);
$tableau = (array) json_decode($json, true);
$retour['donnees']['widget'] = $tableau[0];
$urltype = $this->cel_url_tpl.'?esttype=1';
$jsontype = $this->getDao()->consulter($urltype);
$tableautype= (array) json_decode($jsontype, true);
$retour['donnees']['type'] = $tableautype;
}
return $retour;
}
private function executerSaisie() {
$retour = '';
if (isset($this->parametres['projet'])) {
$retour['squelette'] = 'saisie';
$url = $this->cel_url_tpl.'?projet='.$this->parametres['projet'];
$json = $this->getDao()->consulter($url);
$tableau = (array) json_decode($json, true);
$retour['donnees']['widget'] = $tableau[0];
}
return $retour;
}
private function executerModification() {
$retour = '';
if (isset($this->parametres['projet'])) {
$retour['squelette'] = 'creation';
$url = $this->cel_url_tpl.'?projet='.$this->parametres['projet'].'&langue='.$this->parametres['langue'];
$json = $this->getDao()->consulter($url);
$tableau = (array) json_decode($json, true);
$retour['donnees']['widget'] = $tableau[0];
$urltype = $this->cel_url_tpl.'?esttype=1';
$jsontype = $this->getDao()->consulter($urltype);
$tableautype= (array) json_decode($jsontype, true);
$retour['donnees']['type'] = $tableautype;
}
return $retour;
}
private function traiterParametres() {
$parametres_flux = '?';
$criteres = array('utilisateur', 'commune', 'dept', 'taxon', 'commentaire', 'date', 'tag', 'motcle', 'projet', 'num_taxon', 'num_nom', 'referentiel', 'groupe_zones_geo');
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;
}
private function traiterParametresModif() {
$parametres_modif = array();
foreach ($_POST as $id => $parametres) {
if ($parametres != "") {
$parametres_modif[$id] = $parametres;
}
}
return $parametres_modif;
}
}
?>