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" />
440 jpm 19
 
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 -->
469 jpm 25
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.2&amp;sensor=false"></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() {
123
				document.getElementById('panneau-lateral').style.display = 'block';
124
				document.getElementById('pl-ouverture').style.display = 'none';
125
				google.maps.event.trigger(map, 'resize');
126
			};
469 jpm 127
 
435 jpm 128
			function cacher() {
129
				document.getElementById('panneau-lateral').style.display = 'none';
130
				document.getElementById('pl-ouverture').style.display = 'block';
131
				google.maps.event.trigger(map, 'resize');
132
			};
490 jpm 133
 
501 jpm 134
			function ouvrirPopUp(url, nom) {
503 jpm 135
				window.open(url, nom, 'directories=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, width=650,height=600');
501 jpm 136
			};
137
 
492 jpm 138
			function filtrerParTaxon(ntAFiltrer) {
507 jpm 139
				infoBulle.close();
492 jpm 140
				$('#taxon-'+nt).removeClass('taxon-actif');
141
				if (nt == ntAFiltrer) {
142
					nt = '*';
501 jpm 143
					executerMarkerClusterer(pointsOrigine, boundsOrigine);
492 jpm 144
				} else {
145
					var url = '<?=$url_cel_carto?>/carte-defaut-json/<?=$utilisateur?>/<?=$projet?>/<?=$dept?>/'+ntAFiltrer+'?formatRetour=jsonp&callback=?';
146
					$.getJSON(url, function (observations) {
147
						obs = observations;
148
						nt = ntAFiltrer;
149
						$('#taxon-'+nt).addClass('taxon-actif');
150
						refreshMap();
151
					});
152
				}
490 jpm 153
			};
435 jpm 154
 
424 jpm 155
			function initialize() {
156
				map = new google.maps.Map(document.getElementById('carte'), carteOptions);
463 delphine 157
 
158
				// Ajout des limites communales sur la carte
465 delphine 159
				<? if (isset($url_limites_communales)) : ?>
160
					<? foreach ($url_limites_communales as $url) : ?>
161
						ctaLayer = new google.maps.KmlLayer('<?=$url?>');
162
						ctaLayer.setMap(map);
163
					<? endforeach; ?>
164
				<? endif; ?>
435 jpm 165
 
166
				// Create the DIV to hold the control and call the HomeControl()
167
				// constructor passing in this DIV.
501 jpm 168
 
435 jpm 169
				var panneauDiv = document.getElementById('panneau-lateral');
170
				panneauDiv.index = 0;
171
				map.controls[google.maps.ControlPosition.TOP_LEFT].push(panneauDiv);
172
 
173
				var ouverturePanneauDiv = document.getElementById('pl-ouverture');
174
				ouverturePanneauDiv.index = 0;
175
				map.controls[google.maps.ControlPosition.TOP_LEFT].push(ouverturePanneauDiv);
176
 
501 jpm 177
 
435 jpm 178
				var ouvertureDiv = document.getElementById('pl-ouverture');
179
				google.maps.event.addDomListener(ouvertureDiv, 'click', afficher);
180
 
181
				var fermetureDiv = document.getElementById('pl-fermeture');
182
				google.maps.event.addDomListener(fermetureDiv, 'click', cacher);
183
 
184
				cacher();
424 jpm 185
				refreshMap();
186
			}
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" />
424 jpm 192
	</head>
193
 
194
	<body onload="initialize()">
501 jpm 195
		<div id="zone-titre">
196
			<h1 id="carte-titre">
197
				Observations issues des membres de <a href="http://www.tela-botanica.org/" onclick="window.open(this.href); arreter(event); return false;">Tela Botanica</a>
198
			</h1>
199
			<div id="zone-info">
200
				<a href="<?=$url_base?>carto?carte=avertissement" onClick="ouvrirPopUp('<?=$url_base?>carto?carte=avertissement', 'Avertissement'); arreter(event); return false;">
201
					<img src="<?=$url_base?>modules/carto/squelettes/images/information.png"
503 jpm 202
						alt="Avertissements" title="Avertissements &amp; informations" />
501 jpm 203
				</a>
204
			</div>
205
		</div>
435 jpm 206
		<div id="panneau-lateral">
492 jpm 207
			<div id="pl-ouverture" title="Ouvrir le panneau latéral"><span>Panneau >></span></div>
208
			<div id="pl-fermeture" title="Fermer le panneau latéral"><span><< Fermer [x]</span></div>
435 jpm 209
			<div id="pl-entete">
492 jpm 210
				<h2>Filtre par plante</h2>
507 jpm 211
				<p>
212
					Cliquez sur un nom de plante pour filtrer les observations sur la carte.<br />
213
					Pour revenir à l'état initial, cliquez à nouveau sur le nom sélectionné.
214
				</p>
435 jpm 215
			</div>
492 jpm 216
			<div id="pl-corps" onMouseOver="map.setOptions({'scrollwheel':false});" onMouseOut="map.setOptions({'scrollwheel':true});">
217
				<ol id="taxons">
490 jpm 218
				<? foreach ($taxons as $taxon) : ?>
492 jpm 219
					<li id="taxon-<?=$taxon['nt']?>">
220
						<a href="#" onclick="filtrerParTaxon(<?=$taxon['nt']?>);" title="<?=$taxon['famille']?>">
507 jpm 221
							<?=$taxon['nom']?>
490 jpm 222
						</a>
223
					</li>
224
				<? endforeach; ?>
491 jpm 225
				</ol>
490 jpm 226
			</div>
435 jpm 227
		</div>
424 jpm 228
		<div id="carte"></div>
469 jpm 229
 
230
		<!-- Blocs chargés à la demande : par défaut avec un style display à none -->
231
		<div id="chargement">
232
			<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
233
			<p>Chargement des observations en cours...</p>
234
		</div>
424 jpm 235
	</body>
236
</html>