MediaWiki r43482 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r43481‎ | r43482 (on ViewVC)‎ | r43483 >
Date:09:47, 14 November 2008
Author:siebrand
Status:ok
Tags:
Comment:
* re-enable the marker
* update example again
* update failure message for KML
* another update from http://svn.openstreetmap.org/applications/utils/wiki-extensions/SlippyMap-local/ rev. 11922
Modified paths:

Diff [purge]

Index: trunk/extensions/SlippyMap/SlippyMap.class.php
===================================================================
--- trunk/extensions/SlippyMap/SlippyMap.class.php	(revision 43481)
+++ trunk/extensions/SlippyMap/SlippyMap.class.php	(revision 43482)
@@ -7,7 +7,7 @@
 # the OpenLayers javascript, to show a slippy map.
 #
 # Usage example:
-# <slippymap lat="51.485" lon="-0.15" z="11" w="300" h="200" layer=osmarender marker=0></slippymap>
+# <slippymap lat="51.485" lon="-0.15" z="11" w="300" h="200" layer="osmarender" marker="0" />
 #
 # Tile images are not cached local to the wiki.
 # To acheive this (remove the OSM dependency) you might set up a squid proxy,
@@ -63,39 +63,39 @@
 
 		// Receive new style args: <slippymap aaa=bbb ccc=ddd></slippymap>
 		if ( isset( $argv['lat'] ) ) {
-			$lat		= $argv['lat'];
+			$lat = $argv['lat'];
 		} else {
-			$lat		= '';
+			$lat = $oldStyleParams['lat'];
 		}
 		if ( isset( $argv['lon'] ) ) {
-			$lon		= $argv['lon'];
+			$lon = $argv['lon'];
 		} else {
-			$lon		= '';
+			$lon = $oldStyleParams['lon'];
 		}
 		if ( isset( $argv['z'] ) ) {
-			$zoom		= $argv['z'];
+			$zoom = $argv['z'];
 		} else {
-			$zoom		= '';
+			$zoom = $oldStyleParams['z'];
 		}
 		if ( isset( $argv['w'] ) ) {
-			$width		= $argv['w'];
+			$width = $argv['w'];
 		} else {
-			$width		= '';
+			$width = $oldStyleParams['w'];
 		}
 		if ( isset( $argv['h'] ) ) {
-			$height		= $argv['h'];
+			$height = $argv['h'];
 		} else {
-			$height		= '';
+			$height = $oldStyleParams['h'];
 		}
 		if ( isset( $argv['layer'] ) ) {
-			$layer		= $argv['layer'];
+			$layer = $argv['layer'];
 		} else {
-			$layer		= '';
+			$layer = $oldStyleParams['layer'];
 		}
 		if ( isset( $argv['marker'] ) ) {
-			$marker		= $argv['marker'];
+			$marker = $argv['marker'];
 		} else {
-			$marker		= '';
+			$marker = '';
 		}
 
 		$error = '';
@@ -112,19 +112,20 @@
 		$marker = ( $marker != '' && $marker != '0' );
 
 		// trim off the 'px' on the end of pixel measurement numbers (ignore if present)
-		if ( substr( $width, -2 ) == 'px' )	$width = (int) substr( $width, 0, -2 );
-		if ( substr( $height, -2 ) == 'px' )	$height = (int) substr( $height, 0, -2 );
+		if ( substr( $width, -2 ) == 'px' )
+			$width = (int) substr( $width, 0, -2 );
 
+		if ( substr( $height, - 2 ) == 'px' )
+			$height = (int) substr( $height, 0, -2 );
+
 		if ( trim( $input ) != '' && sizeof( $oldStyleParamStrings ) < 3 ) {
 			$error = 'slippymap tag contents. Were you trying to input KML? KML support ' .
-			         'is disactivated on the OSM wiki pending discussions about wiki syntax';
+				'is disabled pending discussions about wiki syntax';
 			$showkml = false;
 		} else {
 			$showkml = false;
 		}
 
-		if ( $marker ) $error = 'marker support is disactivated on the OSM wiki pending discussions about wiki syntax';
-
 		// Check required parameters values are provided
 		if ( $lat == ''  ) $error .= wfMsg( 'slippymap_latmissing' );
 		if ( $lon == ''  ) $error .= wfMsg( 'slippymap_lonmissing' );
@@ -194,7 +195,6 @@
 			// 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  = '<!-- slippy map -->';
 
 			// This inline stylesheet defines how the two extra buttons look, and where they are positioned.
@@ -202,7 +202,6 @@
 			$output .= "<style> .buttonsPanel .getWikiCodeButtonItemInactive { width:36px; height:19px; background-image:url('" . $wgScriptPath . "/extensions/SlippyMap/wikicode-button.png'); }</style>\n";
 			$output .= "<style> .buttonsPanel .resetButtonItemInactive       { width:36px; height:19px; background-image:url('" . $wgScriptPath . "/extensions/SlippyMap/reset-button.png'); }</style>\n";
 
-
 			$output .= "<!-- bring in the OpenLayers javascript library -->";
 			$output .= "<script src=\"http://openlayers.org/api/OpenLayers.js\"></script> ";
 
@@ -219,7 +218,6 @@
 
 			$output .= 'addOnloadHook( slippymap_init ); ';
 
-
 			$output .= 'function slippymap_resetPosition() {';
 			$output .= '	map.setCenter(lonLat, zoom);';
 			$output .= '}';

Status & tagging log

Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox