Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3119 → Rev 3120

/trunk/widget/modules/saisie2/squelettes/js/carte.js
New file
0,0 → 1,351
/**
* Constructeur WidgetSaisie par défaut
*/
function WidgetSaisie() {
this.map = null;
this.marker = null;
this.latLng = null; // position en cours
this.geocoder = null;
this.serviceNomCommuneUrl = null;
this.serviceNomCommuneUrlAlt = null;
this.googleMapMarqueurUrl = null;
this.chargementIconeUrl = null;
this.chargementImageIconeUrl = null;
}
 
/**
* Initialisation du widget
*/
WidgetSaisie.prototype.init = function() {
this.initCarto();
this.initEvts();
};
 
/**
* Initialise la cartographie
*/
WidgetSaisie.prototype.initCarto = function() {
this.initialiserGoogleMap();
this.initialiserAutocompleteCommune();
};
 
/**
* Initialise les écouteurs d'événements
*/
WidgetSaisie.prototype.initEvts = function() {
// 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();
}
});
};
 
/**
* Initialise l'autocomplétion de la commune, en fonction du référentiel
*/
WidgetSaisie.prototype.initialiserAutocompleteCommune = function() {
var geocoderOptions = {
},
addressSuffix = '',
lthis = this;
 
switch(this.nomSciReferentiel) {
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;
lthis.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 {
lthis.afficherErreurGoogleMap(status);
}
});
},
// Cette partie est executee a la selection d'une adresse
select: function(event, ui) {
lthis.latLng = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
lthis.deplacerMarker(lthis.latLng);
}
});
};
 
WidgetSaisie.prototype.afficherErreurGoogleMap = function(status) {
if (this.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>');
this.afficherPanneau('#dialogue-google-map');
}
};
 
WidgetSaisie.prototype.surDeplacementMarker = function() {
this.latLng = this.marker.getPosition();
this.trouverCommune(this.latLng);
this.mettreAJourMarkerPosition(this.marker.getPosition());
};
 
WidgetSaisie.prototype.surClickDansCarte = function(event) {
this.latLng = event.latLng;
this.deplacerMarker(this.latLng);
};
 
/**
* Place le marqueur aux coordonnées indiquées dans les champs "latitude" et "longitude"
*/
WidgetSaisie.prototype.geolocaliser = function() {
var latitude = $('#latitude').val();
var longitude = $('#longitude').val();
this.latLng = new google.maps.LatLng(latitude, longitude);
this.deplacerMarker(this.latLng);
};
 
WidgetSaisie.prototype.initialiserGoogleMap = function(localisationNavigateur) {
// par défaut on tente de localiser le navigateur (avec son sextant)
if (localisationNavigateur === undefined) {
localisationNavigateur = true;
}
 
var lthis = this;
var latLng,
zoomDefaut;
// Carte @TODO mettre ça dans la config
if(this.nomSciReferentiel == 'bdtre') {
latLng = new google.maps.LatLng(-21.10, 55.30);// Réunion
zoomDefaut = 7;
} else if(this.nomSciReferentiel == 'lbf') {
latLng = new google.maps.LatLng(33.72211, 35.8603);// Liban
zoomDefaut = 7;
} else if(this.nomSciReferentiel == 'bdtxa') {
latLng = new google.maps.LatLng(14.6, -61.08334);// Fort-De-France
zoomDefaut = 8;
} else if(this.nomSciReferentiel == 'isfan') {
latLng = new google.maps.LatLng(29.28358, 10.21884);// Afrique du Nord
zoomDefaut = 4;
} else if(this.nomSciReferentiel == 'apd') {
latLng = new google.maps.LatLng(8.75624, 1.80176);// Afrique de l'Ouest et du Centre
zoomDefaut = 4;
} else if(this.nomSciReferentiel == 'florical') {
latLng = new google.maps.LatLng(-21.40722, 165.4541);// Nouvelle-Calédonie
zoomDefaut = 7;
} else if(this.nomSciReferentiel == 'aublet') {
latLng = new google.maps.LatLng(3.80287, -53.09692);// Guyane
zoomDefaut = 7;
} else {
latLng = new google.maps.LatLng(46.30871, 2.54395);// Centre de la France - @WARNING Prémilhat !! :)
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
this.map = new google.maps.Map(document.getElementById('map-canvas'), options); //affiche la google map dans la div map_canvas
this.map.mapTypes.set('OSM', osmMapType);
 
// Création du Geocoder
this.geocoder = new google.maps.Geocoder();
 
// Marqueur google draggable
this.marker = new google.maps.Marker({
map: this.map,
draggable: true,
title: 'Ma station',
icon: this.googleMapMarqueurUrl,
position: latLng
});
 
this.initialiserMarker(latLng);
 
// Tentative de geocalisation depuis le navigateur
if (localisationNavigateur && navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
lthis.latLng = new google.maps.LatLng(latitude, longitude);
lthis.deplacerMarker(lthis.latLng);
});
}
 
// intéraction carte
$("#geolocaliser").on('click', this.geolocaliser.bind(this));
google.maps.event.addListener(this.marker, 'dragend', this.surDeplacementMarker.bind(this));
google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
};
 
WidgetSaisie.prototype.initialiserMarker = function(latLng) {
if (this.marker != undefined) {
this.marker.setPosition(latLng);
this.map.setCenter(latLng);
// au chargement de la carte, la position est nulle
this.viderMarkerPosition();
}
};
 
WidgetSaisie.prototype.deplacerMarker = function(latLng) {
if (this.marker != undefined) {
this.marker.setPosition(latLng);
this.map.setCenter(latLng);
this.mettreAJourMarkerPosition(latLng);
this.trouverCommune(latLng);
}
};
 
WidgetSaisie.prototype.viderMarkerPosition = function() {
this.remplirChampLatitude(null);
this.remplirChampLongitude(null);
};
 
WidgetSaisie.prototype.mettreAJourMarkerPosition = function(latLng) {
var lat = latLng.lat().toFixed(5);
var lng = latLng.lng().toFixed(5);
this.remplirChampLatitude(lat);
this.remplirChampLongitude(lng);
};
 
/**
* Définit la valeur de latitude, à travers la "value" du champ "#latitude";
* pour définir une valeur vraiment vide (et non 0), passer null en argument
*/
WidgetSaisie.prototype.remplirChampLatitude = function(latDecimale) {
var lat = '';
if (latDecimale !== null) {
lat = Math.round(latDecimale * 100000) / 100000;
}
$('#latitude').val(lat);
};
 
/**
* Définit la valeur de longitude, à travers la "value" du champ "#longitude";
* pour définir une valeur vraiment vide (et non 0), passer null en argument
*/
WidgetSaisie.prototype.remplirChampLongitude = function(lngDecimale) {
var lng = '';
if (lngDecimale !== null) {
lng = Math.round(lngDecimale * 100000) / 100000;
}
$('#longitude').val(lng);
};
 
WidgetSaisie.prototype.trouverCommune = function(pos) {
if (this.latLng == null) { // tentative de protection contre le démon de Prémilhat
return;
}
var lthis = this;
$(function() {
 
var url_service = lthis.serviceNomCommuneUrl;
 
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 (this.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 (this.debug) {
$("#dialogue-erreur .alert-txt").append('<p class="msg">Une erreur Ajax est survenue lors de la recherche de la commune.</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 (this.debug) {
$("#dialogue-erreur .alert-txt").append('<pre class="msg-debug msg">Débogage : '+debugMsg+'</pre>');
}
}
if ($("#dialogue-erreur .msg").length > 0) {
$("#dialogue-erreur").show();
}
}
});
});
};
/trunk/widget/modules/saisie2/squelettes/js/WidgetSaisie.js
New file
0,0 → 1,390
/**
* Constructeur WidgetSaisie par défaut
*/
function WidgetSaisie() {
this.langue = 'fr';
this.obsNbre = 0;
this.nbObsEnCours = 1;
this.totalObsATransmettre = 0;
this.nbObsTransmises = 0;
this.debug = null;
this.html5 = null;
this.tagProjet = null;
this.tagImg = null;
this.tagObs = null;
this.separationTagImg = null;
this.separationTagObs = null;
this.obsId = null;
this.serviceSaisieUrl = null;
this.serviceObsUrl = null;
this.nomSciReferentiel = null;
this.especeImposee = false;
this.infosEspeceImposee = null;
this.autocompletionElementsNbre = null;
this.referentielImpose = null;
this.serviceAutocompletionNomSciUrl = null;
this.serviceAutocompletionNomSciUrlTpl = null;
this.obsMaxNbre = null;
this.dureeMessage = null;
this.serviceAnnuaireIdUrl = null;
this.serviceNomCommuneUrl = null;
this.serviceNomCommuneUrlAlt = null;
this.chargementIconeUrl = null;
this.chargementImageIconeUrl = null;
this.calendrierIconeUrl = null;
this.pasDePhotoIconeUrl = null;
}
 
/**
* Initialisation du widget
*/
WidgetSaisie.prototype.init = function() {
this.initForm();
this.initEvts();
this.requeterIdentite();
};
 
/**
* Initialise le formulaire, les validateurs, les listes de complétion...
*/
WidgetSaisie.prototype.initForm = function() {
if (this.obsId != '') {
//this.chargerInfoObs();
}
 
this.configurerDatePicker('#date');
this.ajouterAutocompletionNoms();
//this.configurerFormValidator();
//this.definirReglesFormValidator();
 
if(this.especeImposee) {
$("#taxon").attr("disabled", "disabled");
$("#taxon-input-groupe").attr("title","");
// Bricolage cracra pour avoir le nom retenu avec auteur (nom_retenu.libelle ne le mentionne pas)
var nomRetenuComplet = this.infosEspeceImposee["nom_retenu_complet"],
debutAnneRefBiblio = nomRetenuComplet.indexOf(" [");
if (debutAnneRefBiblio != -1) {
nomRetenuComplet = nomRetenuComplet.substr(0, debutAnneRefBiblio);
}
// fin bricolage cracra
var infosAssociee = {
label : this.infosEspeceImposee.nom_sci_complet,
value : this.infosEspeceImposee.nom_sci_complet,
nt : this.infosEspeceImposee.num_taxonomique,
nomSel : this.infosEspeceImposee.nom_sci,
nomSelComplet : this.infosEspeceImposee.nom_sci_complet,
numNomSel : this.infosEspeceImposee.id,
nomRet : nomRetenuComplet,
numNomRet : this.infosEspeceImposee["nom_retenu.id"],
famille : this.infosEspeceImposee.famille,
retenu : (this.infosEspeceImposee.retenu == 'false') ? false : true
};
$("#taxon").data(infosAssociee);
}
};
 
/**
* Initialise les écouteurs d'événements
*/
WidgetSaisie.prototype.initEvts = function() {
var lthis = this;
$('body').on('click', '.effacer-miniature', function() {
$(this).parent().remove();
});
$("#fichier").bind('change', function (e) {
arreter(e);
var options = {
success: lthis.afficherMiniature.bind(lthis), // 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="'+this.chargementImageIconeUrl+'"/>');
$("#ajouter-obs").attr('disabled', 'disabled');
if(lthis.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;
});
// identité
$("#courriel").on('blur', this.requeterIdentite.bind(this));
$("#courriel").on('keypress', this.testerLancementRequeteIdentite.bind(this));
$(".alert .close").on('click', this.fermerPanneauAlert);
$(".has-tooltip").tooltip('enable');
$("#btn-aide").on('click', this.basculerAffichageAide);
$("#prenom").on("change", this.formaterPrenom.bind(this));
$("#nom").on("change", this.formaterNom.bind(this));
 
$("#courriel_confirmation").on('paste', this.bloquerCopierCollerCourriel.bind(this));
/*$("#ajouter-obs").on('click', this.ajouterObs.bind(this));
$(".obs-nbre").on('changement', this.surChangementNbreObs.bind(this));
$("body").on('click', ".supprimer-obs", function() {
var that = this,
suppObs = lthis.supprimerObs.bind(lthis);
// bricolage pour avoir les deux contextes en même temps (objet et elt. du DOM)
suppObs(that);
});
$("#transmettre-obs").on('click', this.transmettreObs.bind(this));
$("#referentiel").on('change', this.surChangementReferentiel.bind(this));
 
$("body").on('click', ".defilement-miniatures-gauche", function(event) {
event.preventDefault();
lthis.defilerMiniatures($(this));
});
$("body").on('click', ".defilement-miniatures-droite", function(event) {
event.preventDefault();
lthis.defilerMiniatures($(this));
});
*/
// fermeture fenêtre
if (this.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.';
});
}
 
};
 
/**
* Retourne true si l'extension de l'image "nom" est .jpg ou .jpeg
*/
WidgetSaisie.prototype.verifierFormat = function(nom) {
var parts = nom.split('.');
extension = parts[parts.length - 1];
return (extension.toLowerCase() == 'jpeg' || extension.toLowerCase() == 'jpg');
};
 
/**
* Affiche la miniature d'une image temporaire (formulaire) qu'on a ajoutée à l'obs
*/
WidgetSaisie.prototype.afficherMiniature = function(reponse) {
if (this.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(this.creerWidgetMiniature(reponse));
}
$('#ajouter-obs').removeAttr('disabled');
};
 
/**
* Crée la miniature d'une image temporaire (formulaire), avec le bouton pour l'effacer
*/
WidgetSaisie.prototype.creerWidgetMiniature = function(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;
};
 
/**
* Efface une miniature (formulaire)
*/
WidgetSaisie.prototype.supprimerMiniature = function(miniature) {
miniature.parents('.miniature').remove();
};
 
/**
* Efface toutes les miniatures (formulaire)
*/
WidgetSaisie.prototype.supprimerMiniatures = function() {
$("#miniatures").empty();
$("#miniature-msg").empty();
};
 
/* Observateur */
WidgetSaisie.prototype.testerLancementRequeteIdentite = function(event) {
if (event.which == 13) {
this.requeterIdentite();
this.event.preventDefault();
this.event.stopPropagation();
}
};
 
WidgetSaisie.prototype.requeterIdentite = function() {
var lthis = this;
var courriel = $("#courriel").val();
var urlAnnuaire = this.serviceAnnuaireIdUrl + courriel;
if (courriel != '') {
$.ajax({
url : urlAnnuaire,
type : "GET",
success : function(data, textStatus, jqXHR) {
if (lthis.debug) {
console.log('SUCCESS: '+textStatus);
}
if (data != undefined && data[courriel] != undefined) {
var infos = data[courriel];
lthis.surSuccesCompletionCourriel(infos, courriel);
} else {
lthis.surErreurCompletionCourriel();
}
},
error : function(jqXHR, textStatus, errorThrown) {
if (lthis.debug) {
console.log('ERREUR: '+textStatus);
}
lthis.surErreurCompletionCourriel();
},
complete : function(jqXHR, textStatus) {
if (lthis.debug) {
console.log('COMPLETE: '+textStatus);
}
// @TODO harmoniser class="hidden" VS style="display:none;"
$("#zone-prenom-nom").removeClass("hidden").show();
$("#zone-courriel-confirmation").removeClass("hidden").show();
}
});
}
};
 
WidgetSaisie.prototype.surSuccesCompletionCourriel = function(infos, 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');
this.focusChampFormulaire();
this.masquerPanneau("#dialogue-courriel-introuvable");
};
 
WidgetSaisie.prototype.surErreurCompletionCourriel = function() {
$("#prenom, #nom, #courriel_confirmation").val('');
$("#prenom, #nom, #courriel_confirmation").removeAttr('disabled');
this.afficherPanneau("#dialogue-courriel-introuvable");
};
 
WidgetSaisie.prototype.formaterNom = function() {
$(this).val($(this).val().toUpperCase());
};
 
WidgetSaisie.prototype.formaterPrenom = function() {
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(' '));
};
 
WidgetSaisie.prototype.bloquerCopierCollerCourriel = function() {
this.afficherPanneau("#dialogue-bloquer-copier-coller");
return false;
};
 
WidgetSaisie.prototype.focusChampFormulaire = function() {
$("#date").focus();
};
 
/* 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');
};
 
/* auto completion nom sci */
WidgetSaisie.prototype.ajouterAutocompletionNoms = function() {
var lthis = this;
$('#taxon').autocomplete({
source: function(requete, add){
// la variable de requête doit être vidée car sinon le parametre "term" est ajouté
requete = "";
if($("#referentiel").val() != "autre") {
var url = lthis.getUrlAutocompletionNomsSci();console.log(url);
$.getJSON(url, requete, function(data) {
var suggestions = lthis.traiterRetourNomsSci(data);
add(suggestions);
});
}
},
html: true
});
 
$("#taxon").bind("autocompleteselect", this.surAutocompletionTaxon);
};
 
WidgetSaisie.prototype.surAutocompletionTaxon = function(event, ui) {
$("#taxon").data(ui.item);
if (ui.item.retenu == true) {
$("#taxon").addClass('ns-retenu');
} else {
$("#taxon").removeClass('ns-retenu');
}
};
 
WidgetSaisie.prototype.getUrlAutocompletionNomsSci = function() {
var mots = $('#taxon').val();
var url = this.serviceAutocompletionNomSciUrlTpl.replace('{referentiel}', this.nomSciReferentiel);
url = url.replace('{masque}', mots);
return url;
};
 
WidgetSaisie.prototype.traiterRetourNomsSci = function(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 >= this.autocompletionElementsNbre) {
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;
};
 
WidgetSaisie.prototype.afficherPanneau = function(selecteur) {
$(selecteur).fadeIn("slow").delay(this.dureeMessage).fadeOut("slow");
};