Subversion Repositories eFlore/Applications.cel

Rev

Rev 3046 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3046 Rev 3047
Line 105... Line 105...
105
	$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) {
105
	$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) {
106
		event.stopPropagation();
106
		event.stopPropagation();
107
	});
107
	});
108
	$('#fichier').off(); // elever l'écouteur d'événements de base
108
	$('#fichier').off(); // elever l'écouteur d'événements de base
109
	$('#fichier').on('click change', function(event) {
109
	$('#fichier').on('click change', function(event) {
110
		
-
 
111
		if($("#photos-conteneur #miniatures .miniature").length == 1 && ! lthis.avertissementDeuxPhotosAffiche) {
-
 
112
			messageAvertissement = "Attention: \n"+
-
 
113
			"Sélectionnez uniquement les photos correspondantes à une seule plante \n"+
-
 
114
			"(c'est à dire correspondant à un seul individu d'une espèce donnée) \n"+
-
 
115
			"vue dans le tronçon de rue inventoriée ";
-
 
116
			if(window.confirm(messageAvertissement)) {
-
 
117
				lthis.avertissementDeuxPhotosAffiche = true;
-
 
118
				return true;
-
 
119
			} else {
-
 
120
				return false;
-
 
121
			}
-
 
122
		}
-
 
123
		if ($(this).val().length > 0) {
110
		if ($(this).val().length > 0) {
124
			arreter(event);
111
			arreter(event);
125
			var options = {
112
			var options = {
126
				success: lthis.afficherMiniature.bind(lthis), // post-submit callback
113
				success: lthis.afficherMiniature.bind(lthis), // post-submit callback
127
				dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
114
				dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type)
Line 277... Line 264...
277
			}
264
			}
278
		},
265
		},
279
		errorPlacement: function(error, element) {
266
		errorPlacement: function(error, element) {
280
			if (element.attr('name') == 'date') {
267
			if (element.attr('name') == 'date') {
281
				element.parent('.input-prepend').after(error);
268
				element.parent('.input-prepend').after(error);
282
			/*} else if (element.attr('name') == 'milieux[]') {
-
 
283
				error.insertAfter('#milieux-controls');*/
-
 
284
			} else if (element.attr('name') == 'certitude') {
269
			} else if (element.attr('name') == 'certitude') {
285
				error.insertAfter('#certitude-controls');
270
				error.insertAfter('#certitude-controls');
-
 
271
			} else if (element.attr('name') == 'longitude') { // on ignore "latitude" pour ne pas avoir de double erreur
-
 
272
				error.insertBefore('#info-commune');
286
			} else {
273
			} else {
287
				error.insertAfter(element);
274
				error.insertAfter(element);
288
			}
275
			}
289
		}
276
		}
290
	});
277
	});
Line 312... Line 299...
312
		$('#milieu-autre').val('');
299
		$('#milieu-autre').val('');
313
		$('#milieu-autre-input-group').addClass('hidden');
300
		$('#milieu-autre-input-group').addClass('hidden');
314
	}
301
	}
315
};
302
};
Line -... Line 303...
-
 
303
 
-
 
304
// trouve la commune (zone géo de niveau 8) sous le pointeur, en mode mondial
316
 
305
// et pas seulement français (service zoneAdmin et non nomCommune)
317
WidgetSaisieBellesdemarue.prototype.trouverCommune = function(pos) {
306
WidgetSaisieBellesdemarue.prototype.trouverCommune = function(pos) {
318
	if (this.latLng == null) { // tentative de protection contre le démon de Prémilhat
307
	if (this.latLng == null) { // tentative de protection contre le démon de Prémilhat
319
		return;
308
		return;
320
	}
309
	}
Line 332... Line 321...
332
				$(".commune-info").empty();
321
				$(".commune-info").empty();
333
				$("#dialogue-erreur .alert-txt").empty();
322
				$("#dialogue-erreur .alert-txt").empty();
334
			},
323
			},
335
			success : function(data, textStatus, jqXHR) {
324
			success : function(data, textStatus, jqXHR) {
336
				$(".commune-info").empty();
325
				$(".commune-info").empty();
337
				// mode mondial (service zoneAdmin et non nomCommune) :
-
 
338
				// en Belgique et en France, en général 8 = patelin @TODO bancal
326
				// en Belgique et en France, en général 8 = patelin @TODO bancal
339
				if ("8" in data) {
327
				if ("8" in data) {
340
					$("#commune-nom").append(data["8"].intitule);
328
					$("#commune-nom").append(data["8"].intitule);
341
					$("#marqueur-commune").data('commune', {'nom' : data["8"].nom, 'codeInsee' : null});
329
					$("#marqueur-commune").data('commune', {'nom' : data["8"].nom, 'codeInsee' : null});
342
				}
330
				}
Line 397... Line 385...
397
		$('#certitude-adeterminer').attr('checked', 'checked');
385
		$('#certitude-adeterminer').attr('checked', 'checked');
398
	} else {
386
	} else {
399
		$('#certitude-adeterminer').removeAttr('checked');
387
		$('#certitude-adeterminer').removeAttr('checked');
400
	}
388
	}
401
};
389
};
-
 
390
*/
Line 402... Line 391...
402
 
391
 
403
// surcharge
392
// surcharge
-
 
393
WidgetSaisieBellesdemarue.prototype.ajouterObs = function() {
-
 
394
	// Fermeture automatique des dialogue de transmission de données
-
 
395
	// @WARNING TEST
-
 
396
	$('#dialogue-obs-transaction-ko').hide();
-
 
397
	$('#dialogue-obs-transaction-ok').hide();
-
 
398
 
-
 
399
	// obligation de fournir au moins une image
-
 
400
	var nbImages = $('#miniatures img').length;
-
 
401
	if (nbImages == 0) {
-
 
402
		$('#image-obligatoire').show();
-
 
403
	} else {
-
 
404
		$('#image-obligatoire').hide();
-
 
405
	}
404
WidgetSaisieBellesdemarue.prototype.ajouterObs = function() {
406
 
-
 
407
	if (this.validerFormulaire() == true && nbImages == 0) {
405
	if (this.validerFormulaire() == true) {
408
		this.masquerPanneau('#dialogue-form-invalide');
406
		this.obsNbre = this.obsNbre + 1;
409
		this.obsNbre = this.obsNbre + 1;
407
		$('.obs-nbre').text(this.obsNbre);
410
		$(".obs-nbre").text(this.obsNbre);
408
		$('.obs-nbre').triggerHandler('changement');
411
		$(".obs-nbre").triggerHandler('changement');
409
		this.afficherObs();
412
		this.afficherObs();
410
		this.stockerObsData();
413
		this.stockerObsData();
411
		this.supprimerMiniatures();
-
 
412
	} else {
-
 
413
		// Affichage de tous les panneau cachés avec champ obligatoire
-
 
414
		var debRue = (this.latLngDeb == undefined || this.latLngDeb == this.latLngFin) ? false : true,
-
 
415
			finRue = (this.latLngFin == undefined || this.latLngDeb == this.latLngFin) ? false : true;
414
		this.supprimerMiniatures();
416
		if (debRue == false || finRue == false) {
415
		if(! this.especeImposee) {
417
			this.afficherPanneau('#dialogue-form-invalide-rue');
-
 
418
		} else {
416
			$("#taxon").val("");
419
			this.afficherPanneau('#dialogue-form-invalide');
417
			$("#taxon").data("numNomSel",undefined);
-
 
418
		}
-
 
419
		$('#barre-progression-upload').attr('aria-valuemax', this.obsNbre);
-
 
420
		$('#barre-progression-upload .sr-only').text('0/'+this.obsNbre+" observations transmises");
420
		}
421
	} else {
421
		this.montrerFormIdentite();
422
		this.afficherPanneau('#dialogue-form-invalide');
422
	}
423
	}
Line -... Line 424...
-
 
424
};
423
};
425
 
424
 
426
/*
425
// surcharge
427
// surcharge
426
WidgetSaisieBellesdemarue.prototype.afficherObs = function() {
428
WidgetSaisieBellesdemarue.prototype.afficherObs = function() {
427
	var numNomSel = ($('#taxon-liste').val() == '?') ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(),
429
	var numNomSel = ($('#taxon-liste').val() == '?') ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(),