Subversion Repositories eFlore/Applications.cel

Rev

Rev 2840 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2840 Rev 2904
Line 404... Line 404...
404
 
404
 
405
WidgetSaisie.prototype.initialiserMarker = function(latLng) {
405
WidgetSaisie.prototype.initialiserMarker = function(latLng) {
406
	if (this.marker != undefined) {
406
	if (this.marker != undefined) {
407
		this.marker.setPosition(latLng);
407
		this.marker.setPosition(latLng);
-
 
408
		this.map.setCenter(latLng);
408
		this.map.setCenter(latLng);
409
		// au chargement de la carte, la position est nulle
409
		this.mettreAJourMarkerPosition(latLng);
410
		this.viderMarkerPosition();
410
	}
411
	}
Line 411... Line 412...
411
};
412
};
412
 
413
 
Line 417... Line 418...
417
		this.mettreAJourMarkerPosition(latLng);
418
		this.mettreAJourMarkerPosition(latLng);
418
		this.trouverCommune(latLng);
419
		this.trouverCommune(latLng);
419
	}
420
	}
420
};
421
};
Line -... Line 422...
-
 
422
 
-
 
423
WidgetSaisie.prototype.viderMarkerPosition = function() {
-
 
424
	this.remplirChampLatitude(null);
-
 
425
	this.remplirChampLongitude(null);
-
 
426
};
421
 
427
 
422
WidgetSaisie.prototype.mettreAJourMarkerPosition = function(latLng) {
428
WidgetSaisie.prototype.mettreAJourMarkerPosition = function(latLng) {
423
	var lat = latLng.lat().toFixed(5);
429
	var lat = latLng.lat().toFixed(5);
424
	var lng = latLng.lng().toFixed(5);
430
	var lng = latLng.lng().toFixed(5);
425
	this.remplirChampLatitude(lat);
431
	this.remplirChampLatitude(lat);
426
	this.remplirChampLongitude(lng);
432
	this.remplirChampLongitude(lng);
Line -... Line 433...
-
 
433
};
-
 
434
 
-
 
435
/**
-
 
436
 * Définit la valeur de latitude, à travers la "value" du champ "#latitude";
427
};
437
 * pour définir une valeur vraiment vide (et non 0), passer null en argument
-
 
438
 */
-
 
439
WidgetSaisie.prototype.remplirChampLatitude = function(latDecimale) {
428
 
440
	var lat = '';
-
 
441
	if (latDecimale !== null) {
429
WidgetSaisie.prototype.remplirChampLatitude = function(latDecimale) {
442
		lat = Math.round(latDecimale * 100000) / 100000;
430
	var lat = Math.round(latDecimale * 100000) / 100000;
443
	}
Line -... Line 444...
-
 
444
	$('#latitude').val(lat);
-
 
445
};
-
 
446
 
-
 
447
/**
431
	$('#latitude').val(lat);
448
 * Définit la valeur de longitude, à travers la "value" du champ "#longitude";
-
 
449
 * pour définir une valeur vraiment vide (et non 0), passer null en argument
-
 
450
 */
432
};
451
WidgetSaisie.prototype.remplirChampLongitude = function(lngDecimale) {
-
 
452
	var lng = '';
433
 
453
	if (lngDecimale !== null) {
434
WidgetSaisie.prototype.remplirChampLongitude = function(lngDecimale) {
454
		lng = Math.round(lngDecimale * 100000) / 100000;
Line 435... Line 455...
435
	var lng = Math.round(lngDecimale * 100000) / 100000;
455
	}
436
	$('#longitude').val(lng);
456
	$('#longitude').val(lng);
Line 678... Line 698...
678
				range: [-180, 180]}
698
				range: [-180, 180]}
679
		}
699
		}
680
	});
700
	});
681
	$("#form-obs").validate({
701
	$("#form-obs").validate({
682
		rules: {
702
		rules: {
683
			date : "dateCel",
703
			date : "date",
684
			taxon : "required"
704
			taxon : "required"
685
		}
705
		}
686
	});
706
	});
687
};
707
};
Line 765... Line 785...
765
	// @WARNING TEST
785
	// @WARNING TEST
766
	$('#dialogue-obs-transaction-ko').hide();
786
	$('#dialogue-obs-transaction-ko').hide();
767
	$('#dialogue-obs-transaction-ok').hide();
787
	$('#dialogue-obs-transaction-ok').hide();
Line 768... Line 788...
768
 
788
 
-
 
789
	if (this.validerFormulaire() == true) {
769
	if (this.validerFormulaire() == true) {
790
		this.masquerPanneau('#dialogue-form-invalide');
770
		this.obsNbre = this.obsNbre + 1;
791
		this.obsNbre = this.obsNbre + 1;
771
		$(".obs-nbre").text(this.obsNbre);
792
		$(".obs-nbre").text(this.obsNbre);
772
		$(".obs-nbre").triggerHandler('changement');
793
		$(".obs-nbre").triggerHandler('changement');
773
		this.afficherObs();
794
		this.afficherObs();
Line 792... Line 813...
792
	var commune = $("#commune-nom").text();
813
	var commune = $("#commune-nom").text();
793
	commune = commune.trim() != "" ? commune : $("#carte-recherche").val();
814
	commune = commune.trim() != "" ? commune : $("#carte-recherche").val();
Line 794... Line 815...
794
	
815
	
795
	var code_insee = $('#commune-code-insee').text();
816
	var code_insee = $('#commune-code-insee').text();
796
	code_insee = code_insee.trim() != "" ? "("+code_insee+")" : "";
817
	code_insee = code_insee.trim() != "" ? "("+code_insee+")" : "";
-
 
818
 
797
	
819
	if (this.debug) {
-
 
820
		console.log(commune+'  -  '+code_insee);
Line 798... Line 821...
798
	console.log(commune+'  -  '+code_insee);
821
	}
799
	
822
	
800
	$("#liste-obs").prepend(
823
	$("#liste-obs").prepend(
801
		'<div id="obs'+this.obsNbre+'" class="row-fluid obs obs'+this.obsNbre+'">'+
824
		'<div id="obs'+this.obsNbre+'" class="row-fluid obs obs'+this.obsNbre+'">'+
Line 1209... Line 1232...
1209
			}
1232
			}
1210
        },
1233
        },
1211
        html: true
1234
        html: true
1212
	});
1235
	});
Line 1213... Line 1236...
1213
 
1236
 
-
 
1237
	$("#taxon").bind("autocompleteselect", this.surAutocompletionTaxon);
-
 
1238
};
-
 
1239
 
1214
	$( "#taxon" ).bind("autocompleteselect", function(event, ui) {
1240
WidgetSaisie.prototype.surAutocompletionTaxon = function(event, ui) {
1215
		$("#taxon").data(ui.item);
1241
	$("#taxon").data(ui.item);
1216
		if (ui.item.retenu == true) {
1242
	if (ui.item.retenu == true) {
1217
			$("#taxon").addClass('ns-retenu');
1243
		$("#taxon").addClass('ns-retenu');
1218
		} else {
1244
	} else {
1219
			$("#taxon").removeClass('ns-retenu');
1245
		$("#taxon").removeClass('ns-retenu');
1220
		}
-
 
1221
	});
1246
	}
Line 1222... Line 1247...
1222
};
1247
};
1223
 
1248
 
1224
WidgetSaisie.prototype.getUrlAutocompletionNomsSci = function() {
1249
WidgetSaisie.prototype.getUrlAutocompletionNomsSci = function() {