Subversion Repositories eFlore/Applications.cel

Rev

Rev 3053 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3025 delphine 1
// Héritage !!
3052 mathias 2
function WidgetSaisieBellesdemarue(langue) {
3049 mathias 3
	this.taxons = {}; // utile ?
3052 mathias 4
	this.langue = langue || "fr";
3055 mathias 5
 
6
	// traduction
7
	this.msgs.nl = {
8
		"format-non-supporte": "Het bestandsformaat wordt niet ondersteund, de ondersteunde formaten zijn",
9
		"date-incomplete": "Formaat : dd/mm/jjjj. Onvolledige datum, gebruik 0, bijvoorbeeld: 00/12/2011",
10
		"probleme-service-nom-commune": "Een probleem is opgetreden bij het aanroepen van de dienst die de naam van de gemeenschappelijke",
11
		"erreur-ajax-commune": "Ajax fout opgetreden bij het zoeken naar de stad",
12
		"observations-transmises": "waarnemingen verzonden",
13
		"supprimer-observation-liste": "Verwijder deze waarneming lijst worden doorgestuurd",
14
		"observe-a": "waargenomen bij",
15
		"certitude": "Zekerheid",
16
		"milieu": "Milieu",
17
		"commentaires": "Opmerkingen",
18
		"inconnue": "onbekend",
19
		"non-lie-au-ref": "niet gerelateerd aan referentiesysteem",
20
		"obs-le": "op"
21
	};
3025 delphine 22
}
23
WidgetSaisieBellesdemarue.prototype = new WidgetSaisie();
24
 
25
//surcharge
26
WidgetSaisieBellesdemarue.prototype.initialiserGoogleMap = function() {
3046 mathias 27
	// centrage
3025 delphine 28
	this.latLng = new google.maps.LatLng(50.8504500, 4.3487800);// Bruxelles par défaut
29
 
30
	var options = {
31
			zoom: 11, // avant : 16
32
			center: this.latLng,
33
			mapTypeId: google.maps.MapTypeId.HYBRID,
34
			mapTypeControlOptions: {
35
				mapTypeIds: ['OSM',
36
					google.maps.MapTypeId.ROADMAP,
37
					google.maps.MapTypeId.HYBRID,
38
					google.maps.MapTypeId.SATELLITE,
39
					google.maps.MapTypeId.TERRAIN]}
40
		};
41
 
42
	// Ajout de la couche OSM à la carte
43
	osmMapType = new google.maps.ImageMapType({
44
		getTileUrl: function(coord, zoom) {
45
			return 'http://tile.openstreetmap.org/' + zoom + '/' + coord.x + '/' + coord.y + '.png';
46
		},
47
		tileSize: new google.maps.Size(256, 256),
48
		isPng: true,
49
		alt: 'OpenStreetMap',
50
		name: 'OSM',
51
		maxZoom: 19
52
	});
53
 
54
	// Création de la carte Google
55
	this.map = new google.maps.Map(document.getElementById('map-canvas'), options); //affiche la google map dans la div map_canvas
56
	this.map.mapTypes.set('OSM', osmMapType);
57
 
58
	// Création du Geocoder
59
	this.geocoder = new google.maps.Geocoder();
60
 
61
	// Marqueur google draggable
62
	this.marker = new google.maps.Marker({
63
		map: this.map,
64
		draggable: true,
65
		title: 'Ma station',
66
		icon: this.googleMapMarqueurUrl,
67
		position: this.latLng
68
	});
69
 
70
	this.initialiserMarker(this.latLng);
71
 
72
	// intéraction carte
73
	$("#geolocaliser").on('click', this.geolocaliser.bind(this));
74
	google.maps.event.addListener(this.marker, 'dragend', this.surDeplacementMarker.bind(this));
75
	google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
76
};
77
 
3053 mathias 78
// surcharge
79
WidgetSaisieBellesdemarue.prototype.initialiserAutocompleteCommune = function() {
80
	var geocoderOptions = {
81
	},
82
	addressSuffix = '',
83
	lthis = this;
84
 
85
	if (this.lang == "nl") {
86
		geocoderOptions.region = 'be';
87
		addressSuffix = ', België';
88
	} else {
89
		geocoderOptions.region = 'fr';
90
		addressSuffix = ', France';
91
	}
92
 
93
	$("#carte-recherche").autocomplete({
94
		//Cette partie utilise geocoder pour extraire des valeurs d'adresse
95
		source: function(request, response) {
96
			geocoderOptions.address = request.term + addressSuffix;
97
			lthis.geocoder.geocode( geocoderOptions, function(results, status) {
98
				if (status == google.maps.GeocoderStatus.OK) {
99
					response($.map(results, function(item) {
100
						var retour = {
101
							label: item.formatted_address,
102
							value: item.formatted_address,
103
							latitude: item.geometry.location.lat(),
104
							longitude: item.geometry.location.lng()
105
						};
106
						return retour;
107
					}));
108
				} else {
109
					lthis.afficherErreurGoogleMap(status);
110
				}
111
			});
112
		},
113
		// Cette partie est executee a la selection d'une adresse
114
		select: function(event, ui) {
115
			lthis.latLng = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
116
			lthis.deplacerMarker(lthis.latLng);
117
		}
118
	});
119
};
120
 
3025 delphine 121
//surcharge
122
WidgetSaisieBellesdemarue.prototype.initForm = function() {
123
	// super() à la main - toute autre manière de faire est über-komplex
124
	WidgetSaisie.prototype.initForm.call(this);
125
 
126
	this.surChangementTaxonListe();
127
	$('#taxon-liste').on('change', this.surChangementTaxonListe);
128
	if (this.debug) {
129
		console.log('Selected taxon:'+$('#taxon-liste option:selected').val());
130
	}
3048 mathias 131
 
132
	// vidage du champ de recherche Google Maps
133
	$('#carte-recherche').val('');
134
 
135
	// vidage du taxon précédemment saisi avec l'autocomplétion, sans quoi on
136
	// perd son nn
137
	$('#taxon').val('');
138
	$('#taxon').data('numNomSel', ''); // et on vide le nn précédent
139
	this.surChangementValeurTaxon();
3025 delphine 140
	$('#taxon-liste').on('blur', this.surChangementValeurTaxon);
141
	$('#taxon').on('blur', this.surChangementValeurTaxon);
3046 mathias 142
 
143
	this.surChangementMilieuListe();
144
	$('#milieu').on('change', this.surChangementMilieuListe);
3025 delphine 145
};
146
 
147
//surcharge
148
WidgetSaisieBellesdemarue.prototype.initEvts = function() {
149
	var lthis = this;
150
	// super() à la main - toute autre manière de faire est über-komplex
151
	WidgetSaisie.prototype.initEvts.call(this);
152
 
153
	$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) {
154
		event.stopPropagation();
155
	});
156
	$('#fichier').off(); // elever l'écouteur d'événements de base
157
	$('#fichier').on('click change', function(event) {
158
		if ($(this).val().length > 0) {
159
			arreter(event);
160
			var options = {
161
				success: lthis.afficherMiniature.bind(lthis), // post-submit callback
162
				dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
163
				resetForm: true // reset the form after successful submit
164
			};
165
			$('#miniature').append(
166
				'<img id="miniature-chargement" class="miniature" alt="chargement" src="'+ this.chargementImageIconeUrl +'"/>');
167
			$('#ajouter-obs').attr('disabled', 'disabled');
168
			if (lthis.verifierFormat($(this).val())) {
169
				$('#form-upload').ajaxSubmit(options);
170
			} else {
171
				$('#form-upload')[0].reset();
3055 mathias 172
				window.alert(lthis.msg("format-non-supporte") + ' ' + $('#fichier').attr('accept'));
3025 delphine 173
			}
174
			return false;
175
		}
176
	});
177
 
178
	$('.cb-milieux').on('click', function(event) {
179
		$(this).valid();
180
		event.stopPropagation();
181
	});
182
 
183
	// Défilement des photos
184
	$('body').on('click', '.defilement-control-zone', function(event) {
185
		lthis.defilerMiniatures($(this));
186
	});
187
	$('body').on('mouseover', '.defilement-control-zone', function(event) {
188
		$('.defilement-control', this).removeClass('hidden');
189
	});
190
	$('body').on('mouseout', '.defilement-control-zone', function(event) {
191
		$('.defilement-control', this).addClass('hidden');
192
	});
193
 
194
	$('#photo-placeholder').click(function(event) {
195
		$('#fichier').click();
196
	});
197
	$('#geolocaliser').on('click', this.geolocaliser.bind(this));
198
 
199
};
200
 
201
// surcharge
202
WidgetSaisieBellesdemarue.prototype.configurerFormValidator = function() {
3055 mathias 203
	var lthis = this;
3025 delphine 204
	$.validator.addMethod(
205
		'dateCel',
206
		function (value, element) {
207
			return value == '' || (/^[0-9]{2}[-\/][0-9]{2}[-\/][0-9]{4}$/.test(value));
208
		},
3055 mathias 209
		lthis.msg("date-incomplete"));
3025 delphine 210
 
211
	$.extend($.validator.defaults, {
212
		ignore: [],// Forcer Jquery Validate à examiner les éléments avec en display:none;
213
		highlight: function(element) {
214
			$(element).closest('.control-group').removeClass('success').addClass('error');
215
		},
216
		success: function(element) {
217
			element.text('OK!').addClass('valid');
218
			element.closest('.control-group').removeClass('error').addClass('success');
219
 
220
			if (element.attr('id') == 'taxon' && $('#taxon').val() != '') {
221
				// Si le taxon n'est pas lié au référentiel, on vide le data associé
222
				if ($('#taxon').data('value') != $('#taxon').val()) {
223
					$('#taxon').data('numNomSel', '');
224
					$('#taxon').data('nomRet', '');
225
					$('#taxon').data('numNomRet', '');
226
					$('#taxon').data('nt', '');
227
					$('#taxon').data('famille', '');
228
				}
229
			}
230
		}
231
	});
232
};
233
 
234
// surcharge
235
WidgetSaisieBellesdemarue.prototype.definirReglesFormValidator = function() {
236
	$('#form-observateur').validate({
237
		rules: {
238
			courriel: {
239
				required: true,
240
				email: true},
241
			courriel_confirmation: {
242
				equalTo: '#courriel'},
243
			prenom: {
244
				required: true},
245
			nom: {
246
				required: true}
247
		}
248
	});
249
	$('#form-obs').validate({
250
		rules: {
251
			latitude : {
252
				required: true,
3046 mathias 253
				range: [-90, 90]
254
			},
3025 delphine 255
			longitude: {
256
				required: true,
3046 mathias 257
				range: [-180, 180]
258
			},
3025 delphine 259
			date: {
260
				required: true,
3046 mathias 261
				'dateCel' : true
262
			},
3025 delphine 263
			'taxon-liste': {
3046 mathias 264
				required: true
265
			},
266
			milieu: {
3025 delphine 267
				required: true,
3046 mathias 268
				minlength: 1
269
			},
270
			certitude: {
271
				required: true
272
			}
3025 delphine 273
		},
274
		errorPlacement: function(error, element) {
275
			if (element.attr('name') == 'date') {
276
				element.parent('.input-prepend').after(error);
3046 mathias 277
			} else if (element.attr('name') == 'certitude') {
278
				error.insertAfter('#certitude-controls');
3047 mathias 279
			} else if (element.attr('name') == 'longitude') { // on ignore "latitude" pour ne pas avoir de double erreur
280
				error.insertBefore('#info-commune');
3025 delphine 281
			} else {
282
				error.insertAfter(element);
283
			}
284
		}
285
	});
286
};
287
 
288
WidgetSaisieBellesdemarue.prototype.validerFormulaire = function() {
3046 mathias 289
	$observateur = $("#form-observateur").valid();
290
	$obs = $("#form-obs").valid();
291
	return ($observateur == true && $obs == true) ? true : false;
3025 delphine 292
};
293
 
294
WidgetSaisieBellesdemarue.prototype.surChangementTaxonListe = function() {
295
	if ($('#taxon-liste').val() === '?') {
296
		$('#taxon-input-groupe').removeClass('hidden');
297
	} else {
3048 mathias 298
		$('#taxon').val(''); // on force à réutiliser l'autocomplétion pour avoir un nn
299
		$('#taxon').data('numNomSel', ''); // on vide le nn précédent
3025 delphine 300
		$('#taxon-input-groupe').addClass('hidden');
301
	}
302
};
303
 
3046 mathias 304
WidgetSaisieBellesdemarue.prototype.surChangementMilieuListe = function() {
305
	if ($('#milieu').val() === 'autres') {
306
		$('#milieu-autre-input-group').removeClass('hidden');
307
	} else {
308
		$('#milieu-autre').val('');
309
		$('#milieu-autre-input-group').addClass('hidden');
310
	}
311
};
312
 
3047 mathias 313
// trouve la commune (zone géo de niveau 8) sous le pointeur, en mode mondial
314
// et pas seulement français (service zoneAdmin et non nomCommune)
3045 mathias 315
WidgetSaisieBellesdemarue.prototype.trouverCommune = function(pos) {
316
	if (this.latLng == null) { // tentative de protection contre le démon de Prémilhat
317
		return;
318
	}
319
	var lthis = this;
320
	$(function() {
321
 
322
		var url_service = lthis.serviceNomCommuneUrl;
323
 
324
		var urlNomCommuneFormatee = url_service.replace('{lat}', pos.lat()).replace('{lon}', pos.lng());
325
		$.ajax({
326
			url : urlNomCommuneFormatee,
327
			type : "GET",
328
			dataType : "jsonp",
329
			beforeSend : function() {
330
				$(".commune-info").empty();
331
				$("#dialogue-erreur .alert-txt").empty();
332
			},
333
			success : function(data, textStatus, jqXHR) {
334
				$(".commune-info").empty();
335
				// en Belgique et en France, en général 8 = patelin @TODO bancal
336
				if ("8" in data) {
337
					$("#commune-nom").append(data["8"].intitule);
338
					$("#marqueur-commune").data('commune', {'nom' : data["8"].nom, 'codeInsee' : null});
339
				}
340
			},
341
			statusCode : {
342
			    500 : function(jqXHR, textStatus, errorThrown) {
343
					if (this.debug) {
3055 mathias 344
						$("#dialogue-erreur .alert-txt").append('<p id="msg">' + this.msg("probleme-service-nom-commune") + '</p>');
3045 mathias 345
						reponse = jQuery.parseJSON(jqXHR.responseText);
346
						var erreurMsg = "";
347
						if (reponse != null) {
348
							$.each(reponse, function (cle, valeur) {
349
								erreurMsg += valeur + "<br />";
350
							});
351
						}
352
 
353
						$("#dialogue-erreur .alert-txt").append('<p class="msg-erreur">Erreur 500 : '+errorThrown+"<br />"+erreurMsg+'</p>');
354
					}
355
			    }
356
			},
357
			error : function(jqXHR, textStatus, errorThrown) {
358
				if (this.debug) {
3055 mathias 359
					$("#dialogue-erreur .alert-txt").append('<p class="msg">' + lthis.msg("erreur-ajax-commune") + '</p>');
3045 mathias 360
					reponse = jQuery.parseJSON(jqXHR.responseText);
361
					var erreurMsg = "";
362
					if (reponse != null) {
363
						$.each(reponse, function (cle, valeur) {
364
							erreurMsg += valeur + "<br />";
365
						});
366
					}
367
 
368
					$("#dialogue-erreur .alert-txt").append('<p class="msg-erreur">Erreur Ajax : '+errorThrown+' (type : '+textStatus+') <br />'+erreurMsg+'</p>');
369
				}
370
			},
371
			complete : function(jqXHR, textStatus) {
372
				var debugMsg = extraireEnteteDebug(jqXHR);
373
				if (debugMsg != '') {
374
					if (this.debug) {
3055 mathias 375
						$("#dialogue-erreur .alert-txt").append('<pre class="msg-debug msg">Debug : '+debugMsg+'</pre>');
3045 mathias 376
					}
377
				}
378
				if ($("#dialogue-erreur .msg").length > 0) {
379
					$("#dialogue-erreur").show();
380
				}
381
			}
382
		});
383
	});
384
};
385
 
3048 mathias 386
// lorsqu'on choisit un taxon dans la liste, ou qu'on en tape un à la main dans
387
// le champ "autre espèce" (avec autocomplétion)
3025 delphine 388
WidgetSaisieBellesdemarue.prototype.surChangementValeurTaxon = function() {
389
	var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
390
	var nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special');
391
	var numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val();
3048 mathias 392
	var nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').text().trim();
393
 
3025 delphine 394
	// Un nom non valide entraine automatiquement une certitude "à déterminer"
395
	if(nomSpecial || !numNomSel) {
3048 mathias 396
		$('#certitude-adeterminer').prop('checked', true);
3025 delphine 397
	} else {
3048 mathias 398
		$('#certitude-adeterminer').prop('checked', false);
3025 delphine 399
	}
3048 mathias 400
 
401
	// stockage temporaire des infos connues
402
	$('#taxon').data('nn', numNomSel);
403
	$('#taxon').data('ns', nomSel);
3025 delphine 404
};
405
 
3048 mathias 406
 
3025 delphine 407
// surcharge
408
WidgetSaisieBellesdemarue.prototype.ajouterObs = function() {
3047 mathias 409
	// Fermeture automatique des dialogue de transmission de données
410
	$('#dialogue-obs-transaction-ko').hide();
411
	$('#dialogue-obs-transaction-ok').hide();
412
 
413
	// obligation de fournir au moins une image
414
	var nbImages = $('#miniatures img').length;
415
	if (nbImages == 0) {
416
		$('#image-obligatoire').show();
417
	} else {
418
		$('#image-obligatoire').hide();
419
	}
420
 
3048 mathias 421
	if (this.validerFormulaire() == true && nbImages > 0) {
3047 mathias 422
		this.masquerPanneau('#dialogue-form-invalide');
3025 delphine 423
		this.obsNbre = this.obsNbre + 1;
3047 mathias 424
		$(".obs-nbre").text(this.obsNbre);
425
		$(".obs-nbre").triggerHandler('changement');
3025 delphine 426
		this.afficherObs();
427
		this.stockerObsData();
428
		this.supprimerMiniatures();
3047 mathias 429
		if(! this.especeImposee) {
3048 mathias 430
			$("#taxon").data("numNomSel", undefined);
3047 mathias 431
		}
432
		$('#barre-progression-upload').attr('aria-valuemax', this.obsNbre);
3055 mathias 433
		$('#barre-progression-upload .sr-only').text('0/'+this.obsNbre+" " + this.msg("observations-transmises"));
3025 delphine 434
	} else {
3047 mathias 435
		this.afficherPanneau('#dialogue-form-invalide');
3025 delphine 436
	}
437
};
438
 
439
// surcharge
440
WidgetSaisieBellesdemarue.prototype.afficherObs = function() {
3048 mathias 441
	// on accepte que la commune soit parfois vide
442
	var commune = $("#commune-nom").text();
443
	if (this.debug) {
444
		console.log(commune);
445
	}
446
	$("#liste-obs").prepend(
447
		'<div id="obs'+this.obsNbre+'" class="row-fluid obs obs'+this.obsNbre+'">'+
448
			'<div class="span12">'+
449
				'<div class="well">'+
450
					'<div class="obs-action pull-right has-tooltip" data-placement="bottom" '+
3055 mathias 451
						'title="' + this.msg("supprimer-observation-liste") + '">'+
3048 mathias 452
						'<button class="btn btn-danger supprimer-obs" value="'+this.obsNbre+'" title="'+this.obsNbre+'">'+
453
							'<i class="icon-trash icon-white"></i>'+
454
						'</button>'+
455
					'</div> '+
456
					'<div class="row-fluid">'+
457
						'<div class="thumbnail span2">'+
458
						this.ajouterImgMiniatureAuTransfert()+
3025 delphine 459
						'</div>'+
3048 mathias 460
						'<div class="span9">'+
461
							'<ul class="unstyled">'+
3025 delphine 462
								'<li>'+
3048 mathias 463
									'<span class="nom-sci">'+this.ajouterNomEspece()+'</span> '+
464
									this.ajouterNumNomSel()+
465
									this.ajouterNomReferentiel()+
466
								'</li>'+
467
								'<li>'+
3055 mathias 468
									this.msg('observe-a')+' '+
3048 mathias 469
									'<span class="commune">'+commune+'</span> '+
470
									' ['+$("#latitude").val()+' / '+$("#longitude").val()+']'+
3055 mathias 471
									' ' + this.msg("obs-le") + ' '+
3048 mathias 472
									'<span class="date">'+$("#date").val()+'</span>'+
473
								'</li>'+
474
								'<li>'+
3055 mathias 475
									'<span>' + this.msg("certitude") + ' :</span> '+$('input[name="certitude"]').val()+' '+
3048 mathias 476
								'</li>'+
477
								'<li>'+
3055 mathias 478
									'<span>' + this.msg("milieu") + ' :</span> '+this.ajouterMilieu()+
3048 mathias 479
								'</li>'+
480
								'<li>'+
3055 mathias 481
									this.msg("commentaires") + ' : <span class="discretion">'+$("#notes").val()+'</span>'+
3048 mathias 482
								'</li>'+
483
							'</ul>'+
484
						'</div>'+
485
					'</div>'+
486
				'</div>'+
3025 delphine 487
			'</div>'+
488
		'</div>');
3048 mathias 489
	$('#zone-liste-obs').removeClass("hidden").show();
3025 delphine 490
};
491
 
3049 mathias 492
// surcharge
493
WidgetSaisieBellesdemarue.prototype.stockerObsData = function() {
494
	var lthis = this;
495
	var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
496
		nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
497
		numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val();
498
	var nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
499
		nomRet = nomHorsListe ? $('#taxon').data('nomRet') : this.taxons[numNomSel]['nom_ret'],
500
		numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : this.taxons[numNomSel]['num_nom_ret'],
501
		numTaxon = nomHorsListe ? $('#taxon').data('nt') : this.taxons[numNomSel]['num_taxon'],
502
		famille = nomHorsListe ? $('#taxon').data('famille') : this.taxons[numNomSel]['famille'],
503
		referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel,
504
		notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + '. ' : '') + $('#notes').val();
505
 
506
		certitude = $('input[name=certitude]:checked').val();
507
		certitude = (certitude == undefined) ? '' : certitude;
508
 
509
	$('#liste-obs').data('obsId'+this.obsNbre, {
510
		'date': $('#date').val(),
511
		'notes': notes,
512
 
513
		'latitude': $('#latitude').val(),
514
		'longitude': $('#longitude').val(),
515
		'commune_nom': $('#commune-nom').text(),
516
 
517
		'nom_sel': nomSel,
518
		'num_nom_sel': numNomSel,
519
		'nom_ret': nomRet,
520
		'num_nom_ret': numNomRet,
521
		'num_taxon': numTaxon,
522
		'famille': famille,
523
		'referentiel': referentiel,
524
		'certitude': certitude,
525
		'milieu': lthis.ajouterMilieu(),
526
 
527
		// Ajout des champs images
528
		'image_nom': lthis.getNomsImgsOriginales(),
529
 
530
		// Ajout des champs étendus de l'obs
531
		'obs_etendue': lthis.getObsChpEtendus()
532
	});
3052 mathias 533
	if (this.debug) {
3049 mathias 534
		console.log($('#liste-obs').data('obsId'+this.obsNbre));
3052 mathias 535
	}
3049 mathias 536
};
537
 
3048 mathias 538
WidgetSaisieBellesdemarue.prototype.ajouterMilieu = function() {
539
	var milieu = $('#milieu').val();
540
	if (milieu == 'autres') {
541
		var autreMilieu = $('#milieu-autre').val();
542
		if (autreMilieu) {
543
			milieu = autreMilieu;
544
		}
545
	}
546
	return milieu;
547
};
548
 
549
WidgetSaisieBellesdemarue.prototype.ajouterNomEspece = function() {
550
	var ns = $('#taxon').data('ns');
551
	if (! ns) {
3055 mathias 552
		ns = this.msg("inconnue");
3048 mathias 553
	}
554
	return ns;
555
};
556
 
557
WidgetSaisieBellesdemarue.prototype.ajouterNomReferentiel = function() {
558
	var nomRef = '';
559
	if ($("#taxon").data("nn")) {
560
		nomRef = '<span class="referentiel-obs">'+
561
			' [' + this.nomSciReferentiel +']'+
562
		'</span>';
563
	}
564
	return nomRef;
565
};
566
 
567
// surcharge
568
WidgetSaisieBellesdemarue.prototype.ajouterNumNomSel = function() {
569
	var nn = '';
570
	if (! $("#taxon").data("nn")) {
3055 mathias 571
		nn = ' <span class="alert-error">[' + this.msg("non-lie-au-ref") + ']</span>';
3025 delphine 572
	} else {
3048 mathias 573
		nn = ' <span class="nn">[nn'+$("#taxon").data("nn")+']</span>';
3025 delphine 574
	}
3048 mathias 575
	return nn;
576
};