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[
36
			var markerClusterer = null;
37
			var map = null;
491 jpm 38
			var nt = '<?=$num_taxon?>';
469 jpm 39
			var infoBulle = new google.maps.InfoWindow();
479 jpm 40
			google.maps.event.addListener(infoBulle, 'domready', function() {
41
				if ($("#observations table").get() != 'undefined') {
42
					$("#observations table").tablesorter();
43
				}
44
			});
439 jpm 45
			var pointImageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png';
424 jpm 46
			var carteCentre = new google.maps.LatLng(46.4, 3.10);
47
			var carteOptions = {
48
				zoom: 6,
49
				center: carteCentre,
50
				mapTypeId: google.maps.MapTypeId.ROADMAP
51
			};
463 delphine 52
			var ctaLayer = null;
469 jpm 53
 
424 jpm 54
			function refreshMap() {
55
				if (markerClusterer) {
56
					markerClusterer.clearMarkers();
57
				}
58
 
439 jpm 59
				var points = [];
60
				var pointImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(24, 32));
424 jpm 61
				for (var i = 0; i < obs.nombre; ++i) {
439 jpm 62
					var maLatLng = new google.maps.LatLng(obs.points[i].coord_x, obs.points[i].coord_y);
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
 
439 jpm 70
					google.maps.event.addListener(point, 'click', function() {
469 jpm 71
						afficherMsgChargement();
439 jpm 72
						infoBulle.open(map, this);
479 jpm 73
						chargerFormatObs(this.stationId, '*');
435 jpm 74
					});
75
 
439 jpm 76
					points.push(point);
424 jpm 77
				}
78
 
439 jpm 79
				markerClusterer = new MarkerClusterer(map, points);
469 jpm 80
			}
463 delphine 81
 
469 jpm 82
			function afficherMsgChargement() {
83
				var chargement = document.getElementById('chargement').cloneNode(true);
84
				chargement.setAttribute('id', 'chargement-copie');
85
				infoBulle.setContent(chargement);
86
			}
463 delphine 87
 
469 jpm 88
			function chargerFormatObs(stationId, format) {
490 jpm 89
				var url = '<?=$url_base?>carto?carte=observations'+
90
					'&utilisateur=<?=$utilisateur?>'+
91
					'&projet=<?=$projet?>'+
491 jpm 92
					'&num_taxon='+nt+
490 jpm 93
					'&dept=<?=$dept?>'+
94
					'&format='+format+'&station='+stationId;
469 jpm 95
				$.get(url, function(observations){
96
					infoBulle.setContent(observations);
97
				});
424 jpm 98
			}
99
 
469 jpm 100
			function arreter(event) {
101
				if (event.stopPropagation) {
102
					event.stopPropagation();
103
				}
104
				return false;
105
			}
106
 
435 jpm 107
			function afficher() {
108
				document.getElementById('panneau-lateral').style.display = 'block';
109
				document.getElementById('pl-ouverture').style.display = 'none';
110
				google.maps.event.trigger(map, 'resize');
111
			};
469 jpm 112
 
435 jpm 113
			function cacher() {
114
				document.getElementById('panneau-lateral').style.display = 'none';
115
				document.getElementById('pl-ouverture').style.display = 'block';
116
				google.maps.event.trigger(map, 'resize');
117
			};
490 jpm 118
 
491 jpm 119
			function filtrerParTaxon(num_taxon) {
120
				var url = '<?=$url_cel_carto?>/carte-defaut-json/<?=$utilisateur?>/<?=$projet?>/<?=$dept?>/'+num_taxon+'?formatRetour=jsonp&callback=?';
490 jpm 121
				$.getJSON(url, function (observations) {
122
					obs = observations;
491 jpm 123
					nt = num_taxon;
490 jpm 124
					refreshMap();
125
				});
126
			};
435 jpm 127
 
424 jpm 128
			function initialize() {
129
				map = new google.maps.Map(document.getElementById('carte'), carteOptions);
463 delphine 130
 
131
				// Ajout des limites communales sur la carte
465 delphine 132
				<? if (isset($url_limites_communales)) : ?>
133
					<? foreach ($url_limites_communales as $url) : ?>
134
						ctaLayer = new google.maps.KmlLayer('<?=$url?>');
135
						ctaLayer.setMap(map);
136
					<? endforeach; ?>
137
				<? endif; ?>
435 jpm 138
 
139
				// Create the DIV to hold the control and call the HomeControl()
140
				// constructor passing in this DIV.
141
				var panneauDiv = document.getElementById('panneau-lateral');
142
				panneauDiv.index = 0;
143
				map.controls[google.maps.ControlPosition.TOP_LEFT].push(panneauDiv);
144
 
145
				var ouverturePanneauDiv = document.getElementById('pl-ouverture');
146
				ouverturePanneauDiv.index = 0;
147
				map.controls[google.maps.ControlPosition.TOP_LEFT].push(ouverturePanneauDiv);
148
 
149
				var ouvertureDiv = document.getElementById('pl-ouverture');
150
				google.maps.event.addDomListener(ouvertureDiv, 'click', afficher);
151
 
152
				var fermetureDiv = document.getElementById('pl-fermeture');
153
				google.maps.event.addDomListener(fermetureDiv, 'click', cacher);
154
 
155
				cacher();
424 jpm 156
				refreshMap();
157
			}
158
		//]]>
159
		</script>
440 jpm 160
 
161
		<!-- CSS -->
479 jpm 162
		<link href="<?=$url_base?>modules/carto/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
424 jpm 163
	</head>
164
 
165
	<body onload="initialize()">
435 jpm 166
		<div id="panneau-lateral">
167
			<div id="pl-entete">
168
				<div id="pl-ouverture">Panneau >></div>
169
				<div id="pl-fermeture"><< Fermer [x]</div>
170
			</div>
490 jpm 171
			<div id="pl-corps">
491 jpm 172
				<ol>
490 jpm 173
				<? foreach ($taxons as $taxon) : ?>
174
					<li>
175
						<a href="#" onclick="filtrerParTaxon(<?=$taxon['nt']?>);">
176
							<?=$taxon['nom']?>
177
							<span class="famille"><?=$taxon['famille']?></span>
178
						</a>
179
					</li>
180
				<? endforeach; ?>
491 jpm 181
				</ol>
490 jpm 182
			</div>
435 jpm 183
		</div>
424 jpm 184
		<div id="carte"></div>
469 jpm 185
 
186
		<!-- Blocs chargés à la demande : par défaut avec un style display à none -->
187
		<div id="chargement">
188
			<img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
189
			<p>Chargement des observations en cours...</p>
190
		</div>
424 jpm 191
	</body>
192
</html>