Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2709 Rev 2710
Line 390... Line 390...
390
 
390
 
391
WidgetSaisie.prototype.initialiserMarker = function(latLng) {
391
WidgetSaisie.prototype.initialiserMarker = function(latLng) {
392
	if (this.marker != undefined) {
392
	if (this.marker != undefined) {
393
		this.marker.setPosition(latLng);
393
		this.marker.setPosition(latLng);
-
 
394
		this.map.setCenter(latLng);
-
 
395
		// @WARNING TEST
394
		this.map.setCenter(latLng);
396
		this.mettreAJourMarkerPosition(latLng);
395
	}
397
	}
Line 396... Line 398...
396
};
398
};
397
 
399
 
Line 502... Line 504...
502
	if (courriel != '') {
504
	if (courriel != '') {
503
		$.ajax({
505
		$.ajax({
504
			url : urlAnnuaire,
506
			url : urlAnnuaire,
505
			type : "GET",
507
			type : "GET",
506
			success : function(data, textStatus, jqXHR) {
508
			success : function(data, textStatus, jqXHR) {
-
 
509
				if (lthis.debug) {
507
				//console.log('SUCCESS:'+textStatus);
510
					console.log('SUCCESS: '+textStatus);
-
 
511
				}
508
				if (data != undefined && data[courriel] != undefined) {
512
				if (data != undefined && data[courriel] != undefined) {
509
					var infos = data[courriel];
513
					var infos = data[courriel];
510
					$("#id_utilisateur").val(infos.id);
-
 
511
					$("#prenom").val(infos.prenom);
-
 
512
					$("#nom").val(infos.nom);
-
 
513
					$("#courriel_confirmation").val(courriel);
-
 
514
					$("#prenom, #nom, #courriel_confirmation").attr('disabled', 'disabled');
-
 
515
					lthis.focusChampFormulaire();
-
 
516
					lthis.masquerPanneau("#dialogue-courriel-introuvable");
514
					lthis.surSuccesCompletionCourriel(infos, courriel);
517
				} else {
515
				} else {
518
					lthis.surErreurCompletionCourriel();
516
					lthis.surErreurCompletionCourriel();
519
				}
517
				}
520
			},
518
			},
521
			error : function(jqXHR, textStatus, errorThrown) {
519
			error : function(jqXHR, textStatus, errorThrown) {
-
 
520
				if (lthis.debug) {
522
				//console.log('ERREUR :'+textStatus);
521
					console.log('ERREUR: '+textStatus);
-
 
522
				}
523
				lthis.surErreurCompletionCourriel();
523
				lthis.surErreurCompletionCourriel();
524
			},
524
			},
525
			complete : function(jqXHR, textStatus) {
525
			complete : function(jqXHR, textStatus) {
-
 
526
				if (lthis.debug) {
526
				//console.log('COMPLETE :'+textStatus);
527
					console.log('COMPLETE: '+textStatus);
-
 
528
				}
527
				// @TODO harmoniser class="hidden" VS style="display:none;"
529
				// @TODO harmoniser class="hidden" VS style="display:none;"
528
				$("#zone-prenom-nom").removeClass("hidden").show();
530
				$("#zone-prenom-nom").removeClass("hidden").show();
529
				$("#zone-courriel-confirmation").removeClass("hidden").show();
531
				$("#zone-courriel-confirmation").removeClass("hidden").show();
530
				
-
 
531
			}
532
			}
532
		});
533
		});
533
	}
534
	}
534
};
535
};
Line 535... Line 536...
535
 
536
 
-
 
537
WidgetSaisie.prototype.surSuccesCompletionCourriel = function(infos, courriel) {
-
 
538
	$("#id_utilisateur").val(infos.id);
536
WidgetSaisie.prototype.focusChampFormulaire = function() {
539
	$("#prenom").val(infos.prenom);
-
 
540
	$("#nom").val(infos.nom);
-
 
541
	$("#courriel_confirmation").val(courriel);
-
 
542
	$("#prenom, #nom, #courriel_confirmation").attr('disabled', 'disabled');
-
 
543
	this.focusChampFormulaire();
537
	$("#date").focus();
544
	this.masquerPanneau("#dialogue-courriel-introuvable");
Line 538... Line 545...
538
}
545
};
539
 
546
 
540
WidgetSaisie.prototype.surErreurCompletionCourriel = function() {
547
WidgetSaisie.prototype.surErreurCompletionCourriel = function() {
541
	$("#prenom, #nom, #courriel_confirmation").val('');
548
	$("#prenom, #nom, #courriel_confirmation").val('');
542
	$("#prenom, #nom, #courriel_confirmation").removeAttr('disabled');
549
	$("#prenom, #nom, #courriel_confirmation").removeAttr('disabled');
Line -... Line 550...
-
 
550
	this.afficherPanneau("#dialogue-courriel-introuvable");
-
 
551
};
-
 
552
 
-
 
553
WidgetSaisie.prototype.focusChampFormulaire = function() {
543
	this.afficherPanneau("#dialogue-courriel-introuvable");
554
	$("#date").focus();
544
};
555
};
545
 
556
 
546
WidgetSaisie.prototype.chargerInfoObs = function() {
557
WidgetSaisie.prototype.chargerInfoObs = function() {
547
	var urlObs = this.serviceObsUrl + '/' + this.obsId;
558
	var urlObs = this.serviceObsUrl + '/' + this.obsId;
Line 732... Line 743...
732
 
743
 
733
/**
744
/**
734
 * Ajoute une observation saisie dans le formulaire à la liste des observations à transmettre
745
 * Ajoute une observation saisie dans le formulaire à la liste des observations à transmettre
735
 */
746
 */
-
 
747
WidgetSaisie.prototype.ajouterObs = function() {
-
 
748
	// Fermeture automatique des dialogue de transmission de données
-
 
749
	// @WARNING TEST
-
 
750
	$('#dialogue-obs-transaction-ko').hide();
-
 
751
	$('#dialogue-obs-transaction-ok').hide();
736
WidgetSaisie.prototype.ajouterObs = function() {
752
 
737
	if (this.validerFormulaire() == true) {
753
	if (this.validerFormulaire() == true) {
738
		this.obsNbre = this.obsNbre + 1;
754
		this.obsNbre = this.obsNbre + 1;
739
		$(".obs-nbre").text(this.obsNbre);
755
		$(".obs-nbre").text(this.obsNbre);
740
		$(".obs-nbre").triggerHandler('changement');
756
		$(".obs-nbre").triggerHandler('changement');
Line 801... Line 817...
801
 
817
 
802
WidgetSaisie.prototype.stockerObsData = function() {
818
WidgetSaisie.prototype.stockerObsData = function() {
803
	var lthis = this;
819
	var lthis = this;
804
	$("#liste-obs").data('obsId'+this.obsNbre, {
820
	$("#liste-obs").data('obsId'+this.obsNbre, {
805
		'date' : $("#date").val(),
821
		'date' : $("#date").val(),
Line 806... Line 822...
806
		'notes' : $("#notes").val(),
822
		'notes' : $("#notes").val().trim(),
807
 
823
 
808
		'nom_sel' : $("#taxon").val(),
824
		'nom_sel' : $("#taxon").val(),
809
		'num_nom_sel' : $("#taxon").data("numNomSel"),
825
		'num_nom_sel' : $("#taxon").data("numNomSel"),
Line 868... Line 884...
868
	}
884
	}
869
};
885
};
Line 870... Line 886...
870
 
886
 
871
WidgetSaisie.prototype.transmettreObs = function() {
887
WidgetSaisie.prototype.transmettreObs = function() {
-
 
888
	var observations = $("#liste-obs").data();
-
 
889
	if (this.debug) {
-
 
890
		console.log(observations);
872
	var observations = $("#liste-obs").data();
891
	}
873
	if (observations == undefined || jQuery.isEmptyObject(observations)) {
892
	if (observations == undefined || jQuery.isEmptyObject(observations)) {
874
		this.afficherPanneau("#dialogue-zero-obs");
893
		this.afficherPanneau("#dialogue-zero-obs");
875
	} else {
894
	} else {
876
		this.nbObsEnCours = 1;
895
		this.nbObsEnCours = 1;