Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
424 jpm 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
	<head>
440 jpm 4
		<title>Observations publiques du CEL - Tela Botanica</title>
424 jpm 5
 
6
		<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
440 jpm 7
		<meta http-equiv="Content-style-type" content="text/css" />
8
		<meta http-equiv="Content-script-type" content="text/javascript" />
9
		<meta http-equiv="Content-language" content="fr" />
10
 
11
		<meta name="revisit-after" content="15 days" />
12
        <meta name="robots" content="index,follow" />
13
        <meta name="author" content="Delphine CAUQUIL, Jean-Pascal MILCENT" />
14
        <meta name="keywords" content="Tela Botanica, cartographie, CEL" />
15
        <meta name="description" content="Widget de cartographie des observations publiques de plantes saisies dans le Carnet en Ligne (CEL)" />
16
 
17
		<!-- Spécial mobile -->
424 jpm 18
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
521 jpm 19
 
440 jpm 20
		<!-- Favicones -->
21
		<link rel="icon" type="image/png" href="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.png" />
22
		<link rel="shortcut icon" type="image/x-icon" href="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.ico" />
424 jpm 23
 
440 jpm 24
		<!-- Javascript : bibliothèques -->
521 jpm 25
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.3&amp;sensor=true"></script>
427 jpm 26
		<script type="text/javascript" src="<?=$url_base?>modules/carto/squelettes/markerclusterer_compiled.js"></script>
469 jpm 27
		<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/<?=$jquery_version?>/jquery-<?=$jquery_version?>.min.js"></script>
28
		<script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/tablesorter/2.0.5/jquery.tablesorter.min.js"></script>
424 jpm 29
 
440 jpm 30
		<!-- Javascript : données -->
424 jpm 31
		<script src="<?=$url_json?>" type="text/javascript"></script>
440 jpm 32
 
33
		<!-- Javascript : appli carto -->
424 jpm 34
		<script type="text/javascript">
35
		//<![CDATA[
492 jpm 36
			var pointImageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png';
37
			var pointsOrigine = null;
501 jpm 38
			var boundsOrigine = null;
424 jpm 39
			var markerClusterer = null;
40
			var map = null;
491 jpm 41
			var nt = '<?=$num_taxon?>';
469 jpm 42
			var infoBulle = new google.maps.InfoWindow();
479 jpm 43
			google.maps.event.addListener(infoBulle, 'domready', function() {
44
				if ($("#observations table").get() != 'undefined') {
45
					$("#observations table").tablesorter();
46
				}
47
			});
424 jpm 48
			var carteCentre = new google.maps.LatLng(46.4, 3.10);
49
			var carteOptions = {
50
				zoom: 6,
515 jpm 51
				mapTypeId: google.maps.MapTypeId.ROADMAP,
52
				mapTypeControlOptions: {
53
			        style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
424 jpm 54
			};
463 delphine 55
			var ctaLayer = null;
501 jpm 56
 
424 jpm 57
			function refreshMap() {
439 jpm 58
				var points = [];
501 jpm 59
				var bounds = new google.maps.LatLngBounds();
424 jpm 60
				for (var i = 0; i < obs.nombre; ++i) {
439 jpm 61
					var maLatLng = new google.maps.LatLng(obs.points[i].coord_x, obs.points[i].coord_y);
493 jpm 62
					var pointImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(24, 32));
439 jpm 63
					var point = new google.maps.Marker({
64
						position: maLatLng,
435 jpm 65
						map: map,
439 jpm 66
						icon: pointImage,
469 jpm 67
						stationId: obs.points[i].id
424 jpm 68
					});
435 jpm 69
 
501 jpm 70
					bounds.extend(maLatLng);
71
 
439 jpm 72
					google.maps.event.addListener(point, 'click', function() {
469 jpm 73
						afficherMsgChargement();
439 jpm 74
						infoBulle.open(map, this);
479 jpm 75
						chargerFormatObs(this.stationId, '*');
435 jpm 76
					});
77
 
439 jpm 78
					points.push(point);
424 jpm 79
				}
80
 
501 jpm 81
				if (pointsOrigine == null && boundsOrigine == null) {
492 jpm 82
					pointsOrigine = points;
501 jpm 83
					boundsOrigine = bounds;
492 jpm 84
				}
85
 
501 jpm 86
				executerMarkerClusterer(points, bounds);
492 jpm 87
			}
88
 
501 jpm 89
			function executerMarkerClusterer(points, bounds) {
492 jpm 90
				if (markerClusterer) {
91
					markerClusterer.clearMarkers();
92
				}
439 jpm 93
				markerClusterer = new MarkerClusterer(map, points);
501 jpm 94
				map.fitBounds(bounds);
469 jpm 95
			}
463 delphine 96
 
469 jpm 97
			function afficherMsgChargement() {
98
				var chargement = document.getElementById('chargement').cloneNode(true);
99
				chargement.setAttribute('id', 'chargement-copie');
100
				infoBulle.setContent(chargement);
101
			}
463 delphine 102
 
469 jpm 103
			function chargerFormatObs(stationId, format) {
490 jpm 104
				var url = '<?=$url_base?>carto?carte=observations'+
105
					'&utilisateur=<?=$utilisateur?>'+
106
					'&projet=<?=$projet?>'+
491 jpm 107
					'&num_taxon='+nt+
490 jpm 108
					'&dept=<?=$dept?>'+
109
					'&format='+format+'&station='+stationId;
469 jpm 110
				$.get(url, function(observations){
111
					infoBulle.setContent(observations);
112
				});
424 jpm 113
			}
114
 
469 jpm 115
			function arreter(event) {
116
				if (event.stopPropagation) {
117
					event.stopPropagation();
118
				}
119
				return false;
120
			}
121
 
435 jpm 122
			function afficher() {
521 jpm 123
				document.getElementById('panneau-lateral').style.width = '300px';
124
				document.getElementById('pl-contenu').style.display = 'block';
435 jpm 125
				document.getElementById('pl-ouverture').style.display = 'none';
521 jpm 126
				document.getElementById('pl-fermeture').style.display = 'block';
127
				document.getElementById('carte').style.left = '300px';
435 jpm 128
				google.maps.event.trigger(map, 'resize');
129
			};
469 jpm 130
 
435 jpm 131
			function cacher() {
521 jpm 132
				document.getElementById('panneau-lateral').style.width = '24px';
133
				document.getElementById('pl-contenu').style.display = 'none';
435 jpm 134
				document.getElementById('pl-ouverture').style.display = 'block';
521 jpm 135
				document.getElementById('pl-fermeture').style.display = 'none';
136
				document.getElementById('carte').style.left = '24px';
435 jpm 137
				google.maps.event.trigger(map, 'resize');
138
			};
490 jpm 139
 
501 jpm 140
			function ouvrirPopUp(url, nom) {
503 jpm 141
				window.open(url, nom, 'directories=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, width=650,height=600');
501 jpm 142
			};
143
 
492 jpm 144
			function filtrerParTaxon(ntAFiltrer) {
507 jpm 145
				infoBulle.close();
492 jpm 146
				$('#taxon-'+nt).removeClass('taxon-actif');
147
				if (nt == ntAFiltrer) {
148
					nt = '*';
501 jpm 149
					executerMarkerClusterer(pointsOrigine, boundsOrigine);
492 jpm 150
				} else {
151
					var url = '<?=$url_cel_carto?>/carte-defaut-json/<?=$utilisateur?>/<?=$projet?>/<?=$dept?>/'+ntAFiltrer+'?formatRetour=jsonp&callback=?';
152
					$.getJSON(url, function (observations) {
153
						obs = observations;
154
						nt = ntAFiltrer;
155
						$('#taxon-'+nt).addClass('taxon-actif');
156
						refreshMap();
157
					});
158
				}
490 jpm 159
			};
435 jpm 160
 
424 jpm 161
			function initialize() {
162
				map = new google.maps.Map(document.getElementById('carte'), carteOptions);
463 delphine 163
 
164
				// Ajout des limites communales sur la carte
465 delphine 165
				<? if (isset($url_limites_communales)) : ?>
166
					<? foreach ($url_limites_communales as $url) : ?>
167
						ctaLayer = new google.maps.KmlLayer('<?=$url?>');
168
						ctaLayer.setMap(map);
169
					<? endforeach; ?>
170
				<? endif; ?>
435 jpm 171
 
172
				var ouvertureDiv = document.getElementById('pl-ouverture');
173
				google.maps.event.addDomListener(ouvertureDiv, 'click', afficher);
174
 
175
				var fermetureDiv = document.getElementById('pl-fermeture');
176
				google.maps.event.addDomListener(fermetureDiv, 'click', cacher);
177
 
544 jpm 178
 
424 jpm 179
				refreshMap();
180
			}
544 jpm 181
 
182
			// Déclenchement d'actions pour JQuery
183
			$(document).ready(function() {
184
				// Ajout du nombre de communes où des observations ont eu lieu
185
				$('#commune-nbre').append(obs.nombre);
186
			});
424 jpm 187
		//]]>
188
		</script>
440 jpm 189
 
190
		<!-- CSS -->
479 jpm 191
		<link href="<?=$url_base?>modules/carto/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
518 jpm 192
 
521 jpm 193
		<!--[if lt IE 7]>
194
			<style type="text/css">
195
				#carte {
196
					height:expression(document.body.clientHeight-35); /* 80+20+20=120 */
197
					width:expression(document.body.clientWidth-24); /* 200+20+20+20=260 */
198
				}
199
				#panneau-lateral {
200
					height:expression(document.body.clientHeight-35); /* 80+20+20=120 */
201
				}
202
			</style>
203
		<![endif]-->
204
 
518 jpm 205
		<!-- Stats : Google Analytics -->
206
		<script type="text/javascript">
207
			//<![CDATA[
208
			var _gaq = _gaq || [];
209
			_gaq.push(['_setAccount', 'UA-20092557-1']);
210
			_gaq.push(['_trackPageview']);
211
 
212
			(function() {
213
			  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
214
			  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
215
			  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
216
			})();
217
			//]]>
218
		</script>
424 jpm 219
	</head>
220
 
221
	<body onload="initialize()">
501 jpm 222
		<div id="zone-titre">
223
			<h1 id="carte-titre">
544 jpm 224
				<span id="commune-nbre">&nbsp;</span> Communes contenant des observations du <abbr title="Carnet en Ligne">CEL</abbr> de <a href="http://www.tela-botanica.org/" onclick="window.open(this.href); arreter(event); return false;">Tela Botanica</a>
501 jpm 225
			</h1>
226
			<div id="zone-info">
227
				<a href="<?=$url_base?>carto?carte=avertissement" onClick="ouvrirPopUp('<?=$url_base?>carto?carte=avertissement', 'Avertissement'); arreter(event); return false;">
228
					<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
503 jpm 229
						alt="Avertissements" title="Avertissements &amp; informations" />
501 jpm 230
				</a>
231
			</div>
232
		</div>
435 jpm 233
		<div id="panneau-lateral">
492 jpm 234
			<div id="pl-ouverture" title="Ouvrir le panneau latéral"><span>Panneau >></span></div>
235
			<div id="pl-fermeture" title="Fermer le panneau latéral"><span><< Fermer [x]</span></div>
521 jpm 236
			<div id="pl-contenu">
237
				<div id="pl-entete">
238
					<h2>Filtre par plante</h2>
239
					<p>
240
						Cliquez sur un nom de plante pour filtrer les observations sur la carte.<br />
241
						Pour revenir à l'état initial, cliquez à nouveau sur le nom sélectionné.
242
					</p>
243
				</div>
244
				<div id="pl-corps" onMouseOver="map.setOptions({'scrollwheel':false});" onMouseOut="map.setOptions({'scrollwheel':true});">
245
					<ol id="taxons">
246
					<? foreach ($taxons as $taxon) : ?>
247
						<li id="taxon-<?=$taxon['nt']?>">
248
							<a href="#" onclick="filtrerParTaxon(<?=$taxon['nt']?>);" title="<?=$taxon['famille']?>">
249
								<?=$taxon['nom']?>
250
							</a>
251
						</li>
252
					<? endforeach; ?>
253
					</ol>
254
				</div>
435 jpm 255
			</div>
256
		</div>
424 jpm 257
		<div id="carte"></div>
469 jpm 258
 
259
		<!-- Blocs chargés à la demande : par défaut avec un style display à none -->
260
		<div id="chargement">
261
			<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
262
			<p>Chargement des observations en cours...</p>
263
		</div>
424 jpm 264
	</body>
265
</html>