Amelio popup des coordonnees
[lhc/web/spip_carte_de_sites.git] / contenu / page-carte_de_sites.html
index 90c35ca..582dd05 100755 (executable)
@@ -3,15 +3,21 @@
     
     Parametres :
 
-    - legende = non : ne pas afficher la legende
+    - legende = oui : ne pas afficher la legende
     - coord    = 46.8,2.52   : pour un centrage optimal sur la carte de France
     - zoom    = 5   : pour un centrage optimal sur la carte de France
     - larg  = 540   : largeur
     - haut  = 400   : hauteur
+    - style = 14189 : style de carte. Voir http://maps.cloudmade.com/editor
+    - boite = oui   : affiche la boite avec calques et types
+    - popup = oui   : autoriser les popups
+    - images = oui  : afficher les images
 ]
 
 <!-- Carte -->
-<div id="map" style="width: [(#ENV{larg}|sinon{'540'})]px; height: [(#ENV{haut}|sinon{'400'})]px">
+
+<div id="map" style="[(#ENV{larg}|oui) width: [(#ENV{larg}|sinon{'540'})px;]] height: [(#ENV{haut}|sinon{'400'})]px">
+
 <script src="[(#CHEMIN{lib/CloudMade-Leaflet-edb7d25/dist/leaflet.js}|url_absolue)]"></script>
 
 <script>
                                                });
                                                siteIcon = new WorkshopIcon()
                                                var markerAtelier = new L.Marker(new L.LatLng(#LAT, #LON), {icon: siteIcon});
-                                               markerAtelier.bindPopup("\
-                                                       <span style='float: left; width: 45px;'><img src='[(#LOGO_SYNDIC||extraire_attribut{src}|url_absolue)]' alt='' style='width: 45px;' width='45'></span>\
-                                                       <a href='[(#ID_SYNDIC|generer_url_entite{site})]'>#TITRE</a><br/>#DESCRIPTIF\
-                                                       <span class='spip_documents spip_documents_right' style='float: right; width: 100px;'>\<img src='[(#LOGO_SYNDIC_SURVOL||extraire_attribut{src}|url_absolue)]' alt='' style='width: 100px;' width='100'></span>\
-                                                       #ADRESSE<br/> #CODE_POSTAL #VILLE<br/>\
-                                                       <a href='#URL_SITE'>#NOM_SITE - #URL_SITE</a><br/><br/>\
-                                                       <em>Statut: [(#_ateliers_types:TITRE|supprimer_numero)]</em>\
-                                               ");
+                        [(#ENV{popup}|!={non}|oui)
+                                               markerAtelier.bindPopup("[(#ENV{images}|!={non}|oui)<span style='float: left; width: 45px;'><img src='[(#LOGO_SYNDIC||extraire_attribut{src}|url_absolue)]' alt='' style='width: 45px;' width='45'></span>]<a href='[(#ID_SYNDIC|generer_url_entite{site})]'>#TITRE</a><br/>#DESCRIPTIF[(#ENV{images}|!={non}|oui)<span class='spip_documents spip_documents_right' style='float: right; width: 100px;'>\<img src='[(#LOGO_SYNDIC_SURVOL||extraire_attribut{src}|url_absolue)]' alt='' style='width: 100px;' width='100'></span>]#ADRESSE<br/> #CODE_POSTAL #VILLE<br/><a href='#URL_SITE'>#NOM_SITE - #URL_SITE</a><br/><br/><em>Statut: [(#_ateliers_types:TITRE|supprimer_numero)]</em>");
+                                               ]
                                                group_#ID_MOT.addLayer(markerAtelier)
                                </BOUCLE_coord>
                </BOUCLE_sites>
@@ -47,7 +48,7 @@
                cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/{styleId}/256/{z}/{x}/{y}.png';
                
        var midnightCommander = new L.TileLayer(cloudmadeUrl, cloudmadeOptions, {styleId: 999}),
-               minimal = new L.TileLayer(cloudmadeUrl, cloudmadeOptions, {styleId: 14189});
+               minimal = new L.TileLayer(cloudmadeUrl, cloudmadeOptions, {styleId: [(#ENV{style}|sinon{'14189'})]});
                
 
     <B_map>
@@ -61,7 +62,7 @@
                        };
 
 <B_groups>
-       var overlayMaps = {     
+       var overlayMaps = {
                <BOUCLE_groups(MOTS){type = Ateliers}{par num titre}>
                        "[(#TITRE|supprimer_numero)]": group_#ID_MOT,</BOUCLE_groups>
        };
 
        layersControl = new L.Control.Layers(baseMaps, overlayMaps);
         
-       map.addControl(layersControl);
+       [(#ENV{boite}|!={non}|oui)
+        map.addControl(layersControl);
+    ]
 
        map.on('click', onMapClick);
        
        var popup = new L.Popup();
 
        function onMapClick(e) {
-               var latlngStr = '(' + e.latlng.lat.toFixed(5) + ', ' + e.latlng.lng.toFixed(5) + ')';
+               var latlngStr = '(' + e.latlng.lat.toFixed(5) + ',' + e.latlng.lng.toFixed(5) + ')';
                popup.setLatLng(e.latlng);
                popup.setContent("Coordonnees de votre clic (Latitude, Longitude)" + latlngStr);
                map.openPopup(popup);