tag is placed in the wikitext
#
# We show a map based on the lat/lon/zoom data passed in. This extension brings in
# the OpenLayers javascript, to show a slippy map.
#
# Usage example:
#
';
}
}
$showkml = false; //currently disabled
if ($marker) $error = 'marker support is disactivated on the OSM wiki pending discussions about wiki syntax';
if ( $error == '' ) {
// Check required parameters values are provided
if ( $lat == '' ) $error .= wfMsg( 'slippymap_latmissing' ) . '
';
if ( $lon == '' ) $error .= wfMsg( 'slippymap_lonmissing' ) . '
';
if ( $zoom == '' ) $error .= wfMsg( 'slippymap_zoommissing' ) . '
';
// no errors so far. Now check the values
if ( !is_numeric( $width ) ) {
$error = wfMsg( 'slippymap_widthnan', $width ) . '
';
} else if ( !is_numeric( $height ) ) {
$error = wfMsg( 'slippymap_heightnan', $height ) . '
';
} else if ( !is_numeric( $zoom ) ) {
$error = wfMsg( 'slippymap_zoomnan', $zoom ) . '
';
} else if ( !is_numeric( $lat ) ) {
$error = wfMsg( 'slippymap_latnan', $lat ) . '
';
} else if ( !is_numeric( $lon ) ) {
$error = wfMsg( 'slippymap_lonnan', $lon ) . '
';
} else if ( $width > 1000 ) {
$error = wfMsg( 'slippymap_widthbig' ) . '
';
} else if ( $width < 100 ) {
$error = wfMsg( 'slippymap_widthsmall' ) . '
';
} else if ( $height > 1000 ) {
$error = wfMsg( 'slippymap_heightbig' ) . '
';
} else if ( $height < 100 ) {
$error = wfMsg( 'slippymap_heightsmall' ) . '
';
} else if ( $lat > 90 ) {
$error = wfMsg( 'slippymap_latbig' ) . '
';
} else if ( $lat < -90 ) {
$error = wfMsg( 'slippymap_latsmall' ) . '
';
} else if ( $lon > 180 ) {
$error = wfMsg( 'slippymap_lonbig' ) . '
';
} else if ( $lon < -180 ) {
$error = wfMsg( 'slippymap_lonsmall' ) . '
';
} else if ( $zoom < 0 ) {
$error = wfMsg( 'slippymap_zoomsmall' ) . '
';
} else if ( $zoom == 18 ) {
$error = wfMsg( 'slippymap_zoom18' ) . '
';
} else if ( $zoom > 17 ) {
$error = wfMsg( 'slippymap_zoombig' ) . '
';
}
}
// Find the tile server URL to use. Note that we could allow the user to override that with
// *any* tile server URL for more flexibility, but that might be a security concern.
$layer = strtolower( $layer );
$layerObjectDef = '';
if ( $layer == 'osmarender' ) {
$layerObjectDef = 'OpenLayers.Layer.OSM.Osmarender("Osmarender"); ';
} elseif ( $layer == 'mapnik' ) {
$layerObjectDef = 'OpenLayers.Layer.OSM.Mapnik("Mapnik"); ';
} elseif ( $layer == 'maplint' ) {
$layerObjectDef = 'OpenLayers.Layer.OSM.Maplint("Maplint"); ';
} elseif ( $layer == 'cyclemap' ) {
$layerObjectDef = 'OpenLayers.Layer.OSM.CycleMap("CycleMap"); ';
} else {
$error = wfMsg( 'slippymap_invalidlayer', htmlspecialchars( $layer ) );
}
if ( $error != "" ) {
// Something was wrong. Spew the error message and input text.
$output = '';
$output .= "" . wfMsg( 'slippymap_maperror' ) . ' ' . $error . "
";
$output .= htmlspecialchars( $input );
} else {
// HTML output for the slippy map.
// Note that this must all be output on one line (no linefeeds)
// otherwise MediaWiki adds
tags, which is bad in the middle of a block of javascript.
// There are other ways of fixing this, but not for MediaWiki v4
// (See http://www.mediawiki.org/wiki/Manual:Tag_extensions#How_can_I_avoid_modification_of_my_extension.27s_HTML_output.3F)
$output = '';
// This inline stylesheet defines how the two extra buttons look, and where they are positioned.
$output .= "\n";
$output .= "\n";
$output .= "\n";
$output .= "";
$output .= " ";
$output .= " ";
$output .= " ";
$output .= ' ";
$output .= "