Skip to content

Commit e9c37c8

Browse files
committed
Show attibution on click for minimap #15
1 parent 14617a9 commit e9c37c8

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

picture.inc.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function osm_insert_map($content, &$smarty)
4444
global $conf;
4545
load_language('plugin.lang', OSM_PATH);
4646

47-
/* Would be better if you could be like the Metdata but how?
47+
/* Would be better if it could be like the Metdata but how?
4848
$search = '#<dl id="Metadata" class="imageInfoTable">#';
4949
$replacement = '
5050
<dl id="map-info" class="imageInfoTable">
@@ -64,6 +64,13 @@ function osm_insert_map($content, &$smarty)
6464
<dd>
6565
<div id="map"></div>
6666
<script type="text/javascript">{$OSMJS}</script>
67+
<div id="osm_attrib" style="visibility: hidden; display: none;">
68+
<ul>
69+
<li>Plugin by <a href="https://github.com/xbgmsharp/piwigo-openstreetmap" target="_blank">xbgmsharp</a></li>
70+
<li><a href="http://leafletjs.com/" target="_blank">Leaflet</a></li>
71+
<li>&copy; <a href="http://www.openstreetmap.org" target="_blank">OpenStreetMap</a> contributors, (<a href="http://www.openstreetmap.org/copyright" target="_blank">ODbL</a>)</li>
72+
</ul>
73+
</div>
6774
{if $SHOWOSM}
6875
View on <a href="{$OSMLINK}" target="_blank">OpenStreetMap</a>
6976
{/if}
@@ -126,7 +133,8 @@ function osm_render_element_content()
126133
else if($baselayer == 'mapquestaerial') $baselayerurl = 'http://oatile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg';
127134
else if($baselayer == 'custom') $baselayerurl = $custombaselayerurl;
128135

129-
$attribution = osmcopyright($attrleaflet, $attrimagery, $attrmodule, $baselayer, $custombaselayer);
136+
//$attribution = osmcopyright($attrleaflet, $attrimagery, $attrmodule, $baselayer, $custombaselayer);
137+
$attribution = '<a id="osm_license_link" style="cursor: pointer;" onclick="ShowOSMLicense();">see map license</a>';
130138

131139
// Generate Javascript
132140
// ----------------------------------------
@@ -187,6 +195,19 @@ function osm_render_element_content()
187195
// set map view
188196
$js .= "map.setView(coord, ".$zoom.").addLayer(baselayer);\n";
189197

198+
$js .= "\n<!-- pop up full OSM license when clicked -->
199+
function ShowOSMLicense()
200+
{
201+
var osm_attrib = document.getElementById('osm_attrib');
202+
if (osm_attrib.style['display'] != 'none') {
203+
osm_attrib.setAttribute('style','visibility:hidden;');
204+
osm_attrib.setAttribute('style','display: none;');
205+
} else {
206+
osm_attrib.removeAttribute('style');
207+
}
208+
}
209+
\n\n";
210+
190211
// Select the template
191212
$template->set_filenames(
192213
array('osm_content' => dirname(__FILE__)."/template/osm-picture.tpl")

0 commit comments

Comments
 (0)