2ec7ab68d2464a43291f4f57ab5bfc1f531b15db
[lhc/web/spip_carte_de_sites.git] / contenu / page-carte_de_sites.html
1 <div id="map" style="width: 540px; height: 400px"></div>
2
3
4 <strong>Legende</strong><br/>
5 <BOUCLE_legende(MOTS){type = Ateliers}{!par id_mot}>
6 <p>#LOGO_MOT #TITRE</p>
7 </BOUCLE_legende>
8
9
10 <script src="#CONFIG{adresse_site}/lib/CloudMade-Leaflet-404b097/dist/leaflet.js"></script>
11 <script>
12 var map = new L.Map('map');
13
14 var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
15 cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
16 cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
17
18 map.setView(new L.LatLng(46.8, 2.52), 5).addLayer(cloudmade);
19
20 var WorkshopIcon = L.Icon.extend({
21 iconUrl: '#CONFIG{adresse_site}/plugins/carte-de-sites/images/grey.png',
22 shadowUrl: '#CONFIG{adresse_site}/lib/CloudMade-Leaflet-404b097/dist/images/marker-shadow.png',
23 iconSize: new L.Point(25, 41),
24 shadowSize: new L.Point(41, 41),
25 iconAnchor: new L.Point(13, 41),
26 popupAnchor: new L.Point(0, -33)
27 });
28
29 var greyIcon = new WorkshopIcon()
30 redIcon = new WorkshopIcon('#CONFIG{adresse_site}/plugins/carte-de-sites/images/red.png'),
31 yellowIcon = new WorkshopIcon('#CONFIG{adresse_site}/plugins/carte-de-sites/images/yellow.png'),
32 blueIcon = new WorkshopIcon('#CONFIG{adresse_site}/plugins/carte-de-sites/images/blue.png'),
33 greenIcon = new WorkshopIcon('#CONFIG{adresse_site}/plugins/carte-de-sites/images/green.png');
34
35
36 <BOUCLE_ateliers_types(MOTS){type = Ateliers}{!par id_mot}>
37 <BOUCLE_sites(SITES){id_mot}>
38 <BOUCLE_coord(GIS){id_syndic}>
39 siteIcon = new WorkshopIcon('#CONFIG{adresse_site}/IMG/[(#LOGO_MOT|fichier)]')
40 var markerGrenoble = new L.Marker(new L.LatLng(#LAT, #LON), {icon: siteIcon});
41 map.addLayer(markerGrenoble);
42 markerGrenoble.bindPopup("<a href='#URL_SITE'>#NOM_SITE</a><br/>#_sites:DESCRIPTIF<br/>#ADRESSE<br/> #CODE_POSTAL #VILLE<br/><br/><em>Statut: #_ateliers_types:TITRE</em>");
43 </BOUCLE_coord>
44 </BOUCLE_sites>
45 </BOUCLE_ateliers_types>
46
47
48 map.on('click', onMapClick);
49
50 var popup = new L.Popup();
51
52 function onMapClick(e) {
53 var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' + e.latlng.lng.toFixed(3) + ')';
54
55 popup.setLatLng(e.latlng);
56 popup.setContent("You clicked the map at " + latlngStr);
57 map.openPopup(popup);
58 }
59
60 </script>