Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 3041 Rev 3630
Line 9... Line 9...
9
	<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/validate/1.8.1/jquery.validate.min.js"></script>
9
	<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/validate/1.8.1/jquery.validate.min.js"></script>
10
	<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/validate/1.8.1/messages_fr.js"></script>
10
	<script type="text/javascript" src="https://www.tela-botanica.org/commun/jquery/validate/1.8.1/messages_fr.js"></script>
11
</head>
11
</head>
12
<body>
12
<body>
13
	<script type="text/javascript">
13
	<script type="text/javascript">
14
	//<![CDATA[	
14
	//<![CDATA[
15
	           
15
 
16
	    var donnees = new Array();
16
	    var donnees = new Array();
17
		function envoyerCourriel() {
17
		function envoyerCourriel() {
18
			//console.log('Formulaire soumis');
18
			//console.log('Formulaire soumis');
19
			if ($("#form-contact").valid()) {
19
			if ($("#form-contact").valid()) {
20
				var destinataireId = $("#fc_destinataire_id").attr('value');
20
				var destinataireId = $("#fc_destinataire_id").attr('value');
Line 25... Line 25...
25
				var erreurMsg = "";
25
				var erreurMsg = "";
26
				console.log($(this));
26
				console.log($(this));
27
				$.each($("#form-contact").serializeArray(), function (index, champ) {
27
				$.each($("#form-contact").serializeArray(), function (index, champ) {
28
					var cle = champ.name;
28
					var cle = champ.name;
29
					cle = cle.replace(/^fc_/, '');
29
					cle = cle.replace(/^fc_/, '');
30
					
30
 
31
					if (cle == 'sujet') {
31
					if (cle == 'sujet') {
32
						champ.value += " - Carnet en ligne - Tela Botanica";
32
						champ.value += " - Carnet en ligne - Tela Botanica";
33
					}
33
					}
34
					if (cle == 'message') {
34
					if (cle == 'message') {
35
						champ.value += "\n--\n"+
35
						champ.value += "\n--\n"+
36
							"Dit bericht wordt u toegestuurd via de fotowidget van de ‘Carnet en Ligne’ van het Tela Botanica netwerk.\n"+
36
							"Dit bericht wordt u toegestuurd via de fotowidget van de ‘Carnet en Ligne’ van het Tela Botanica netwerk.\n"+
37
							"http://www.tela-botanica.org/widget:cel:photo";
37
							"http://www.tela-botanica.org/widget:cel:photo";
38
					}
38
					}
39
					
39
 
40
					donnees[index] = {'name':cle,'value':champ.value};
40
					donnees[index] = {'name':cle,'value':champ.value};
41
				});
41
				});
42
				$.ajax({
42
				$.ajax({
43
					type : "POST",
43
					type : "POST",
44
					cache : false,
44
					cache : false,
Line 55... Line 55...
55
						reponse = jQuery.parseJSON(jqXHR.responseText);
55
						reponse = jQuery.parseJSON(jqXHR.responseText);
56
						if (reponse != null) {
56
						if (reponse != null) {
57
							$.each(reponse, function (cle, valeur) {
57
							$.each(reponse, function (cle, valeur) {
58
								erreurMsg += valeur + "\n";
58
								erreurMsg += valeur + "\n";
59
							});
59
							});
60
						}				
60
						}
61
					},
61
					},
62
					complete : function(jqXHR, textStatus) {
62
					complete : function(jqXHR, textStatus) {
63
						var debugMsg = '';
63
						var debugMsg = '';
64
						if (jqXHR.getResponseHeader("X-DebugJrest-Data") != '') {
64
						if (jqXHR.getResponseHeader("X-DebugJrest-Data") != '') {
65
							debugInfos = jQuery.parseJSON(jqXHR.getResponseHeader("X-DebugJrest-Data"));
65
							debugInfos = jQuery.parseJSON(jqXHR.getResponseHeader("X-DebugJrest-Data"));
Line 82... Line 82...
82
					}
82
					}
83
				});
83
				});
84
			}
84
			}
85
			return false;
85
			return false;
86
		}
86
		}
87
		
87
 
88
		function initialiserFormulaireContact() {
88
		function initialiserFormulaireContact() {
89
			$("#form-contact").validate({
89
			$("#form-contact").validate({
90
				rules: {
90
				rules: {
91
					fc_sujet : "required",
91
					fc_sujet : "required",
92
					fc_message : "required",
92
					fc_message : "required",
Line 99... Line 99...
99
				event.preventDefault();
99
				event.preventDefault();
100
				envoyerCourriel();
100
				envoyerCourriel();
101
			});
101
			});
102
			$("#fc_annuler").live("click", function() {window.close();});
102
			$("#fc_annuler").live("click", function() {window.close();});
103
		}
103
		}
104
		
104
 
105
		$(document).ready(function() {
105
		$(document).ready(function() {
106
			initialiserFormulaireContact();
106
			initialiserFormulaireContact();
107
		});
107
		});
108
	//]]>
108
	//]]>
109
	</script>
109
	</script>