Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1577 Rev 1580
Line 41... Line 41...
41
function afficherPanneau(selecteur) {
41
function afficherPanneau(selecteur) {
42
	$(selecteur).fadeIn('slow').delay(DUREE_MESSAGE).fadeOut('slow');
42
	$(selecteur).fadeIn('slow').delay(DUREE_MESSAGE).fadeOut('slow');
43
}
43
}
Line 44... Line 44...
44
 
44
 
-
 
45
//+----------------------------------------------------------------------------------------------------------+
-
 
46
// PRÉCHARGEMENT DU FORMULAIRE
-
 
47
$(document).ready(function() {
-
 
48
	if (OBS_ID != '') {
-
 
49
		chargerInfoObs();
-
 
50
	}
-
 
51
});
-
 
52
 
-
 
53
function chargerInfoObs() {
-
 
54
	var urlObs = SERVICE_OBS_URL + '/' + OBS_ID;
-
 
55
	$.ajax({
-
 
56
		url: urlObs,
-
 
57
		type: 'GET',
-
 
58
		success: function(data, textStatus, jqXHR) {
-
 
59
			if (data != undefined) {
-
 
60
				prechargerForm(data);
-
 
61
			} else {
-
 
62
				surErreurChargementInfosObs();
-
 
63
			}
-
 
64
		},
-
 
65
		error: function(jqXHR, textStatus, errorThrown) {
-
 
66
			surErreurChargementInfosObs();
-
 
67
		}
-
 
68
	});
-
 
69
}
-
 
70
 
-
 
71
function prechargerForm(infos) {
-
 
72
	$('input[name="station"]').val(infos.station);
-
 
73
	
-
 
74
	var dateParts = infos.dateObservation.split('-');
-
 
75
	var dateObs = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);
-
 
76
	var dateObsStr = ('0' + dateObs.getDate()).slice(-2) + '/' +
-
 
77
		('0' + (dateObs.getMonth()+1)).slice(-2) + '/' + 
-
 
78
		dateObs.getFullYear();
-
 
79
	$('input[name="date"]').val(dateObsStr);
-
 
80
	
-
 
81
	$.each(infos.extension, function(index, value) {
-
 
82
		if ($('[name="' + index + '"]').hasClass('slider')) {
-
 
83
			console.log('select[name="' + index + '"] option[value="' + value.valeur + '"]');
-
 
84
			$('select[name="' + index + '"] option[value="' + value.valeur + '"]')
-
 
85
				.attr('selected', 'selected');
-
 
86
			var selectedIndexOptions = $('select[name="' + index + '"]').prop('selectedIndex') + 1;
-
 
87
			console.log(selectedIndexOptions);
-
 
88
			$('[name="' + index + '"]').parent().find('.horizontal-slider').slider('value', selectedIndexOptions);
-
 
89
		} else {
-
 
90
			$('[name="' + index + '"]').val(value.valeur);
-
 
91
		}
-
 
92
	});
-
 
93
}
-
 
94
 
-
 
95
 
45
//+----------------------------------------------------------------------------------------------------------+
96
//+----------------------------------------------------------------------------------------------------------+
Line 46... Line 97...
46
//FORM IDENTITE : gestion de l'observateur
97
//FORM IDENTITE : gestion de l'observateur
47
 
98
 
48
$(document).ready(function() {
99
$(document).ready(function() {
Line 71... Line 122...
71
				$('#id_utilisateur').val(infos.id);
122
				$('#id_utilisateur').val(infos.id);
72
				$('#prenom').val(infos.prenom);
123
				$('#prenom').val(infos.prenom);
73
				$('#nom').val(infos.nom);
124
				$('#nom').val(infos.nom);
74
				$('#courriel_confirmation').val(courriel);
125
				$('#courriel_confirmation').val(courriel);
75
				$('#prenom, #nom, #courriel_confirmation').attr('disabled', 'disabled');
126
				$('#prenom, #nom, #courriel_confirmation').attr('disabled', 'disabled');
76
				$('#date').focus();
127
				$('#structure').focus();
77
			} else {
128
			} else {
78
				surErreurCompletionCourriel();
129
				surErreurCompletionCourriel();
79
			}
130
			}
80
		},
131
		},
81
		error: function(jqXHR, textStatus, errorThrown) {
132
		error: function(jqXHR, textStatus, errorThrown) {