10,6 → 10,10 |
this.valeurChamp = ""; |
this.avertissementDeuxPhotosAffiche = false; |
this.taxons = {}; |
this.googleMapMarqueurDebutUrl = null; |
this.googleMapMarqueurFinUrl = null; |
this.ville = null; |
this.supprimerIconeUrl = null; |
} |
WidgetSaisieSauvages.prototype = new WidgetSaisie(); |
|
30,7 → 34,7 |
|
this.surChangementTaxonListe(); |
$('#taxon-liste').on('change', this.surChangementTaxonListe); |
if (DEBUG) { |
if (this.debug) { |
console.log('Selected taxon:'+$('#taxon-liste option:selected').val()); |
} |
$('#taxon-liste').on('blur', this.surChangementValeurTaxon); |
41,9 → 45,14 |
WidgetSaisieSauvages.prototype.initEvts = function() { |
var lthis = this; |
|
$('body').on('click', '.effacer-miniature', function(event) { |
lthis.supprimerMiniature($(this)); |
// super() à la main - toute autre manière de faire est über-komplex |
WidgetSaisie.prototype.initEvts.call(this); |
|
$('.has-tooltip').tooltip('enable'); // @TODO harmoniser .has-tooltip et [rel="tooltip"] |
$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) { |
event.stopPropagation(); |
}); |
$('#fichier').off(); // elever l'écouteur d'événements de base |
$('#fichier').on('click change', function(event) { |
|
if($("#photos-conteneur #miniatures .miniature").length == 1 && ! lthis.avertissementDeuxPhotosAffiche) { |
66,7 → 75,7 |
resetForm: true // reset the form after successful submit |
}; |
$('#miniature').append( |
'<img id="miniature-chargement" class="miniature" alt="chargement" src="'+CHARGEMENT_IMAGE_URL+'"/>'); |
'<img id="miniature-chargement" class="miniature" alt="chargement" src="'+ this.chargementImageIconeUrl +'"/>'); |
$('#ajouter-obs').attr('disabled', 'disabled'); |
if (lthis.verifierFormat($(this).val())) { |
$('#form-upload').ajaxSubmit(options); |
82,15 → 91,6 |
$(this).valid(); |
event.stopPropagation(); |
}); |
$('#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)); |
|
// Défilement des photos |
$('body').on('click', '.defilement-control-zone', function(event) { |
102,25 → 102,11 |
$('body').on('mouseout', '.defilement-control-zone', function(event) { |
$('.defilement-control', this).addClass('hidden'); |
}); |
// Interaction sur le formulaire observateur |
$('#prenom').on('change', this.formaterPrenom.bind(this)); |
$('#nom').on('change', this.formaterNom.bind(this)); |
$('#courriel').on('keyup', this.testerLancementRequeteIdentite.bind(this)); |
$('#courriel').on('blur', this.requeterIdentite.bind(this)); |
$('#courriel_confirmation').on('paste', this.bloquerCopierCollerCourriel.bind(this)); |
|
$('#photo-placeholder').click(function(event) { |
$('#fichier').click(); |
}); |
|
// Interaction générales |
$('.alert .close').on('click', this.fermerPanneauAlert); |
$('.has-tooltip').tooltip('enable'); |
$('#btn-aide').on('click', this.basculerAffichageAide); |
$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) { |
event.stopPropagation(); |
}); |
|
// Autocompletion du champ adresse |
$('#carte-recherche').on('focus', function() { |
$(this).select(); |
170,7 → 156,6 |
$('#geolocaliser').on('click', this.geolocaliser.bind(this)); |
} |
|
|
WidgetSaisieSauvages.prototype.montrerFormIdentite = function() { |
$('#zone-courriel-confirmation, #zone-prenom-nom').css('display', 'block'); |
} |
179,9 → 164,9 |
WidgetSaisieSauvages.prototype.initialiserGoogleMap = function() { |
var lthis = this; |
this.latLngDeb = new google.maps.LatLng(48.8543, 2.3483);// Paris |
if (VILLE == 'Marseille') { |
if (this.ville == 'Marseille') { |
this.latLngDeb = new google.maps.LatLng(43.29545, 5.37458); |
} else if (VILLE == 'Montpellier') { |
} else if (this.ville == 'Montpellier') { |
this.latLngDeb = new google.maps.LatLng(43.61077, 3.87672); |
} |
var options = { |
219,7 → 204,7 |
google.maps.event.addListenerOnce(this.map, 'idle', function(){ |
// Initialisation du marker de début de rue |
lthis.initialiserMarkerDeb(); |
if (OBS_ID != '') { |
if (this.obsId != '') { |
lthis.chargerInfoObs(); |
} else { |
// Tentative de geocalisation si aucune obs à précharger |
279,7 → 264,7 |
map: this.map, |
draggable: true, |
title: 'Début de la portion de rue étudiée', |
icon: GOOGLE_MAP_MARQUEUR_DEBUT_URL, |
icon: this.googleMapMarqueurDebutUrl, |
position: this.latLngDeb |
}); |
google.maps.event.addListener(this.markerDeb, 'dragend', this.surDeplacementMarkerDeb.bind(this)); |
323,7 → 308,7 |
map: this.map, |
draggable: true, |
title: 'Fin de la portion de rue étudiée', |
icon: GOOGLE_MAP_MARQUEUR_FIN_URL, |
icon: this.googleMapMarqueurFinUrl, |
position: this.latLngFin |
}); |
google.maps.event.addListener(this.markerFin, 'dragend', this.surDeplacementMarkerFin.bind(this)); |
444,7 → 429,7 |
|
WidgetSaisieSauvages.prototype.getUrlAutocompletionNomsSci = function() { |
var mots = $('#taxon').val(), |
url = SERVICE_AUTOCOMPLETION_NOM_SCI_URL_TPL.replace('{referentiel}',NOM_SCI_REFERENTIEL); |
url = this.serviceAutocompletionNomSciUrlTpl.replace('{referentiel}', this.nomSciReferentiel); |
url = url.replace('{masque}', mots); |
return url; |
} |
457,7 → 442,7 |
var nom = {label: '', value: '', nt: '', nomSel: '', nomSelComplet: '', numNomSel: '', |
nomRet: '', numNomRet: '', famille: '', retenu: false |
}; |
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) { |
if (suggestions.length >= this.autocompletionElementsNbre) { |
nom.label = '...'; |
nom.value = $('#taxon').val(); |
suggestions.push(nom); |
608,7 → 593,7 |
maxDate: new Date, |
showOn: 'button', |
buttonImageOnly: true, |
buttonImage: CALENDRIER_ICONE_URL, |
buttonImage: this.calendrierIconeUrl, |
buttonText: 'Afficher le calendrier pour saisir la date.', |
showButtonPanel: true, |
onSelect: function(date) { |
645,9 → 630,9 |
var debRue = (this.latLngDeb == undefined || this.latLngDeb == this.latLngFin) ? false : true, |
finRue = (this.latLngFin == undefined || this.latLngDeb == this.latLngFin) ? false : true; |
if (debRue == false || finRue == false) { |
afficherPanneau('#dialogue-form-invalide-rue'); |
this.afficherPanneau('#dialogue-form-invalide-rue'); |
} else { |
afficherPanneau('#dialogue-form-invalide'); |
this.afficherPanneau('#dialogue-form-invalide'); |
} |
this.montrerFormIdentite(); |
} |
658,7 → 643,7 |
var numNomSel = ($('#taxon-liste').val() == '?') ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(), |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'), |
taxon = ($('#taxon-liste').val() == '?') ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'), |
referentiel = (numNomSel == undefined) ? '' : '['+NOM_SCI_REFERENTIEL+']', |
referentiel = (numNomSel == undefined) ? '' : '['+ this.nomSciReferentiel +']', |
commune = $('#commune-nom').text(), |
codeInsee = $('#commune-code-insee').text(), |
station = $('input[name="adresse"]').val(), |
727,7 → 712,7 |
premiere = true, |
numero = 1; |
if ($('#miniatures img').length == 0) { |
html = '<img class="miniature" alt="Aucune photo"src="'+PAS_DE_PHOTO_ICONE_URL+'" />'; |
html = '<img class="miniature" alt="Aucune photo"src="'+ this.pasDePhotoIconeUrl +'" />'; |
} else if ($('#miniatures img').length >= 1) { |
$('#miniatures img').each(function() { |
var visible = premiere ? 'miniature-selectionnee' : 'miniature-cachee', |
804,7 → 789,7 |
|
// surcharge |
WidgetSaisieSauvages.prototype.surChangementReferentiel = function() { |
NOM_SCI_REFERENTIEL = $('#referentiel').val(); |
this.nomSciReferentiel = $('#referentiel').val(); |
$('#taxon').val(''); |
} |
|
819,7 → 804,7 |
numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : taxons[numNomSel]['num_nom_ret'], |
numTaxon = nomHorsListe ? $('#taxon').data('nt') : taxons[numNomSel]['num_taxon'], |
famille = nomHorsListe ? $('#taxon').data('famille') : taxons[numNomSel]['famille'], |
referentiel = (numNomSel == undefined) ? '' : NOM_SCI_REFERENTIEL, |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel, |
notes = (nomSpecial ? taxons[numNomSel]['nom_fr'] + '. ' : '') + $('#notes').val(); |
|
certitude = $('input[name=certitude]:checked').val(); |
851,7 → 836,7 |
// Ajout des champs étendus de l'obs |
'obs_etendue': lthis.getObsChpEtendus() |
}); |
if (DEBUG) { |
if (this.debug) { |
console.log($('#liste-obs').data('obsId'+this.obsNbre)); |
} |
} |