Subversion Repositories eFlore/Applications.cel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2359 → Rev 2360

/trunk/widget/modules/saisie/squelettes/arbres-tetards/css/arbres-tetards.css
New file
0,0 → 1,422
@CHARSET "UTF-8";
/*
Code couleurs :
Police : ?
Gris :
foncé : #2B2E34
clair : #D7DBC5
Vert :
foncé : #C4D24C / #898F5E (couverture)
median : #CAD65E / #C0CE40 (titre)
clair : #D9E28C / #E4E9AD / #F4F7DF
Marron
fonçé : #999E6C
clair texturé : #CDBEA2
 
*/
/*+--------------------------------------------------------------------------------------------------------+*/
/* Polices d'écriture*/
/* FONT : Balthazar */
@font-face {
font-family: 'Balthazar';
font-style: normal;
font-weight: 400;
src:
local('Balthazar Regular'),
local('Balthazar-Regular'),
url('http://resources.tela-botanica.org/fonts/balthazar/regular.woff') format('woff');
}
/* FONT : Ubuntu */
@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 400;
src:
local('Ubuntu'),
url(http://resources.tela-botanica.org/fonts/ubuntu/regular.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/ubuntu/regular.ttf) format('ttf');
}
@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 700;
src:
local('Ubuntu Bold'),
local('Ubuntu-Bold'),
url(http://resources.tela-botanica.org/fonts/ubuntu/bold.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/ubuntu/bold.ttf) format('ttf');
}
@font-face {
font-family: 'Ubuntu';
font-style: italic;
font-weight: 400;
src:
local('Ubuntu Italic'),
local('Ubuntu-Italic'),
url(http://resources.tela-botanica.org/fonts/ubuntu/italic.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/ubuntu/italic.ttf) format('ttf');
}
@font-face {
font-family: 'Ubuntu';
font-style: italic;
font-weight: 700;
src:
local('Ubuntu Bold Italic'),
local('Ubuntu-BoldItalic'),
url(http://resources.tela-botanica.org/fonts/ubuntu/bold_italic.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/ubuntu/bold_italic.ttf) format('ttf');
}
/* FONT : Muli */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 300;
src:
local('Muli Light'),
local('Muli-Light'),
url(http://resources.tela-botanica.org/fonts/muli/regular.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/muli/regular.ttf) format('ttf');
}
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 400;
src:
local('Muli'),
url(http://resources.tela-botanica.org/fonts/muli/bold.woff) format('woff');
}
@font-face {
font-family: 'Muli';
font-style: italic;
font-weight: 300;
src:
local('Muli Light Italic'),
local('Muli-LightItalic'),
url(http://resources.tela-botanica.org/fonts/muli/italic.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/muli/italic.ttf) format('ttf');
}
@font-face {
font-family: 'Muli';
font-style: italic;
font-weight: 400;
src:
local('Muli Italic'),
local('Muli-Italic'),
url(http://resources.tela-botanica.org/fonts/muli/bold_italic.woff) format('woff'),
url(http://resources.tela-botanica.org/fonts/muli/bold_italic.ttf) format('ttf');
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Balises */
body {
background: #d9e28c;
background-image: url('../img/background/dessin-tetard.png'), -moz-radial-gradient(center, ellipse cover, #d9e28c 8%, #999e6c 85%);
background-image: url('../img/background/dessin-tetard.png'), -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(27%,#d9e28c), color-stop(85%,#999e6c));
background-image: url('../img/background/dessin-tetard.png'), -webkit-radial-gradient(center, ellipse cover, #d9e28c 27%,#999e6c 85%);
background-image: url('../img/background/dessin-tetard.png'), -o-radial-gradient(center, ellipse cover, #d9e28c 27%,#999e6c 85%);
background-image: url('../img/background/dessin-tetard.png'), -ms-radial-gradient(center, ellipse cover, #d9e28c 27%,#999e6c 85%);
background-image: url('../img/background/dessin-tetard.png'), radial-gradient(ellipse at center, #d9e28c 27%,#999e6c 85%);
background-repeat: no-repeat;
background-attachment:fixed;
}
footer p{
text-align:center;
}
button img {
display:block;
}
h2 {
color: #C0CE40;
font-family: 'Muli', sans-serif;
border-bottom: 1px solid #2B2E34;
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* 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 */
.page-header {
background-color: rgba(202, 214, 94, 0.4);
border-radius: 10px;
text-align: center;
}
.page-header h1{
font-size: 3em;
line-height: 63px;
color: #2B2E34;
font-family: 'Muli', sans-serif;
}
#logo-titre {
position: relative;
left: 8px;
margin-right: 1em;
}
 
#intro {
 
}
 
#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;
}
 
#miniatures {
padding-top: 5px;
}
 
.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;
}
 
#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;
}
 
#barre-progression-upload span {
color : #333333;
}
 
.obs-erreur {
background-color: #DD6E6E;
}
 
#barre-progression-upload span {
color : #333333;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Form validation */
/* Validation du formulaire */
label.error {
font-weight: bold;
font-style: italic;
color: #B94A48;
padding: 0 8px;
}
 
label.valid {
display: inline-block;
text-indent: -9999px;
color: #468847;
width: 0;
height: 0;
padding: 0;
}
 
.control-group.error label {
font-weight: bold;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/* Collapse */
.well .fermer-symbole {
position: absolute;
right:0;
}
.well .titre, .fermer {
margin:0;
padding: 0;
font-size: 20px;
line-height: 20px;
cursor:pointer;
}
.well .fermer {
display:block;
color: black;
}
.well .fermer:hover {
text-decoration: none;
}
.well .icone {
position:absolute;
right:5px;
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
/*Modal plte-description */
.dsc-imgs {
max-width: 800px;
margin:0 auto;
}
.dsc-infos {
max-width: 800px;
}
.dsc-clean {
clear:both;
}
@media (min-width: 600px) and (max-width: 800px) {
.dsc-imgs {
width: 600px;
}
.dsc-imgs img {
width: 290px;
}
.dsc-infos {
width: 600px;
}
}
@media (min-width: 801px) and (max-width: 1359px) {
.modal {
width:800px;
margin-left:-400px;
}
.dsc-imgs {
width: 780px;
}
.dsc-infos {
width: 700px;
}
}
@media (min-width: 1360px) {
.modal {
width:1360px;
margin-left:-680px;
}
.dsc-imgs {
float:left;
}
.dsc-infos {
float:left;
max-width: 500px;
}
 
}
/*+--------------------------------------------------------------------------------------------------------+*/
/* Correction style CSS Bootstrap */
.well {
margin-bottom: 5px;
padding: 4px;
background-color: rgba(245,245,245,0.85);
}
.btn-primary {
background-image: linear-gradient(to bottom, #D9E28C, #999E6C);
background-color: #999E6C;
font-weight: bold;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .btn-primary.disabled, .btn-primary[disabled] {
color: rgb(255, 255, 255);
background-color: #999E6C;
}
/trunk/widget/modules/saisie/squelettes/arbres-tetards/css/bootstrap-modal.css
New file
0,0 → 1,214
/*!
* Bootstrap Modal
*
* Copyright Jordan Schroter
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
 
.modal-open {
overflow: hidden;
}
 
 
/* add a scroll bar to stop page from jerking around */
.modal-open.page-overflow .page-container,
.modal-open.page-overflow .page-container .navbar-fixed-top,
.modal-open.page-overflow .page-container .navbar-fixed-bottom,
.modal-open.page-overflow .modal-scrollable {
overflow-y: scroll;
}
 
@media (max-width: 979px) {
.modal-open.page-overflow .page-container .navbar-fixed-top,
.modal-open.page-overflow .page-container .navbar-fixed-bottom {
overflow-y: visible;
}
}
 
 
.modal-scrollable {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
}
 
.modal {
outline: none;
position: absolute;
margin-top: 0;
top: 50%;
overflow: visible; /* allow content to popup out (i.e tooltips) */
}
 
.modal.fade {
top: -100%;
-webkit-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
-moz-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
-o-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
}
 
.modal.fade.in {
top: 50%;
}
 
.modal-body {
max-height: none;
overflow: visible;
}
 
.modal.modal-absolute {
position: absolute;
z-index: 950;
}
 
.modal .loading-mask {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #fff;
border-radius: 6px;
}
 
.modal-backdrop.modal-absolute{
position: absolute;
z-index: 940;
}
 
.modal-backdrop,
.modal-backdrop.fade.in{
opacity: 0.7;
filter: alpha(opacity=70);
background: #fff;
}
 
.modal.container {
width: 940px;
margin-left: -470px;
}
 
/* Modal Overflow */
 
.modal-overflow.modal {
top: 1%;
}
 
.modal-overflow.modal.fade {
top: -100%;
}
 
.modal-overflow.modal.fade.in {
top: 1%;
}
 
.modal-overflow .modal-body {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
 
/* Responsive */
 
@media (min-width: 1200px) {
.modal.container {
width: 1170px;
margin-left: -585px;
}
}
 
@media (max-width: 979px) {
.modal,
.modal.container,
.modal.modal-overflow {
top: 1%;
right: 1%;
left: 1%;
bottom: auto;
width: auto !important;
height: auto !important;
margin: 0 !important;
padding: 0 !important;
}
.modal.fade.in,
.modal.container.fade.in,
.modal.modal-overflow.fade.in {
top: 1%;
bottom: auto;
}
.modal-body,
.modal-overflow .modal-body {
position: static;
margin: 0;
height: auto !important;
max-height: none !important;
overflow: visible !important;
}
.modal-footer,
.modal-overflow .modal-footer {
position: static;
}
}
 
.loading-spinner {
position: absolute;
top: 50%;
left: 50%;
margin: -12px 0 0 -12px;
}
 
/*
Animate.css - http://daneden.me/animate
Licensed under the ☺ license (http://licence.visualidiot.com/)
 
Copyright (c) 2012 Dan Eden*/
 
.animated {
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
}
 
@-webkit-keyframes shake {
0%, 100% {-webkit-transform: translateX(0);}
10%, 30%, 50%, 70%, 90% {-webkit-transform: translateX(-10px);}
20%, 40%, 60%, 80% {-webkit-transform: translateX(10px);}
}
 
@-moz-keyframes shake {
0%, 100% {-moz-transform: translateX(0);}
10%, 30%, 50%, 70%, 90% {-moz-transform: translateX(-10px);}
20%, 40%, 60%, 80% {-moz-transform: translateX(10px);}
}
 
@-o-keyframes shake {
0%, 100% {-o-transform: translateX(0);}
10%, 30%, 50%, 70%, 90% {-o-transform: translateX(-10px);}
20%, 40%, 60%, 80% {-o-transform: translateX(10px);}
}
 
@keyframes shake {
0%, 100% {transform: translateX(0);}
10%, 30%, 50%, 70%, 90% {transform: translateX(-10px);}
20%, 40%, 60%, 80% {transform: translateX(10px);}
}
 
.shake {
-webkit-animation-name: shake;
-moz-animation-name: shake;
-o-animation-name: shake;
animation-name: shake;
}
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/chargement-image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/chargement-image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/aide.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/aide.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/plus.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/plus.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/pasdephoto.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/pasdephoto.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/supprimer.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/supprimer.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/calendrier.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/icones/calendrier.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/logos/gentiana.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/logos/gentiana.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/epingle.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/epingle.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/rond_vert_jaune.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/rond_vert_jaune.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/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
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/chargement.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/chargement.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/etoile_argent.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/marqueurs/etoile_argent.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/favicon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/favicon.ico
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/background/dessin-tetard.jpg
Cannot display: file marked as a binary type.
svn:mime-type = image/jpeg
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/background/dessin-tetard.jpg
New file
Property changes:
Added: svn:mime-type
+image/jpeg
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/background/dessin-tetard.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/background/dessin-tetard.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/background/noise.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/trunk/widget/modules/saisie/squelettes/arbres-tetards/img/background/noise.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/trunk/widget/modules/saisie/squelettes/arbres-tetards/js/arbres-tetards.js
New file
0,0 → 1,1227
//+---------------------------------------------------------------------------------------------------------+
// GÉNÉRAL
$(document).ready(function() {
if (DEBUG == false) {
$(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));
});
 
$("#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 {
$('#form-upload')[0].reset();
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();
}
 
//Initialise l'autocomplétion de la commune, en fonction du référentiel
function initialiserAutocompleteCommune() {
var geocoderOptions = {
};
var addressSuffix = '';
 
switch(NOM_SCI_PROJET) {
case 'isfan':
// Si des résultats se trouvent dans ce rectangle, ils apparaîtront en premier.
// Ça marche moyen...
geocoderOptions.bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(20.756114, -22.023927),
new google.maps.LatLng(38.065392, 33.78662)
);
break;
case 'apd':
geocoderOptions.bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(-6.708254, -26.154786),
new google.maps.LatLng(27.488781, 30.490722)
);
break;
case 'bdtfx':
case 'bdtxa':
geocoderOptions.region = 'fr';
addressSuffix = ', France';
}
 
$("#carte-recherche").autocomplete({
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
source: function(request, response) {
geocoderOptions.address = request.term + addressSuffix;
geocoder.geocode( geocoderOptions, 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);
}
});
 
// 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();
}
});
};
 
//+----------------------------------------------------------------------------------------------------------+
// GOOGLE MAP
var map;
var marker;
var latLng;
var geocoder;
 
$(document).ready(function() {
initialiserGoogleMap();
initialiserAutocompleteCommune();
});
 
function afficherErreurGoogleMap(status) {
if (DEBUG) {
$('#dialogue-google-map .contenu').empty().append(
'<pre class="msg-erreur">'+
"Le service de Géocodage de Google Map a échoué à cause de l'erreur : "+status+
'</pre>');
afficherPanneau('#dialogue-google-map');
}
}
 
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(NOM_SCI_PROJET == 'bdtxa') {
var latLng = new google.maps.LatLng(14.6, -61.08334);// Fort-De-France
var zoomDefaut = 8;
} else if(NOM_SCI_PROJET == 'isfan') {
var latLng = new google.maps.LatLng(29.28358, 10.21884);// Afrique du Nord
var zoomDefaut = 4;
} else if(NOM_SCI_PROJET == 'apd') {
var latLng = new google.maps.LatLng(8.75624, 1.80176);// Afrique de l'Ouest et du Centre
var zoomDefaut = 4;
} 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);
});
}
 
// intéraction carte
$("#geolocaliser").on('click', geolocaliser);
google.maps.event.addListener(marker, 'dragend', surDeplacementMarker);
google.maps.event.addListener(map, 'click', surClickDansCarte);
}
 
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 = SERVICE_ANNUAIRE_ID_URL+courriel;
$.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
$(document).ready(function() {
if (OBS_ID != '') {
chargerInfoObs();
}
});
 
function chargerInfoObs() {
var urlObs = SERVICE_OBS_URL + '/' + OBS_ID;
$.ajax({
url: urlObs,
type: 'GET',
success: function(data, textStatus, jqXHR) {
if (data != undefined && data != "") {
prechargerForm(data);
}
// TODO: voir s'il est pertinent d'indiquer quelque chose en cas d'erreur ou d'obs
// inexistante
},
error: function(jqXHR, textStatus, errorThrown) {
// TODO: cf TODO ci-dessus
}
});
}
 
function prechargerForm(data) {
 
$("#milieu").val(data.milieu);
 
$("#carte-recherche").val(data.zoneGeo);
$("#commune-nom").text(data.zoneGeo);
 
if(data.hasOwnProperty("codeZoneGeo")) {
// TODO: trouver un moyen qui fonctionne lorsqu'on aura d'autres référentiels que INSEE
$("#commune-code-insee").text(data.codeZoneGeo.replace('INSEE-C:', ''));
}
 
if(data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) {
var latLng = new google.maps.LatLng(data.latitude, data.longitude);
mettreAJourMarkerPosition(latLng);
marker.setPosition(latLng);
map.setCenter(latLng);
map.setZoom(16);
}
}
 
var obsNbre = 0;
 
$(document).ready(function() {
$(".alert .close").on('click', fermerPanneauAlert);
 
$("body").on('click', ".fermer", function(event) {
event.preventDefault();
basculerOuvertureFermetureCadre($(this).find('.icone'));
});
 
$('.has-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, {
ignore: [],// Forcer Jquery Validate à examiner les éléments avec en display:none;
highlight: function(element) {
$(element).closest('.control-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid');
element.closest('.control-group').removeClass('error').addClass('success');
 
if (element.attr('id') == 'taxon' && $('#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', '');
}
}
}
});
}
 
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],
required: true},
longitude : {
range: [-180, 180],
required: true},
stationSurface: 'required',
milieu: 'required'
}
});
$('#form-obs').validate({
rules: {
date: {
required: true,
'dateCel' : true},
taxon: 'required',
recouvrement: 'required'
},
errorPlacement: function(error, element) {
if (element.attr('name') == 'date') {
element.parent('.input-prepend').after(error);
} else {
error.insertAfter(element);
}
}
});
}
 
function configurerDatePicker() {
$.datepicker.setDefaults($.datepicker.regional["fr"]);
$("#date").datepicker({
dateFormat: "dd/mm/yy",
maxDate: new Date,
showOn: "button",
buttonImageOnly: true,
buttonImage: CALENDRIER_ICONE_URL,
buttonText: "Afficher le calendrier pour saisir la date.",
showButtonPanel: true,
onSelect: function(date) {
$(this).valid();
}
});
$("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 basculerOuvertureFermetureCadre(element) {
if (element.hasClass('icon-plus-sign')) {
element.removeClass('icon-plus-sign').addClass('icon-minus-sign');
} else {
element.removeClass('icon-minus-sign').addClass('icon-plus-sign');
}
}
 
function basculerAffichageAide() {
if ($(this).hasClass('btn-warning')) {
$('.has-tooltip').tooltip('enable');
$(this).removeClass('btn-warning').addClass('btn-success');
$('#btn-aide-txt', this).text("Désactiver l'aide");
} else {
$('.has-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();
if(!ESPECE_IMPOSEE) {
$("#taxon").val("");
$("#taxon").data("numNomSel",undefined);
}
$('#barre-progression-upload').attr('aria-valuemax', obsNbre);
$('#barre-progression-upload .sr-only').text('0/'+obsNbre+" observations transmises");
} 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 has-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()+
' 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()+' '+
'</li>'+
'<li>'+
'<span>Surface :</span> '+$('#station-surface option:selected').text()+' - '+
'<span>Recouvrement :</span> '+$('#recouvrement option:selected').text()+' '+
'</li>'+
'<li>'+
'<span>Milieu :</span> '+$('#milieu').val()+' '+' - '+
'<span>Commentaire sur le milieu :</span> <span class="discretion">'+$('#milieu-commentaire').val()+' '+'</span><br />'+
'</li>'+
'<li>'+
'Notes : <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_PROJET),
 
'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(),
 
// Ajout des champs étendus de l'obs
'obs_etendue': getObsChpEtendus()
});
}
 
function getObsChpEtendus() {
var champs = [];
 
$('.obs-chp-etendu').each(function() {
var valeur = $(this).val(),
cle = $(this).attr('name'),
label = $(this).data('label');
if (valeur != '') {
var chpEtendu = {cle: cle, label: label, valeur: valeur};
champs.push(chpEtendu);
}
});
return champs;
}
 
function surChangementReferentiel() {
NOM_SCI_PROJET = $('#referentiel').val();
NOM_SCI_REFERENTIEL = NOM_SCI_PROJET+':'+PROJETS_VERSIONS[NOM_SCI_PROJET];
$('#taxon').val('');
initialiserAutocompleteCommune();
initialiserGoogleMap();
}
 
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");
}
}
 
var nbObsEnCours = 1;
var totalObsATransmettre = 0;
function transmettreObs() {
var observations = $("#liste-obs").data();
if (observations == undefined || jQuery.isEmptyObject(observations)) {
afficherPanneau("#dialogue-zero-obs");
} else {
nbObsEnCours = 1;
nbObsTransmises = 0;
totalObsATransmettre = $.map(observations, function(n, i) { return i; }).length;
depilerObsPourEnvoi();
}
return false;
}
 
function depilerObsPourEnvoi() {
var observations = $("#liste-obs").data();
// la boucle est factice car on utilise un tableau
// dont on a besoin de n'extraire que le premier élément
// or javascript n'a pas de méthode cross browsers pour extraire les clés
// TODO: utiliser var.keys quand ça sera plus répandu
// ou bien utiliser un vrai tableau et pas un objet
for (var obsNum in observations) {
obsATransmettre = new Object();
 
obsATransmettre['projet'] = TAG_PROJET;
obsATransmettre['tag-obs'] = TAG_OBS;
obsATransmettre['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();
obsATransmettre['utilisateur'] = utilisateur;
obsATransmettre[obsNum] = observations[obsNum];
var idObsNumerique = obsNum.replace('obsId', '');
if(idObsNumerique != "") {
envoyerObsAuCel(idObsNumerique, obsATransmettre);
}
 
break;
}
}
 
var nbObsTransmises = 0;
function mettreAJourProgression() {
nbObsTransmises++;
var pct = (nbObsTransmises/totalObsATransmettre)*100;
$('#barre-progression-upload').attr('aria-valuenow', nbObsTransmises);
$('#barre-progression-upload').attr('style', "width: "+pct+"%");
$('#barre-progression-upload .sr-only').text(nbObsTransmises+"/"+totalObsATransmettre+" observations transmises");
 
if(obsNbre == 0) {
$('.progress').removeClass('active');
$('.progress').removeClass('progress-striped');
}
}
 
function envoyerObsAuCel(idObs, observation) {
var erreurMsg = "";
$.ajax({
url : SERVICE_SAISIE_URL,
type : "POST",
data : observation,
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) {
// mise à jour du nombre d'obs à transmettre
// et suppression de l'obs
supprimerObsParId(idObs);
nbObsEnCours++;
// mise à jour du statut
mettreAJourProgression();
if(obsNbre > 0) {
// dépilement de la suivante
depilerObsPourEnvoi();
}
},
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) {
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_remarques@tela-botanica.org?"+
"subject=Dysfonctionnement du widget de saisie "+TAG_PROJET+
"&body="+erreurMsg+"%0D%0ADébogage :%0D%0A"+debugMsg;
 
// mise en valeur de l'obs en erreur + scroll vers celle ci en changeant le hash
$('#obs'+idObs+' div div').addClass('obs-erreur');
window.location.hash = "obs"+idObs;
 
$('#dialogue-obs-transaction-ko .alert-txt').append($("#tpl-transmission-ko").clone()
.find('.courriel-erreur')
.attr('href', hrefCourriel)
.end()
.html());
$("#dialogue-obs-transaction-ko").show();
$("#chargement").hide();
initialiserBarreProgression();
} else {
if (DEBUG) {
$("#dialogue-obs-transaction-ok .alert-txt").append('<pre class="msg-debug">Débogage : '+debugMsg+'</pre>');
}
if(obsNbre == 0) {
setTimeout(function() {
$("#chargement").hide();
$('#dialogue-obs-transaction-ok .alert-txt').append($('#tpl-transmission-ok').clone().html());
$("#dialogue-obs-transaction-ok").show();
window.location.hash = "dialogue-obs-transaction-ok";
initialiserObs();
}, 1500);
 
}
}
}
});
}
 
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");
}
supprimerObsParId(obsId);
}
 
function supprimerObsParId(obsId) {
obsNbre = obsNbre - 1;
$(".obs-nbre").text(obsNbre);
$(".obs-nbre").triggerHandler('changement');
$('.obs'+obsId).remove();
$("#liste-obs").removeData('obsId'+obsId);
}
 
function initialiserBarreProgression() {
$('#barre-progression-upload').attr('aria-valuenow', 0);
$('#barre-progression-upload').attr('style', "width: 0%");
$('#barre-progression-upload .sr-only').text("0/0 observations transmises");
$('.progress').addClass('active');
$('.progress').addClass('progress-striped');
}
 
function initialiserObs() {
obsNbre = 0;
nbObsTransmises = 0;
nbObsEnCours = 0;
totalObsATransmettre = 0;
initialiserBarreProgression();
$(".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">['+
'<span class="referentiel-obs">'+($("#taxon").data("numNomSel") == undefined ? '' : NOM_SCI_PROJET+'-')+'</span>'+
'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;
// Tester dans ce sens, permet de considérer "absent" comme "false" => est-ce opportun ?
// en tout cas c'est harmonisé avec le CeL
nom.retenu = (val.retenu == 'true') ? true : false;
 
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 );
/trunk/widget/modules/saisie/squelettes/arbres-tetards/js/bootstrap-modalmanager.js
New file
0,0 → 1,423
/* ===========================================================
* bootstrap-modalmanager.js v2.2.5
* ===========================================================
* Copyright 2012 Jordan Schroter.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
 
!function ($) {
 
"use strict"; // jshint ;_;
 
/* MODAL MANAGER CLASS DEFINITION
* ====================== */
 
var ModalManager = function (element, options) {
this.init(element, options);
};
 
ModalManager.prototype = {
 
constructor: ModalManager,
 
init: function (element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options);
this.stack = [];
this.backdropCount = 0;
 
if (this.options.resize) {
var resizeTimeout,
that = this;
 
$(window).on('resize.modal', function(){
resizeTimeout && clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function(){
for (var i = 0; i < that.stack.length; i++){
that.stack[i].isShown && that.stack[i].layout();
}
}, 10);
});
}
},
 
createModal: function (element, options) {
$(element).modal($.extend({ manager: this }, options));
},
 
appendModal: function (modal) {
this.stack.push(modal);
 
var that = this;
 
modal.$element.on('show.modalmanager', targetIsSelf(function (e) {
 
var showModal = function(){
modal.isShown = true;
 
var transition = $.support.transition && modal.$element.hasClass('fade');
 
that.$element
.toggleClass('modal-open', that.hasOpenModal())
.toggleClass('page-overflow', $(window).height() < that.$element.height());
 
modal.$parent = modal.$element.parent();
 
modal.$container = that.createContainer(modal);
 
modal.$element.appendTo(modal.$container);
 
that.backdrop(modal, function () {
modal.$element.show();
 
if (transition) {
//modal.$element[0].style.display = 'run-in';
modal.$element[0].offsetWidth;
//modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });
}
modal.layout();
 
modal.$element
.addClass('in')
.attr('aria-hidden', false);
 
var complete = function () {
that.setFocus();
modal.$element.trigger('shown');
};
 
transition ?
modal.$element.one($.support.transition.end, complete) :
complete();
});
};
 
modal.options.replace ?
that.replace(showModal) :
showModal();
}));
 
modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) {
that.backdrop(modal);
// handle the case when a modal may have been removed from the dom before this callback executes
if (!modal.$element.parent().length) {
that.destroyModal(modal);
} else if (modal.$backdrop){
var transition = $.support.transition && modal.$element.hasClass('fade');
 
// trigger a relayout due to firebox's buggy transition end event
if (transition) { modal.$element[0].offsetWidth; }
$.support.transition && modal.$element.hasClass('fade') ?
modal.$backdrop.one($.support.transition.end, function () { modal.destroy(); }) :
modal.destroy();
} else {
modal.destroy();
}
 
}));
 
modal.$element.on('destroyed.modalmanager', targetIsSelf(function (e) {
that.destroyModal(modal);
}));
},
 
getOpenModals: function () {
var openModals = [];
for (var i = 0; i < this.stack.length; i++){
if (this.stack[i].isShown) openModals.push(this.stack[i]);
}
 
return openModals;
},
 
hasOpenModal: function () {
return this.getOpenModals().length > 0;
},
 
setFocus: function () {
var topModal;
 
for (var i = 0; i < this.stack.length; i++){
if (this.stack[i].isShown) topModal = this.stack[i];
}
 
if (!topModal) return;
 
topModal.focus();
},
 
destroyModal: function (modal) {
modal.$element.off('.modalmanager');
if (modal.$backdrop) this.removeBackdrop(modal);
this.stack.splice(this.getIndexOfModal(modal), 1);
 
var hasOpenModal = this.hasOpenModal();
 
this.$element.toggleClass('modal-open', hasOpenModal);
 
if (!hasOpenModal){
this.$element.removeClass('page-overflow');
}
 
this.removeContainer(modal);
 
this.setFocus();
},
 
getModalAt: function (index) {
return this.stack[index];
},
 
getIndexOfModal: function (modal) {
for (var i = 0; i < this.stack.length; i++){
if (modal === this.stack[i]) return i;
}
},
 
replace: function (callback) {
var topModal;
 
for (var i = 0; i < this.stack.length; i++){
if (this.stack[i].isShown) topModal = this.stack[i];
}
 
if (topModal) {
this.$backdropHandle = topModal.$backdrop;
topModal.$backdrop = null;
 
callback && topModal.$element.one('hidden',
targetIsSelf( $.proxy(callback, this) ));
 
topModal.hide();
} else if (callback) {
callback();
}
},
 
removeBackdrop: function (modal) {
modal.$backdrop.remove();
modal.$backdrop = null;
},
 
createBackdrop: function (animate, tmpl) {
var $backdrop;
 
if (!this.$backdropHandle) {
$backdrop = $(tmpl)
.addClass(animate)
.appendTo(this.$element);
} else {
$backdrop = this.$backdropHandle;
$backdrop.off('.modalmanager');
this.$backdropHandle = null;
this.isLoading && this.removeSpinner();
}
 
return $backdrop;
},
 
removeContainer: function (modal) {
modal.$container.remove();
modal.$container = null;
},
 
createContainer: function (modal) {
var $container;
 
$container = $('<div class="modal-scrollable">')
.css('z-index', getzIndex('modal', this.getOpenModals().length))
.appendTo(this.$element);
 
if (modal && modal.options.backdrop != 'static') {
$container.on('click.modal', targetIsSelf(function (e) {
modal.hide();
}));
} else if (modal) {
$container.on('click.modal', targetIsSelf(function (e) {
modal.attention();
}));
}
 
return $container;
 
},
 
backdrop: function (modal, callback) {
var animate = modal.$element.hasClass('fade') ? 'fade' : '',
showBackdrop = modal.options.backdrop &&
this.backdropCount < this.options.backdropLimit;
 
if (modal.isShown && showBackdrop) {
var doAnimate = $.support.transition && animate && !this.$backdropHandle;
 
modal.$backdrop = this.createBackdrop(animate, modal.options.backdropTemplate);
 
modal.$backdrop.css('z-index', getzIndex( 'backdrop', this.getOpenModals().length ));
 
if (doAnimate) modal.$backdrop[0].offsetWidth; // force reflow
 
modal.$backdrop.addClass('in');
 
this.backdropCount += 1;
 
doAnimate ?
modal.$backdrop.one($.support.transition.end, callback) :
callback();
 
} else if (!modal.isShown && modal.$backdrop) {
modal.$backdrop.removeClass('in');
 
this.backdropCount -= 1;
 
var that = this;
 
$.support.transition && modal.$element.hasClass('fade')?
modal.$backdrop.one($.support.transition.end, function () { that.removeBackdrop(modal) }) :
that.removeBackdrop(modal);
 
} else if (callback) {
callback();
}
},
 
removeSpinner: function(){
this.$spinner && this.$spinner.remove();
this.$spinner = null;
this.isLoading = false;
},
 
removeLoading: function () {
this.$backdropHandle && this.$backdropHandle.remove();
this.$backdropHandle = null;
this.removeSpinner();
},
 
loading: function (callback) {
callback = callback || function () { };
 
this.$element
.toggleClass('modal-open', !this.isLoading || this.hasOpenModal())
.toggleClass('page-overflow', $(window).height() < this.$element.height());
 
if (!this.isLoading) {
 
this.$backdropHandle = this.createBackdrop('fade', this.options.backdropTemplate);
 
this.$backdropHandle[0].offsetWidth; // force reflow
 
var openModals = this.getOpenModals();
 
this.$backdropHandle
.css('z-index', getzIndex('backdrop', openModals.length + 1))
.addClass('in');
 
var $spinner = $(this.options.spinner)
.css('z-index', getzIndex('modal', openModals.length + 1))
.appendTo(this.$element)
.addClass('in');
 
this.$spinner = $(this.createContainer())
.append($spinner)
.on('click.modalmanager', $.proxy(this.loading, this));
 
this.isLoading = true;
 
$.support.transition ?
this.$backdropHandle.one($.support.transition.end, callback) :
callback();
 
} else if (this.isLoading && this.$backdropHandle) {
this.$backdropHandle.removeClass('in');
 
var that = this;
$.support.transition ?
this.$backdropHandle.one($.support.transition.end, function () { that.removeLoading() }) :
that.removeLoading();
 
} else if (callback) {
callback(this.isLoading);
}
}
};
 
/* PRIVATE METHODS
* ======================= */
 
// computes and caches the zindexes
var getzIndex = (function () {
var zIndexFactor,
baseIndex = {};
 
return function (type, pos) {
 
if (typeof zIndexFactor === 'undefined'){
var $baseModal = $('<div class="modal hide" />').appendTo('body'),
$baseBackdrop = $('<div class="modal-backdrop hide" />').appendTo('body');
 
baseIndex['modal'] = +$baseModal.css('z-index');
baseIndex['backdrop'] = +$baseBackdrop.css('z-index');
zIndexFactor = baseIndex['modal'] - baseIndex['backdrop'];
 
$baseModal.remove();
$baseBackdrop.remove();
$baseBackdrop = $baseModal = null;
}
 
return baseIndex[type] + (zIndexFactor * pos);
 
}
}());
 
// make sure the event target is the modal itself in order to prevent
// other components such as tabsfrom triggering the modal manager.
// if Boostsrap namespaced events, this would not be needed.
function targetIsSelf(callback){
return function (e) {
if (e && this === e.target){
return callback.apply(this, arguments);
}
}
}
 
 
/* MODAL MANAGER PLUGIN DEFINITION
* ======================= */
 
$.fn.modalmanager = function (option, args) {
return this.each(function () {
var $this = $(this),
data = $this.data('modalmanager');
 
if (!data) $this.data('modalmanager', (data = new ModalManager(this, option)));
if (typeof option === 'string') data[option].apply(data, [].concat(args))
})
};
 
$.fn.modalmanager.defaults = {
backdropLimit: 999,
resize: true,
spinner: '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
backdropTemplate: '<div class="modal-backdrop" />'
};
 
$.fn.modalmanager.Constructor = ModalManager
 
// ModalManager handles the modal-open class so we need
// to remove conflicting bootstrap 3 event handlers
$(function () {
$(document).off('show.bs.modal').off('hidden.bs.modal');
});
 
}(jQuery);
/trunk/widget/modules/saisie/squelettes/arbres-tetards/js/bootstrap-modal.js
New file
0,0 → 1,378
/* ===========================================================
* bootstrap-modal.js v2.2.5
* ===========================================================
* Copyright 2012 Jordan Schroter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
 
 
!function ($) {
 
"use strict"; // jshint ;_;
 
/* MODAL CLASS DEFINITION
* ====================== */
 
var Modal = function (element, options) {
this.init(element, options);
};
 
Modal.prototype = {
 
constructor: Modal,
 
init: function (element, options) {
var that = this;
 
this.options = options;
 
this.$element = $(element)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
 
this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {
var e = $.Event('loaded');
that.$element.trigger(e);
});
 
var manager = typeof this.options.manager === 'function' ?
this.options.manager.call(this) : this.options.manager;
 
manager = manager.appendModal ?
manager : $(manager).modalmanager().data('modalmanager');
 
manager.appendModal(this);
},
 
toggle: function () {
return this[!this.isShown ? 'show' : 'hide']();
},
 
show: function () {
var e = $.Event('show');
 
if (this.isShown) return;
 
this.$element.trigger(e);
 
if (e.isDefaultPrevented()) return;
 
this.escape();
 
this.tab();
 
this.options.loading && this.loading();
},
 
hide: function (e) {
e && e.preventDefault();
 
e = $.Event('hide');
 
this.$element.trigger(e);
 
if (!this.isShown || e.isDefaultPrevented()) return;
 
this.isShown = false;
 
this.escape();
 
this.tab();
 
this.isLoading && this.loading();
 
$(document).off('focusin.modal');
 
this.$element
.removeClass('in')
.removeClass('animated')
.removeClass(this.options.attentionAnimation)
.removeClass('modal-overflow')
.attr('aria-hidden', true);
 
$.support.transition && this.$element.hasClass('fade') ?
this.hideWithTransition() :
this.hideModal();
},
 
layout: function () {
var prop = this.options.height ? 'height' : 'max-height',
value = this.options.height || this.options.maxHeight;
 
if (this.options.width){
this.$element.css('width', this.options.width);
 
var that = this;
this.$element.css('margin-left', function () {
if (/%/ig.test(that.options.width)){
return -(parseInt(that.options.width) / 2) + '%';
} else {
return -($(this).width() / 2) + 'px';
}
});
} else {
this.$element.css('width', '');
this.$element.css('margin-left', '');
}
 
this.$element.find('.modal-body')
.css('overflow', '')
.css(prop, '');
 
if (value){
this.$element.find('.modal-body')
.css('overflow', 'auto')
.css(prop, value);
}
 
var modalOverflow = $(window).height() - 10 < this.$element.height();
if (modalOverflow || this.options.modalOverflow) {
this.$element
.css('margin-top', 0)
.addClass('modal-overflow');
} else {
this.$element
.css('margin-top', 0 - this.$element.height() / 2)
.removeClass('modal-overflow');
}
},
 
tab: function () {
var that = this;
 
if (this.isShown && this.options.consumeTab) {
this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
if (e.keyCode && e.keyCode == 9){
var elements = [],
tabindex = Number($(this).data('tabindex'));
 
that.$element.find('[data-tabindex]:enabled:visible:not([readonly])').each(function (ev) {
elements.push(Number($(this).data('tabindex')));
});
elements.sort(function(a,b){return a-b});
var arrayPos = $.inArray(tabindex, elements);
if (!e.shiftKey){
arrayPos < elements.length-1 ?
that.$element.find('[data-tabindex='+elements[arrayPos+1]+']').focus() :
that.$element.find('[data-tabindex='+elements[0]+']').focus();
} else {
arrayPos == 0 ?
that.$element.find('[data-tabindex='+elements[elements.length-1]+']').focus() :
that.$element.find('[data-tabindex='+elements[arrayPos-1]+']').focus();
}
e.preventDefault();
}
});
} else if (!this.isShown) {
this.$element.off('keydown.tabindex.modal');
}
},
 
escape: function () {
var that = this;
if (this.isShown && this.options.keyboard) {
if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);
 
this.$element.on('keyup.dismiss.modal', function (e) {
e.which == 27 && that.hide();
});
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.modal')
}
},
 
hideWithTransition: function () {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end);
that.hideModal();
}, 500);
 
this.$element.one($.support.transition.end, function () {
clearTimeout(timeout);
that.hideModal();
});
},
 
hideModal: function () {
var prop = this.options.height ? 'height' : 'max-height';
var value = this.options.height || this.options.maxHeight;
 
if (value){
this.$element.find('.modal-body')
.css('overflow', '')
.css(prop, '');
}
 
this.$element
.hide()
.trigger('hidden');
},
 
removeLoading: function () {
this.$loading.remove();
this.$loading = null;
this.isLoading = false;
},
 
loading: function (callback) {
callback = callback || function () {};
 
var animate = this.$element.hasClass('fade') ? 'fade' : '';
 
if (!this.isLoading) {
var doAnimate = $.support.transition && animate;
 
this.$loading = $('<div class="loading-mask ' + animate + '">')
.append(this.options.spinner)
.appendTo(this.$element);
 
if (doAnimate) this.$loading[0].offsetWidth; // force reflow
 
this.$loading.addClass('in');
 
this.isLoading = true;
 
doAnimate ?
this.$loading.one($.support.transition.end, callback) :
callback();
 
} else if (this.isLoading && this.$loading) {
this.$loading.removeClass('in');
 
var that = this;
$.support.transition && this.$element.hasClass('fade')?
this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :
that.removeLoading();
 
} else if (callback) {
callback(this.isLoading);
}
},
 
focus: function () {
var $focusElem = this.$element.find(this.options.focusOn);
 
$focusElem = $focusElem.length ? $focusElem : this.$element;
 
$focusElem.focus();
},
 
attention: function (){
// NOTE: transitionEnd with keyframes causes odd behaviour
 
if (this.options.attentionAnimation){
this.$element
.removeClass('animated')
.removeClass(this.options.attentionAnimation);
 
var that = this;
 
setTimeout(function () {
that.$element
.addClass('animated')
.addClass(that.options.attentionAnimation);
}, 0);
}
 
 
this.focus();
},
 
 
destroy: function () {
var e = $.Event('destroy');
 
this.$element.trigger(e);
 
if (e.isDefaultPrevented()) return;
 
this.$element
.off('.modal')
.removeData('modal')
.removeClass('in')
.attr('aria-hidden', true);
if (this.$parent !== this.$element.parent()) {
this.$element.appendTo(this.$parent);
} else if (!this.$parent.length) {
// modal is not part of the DOM so remove it.
this.$element.remove();
this.$element = null;
}
 
this.$element.trigger('destroyed');
}
};
 
 
/* MODAL PLUGIN DEFINITION
* ======================= */
 
$.fn.modal = function (option, args) {
return this.each(function () {
var $this = $(this),
data = $this.data('modal'),
options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);
 
if (!data) $this.data('modal', (data = new Modal(this, options)));
if (typeof option == 'string') data[option].apply(data, [].concat(args));
else if (options.show) data.show()
})
};
 
$.fn.modal.defaults = {
keyboard: true,
backdrop: true,
loading: false,
show: true,
width: null,
height: null,
maxHeight: null,
modalOverflow: false,
consumeTab: true,
focusOn: null,
replace: false,
resize: false,
attentionAnimation: 'shake',
manager: 'body',
spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
backdropTemplate: '<div class="modal-backdrop" />'
};
 
$.fn.modal.Constructor = Modal;
 
 
/* MODAL DATA-API
* ============== */
 
$(function () {
$(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this),
href = $this.attr('href'),
$target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
 
e.preventDefault();
$target
.modal(option)
.one('hide', function () {
$this.focus();
})
});
});
 
}(window.jQuery);
/trunk/widget/modules/saisie/squelettes/arbres-tetards/arbres-tetards.tpl.html
New file
0,0 → 1,686
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Arbres têtards : saisie d'observations</title>
 
<meta charset="utf-8">
 
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Arbres têtards, projet, saisie, observation, Gentiana, CEL" />
<meta name="description" content="Projet Arbres têtards de Gentiana - 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/arbres-tetards/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 src="http://resources.tela-botanica.org/jquery/1.7.1/jquery-1.7.1.min.js"></script>
<!-- Jquery UI : nécessaire pour le mini-calendrier et l'auto-complétion -->
<script src="http://resources.tela-botanica.org/jquery/jquery-ui/1.8.18/js/jquery-ui-1.8.18.custom.min.js"></script>
<script src="http://resources.tela-botanica.org/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 src="http://resources.tela-botanica.org/jquery/validate/1.9.0/jquery.validate.min.js"></script>
<script src="http://resources.tela-botanica.org/jquery/validate/1.9.0/messages_fr.js"></script>
<!-- Jquery Form :nécessaire pour l'upload des images -->
<script src="http://resources.tela-botanica.org/jquery/form/2.95/jquery.form.min.js"></script>
 
<!-- Bootstrap -->
<script src="http://resources.tela-botanica.org/bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="http://resources.tela-botanica.org/bootstrap/modal/2.2.5/js/bootstrap-modalmanager.js"></script>
<script src="http://resources.tela-botanica.org/bootstrap/modal/2.2.5/js/bootstrap-modal.js"></script>
 
<!-- Javascript : appli saisie -->
<script>
//<![CDATA[
// Précharger le formulaire avec les infos d'une observation
var OBS_ID = "<?=isset($_GET['id-obs']) ? $_GET['id-obs'] : ''?>";
// La présence du parametre 'debug' dans l'URL enclenche le dégogage
var DEBUG = <?=isset($_GET['debug']) ? 'true' : 'false'?>;
 
// Mot-clé du widget/projet
var TAG_PROJET = "WidgetSaisie,ArbresTetards";
// 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' ?>;
 
// 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?>";
 
// 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; ?>;
 
// Indication des version utilisées de chaque référentiel
var PROJETS_VERSIONS = <?=json_encode($projets_versions)?>;
// 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_TPL = "<?=$url_ws_autocompletion_ns_tpl?>?"+
"masque={masque}&"+
"recherche=etendue&"+
"retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
"retour.tri=alpharet&"+ // tri "à la CeL"
"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;
 
// URL du web service permettant de récupérer les infos d'une observation du CEL.
var SERVICE_OBS_URL = "<?=$url_ws_obs?>";
// 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 de l'annuaire.
var SERVICE_ANNUAIRE_ID_URL = "<?=$url_ws_annuaire?>";
// Squelette d'URL du web service d'eFlore fournissant les noms de communes.
var SERVICE_NOM_COMMUNE_URL = "http://api.tela-botanica.org/service:eflore:0.1/osm/nom-commune?lon={lon}&lat={lat}";
 
// URL du marqueur à utiliser dans la carte Google Map
var GOOGLE_MAP_MARQUEUR_URL = "<?=$url_base?>modules/saisie/squelettes/arbres-tetards/img/marqueurs/epingle.png";
// URL de l'icône du chargement en cours
var CHARGEMENT_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/arbres-tetards/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/arbres-tetards/img/icones/chargement-image.gif";
// URL de l'icône du calendrier
var CALENDRIER_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/arbres-tetards/img/icones/calendrier.png";
// URL de l'icône du calendrier
var PAS_DE_PHOTO_ICONE_URL = "<?=$url_base?>modules/saisie/squelettes/arbres-tetards/img/icones/pasdephoto.png";
 
//]]>
</script>
<script src="<?=$url_base?>modules/saisie/squelettes/arbres-tetards/js/arbres-tetards.js"></script>
 
<!-- CSS -->
<link rel="stylesheet" href="http://resources.tela-botanica.org/jquery/jquery-ui/1.8.18/css/smoothness/jquery-ui-1.8.18.custom.css" />
<link rel="stylesheet" href="http://resources.tela-botanica.org/bootstrap/2.3.2/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://resources.tela-botanica.org/bootstrap/2.3.2/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="http://resources.tela-botanica.org/bootstrap/modal/2.2.5/css/bootstrap-modal.css" />
<link rel="stylesheet" href="<?=$url_base?>modules/saisie/squelettes/arbres-tetards/css/<?=isset($_GET['style']) ? $_GET['style'] : 'arbres-tetards'?>.css" />
 
</head>
 
<body data-spy="scroll">
<div class="container">
<div class="row-fluid page-header">
<div>
<h1>
<img id="logo-titre" class="span1" src="<?=$url_base?>/modules/saisie/squelettes/arbres-tetards/img/logos/gentiana.png" alt="Gentiana" />
Arbres têtards de l'Isère
</h1>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<div class="row-fluid">
<div id="intro" class ="well collapse in">
<a class="fermer" data-toggle="collapse" data-target="#intro">
<h3 class="titre">
Le projet
<i class="icone icon-plus-sign"></i>
</h3>
</a>
<p>
Les arbres têtards (trognes), sont des arbres taillés exploités depuis des siècles
pour leurs branches ou leurs feuilles.
</p>
<p>
La taille consiste à couper la tête de l’arbre à environ 2m du sol. Les branches
repoussent en couronne au sommet du tronc et sont taillées au même endroit tous
les 5 à 12 ans. De nombreuses espèces de feuillus peuvent être taillées en têtard,
les plus fréquentes sont les saules, les frênes, les peupliers et aussi les muriers.
</p>
<p>
Ces arbres, témoins d’anciennes pratiques agricoles, embellissent le paysage,
retiennent les berges, participent au maintien des zones humides et abritent de
nombreuses espèces végétales et animales dont beaucoup sont menacées.<br />
Victimes de la modernisation de l’agriculture et de l’urbanisation des zones
rurales, ces arbres remarquables disparaissent !
</p>
<p>
C’est pourquoi <a href="http://www.gentiana.org/" target="_blank">Gentiana</a>
a lancé un programme de suivi, de sauvegarde et de restauration des arbres têtards
en Isère. Ce projet a pour but de mieux faire connaître ces arbres, de les entretenir,
de restaurer les arbres à l’abandon et d’en replanter.
</p>
<p>
La première chose à faire est un état des lieux des arbres têtards sur tout le
département de l’Isère.<br />
<strong>Nous avons besoin de vous pour améliorer notre connaissance !</strong><br />
Vous pouvez nous aider en nous signalant les arbres têtards que vous connaissez
à l’aide du formulaire suivant.
</p>
</div>
</div>
</div>
 
<div class="span6">
<div class="row-fluid">
<div id="aide" class="well collapse in">
<a class="fermer" data-toggle="collapse" data-target="#aide">
<h3 class="titre">
Aide
<i class="icone icon-plus-sign"></i>
</h3>
</a>
<p>
Cet outil vous permet de partager simplement vos observations avec
<a href="http://www.gentiana.org/" target="_blank">Gentiana</a> et 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">cartes et galeries photos </a> du site.
</p>
<p class="discretion">
Pour toute question ou remarque,
<a href="<?= $url_remarques ?>?email=cel_remarques@tela-botanica.org&pageSource=<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']); ?>"
target="_blank"
onclick="javascript:window.open(this.getAttribute('href'), 'Tela Botanica - Remarques', config='height=700, width=640, scrollbars=yes, resizable=yes'); return false;">
contactez-nous</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>
<div class="row-fluid">
<div class="well">
<h2>Observateur</h2>
<form id="form-observateur" action="#" class="" autocomplete="on">
<div class="row-fluid">
<div class="span6 control-group has-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" class="control-label"
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" name="courriel" type="text"/>
<input id="id_utilisateur" name="id_utilisateur" type="hidden"/>
</div>
</div>
<div id="zone-courriel-confirmation" class="span6 control-group hidden">
<label for="courriel_confirmation" class="control-label"
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" 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" type="text"/>
</div>
</div>
<div class="span6">
<label for="nom">Nom</label>
<div>
<input id="nom" name="nom" type="text"/>
</div>
</div>
</div>
</form>
</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 id="dialogue-google-map" class="alert alert-info alert-block" style="display: none;">
<a class="close">×</a>
<h4 class="alert-heading">Information sur Google Map</h4>
<div class="contenu"></div>
</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 has-tooltip" type="text" value=""
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" class="has-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 class="span7 control-label">
<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 has-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 has-tooltip"
title="Code INSEE de la commune"></span>)
</span>
</div>
</div>
<form id="form-station" 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"
class="has-tooltip"
title="Centre la carte sur les coordonnées de latitude et longitude saisies."/>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group has-tooltip"
title="Toponyme plus précis que la commune, utilisé localement et se trouvant souvent sur les cartes au 1/25 000." >
<label class="control-label">
Lieu-dit
<input type="text" id="lieudit" class="" name="lieudit"/>
</label>
</div>
<div class="span6 control-group has-tooltip"
title="Lieu précis de l'observation définissant une unité écologique homogène (ex: le pré derrière la maison)." >
<label class="control-label">
Station
<input type="text" id="station" class="" name="station"/>
</label>
</div>
</div>
 
<div class="row-fluid">
<div class="span12 control-group" >
<label class="span12 control-label">
<strong class="obligatoire">*</strong>
Milieu
<select id="milieu" class="span8" name="milieu">
<option selected value="">Sélectionnez un milieu</option>
<?php foreach ($milieux as $milieu => $description) : ?>
<option value="<?=strtolower($milieu)?>">
<?=$milieu?> <?=($description != '') ? "($description)" : '' ?>
</option>
<?php endforeach; ?>
<option value="">Autre : préciser dans les commentaires.</option>
</select>
</label>
</div>
</div>
 
 
<div class="row-fluid">
<div class="span12 control-group has-tooltip"
title="Indiquez la surface en m² de la station au sein de laquelle la plante est présente.">
<label class="span12 control-label">
<strong class="obligatoire">*</strong>
Surface de la station
<select id="station-surface" class="span8 obs-chp-etendu" name="stationSurface"
data-label="Surface couverte dans la station">
<option selected value="">Sélectionnez une surface</option>
<option value="0-5">&lt;5 m²</option>
<option value="5-10">5-10 m²</option>
<option value="10-50">10-50 m²</option>
<option value="50-100">50-100 m²</option>
<option value="100-500">100-500 m²</option>
<option value="500-1000">500-1000 m²</option>
<option value="1000+">&gt; 1000 m²</option>
</select>
</label>
</div>
</div>
 
 
<div class="row-fluid">
<div class="span12">
<label for="milieuCommentaire">Commentaires sur le milieu</label>
<div>
<textarea id="milieu-commentaire" class="span12 obs-chp-etendu" rows="7"
name="milieuCommentaire" data-label="Commentaires sur le milieu"
placeholder="Vous pouvez éventuellement ajouter des informations complémentaires concernant le milieu"></textarea>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="span6">
<form id="form-obs" action="#" autocomplete="on">
<h2>Observation</h2>
<input id="referentiel" type="hidden" value="bdtfx" />
 
<div class="row-fluid">
<div id="taxon-input-groupe" class="span8 has-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 class="span12 control-label">Espèce
<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>
</label>
</div>
</div>
 
<div class="row-fluid">
<div class="span12 control-group has-tooltip"
title="Vous pouvez cliquer sur l'icône de calendrier pour
sélectionner une date dans un calendrier.">
<label class="span12 control-label" title="Veuillez indiquer la date du relevé au format jj/mm/aaaa">
<strong class="obligatoire">*</strong>
Date du relevé
<div class="input-prepend">
<span id="date-icone" class="add-on"></span>
<input id="date" name="date" type="text" placeholder="jj/mm/aaaa" />
</div>
</label>
</div>
</div>
 
<div class="row-fluid">
<div class="span12 control-group has-tooltip"
title="Indiquez ici le pourcentage de recouvrement par la plante sur la surface de la station.">
<label class="span12 control-label">
<strong class="obligatoire">*</strong>
Recouvrement par la plante de la surface de la station
<select id="recouvrement" class="span8 obs-chp-etendu" name="recouvrement"
data-label="Recouvrement au sein de la surface couverte dans la station">
<option selected value="">Sélectionnez un recouvrement</option>
<option value="+">&lt;1 %</option>
<option value="1">1-5 %</option>
<option value="2">5-25 %</option>
<option value="3">25-50 %</option>
<option value="4">50-75 %</option>
<option value="5">75-100 %</option>
</select>
</label>
</div>
</div>
 
<div class="row-fluid">
<div class="span12">
<label for="notes">Notes</label>
<div>
<textarea id="notes" class="span12" 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_ws_upload ?>?projet=<?=isset($_GET['projet']) ? $_GET['projet'] : 'defaut'?>"
method="post" enctype="multipart/form-data">
<h2>Image(s) de cette plante</h2>
<strong>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">
<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 has-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écapitulatif 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 has-tooltip"
type="button" disabled="disabled"
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 2014</p>
</footer>
 
<!-- Fenêtres modales -->
<div id="chargement" class="modal-fenetre" style="display:none;">
<div id="chargement-centrage" class="modal-contenu">
<div class="progress progress-striped active">
<div id="barre-progression-upload" class="bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="10" style="">
<span class="sr-only">0/10 observations transmises</span>
</div>
</div>
<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 d'une observation (indiquée en rouge).<br />
Vous pouvez tenter de la retransmettre en cliquant à nouveau sur le bouton transmettre ou bien la supprimer
et transmettre les suivantes.<br />
Néanmoins, les observations n'apparaissant plus dans la liste "observations à transmettre", ont bien été transmises lors de votre précédente tentative. <br />
Si le problème persiste, vous pouvez signaler le dysfonctionnement sur
<a href="<?= $url_remarques ?>?email=cel_remarques@tela-botanica.org&pageSource=<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']); ?>"
target="_blank"
onclick="javascript:window.open(this.getAttribute('href'), 'Tela Botanica - Remarques', config='height=700, width=640, scrollbars=yes, resizable=yes'); return false;">
le formulaire de signalement d'erreurs</a>.
</p>
</div>
 
<!-- Fenêtres modales -->
<div id="projet-description" class="modal hide fade modal-fullscreen" tabindex="-1" role="dialog"
aria-labelledby="projet-description-titre" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h1 id="projet-description-titre">Les arbres têtards</h1>
</div>
<div class="modal-body">
 
</div>
<div class="modal-footer dsc-clean">
<button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
</div>
</div>
 
<!-- Stats : Google Analytics-->
<script>
//<![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>
/trunk/widget/modules/saisie/Saisie.php
118,7 → 118,7
$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
$projetsAutorises = array('defaut', 'ambrosia', 'florileges', 'sauvages');
$projetsAutorises = array('defaut', 'ambrosia', 'arbres-tetards', 'florileges', 'sauvages');
if (in_array($this->projet, $projetsAutorises) || !$this->projetASquelette()) {
$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
$urlWsNs = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, $this->NS_PROJET, self::WS_NOM);
331,5 → 331,4
}
return $tableauJs;
}
}
?>
}