6b9265a8e9181ead216971b7e8422c6ac24512d4
[lhc/web/spip_carte_de_sites.git] / contenu / page-carte_de_sites.html
1 <div id="map" style="width: 540px; height: 400px">
2 <script src="#CONFIG{adresse_site}/lib/CloudMade-Leaflet-50a5790/dist/leaflet.js"></script>
3
4
5
6
7 <script>
8 <BOUCLE_ateliers_types(MOTS){type = Ateliers}{par num titre}>
9 var group_#ID_MOT = new L.LayerGroup();
10 <BOUCLE_sites(SITES){id_mot}>
11 <BOUCLE_coord(GIS){id_syndic}>
12 var WorkshopIcon = L.Icon.extend({
13 iconUrl: '#CONFIG{adresse_site}/IMG/[(#LOGO_MOT|fichier)]',
14 shadowUrl: '#CONFIG{adresse_site}/IMG/[(#LOGO_MOT_SURVOL|fichier)]',
15 iconSize: new L.Point(25, 41),
16 shadowSize: new L.Point(41, 41),
17 iconAnchor: new L.Point(13, 41),
18 popupAnchor: new L.Point(0, -33)
19 });
20 siteIcon = new WorkshopIcon()
21 var markerAtelier = new L.Marker(new L.LatLng(#LAT, #LON), {icon: siteIcon});
22 markerAtelier.bindPopup("<span style='float: left; width: 45px;'> <img src='#CONFIG{adresse_site}/IMG/#LOGO_SYNDIC**' alt='' style='width: 45px;' width='45'></span><a href='[(#ID_SYNDIC|generer_url_entite{site})]'>#NOM_SITE</a><br/>#_sites:DESCRIPTIF<br/><i>#DESCRIPTIF</i><span class='spip_documents spip_documents_right' style='float: right; width: 100px;'> <img src='#CONFIG{adresse_site}/IMG/#LOGO_SYNDIC_SURVOL**' alt='' style='width: 100px;' width='100'></span>#ADRESSE<br/> #CODE_POSTAL #VILLE<br/><br/><em>Statut: [(#_ateliers_types:TITRE|supprimer_numero)]</em>");
23 group_#ID_MOT.addLayer(markerAtelier)
24 </BOUCLE_coord>
25 </BOUCLE_sites>
26 </BOUCLE_ateliers_types>
27
28 var cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
29 cloudmadeOptions = {maxZoom: 18, attribution: cloudmadeAttribution},
30 cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/{styleId}/256/{z}/{x}/{y}.png';
31
32 var minimal = new L.TileLayer(cloudmadeUrl, cloudmadeOptions, {styleId: 22677}),
33 midnightCommander = new L.TileLayer(cloudmadeUrl, cloudmadeOptions, {styleId: 999}),
34 motorways = new L.TileLayer(cloudmadeUrl, cloudmadeOptions, {styleId: 46561});
35
36 <B_map>
37 var map = new L.Map('map', {center: new L.LatLng(46.8, 2.52), zoom: 5, layers: [<BOUCLE_map(MOTS){type = Ateliers}> group_#ID_MOT,</BOUCLE_map> minimal, midnightCommander, motorways]});
38 </B_map>
39
40 var baseMaps = {
41 "Night View": midnightCommander,
42 "Minimal": minimal
43 };
44
45 <B_groups>
46 var overlayMaps = {
47 <BOUCLE_groups(MOTS){type = Ateliers}{par num titre}>
48 "[(#TITRE|supprimer_numero)]": group_#ID_MOT,</BOUCLE_groups>
49 "Motorways": motorways
50 };
51 </B_groups>
52
53
54 layersControl = new L.Control.Layers(baseMaps, overlayMaps);
55
56 map.addControl(layersControl);
57
58 map.on('click', onMapClick);
59
60 var popup = new L.Popup();
61
62 function onMapClick(e) {
63 var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' + e.latlng.lng.toFixed(3) + ')';
64 popup.setLatLng(e.latlng);
65 popup.setContent("You clicked the map at " + latlngStr);
66 map.openPopup(popup);
67 }
68
69 </script>
70 </div>
71
72 <h2 class='h2 spip'>Legende</h2>
73 <BOUCLE_legende(MOTS){type = Ateliers}{par num titre}>
74 <p>#LOGO_MOT [(#TITRE|supprimer_numero)]</p>
75 </BOUCLE_legende>
76
77 <h2 class='h2 spip'>Ateliers</h2>
78 <BOUCLE_liste_pays(GIS){par pays}{fusion pays}>
79 <h3 class='h3 spip'>#PAYS</h3>
80 <BOUCLE_liste_region(GIS){par region}{pays}{fusion region}>
81 <h4 class='h4 spip'>#REGION</h4>
82 <BOUCLE_liste_ateliers(GIS){par ville}{region}>
83 <li>#VILLE (#CODE_POSTAL) #TITRE - #ADRESSE</li>
84 </BOUCLE_liste_ateliers>
85 </BOUCLE_liste_region>
86 </BOUCLE_liste_pays>