@@ -300,90 +300,96 @@ function osm_get_js($conf, $local_conf, $js_data)
300300 '10 ' => 'ImgIcon '
301301 );
302302
303+ $ editor = isset ($ local_conf ['editor ' ]) ? "editInOSMControlOptions: { editors: ['id'] }, " : '' ;
304+
303305 // Create the map and get a new map instance attached and element with id="tile-map"
304306 $ js .= "\nvar Url = ' " .$ baselayerurl ."',
305307 Attribution = ' " .$ attribution ."',
306308 TileLayer = new L.TileLayer(Url, {maxZoom: 18, noWrap: " .$ nowarp .", attribution: Attribution}),
307309 latlng = new L.LatLng( " .$ local_conf ['center_lat ' ].", " .$ local_conf ['center_lng ' ]."); \n" ;
308- $ js .= "var " . $ divname . " = new L.Map(' " . $ divname . "', { " . $ worldcopyjump . ", center: latlng, zoom: " .$ local_conf ['zoom ' ].", layers: [TileLayer], contextmenu: " . $ local_conf ['contextmenu ' ] . "}); \n" ;
310+ $ js .= "var " . $ divname . " = new L.Map(' " . $ divname . "', { " . $ worldcopyjump . ", center: latlng, " . $ editor . " zoom: " .$ local_conf ['zoom ' ].", layers: [TileLayer], contextmenu: " . $ local_conf ['contextmenu ' ] . "}); \n" ;
309311 $ js .= $ divname . ".attributionControl.setPrefix(''); \n" ;
310312 $ js .= "var MarkerClusterList=[]; \n" ;
311313 $ js .= "if (typeof L.MarkerClusterGroup === 'function') \n" ;
312314 $ js .= " var markers = new L.MarkerClusterGroup(); \n" ;
313315 if ($ local_conf ['control ' ] === true )
314316 {
315- $ js .= "L .control.scale().addTo( " . $ divname . "); \n" ;
317+ $ js .= "\n L .control.scale().addTo( " . $ divname . "); \n" ;
316318 }
317- // Icons
318- $ js .= "
319-
320- var PlgIcon = L.Icon.extend({
321- options: {
322- shadowUrl: 'plugins/piwigo-openstreetmap/leaflet/images/marker-shadow.png',
323- iconSize: [25, 41],
324- shadowSize: [41, 41],
325- iconAnchor: [21, 21],
326- popupAnchor: [-10, -10]
327- }
328- });
329-
330- var LeafIcon = L.Icon.extend({
331- options: {
332- shadowUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-shadow.png',
333- iconSize: [38, 95],
334- shadowSize: [50, 64],
335- iconAnchor: [22, 94],
336- shadowAnchor: [4, 62],
337- popupAnchor: [-3, -76]
338- }
339- });
340-
341- var MapIcon = L.Icon.extend({
342- options: {
343- shadowUrl: 'plugins/piwigo-openstreetmap/leaflet/images/mapicons-shadow.png',
344- iconSize: [32, 37],
345- shadowSize: [51, 37],
346- iconAnchor: [19, 38],
347- shadowAnchor: [4, 33],
348- popupAnchor: [-2, -33]
349- }
350- });
351- " ;
352319
353- if ($ pinid == 9 )
320+ if ($ pinid >= 2 )
354321 {
355- $ js .= "\nvar CustomIcon = L.Icon.extend({
322+ // Icons
323+ $ js .= "
324+
325+ var PlgIcon = L.Icon.extend({
356326 options: {
357- iconUrl: " .$ pinpath .",
358- shadowUrl: " .$ pinshadowpath .",
359- iconSize: [ " .$ pinsize ."],
360- shadowSize: [ " .$ pinshadowsize ."],
361- iconAnchor: [ " .$ pinoffset ."],
362- shadowAnchor: [ " .$ pinoffset ."],
363- popupAnchor: [ " .$ pinpopupoffset ."]
327+ shadowUrl: 'plugins/piwigo-openstreetmap/leaflet/images/marker-shadow.png',
328+ iconSize: [25, 41],
329+ shadowSize: [41, 41],
330+ iconAnchor: [21, 21],
331+ popupAnchor: [-10, -10]
364332 }
365- }); " ;
366- }
333+ });
367334
368- $ js .= "\nvar ImgIcon = L.Icon.extend({
369- options: {
370- iconSize: [42, 42],
371- iconAnchor: [21, 21],
372- popupAnchor: [0,-21]
335+ var LeafIcon = L.Icon.extend({
336+ options: {
337+ shadowUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-shadow.png',
338+ iconSize: [38, 95],
339+ shadowSize: [50, 64],
340+ iconAnchor: [22, 94],
341+ shadowAnchor: [4, 62],
342+ popupAnchor: [-3, -76]
343+ }
344+ });
345+
346+ var MapIcon = L.Icon.extend({
347+ options: {
348+ shadowUrl: 'plugins/piwigo-openstreetmap/leaflet/images/mapicons-shadow.png',
349+ iconSize: [32, 37],
350+ shadowSize: [51, 37],
351+ iconAnchor: [19, 38],
352+ shadowAnchor: [4, 33],
353+ popupAnchor: [-2, -33]
354+ }
355+ });
356+ " ;
357+
358+ if ($ pinid == 9 )
359+ {
360+ $ js .= "\nvar CustomIcon = L.Icon.extend({
361+ options: {
362+ iconUrl: " .$ pinpath .",
363+ shadowUrl: " .$ pinshadowpath .",
364+ iconSize: [ " .$ pinsize ."],
365+ shadowSize: [ " .$ pinshadowsize ."],
366+ iconAnchor: [ " .$ pinoffset ."],
367+ shadowAnchor: [ " .$ pinoffset ."],
368+ popupAnchor: [ " .$ pinpopupoffset ."]
369+ }
370+ }); " ;
373371 }
374- });
375372
376- var PlgIconGreen = new PlgIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/marker-green.png'}),
377- PlgIconRed = new PlgIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/marker-red.png'});
373+ $ js .= "\nvar ImgIcon = L.Icon.extend({
374+ options: {
375+ iconSize: [42, 42],
376+ iconAnchor: [21, 21],
377+ popupAnchor: [0,-21]
378+ }
379+ });
380+
381+ var PlgIconGreen = new PlgIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/marker-green.png'}),
382+ PlgIconRed = new PlgIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/marker-red.png'});
378383
379- var LeafIconGreen = new LeafIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-green.png'}),
380- LeafIconRed = new LeafIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-red.png'}),
381- LeafIconOrange = new LeafIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-orange.png'});
384+ var LeafIconGreen = new LeafIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-green.png'}),
385+ LeafIconRed = new LeafIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-red.png'}),
386+ LeafIconOrange = new LeafIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/leaf-orange.png'});
382387
383- var MapIconBlue = new MapIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/mapicons-blue.png'}),
384- MapIconGreen = new MapIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/mapicons-green.png'});
388+ var MapIconBlue = new MapIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/mapicons-blue.png'}),
389+ MapIconGreen = new MapIcon({iconUrl: 'plugins/piwigo-openstreetmap/leaflet/images/mapicons-green.png'});
385390
386- " ;
391+ " ;
392+ }
387393
388394 $ js .= "for (var i = 0; i < addressPoints.length; i++) {
389395 var a = addressPoints[i];
0 commit comments