/trunk/widget/modules/saisie2/squelettes/saisie.tpl.html |
---|
13,7 → 13,7 |
<meta name="robots" content="index,follow" /> |
<meta name="author" content="Tela Botanica" /> |
<meta name="keywords" content="Tela Botanica, CEL" /> |
<meta name="description" content="Widgets de saisie du carnet en ligne" /> |
<meta name="description" content="Gestion des widgets de saisie du carnet en ligne" /> |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no" /> |
<!-- OpenGraph pour Facebook, Pinterest, Google+ --> |
44,13 → 44,13 |
<?php if( $prod ): ?> |
<?php include "analytics.html"; ?> |
<?php endif; ?> |
<!-- <link rel="icon" type="image/x-icon" href="favicon.ico" /> --> |
<link rel="icon" type="image/x-icon" href="favicon.ico" /> |
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" /> |
</head> |
<body> |
<?php |
echo ( $widget['image_fond'] ) ? '<div id="image-fond" style="' . htmlspecialchars( 'background:url("' . $widget['chemin_fichiers'] . 'image_fond.' . preg_replace( '/(?:imag)?e\/?/','',$widget['image_fond']) . '") no-repeat center center;background-size:cover') . '"></div>': ''; |
echo ( $widget['image_fond'] ) ? '<div id="image-fond" style="' . htmlspecialchars( 'background:url("' . $widget['chemin_fichiers'] . 'image_fond.' . preg_replace( '/(?:imag)?e\/?/','',$widget['image_fond']) . '") no-repeat center center') . '"></div>': ''; |
?> |
<!-- <?php //var_dump($widget['especes']['url_ws_autocompletion_ns']); ?> --> |
<div id="zone-appli" class="container" data-projet="<?= $widget['projet']; ?>" data-url-fichiers="<?= $widget['chemin_fichiers']; ?>"> |
164,22 → 164,19 |
</form> |
<!-- Messages d'erreur du formulaire--> |
<div class="zone-alerte"> |
<div id="dialogue-bloquer-copier-coller" class="alert alert-info alert-block hidden"> |
<a class="close">×</a> |
<h4 class="alert-heading"><?= $observateur['alertcc-title']; ?></h4> |
<p><?= $observateur['alertcc']; ?></p> |
<div class="row"> |
<div class="zone-alerte"> |
<div id="dialogue-bloquer-copier-coller" class="alert alert-info alert-block hidden""> |
<a class="close">×</a> |
<h4 class="alert-heading"><?= $observateur['alertcc-title']; ?></h4> |
<p><?= $observateur['alertcc']; ?></p> |
</div> |
<div id="dialogue-utilisateur-non-identifie" class="alert alert-warning alert-block hidden"> |
<a class="close">×</a> |
<h4 class="alert-heading"><?= $observateur['alertni-title']; ?></h4> |
<p><?= $observateur['alertni']; ?></p> |
</div> |
</div> |
<div id="dialogue-utilisateur-non-identifie" class="alert alert-warning alert-block hidden"> |
<a class="close">×</a> |
<h4 class="alert-heading"><?= $observateur['alertni-title']; ?></h4> |
<p><?= $observateur['alertni']; ?></p> |
</div> |
<div id="dialogue-geoloc-ko" class="alert alert-warning alert-block hidden"> |
<a class="close">×</a> |
<h4 class="alert-heading"><?= $observateur['alertgk-title']; ?></h4> |
<p><?= $observateur['alertgk']; ?></p> |
</div> |
</div> |
<form id="form-observation" role="form" autocomplete="on" class="bloc-top"> |
187,7 → 184,7 |
<div id="zone-observation" class="row"> |
<div class="col-md-6"> |
<div class=""> |
<div class="control-group"> |
<label for="geolocalisation" class="col-sm-8 obligatoire" title="<?= $observateur['courriel-title']; ?>"> |
<i class="fa fa-street-view" aria-hidden="true"></i> |
<?= $observation['geolocalisation']; ?> |
194,22 → 191,11 |
</label> |
<div class="col-sm-8 mb-3"> |
<input id="geolocalisation" name="geolocalisation" type="hidden"> |
<!-- retirer "ok" après test --> |
<input type="hidden" id="geoloc" name="geoloc" value="ok" style="display:none"> |
<input type="hidden" id="pays" name="pays" value="" style="display:none"> |
<input type="hidden" id="commune-nom" name="commune-nom" value="" style="display:none"> |
<input type="hidden" id="latitude" name="latitude" value="0.00000" style="display:none"> |
<input type="hidden" id="longitude" name="longitude" value="0.00000" style="display:none"> |
<input type="hidden" id="commune-insee" name="commune-insee" value="" style="display:none"> |
<input type="hidden" id="lieudit" name="lieudit" value="" style="display:none"> |
<input type="hidden" id="station" name="station" value="" style="display:none"> |
<input type="hidden" id="altitude" name="altitude" value="" style="display:none"> |
<tb-geolocation-element id="tb-geolocation"></tb-geolocation-element> |
</div> |
</div> |
<div class=""> |
<div class="control-group"> |
<label for="milieu" class="col-sm-8"> |
<i class="fa fa-street-view" aria-hidden="true"></i> |
<?= $observation['milieu']; ?> |
236,8 → 222,8 |
<i class="fa fa-calendar" aria-hidden="true"></i> |
<?= $observation['date']; ?> |
</label> |
<div class="col-sm-8 mb-3"> |
<input type="date" id="date_releve" name="date_releve" class="form-control" max="<?= date('Y-m-d', time()); ?>" placeholder="jj/mm/aaaa" title="jj/mm/aaaa" required> |
<div class="col-sm-8 mb-3" id="datetimepicker"> |
<input type="text" id="date_releve" name="date_releve" class="form-control date" placeholder="jj/mm/aaaa" pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)" title="jj/mm/aaaa"> |
</div> |
</div> |
272,7 → 258,7 |
<?= $observation['espece']; ?><?php if ( $widget['referentiel'] !== '' && $widget['referentiel'] !== NULL ) echo " (" . $widget['referentiel'] . ")"; ?> |
</label> |
<div class="col-sm-8 mb-3"> |
<input id="taxon" name="taxon" class="form-control" type="text" required> |
<input id="taxon" name="taxon" class="form-control" type="text"> |
</div> |
</div> |
289,13 → 275,13 |
</select> |
</div> |
</div> |
<div class=""> |
<div class="control-group"> |
<label for="notes" class="col-sm-8" title=""> |
<i class="fa fa-pen" aria-hidden="true"></i> |
<?= $observation['notes']; ?> |
</label> |
<div class="col-sm-8 mb-3"> |
<textarea id="notes" form="form-observation" class="col-md-12" rows="7" name="notes" placeholder="<?= $observation['notes_ph']; ?>"></textarea> |
<textarea id="notes" form="form-obs" class="form-control col-md-12" rows="7" name="notes" placeholder="<?= $observation['notes_ph']; ?>"></textarea> |
</div> |
</div> |
320,6 → 306,7 |
$placeholder = ( $champ['fieldValues']['placeholder'] )? ' placeholder="' . $champ['fieldValues']['placeholder'] . '"':''; |
$required = ''; |
$mandatory = ''; |
$datepicker = ''; |
$pattern = ''; |
$obs_radio = ''; |
$help = ''; |
337,9 → 324,10 |
$mandatory = ' obligatoire'; |
} |
// if( 'date' === $champ['element'] ) { |
// $pattern = ' pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)"'; |
// } |
if( 'date' === $champ['element'] ) { |
$datepicker = ' date'; |
$pattern = ' pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)"'; |
} |
switch( $champ['element'] ) { |
case 'radio': |
383,7 → 371,7 |
<label class="col-sm-8<?= $mandatory; ?>"><?= $champ['name'] . $help_button; ?></label> |
<div class="control-group col-sm-8 mb-3"> |
<div class="selectBox"> |
<select class="form-control list-checkbox" id="list-checkbox-<?= $champ['key']; ?>"<?php echo $description . $required; ?> class="form-control"> |
<select class="form-control" id="list-checkbox-<?= $champ['key']; ?>"<?php echo $description . $required; ?> class="form-control"> |
<option>Plusieurs choix possibles</option> |
</select> |
<div class="overSelect"></div> |
461,37 → 449,37 |
case 'range': ?> |
<div class="control-group"> |
<label for="<?= $champ['key']; ?>" class="col-sm-8<?= $help . $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label> |
<div class="col-sm-8 mb-3 row"> |
<div class="col-sm-8 mb-3 <?php echo ($champ['fieldValues']['min'] || $champ['fieldValues']['max']) ? 'row' : '';?>"> |
<?php |
$div_range_min_max = ''; |
if ( $champ['fieldValues']['min'] || $champ['fieldValues']['max'] ) { |
if ( $champ['fieldValues']['min'] ) { |
$div_range_min_max = |
"<p class=\"col-sm-2 range-values text-center font-weight-bold\">". |
"Min " . $champ['fieldValues']['min'] . |
"</p>"; |
} |
$div_range_min_max = ''; |
$div_range_min_max .= '<div class="range-live-value range-values text-center font-weight-bold col-sm-'; |
if ( $champ['fieldValues']['min'] ) { |
$div_range_min_max = |
"<p class=\"col-sm-2 range-values text-center font-weight-bold\">". |
"Min " . $champ['fieldValues']['min'] . |
"</p>"; |
} |
$div_range_min_max .= '<div class="range-live-value range-values text-center font-weight-bold col-sm-'; |
if ( $champ['fieldValues']['min'] && $champ['fieldValues']['max'] ) { |
$div_range_min_max .= '8'; |
} elseif ( $champ['fieldValues']['min'] || $champ['fieldValues']['max'] ) { |
$div_range_min_max .= '10'; |
} else { |
$div_range_min_max .= '12'; |
} |
if ( $champ['fieldValues']['min'] && $champ['fieldValues']['max'] ) { |
$div_range_min_max .= '8">'; |
} else { |
$div_range_min_max .= '10">'; |
} |
$div_range_min_max .= '"></div>'; |
$div_range_min_max .= '</div>'; |
if( $champ['fieldValues']['max'] ) { |
$div_range_min_max .= |
"<p class=\"col-sm-2 range-values text-center font-weight-bold\">". |
"Max " . $champ['fieldValues']['max'] . |
"</p>"; |
if( $champ['fieldValues']['max'] ) { |
$div_range_min_max .= |
"<p class=\"col-sm-2 range-values text-center font-weight-bold\">". |
"Max " . $champ['fieldValues']['max'] . |
"</p>"; |
} |
echo $div_range_min_max; |
} |
echo $div_range_min_max; |
?> |
<input type="<?= $champ['element']; ?>" name="<?= $champ['key']; ?>" class="custom-range <?= $champ['key'] . $help; ?> form-control" <?= $description . $placeholder . $step . $default . $min . $max . $required; ?> data-label="<?= $champ['name']; ?>"> |
</div> |
501,9 → 489,9 |
case 'number': |
case 'date': ?> |
<div class="control-group"> |
<label for="<?= $champ['key']; ?>" class="col-sm-8<?php echo $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label> |
<label for="<?= $champ['key']; ?>" class="col-sm-8<?php echo $datepicker . $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label> |
<div class="col-sm-8 mb-3"> |
<input type="<?= $champ['element']; ?>" name="<?= $champ['key']; ?>" class="<?= $champ['key'] . $help; ?> form-control"<?php echo $pattern . $description . $placeholder . $step . $default . $min . $max . $required; ?> data-label="<?= $champ['name']; ?>"> |
<input type="<?= $champ['element']; ?>" name="<?= $champ['key']; ?>" class="<?= $champ['key'] . $help . $datepicker; ?> form-control"<?php echo $pattern . $description . $placeholder . $step . $default . $min . $max . $required; ?> data-label="<?= $champ['name']; ?>"> |
</div> |
</div> |
<?php break; |
550,9 → 538,9 |
</div> |
<!-- Bouton cr&ation d'une obs --> |
<div class="row mb-3"> |
<div class="row mb-3 bloc-bottom"> |
<div class="centre" title="<?= $resume['creer-title']; ?>"> |
<button id="ajouter-obs" class="btn btn-primary"><i class="fas fa-check-square"></i> <?= $resume['creer']; ?></button> |
<a id="ajouter-obs" class="btn btn-primary"><i class="fas fa-check-square"></i> <?= $resume['creer']; ?></a> |
</div> |
</div> |
575,7 → 563,7 |
</div> |
<!-- Affiche le tableau récapitualif des observations ajoutées --> |
<div id="zone-liste-obs" class="bloc-top hidden"> |
<div id="zone-liste-obs" class="hidden"> |
<div class="alert alert-info"> |
<h2 class="transmission-title"><strong><?= $resume['titre']; ?> <span class="obs-nbre badge badge-info">0</span></strong></h2> |
<button id="transmettre-obs" class="btn btn-primary droite" disabled="disabled" |
645,36 → 633,11 |
</div> |
</div> |
<!-- carto --> |
<?php if( $widget["type_localisation"] === 'point' ): ?> |
<script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-lib-app.js"></script> |
<?php elseif ( $widget["type_localisation"] === 'rue' ) : ?> |
<script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-custom-element.js"></script> |
<?php endif; ?> |
<script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-lib-app_inputs.js"></script> |
<script type="text/javascript"> |
var tbGeolocation = document.getElementById( 'tb-geolocation' ); |
tbGeolocation.addEventListener( 'location', function( location ) { |
console.log( location.detail ); |
var locationDatas = location.detail; |
var latitude = ''; |
var longitude = ''; |
if ( undefined !== locationDatas.geometry.features ) { |
latitude = ( locationDatas.geometry.features[0].geometry.coordinates[0][1] + locationDatas.geometry.features[0].geometry.coordinates[1][1]) / 2; |
longitude = ( locationDatas.geometry.features[0].geometry.coordinates[0][0] + locationDatas.geometry.features[0].geometry.coordinates[1][0]) / 2; |
} else if ( undefined !== locationDatas.geometry.coordinates ) { |
latitude = locationDatas.geometry.coordinates[1]; |
longitude = locationDatas.geometry.coordinates[0]; |
} |
document.getElementById('pays').value = locationDatas.osmCountry; |
document.getElementById('commune-nom').value = locationDatas.locality; |
// À modifier quand on recevra les codes insee |
document.getElementById('commune-insee').value = locationDatas.osmPostcode; |
document.getElementById('latitude').value = latitude; |
document.getElementById('longitude').value = longitude; |
document.getElementById('altitude').value = locationDatas.elevation; |
document.getElementById('geoloc').value = 'ok'; |
<script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-custom-element.js"></script> |
<script> |
var tbGeolocation = document.getElementById('tb-geolocation'); |
tbGeolocation.addEventListener("location", function(location) { |
console.log(location.detail); |
}); |
</script> |
683,7 → 646,7 |
<!-- Jquery UI : nécessaire pour le minicalendrier et l'auto-complétion --> |
<script type="text/javascript" src="https://resources.tela-botanica.org/jquery/jquery-ui/1.11.0/js/jquery-ui.min.js"></script> |
<!-- <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/jquery-ui/1.11.0/js/datepicker-fr.js"></script> --> |
<script type="text/javascript" src="https://resources.tela-botanica.org/jquery/jquery-ui/1.11.0/js/datepicker-fr.js"></script> |
<!-- Jquery Plugins --> |
<!-- Jquery Validate : nécessaire pour la validation des formulaires --> |
<script type="text/javascript" src="https://resources.tela-botanica.org/jquery/validate/1.11.1/jquery.validate.min.js"></script> |
/trunk/widget/modules/saisie2/squelettes/css/saisie.css |
---|
13,10 → 13,6 |
margin-top: 2rem; |
} |
#zone-appli .zone-alerte{ |
width: 100%; |
} |
h1, h2, h3, h4, h5 { |
font-family: Muli,sans-serif; |
} |
471,13 → 467,11 |
#zone-appli #formulaire #form-supp #zone-supp .checkboxes { |
position: absolute; |
z-index: 1001; |
top: 120%; |
z-index: 998; |
left: 1rem; |
right: 1rem; |
background-color: #fff; |
border: 1px solid #ced4da; |
border-top: 0; |
border-radius: 0 0 0.3rem 0.3rem; |
margin-top: -0.3rem; |
} |
508,7 → 502,7 |
/*************************************************************************/ |
.range-values { |
.range-values { |
color: #606060; |
} |
708,41 → 702,10 |
/*************************************/ |
@media screen and ( max-width: 768px ) { |
@media screen and ( max-width: 765px ) { |
#bouton-connexion, #creation-compte { |
display: block; |
width: 100%; |
position: static; |
} |
.navbar-nav, .nav { |
flex-direction: column; |
} |
#transmettre-obs.droite { |
float: none; |
} |
.obs { |
height: auto; |
} |
.obs .unstyled { |
font-size: 0.6rem; |
} |
.obs .nom-sci { |
font-size: 0.8rem; |
} |
.supprimer-obs { |
overflow: hidden; |
} |
#image-fond { |
display: none; |
} |
} |
/trunk/widget/modules/saisie2/squelettes/js/champs-supp.js |
---|
30,6 → 30,7 |
function inputListCheckbox() { |
// On écoute le click sur une list-checkbox ('.selectBox') |
// à tout moment de son insertion dans le dom |
// Todo : |
// _ S'assurer de bien viser la bonne list-checkbox |
// _ Au click sur un autre champ remballer la list-checkbox |
$( document ).click( function( event ) { |
46,25 → 47,10 |
}); |
$( '#zone-appli' ).on( 'click' , '.selectBox' , function() { |
// afficher/cacher le volet des checkboxes et focus |
// $( '.checkboxes[data-id="' + $(this).attr( 'data-id' ) + '"]' ).toggleClass( 'hidden' ); |
$( this ).next().toggleClass( 'hidden' ); |
$( this ).find( 'select' ).toggleClass( 'focus' ); |
// Cacher le volet des autres checkboxes et retirer leur focus |
var $checkboxes = $( this ).next(), |
count = $( '.checkboxes' ).length; |
for ( var i = 0; i < count; i++ ) { |
if ( $( '.checkboxes' )[i] !== $checkboxes[0] && !$checkboxes.hasClass( 'hidden' ) ) { |
var $otherListCheckboxes = $( '.checkboxes' )[i]; |
if ( !$otherListCheckboxes.classList.contains( 'hidden' ) ) { |
$otherListCheckboxes.classList.add( 'hidden' ); |
} |
if( $otherListCheckboxes.previousElementSibling.firstElementChild.classList.contains( 'focus' ) ) { |
$otherListCheckboxes.previousElementSibling.firstElementChild.classList.remove( 'focus' ); |
} |
} |
} |
}); |
} |
75,6 → 61,7 |
$( this ).siblings( '.range-live-value' ).text( $( this ).val() ); |
}); |
$( '#zone-supp' ).on( 'input' , 'input[type="range"]' , function () { |
console.log( 'nello' ); |
$( this ).siblings( '.range-live-value' ).text( $( this ).val() ); |
}); |
} |
259,14 → 246,7 |
const CHEMIN_FICHIERS = $( '#zone-appli' ).data('url-fichiers'); |
jQuery( document ).ready( function() { |
$( '#form-supp' )[0].reset(); |
// console.log( $('#taxon').val() !== '' ); |
// $('#ajouter-obs').click( function() { |
// // console.log( $('#taxon').val() !== '' ); |
// }); |
//pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)" |
// Volet de profil/déconnexion |
connexionDprodownMenu(); |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-lib-app.js |
---|
File deleted |
\ No newline at end of file |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-lib-app_inputs.js |
---|
File deleted |
\ No newline at end of file |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/__MACOSX/._index.html |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/index.html |
---|
10,13 → 10,11 |
</head> |
<body> |
<script src="./tb-geoloc-lib-app_.js"></script> |
<tb-geolocation-element |
id="tb-geolocation" |
> |
<tb-geolocation-element |
id="tb-geolocation"> |
</tb-geolocation-element> |
<script src="./tb-geoloc-custom-element.js"></script> |
<script> |
var tbGeolocation = document.getElementById('tb-geolocation'); |
tbGeolocation.addEventListener("location", function(location) { |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/assets/img/map/marker-icon.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/assets/img/map/photo-marker-icon.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/widget/modules/saisie2/squelettes/js/tb-geoloc/assets/img/map/marker-shadow.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/widget/modules/saisie2/squelettes/js/WidgetSaisie.js |
---|
33,52 → 33,6 |
this.chargementImageIconeUrl = null; |
this.calendrierIconeUrl = null; |
this.pasDePhotoIconeUrl = null; |
// système de traduction minimaliste |
this.msgs = { |
fr: { |
'format-non-supporte': 'Le format de fichier n\'est pas supporté, les formats acceptés sont', |
'date-incomplete': 'Format : jj/mm/aaaa. Date incomplète, utiliser 0, exemple : 00/12/2011.', |
'observations-transmises': 'observations transmises', |
'supprimer-observation-liste': 'Supprimer cette observation de la liste à transmettre', |
'milieu': 'Milieu', |
'commentaires': 'Commentaires', |
'erreur-inconnue': 'Erreur inconnue', |
'non-lie-au-ref': 'non lié au référentiel', |
'obs-le': 'le', |
'quitter-page' : 'Êtes vous sûr de vouloir quiter la page?\nLes observations saisies mais non transmises seront perdues.', |
'courriel-connu' : 'Un compte existe pour ce courriel, connectez-vous pour saisir votre observation', |
'obs-numero' : 'Observation n°', |
'erreur-ajax' : 'Erreur Ajax', |
'erreur' : 'Erreur', |
'erreur-chargement' : 'Erreur lors du chargement de l\'observation', |
'lieu-obs' : 'observé à', |
'lieu-dit' : 'Lieu-dit', |
'station' : 'Station' |
}, |
en: { |
'format-non-supporte': 'The file format is not supported, the accepted formats are', |
'date-incomplete': 'Format: dd / mm / yyyy. Incomplete date, use 0, example: 00/12/2011.', |
'observations-transmises': 'observations transmitted', |
'supprimer-observation-liste': 'Delete this observation from the list to be transmitted', |
'milieu': 'Environment', |
'commentaires': 'Comments', |
'erreur-inconnue': 'Unknown error', |
'non-lie-au-ref': 'unrelated to the referencial ', |
'obs-le': 'the', |
'quitter-page' : 'Are you sure you want to leave the page?\nThe observations entered but not transmitted will be lost.', |
'courriel-connu' : 'An account exists for this email, log in to enter your observation', |
'obs-numero' : 'Observation number ', |
'erreur-ajax' : 'Ajax Error', |
'erreur' : 'Error', |
'erreur-chargement' : 'Error loading the observation', |
'lieu-obs' : 'observed at', |
'lieu-dit' : 'Locality', |
'station' : 'Place' |
} |
}; |
} |
/** |
101,7 → 55,7 |
this.chargerInfoObs(); |
} |
// this.configurerDatePicker( '.date' ); |
this.configurerDatePicker( '.date' ); |
this.ajouterAutocompletionNoms(); |
this.configurerFormValidator(); |
this.definirReglesFormValidator(); |
166,7 → 120,7 |
$( '#form-upload' ).ajaxSubmit( options ); |
} else { |
$( '#form-upload' )[0].reset(); |
window.alert( this.msgTraduction( 'format-non-supporte' ) + ' ' + $( '#fichier' ).attr( 'accept' ) ); |
window.alert( 'Le format de fichier n\'est pas supporté, les formats acceptés sont ' + $( '#fichier' ).attr( 'accept' ) ); |
} |
return false; |
}); |
207,7 → 161,7 |
// fermeture fenêtre |
if ( !this.debug && 0 < $( '.obs' ).length ) { |
$( window ).on( 'beforeunload', function( event ) { |
return this.msgTraduction( 'quitter-page' ); |
return 'Êtes vous sûr de vouloir quiter la page?\nLes observations saisies mais non transmises seront perdues.'; |
}); |
} |
313,7 → 267,7 |
}; |
WidgetSaisie.prototype.surSuccesCompletionCourriel = function( infos, courriel ) { |
$( '#zone-courriel' ).before( '<p class="warning"><i class="fas fa-exclamation-triangle"></i> ' + this.msgTraduction( 'courriel-connu' ) + '</p>' ); |
$( '#zone-courriel' ).before( '<p class="warning"><i class="fas fa-exclamation-triangle"></i> Un compte existe pour ce courriel, connectez-vous pour saisir votre observation</p>' ); |
$( '#bouton-inscription, #zone-prenom-nom, #zone-courriel-confirmation' ).addClass( 'hidden' ); |
$( '#prenom, #nom, #courriel_confirmation' ).attr( 'disabled', 'disabled' ); |
$( '#bouton-connexion a' ).css( 'box-shadow', '0 0 1.5px 1px red' ); |
391,7 → 345,6 |
// @WARNING TEST |
$( '#dialogue-obs-transaction-ko' ).addClass( 'hidden' ); |
$( '#dialogue-obs-transaction-ok' ).addClass( 'hidden' ); |
console.log( this.validerFormulaire() ); |
if ( this.validerFormulaire() ) { |
this.masquerPanneau( '#dialogue-form-invalide' ); |
406,7 → 359,7 |
$( '#taxon' ).data( 'numNomSel', undefined ); |
} |
$( '#barre-progression-upload' ).attr( 'aria-valuemax', this.obsNbre ); |
$( '#barre-progression-upload .sr-only' ).text( '0/' + this.obsNbre + ' ' + this.msgTraduction( 'observations-transmises' ) ); |
$( '#barre-progression-upload .sr-only' ).text( '0/' + this.obsNbre + ' observations transmises' ); |
} else { |
this.afficherPanneau( '#dialogue-form-invalide' ); |
} |
417,116 → 370,70 |
*/ |
WidgetSaisie.prototype.afficherObs = function() { |
var obsHtmlDiff1 = '', |
obsHtmlDiff2 = '', |
obsHtmlDiff3 = '', |
obsHtmlDiff4 = '', |
obsHtmlDiff5 = '', |
obsHtmlDiff6 = '', |
taxon = '', |
commune = '', |
inseeLatitudeLongitude = '', |
lieudit = '', |
station = '', |
milieu = '', |
commentaires = ''; |
// var commune = $( '#commune-nom' ).text(); |
// commune = ( '' !== commune.trim() ) ? commune : $( '#carte-recherche' ).val(); |
if ( undefined != $('#taxon').data( 'numNomSel' ) ) { |
taxon = '<span class="referentiel-obs">' + '[' + this.nomSciReferentiel + ']' + '</span>'; |
} |
if ( 0 < $( '#commune-nom' ).val().length ) { |
commune = ' ' + this.msgTraduction( 'lieu-obs' ) + ' <span class="commune">' + commune + '</span> '; |
} |
if ( 0 < $( '#commune-insee' ).val().length && 0 < $( '#latitude' ).val().length && 0 < $( '#longitude' ).val().length ) { |
inseeLatitudeLongitude = $('#commune-insee').val() + ' [' + $( '#latitude' ).val() + ' / ' + $( '#longitude' ).val() + ']'; |
} |
if ( 0 < $( '#lieudit' ).val().length ) { |
lieudit = '<span>' + this.msgTraduction( 'lieu-dit' ) + ' :</span> ' + $( '#lieudit' ).val() + ' '; |
} |
if ( 0 < $( '#station' ).val().length ) { |
station = '<span>' + this.msgTraduction( 'station' ) + ' :</span> ' + $( '#station' ).val() + ' '; |
} |
if ( 0 < $( '#milieu' ).val().length ) { |
milieu = '<span>' + this.msgTraduction( 'milieu' ) + ' :</span> ' + $( '#milieu' ).val() + ' '; |
} |
if ( 0 < $( '#notes' ).val().length ) { |
commentaires = this.msgTraduction( 'commentaires' ) + ' : <span class="discretion">' + $( '#notes' ).val() + '</span>' + ' '; |
} |
// var code_insee = $('#commune-code-insee').text(); |
// code_insee = ( '' !== code_insee.trim() ) ? '(' + code_insee + ')' : ''; |
if ( window.matchMedia( '(min-width: 576px)' ).matches ) { |
/* La largeur minimum de l'affichage est 600 px inclus */ |
obsHtmlDiff1 = ' droite'; |
obsHtmlDiff2 = '<div></div>'; |
obsHtmlDiff3 = '<div class="row">'; |
obsHtmlDiff4 = ' col-md-2 col-sm-4'; |
obsHtmlDiff5 = ' class="col-md-9 col-sm-7"'; |
obsHtmlDiff6 = '</div>'; |
} |
// if ( this.debug ) { |
// console.log( commune + ' - ' + code_insee ); |
// } |
$( '#liste-obs' ).prepend( |
'<div id="obs' + this.obsNbre + '" class="obs obs' + this.obsNbre + ' mb-2">'+ |
$( '#liste-obs' ).prepend( |
'<div id="obs' + this.obsNbre + '" class="obs obs' + this.obsNbre + ' mb-2">'+ |
'<div '+ |
'class="obs-action" '+ |
'title="' + this.msgTraduction( 'supprimer-observation-liste' ) + '"'+ |
'>'+ |
'<button class="btn btn-danger supprimer-obs' + obsHtmlDiff1 + '" value="'+ this.obsNbre + '" title="' + this.msgTraduction( 'obs-numero' ) + this.obsNbre + '">'+ |
'<div '+ |
'class="obs-action droite" '+ |
'title="Supprimer cette observation de la liste à transmettre"'+ |
'>'+ |
'<button class="btn btn-danger supprimer-obs" value="'+ this.obsNbre + '" title="Observation n°' + this.obsNbre + '">'+ |
'<i class="far fa-trash-alt"></i>'+ |
'</button>'+ |
obsHtmlDiff2 + |
'</div> '+ |
'</button>'+ |
'</div> '+ |
obsHtmlDiff3 + |
'<div class="thumbnail' + obsHtmlDiff4 + '">'+ |
this.ajouterImgMiniatureAuTransfert()+ |
'</div>'+ |
'<div' + obsHtmlDiff5 + '>'+ |
'<ul class="unstyled">'+ |
'<li>'+ |
'<span class="nom-sci">' + $( '#taxon' ).val() + '</span> '+ |
this.ajouterNumNomSel() + |
taxon + |
commune + |
inseeLatitudeLongitude + |
' ' + this.msgTraduction( 'obs-le' ) + ' ' + |
'<span class="date">' + $( '#date_releve' ).val() + '</span>'+ |
'</li>'+ |
'<li>'+ |
lieudit + |
station + |
milieu + |
'</li>'+ |
'<li>'+ |
commentaires + |
'</li>'+ |
'</ul>'+ |
'</div>'+ |
obsHtmlDiff6+ |
'</div>' |
); |
'<div class="row">'+ |
'<div class="thumbnail col-md-2">'+ |
this.ajouterImgMiniatureAuTransfert()+ |
'</div>'+ |
'<div class="col-md-9">'+ |
'<ul class="unstyled">'+ |
'<li>'+ |
'<span class="nom-sci">' + $( '#taxon' ).val() + '</span> '+ |
this.ajouterNumNomSel() + '<span class="referentiel-obs">'+ |
( ( undefined == $('#taxon').data( 'numNomSel' ) ) ? '' : '[' + this.nomSciReferentiel + ']' ) + '</span>'+ |
// ' observé à '+ |
// '<span class="commune">' + commune + '</span> '+ |
// code_insee + ' [' + $( '#latitude' ).val() + ' / ' + $( '#longitude' ).val() + ']'+ |
// ' le '+ |
// '<span class="date">' + $( '#date' ).val() + '</span>'+ |
'</li>'+ |
'<li>'+ |
// '<span>Lieu-dit :</span> ' + $( '#lieudit' ).val() + ' '+ |
// '<span>Station :</span> ' + $( '#station' ).val() + ' '+ |
'<span>Milieu :</span> '+ $ ( '#milieu' ).val() + ' '+ |
'</li>'+ |
'<li>'+ |
'Commentaires : <span class="discretion">' + $( '#notes' ).val() + '</span>'+ |
'</li>'+ |
'</ul>'+ |
'</div>'+ |
'</div>'+ |
'</div>' |
); |
$( '#zone-liste-obs' ).removeClass( 'hidden' ); |
}; |
WidgetSaisie.prototype.fournirDate = function( dateObs ) { |
if ( /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test( dateObs ) ) { |
return dateObs; |
} else if ( /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test( dateObs ) ) { |
var dateArray = dateObs.split( '-' ); |
return dateArray[2] + '/' + dateArray[1] + '/' + dateArray[0] |
} else { |
console.log( 'erreur date : ' + dateObs ) |
} |
} |
WidgetSaisie.prototype.stockerObsData = function() { |
var lthis = this; |
// var commune = $( '#commune-nom' ).text(); |
// commune = ( '' === commune.trim() ) ? commune : $( '#carte-recherche' ).val(); |
$( '#liste-obs' ).data( 'obsId' + this.obsNbre, { |
'date' : lthis.fournirDate( $( '#date_releve' ).val() ), |
'date' : $( '#date' ).val(), |
'notes' : $( '#notes' ).val().trim(), |
'nom_sel' : $( '#taxon' ).val(), |
'num_nom_sel' : $( '#taxon' ).data( 'numNomSel' ), |
535,24 → 442,12 |
'num_taxon' : $( '#taxon' ).data( 'nt' ), |
'famille' : $( '#taxon' ).data( 'famille' ), |
'referentiel' : ( ( undefined === $( '#taxon' ).data( 'numNomSel' ) ) ? '' : lthis.nomSciReferentiel ), |
// 'pays' : $( 'pays' ).val(), |
// 'commune_nom' : $( '#commune-nom' ).val(), |
// 'commune_code_insee' : $( '#commune-code-insee' ).text(), |
// 'commune_code_insee' : $( '#commune-insee' ).val(), |
// 'latitude' : $( '#latitude' ).val(), |
// 'longitude' : $( '#longitude' ).val(), |
// 'commune_nom' : commune, |
// 'commune_code_insee' : $( '#commune-code-insee' ).text(), |
// 'lieudit' : $( '#lieudit' ).val(), |
// 'station' : $( '#station' ).val(), |
// 'altitude' : $( '#altitude' ).val(), |
// début valeurs pour test: |
'commune_nom' : 'Montpellier', |
'commune_code_insee' : '34172', |
'latitude' : '43.608320', |
'longitude' : '3.880196', |
'altitude' : '0', |
//fin valeurs pour test |
'milieu' : $( '#milieu' ).val(), |
//Ajout des champs images |
568,7 → 463,7 |
* Retourne un Array contenant les valeurs des champs étendus |
*/ |
WidgetSaisie.prototype.getObsChpEtendus = function() { |
var champs = new Array(), |
var champs = [], |
$thisForm = $( '#form-supp' ), |
elements = |
'input[type=text]:not(.collect-other),'+ |
579,27 → 474,22 |
'input[type=range]'+ |
'input[type=date],'+ |
'textarea,'+ |
'select:not(.list-checkbox)', |
retour = new Array(); |
'select'; |
$( elements, $thisForm ).each( function() { |
var valeur = $( this ).val(); |
cle = $( this ).attr( 'name' ); |
console.log(valeur); |
var valeur = $( this ).val(), |
cle = $( this ).attr( 'name' ), |
label = $( this ).data( 'label' ); |
if ( '' !== valeur ) { |
if ( cle in champs ) { |
champs[cle] += ';' + valeur; |
} else { |
champs[cle] = valeur; |
} |
var chpEtendu = { |
cle: cle, |
label: label, |
valeur: valeur |
}; |
champs.push( chpEtendu ); |
} |
}); |
for( var key in champs ) { |
retour.push({ 'cle' : key , 'valeur' : champs[key] }); |
}; |
return retour; |
return champs; |
}; |
WidgetSaisie.prototype.surChangementReferentiel = function() { |
712,7 → 602,7 |
}); |
} |
} catch( e ) { |
erreurMsg += 'Erreur inconnue : ' + jqXHR.responseText; |
erreurMsg += 'Erreur inconnue: ' + jqXHR.responseText; |
} |
}, |
complete : function( jqXHR, textStatus ) { |
764,7 → 654,7 |
var pct = ( this.nbObsTransmises / this.totalObsATransmettre ) * 100; |
$( '#barre-progression-upload' ).attr( 'aria-valuenow', this.nbObsTransmises ); |
$( '#barre-progression-upload' ).attr( 'style', 'width: ' + pct + '%' ); |
$( '#barre-progression-upload .sr-only' ).text( this.nbObsTransmises + '/' + this.totalObsATransmettre + ' ' + this.msgTraduction( 'observations-transmises' ) ); |
$( '#barre-progression-upload .sr-only' ).text( this.nbObsTransmises + '/' + this.totalObsATransmettre + ' observations transmises' ); |
if( 0 === this.obsNbre ) { |
$( '.progress' ).removeClass( 'active' ); |
773,13 → 663,12 |
}; |
WidgetSaisie.prototype.validerFormulaire = function() { |
var observateur = $( '#form-observateur' ).valid(); |
var obs = $( '#form-observation' ).valid(); |
var geoloc = ( 'ok' === $( '#geoloc' ).val() ); |
( geoloc ) ? this.masquerPanneau( '#dialogue-geoloc-ko' ) : this.afficherPanneau( '#dialogue-geoloc-ko' ); |
observateur = $( '#form-observateur' ).valid(); |
// station = $( '#form-station' ).valid(); |
obs = ( '' !== $( '#nom-complet' ).text() || ( $( '#form-observation' ).valid() && !$( '#anonyme' ).hasClass( 'hidden' ) ) ) ? true : false; |
( obs ) ? this.masquerPanneau( '#dialogue-utilisateur-non-identifie' ) : this.afficherPanneau( '#dialogue-utilisateur-non-identifie' ); |
return ( observateur && geoloc && obs ); |
return ( observateur /*&& station */&& obs ) ? true : false; |
}; |
WidgetSaisie.prototype.getNomsImgsOriginales = function() { |
822,7 → 711,7 |
WidgetSaisie.prototype.initialiserBarreProgression = function() { |
$( '#barre-progression-upload' ).attr( 'aria-valuenow', 0 ); |
$( '#barre-progression-upload' ).attr( 'style', 'width: 0%' ); |
$( '#barre-progression-upload .sr-only' ).text( '0/0 ' + this.msgTraduction( 'observations-transmises' ) ); |
$( '#barre-progression-upload .sr-only' ).text( '0/0 observations transmises' ); |
$( '.progress' ).addClass( 'active' ); |
$( '.progress' ).addClass( 'progress-striped' ); |
}; |
917,7 → 806,7 |
WidgetSaisie.prototype.ajouterNumNomSel = function() { |
var nn = '<span class="nn">[nn' + $( '#taxon' ).data( 'numNomSel' ) + ']</span>'; |
if ( undefined == $( '#taxon' ).data( 'numNomSel' ) ) { |
nn = '<span class="alert-error">[' + this.msgTraduction( 'non-lie-au-ref' ) + ']</span>'; |
nn = '<span class="alert-error">[non lié au référentiel]</span>'; |
} |
return nn; |
}; |
993,7 → 882,7 |
// @TODO faire mieux que ça ! |
WidgetSaisie.prototype.surErreurChargementInfosObs = function() { |
alert( this.msgTraduction( 'erreur-chargement' ) ); |
alert( 'Erreur lors du chargement de l\'observation' ); |
}; |
WidgetSaisie.prototype.prechargerForm = function( data ) { |
1022,9 → 911,9 |
$.validator.addMethod( |
'dateCel', |
function ( value, element ) { |
return ( '' !== value || ( /^(?:[0-9]{4}-[0-9]{2}-[0-9]{2})|(?:[0-9]{2}\/[0-9]{2}\/[0-9]{4})$/.test( value ) ) ); |
return ( '' === value || ( /(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)/.test( value ) ) ); |
}, |
this.msgTraduction( 'date-incomplete' ) |
'Format : jj/mm/aaaa. Date incomplète, utiliser 0, exemple : 00/12/2011.' |
); |
$.validator.addMethod( |
1066,7 → 955,7 |
unhighlight: function( element ) { |
if ( 'taxon' === $( element ).attr( 'id' ) ) { |
if ( 0 < $( '#taxon' ).val().length ) { |
if ( '' !== $( '#taxon' ).val() ) { |
// Si le taxon n'est pas lié au référentiel, on vide le data associé |
if ( $( '#taxon' ).data( 'value' ) != $( '#taxon' ).val() ) { |
$( '#taxon' ).data( 'numNomSel', '' ); |
1077,8 → 966,6 |
} |
$( '#taxon-input-groupe' ).removeClass( 'error' ); |
$( element ).next( 'span.help-inline' ).remove(); |
} else { |
$( '#taxon-input-groupe' ).addClass( 'error' ); |
} |
} else { |
$( element ).closest( '.control-group' ).removeClass( 'error' ); |
1091,21 → 978,6 |
WidgetSaisie.prototype.definirReglesFormValidator = function() { |
$( '#form-observation' ).validate({ |
rules : { |
date_releve : { |
required : true, |
'dateCel' : true |
}, |
taxon : 'required' |
// latitude : { |
// range: [-90, 90] |
// }, |
// longitude : { |
// range: [-180, 180] |
// } |
} |
}); |
$( '#form-observateur' ).validate({ |
rules : { |
courriel : { |
1119,20 → 991,39 |
} |
} |
}); |
// $( '#form-station' ).validate({ |
// rules: { |
// latitude : { |
// range: [-90, 90] |
// }, |
// longitude : { |
// range: [-180, 180] |
// } |
// } |
// }); |
$( '#form-observation' ).validate({ |
rules : { |
date_releve : { |
required : true, |
'dateCel' : true |
}, |
taxon : 'required' |
} |
}); |
}; |
// /* calendrier */ |
// WidgetSaisie.prototype.configurerDatePicker = function( selector ) { |
// $.datepicker.setDefaults( $.datepicker.regional[ this.langue ] ); |
// $( selector ).datepicker({ |
// dateFormat: 'dd/mm/yyyy', |
// maxDate: new Date, |
// onSelect: function( date ) { |
// $( this ).valid(); |
// } |
// }); |
// $( selector + ' + img.ui-datepicker-trigger' ).appendTo( selector + '-icone.add-on' ); |
// }; |
/* calendrier */ |
WidgetSaisie.prototype.configurerDatePicker = function( selector ) { |
$.datepicker.setDefaults( $.datepicker.regional[ this.langue ] ); |
$( selector ).datepicker({ |
dateFormat: 'dd/mm/yy', |
maxDate: new Date, |
onSelect: function( date ) { |
$( this ).valid(); |
} |
}); |
$( selector + ' + img.ui-datepicker-trigger' ).appendTo( selector + '-icone.add-on' ); |
}; |
WidgetSaisie.prototype.surAutocompletionTaxon = function( event, ui ) { |
$( '#taxon' ).data( ui.item ); |
1207,24 → 1098,6 |
$( selecteur ).addClass( 'hidden' ); |
}; |
/** |
* Si la langue est définie dans this.langue, et si des messages sont définis |
* dans this.msgs, tente de trouver le message dont la clé est [cle] dans la |
* langue en cours. S'il n'est pas trouvé, retourne la version française (par |
* défaut); si celle-ci n'exite pas, retourne "N/A". |
*/ |
WidgetSaisie.prototype.msgTraduction = function( cle ) { |
var msg = 'N/A'; |
if ( this.msgs ) { |
if ( this.langue in this.msgs && cle in this.msgs[this.langue] ) { |
msg = this.msgs[this.langue][cle]; |
} else if ( cle in this.msgs['fr'] ) { |
msg = this.msgs['fr'][cle]; |
} |
} |
return msg; |
}; |
// lib hors objet -- |
/** |