Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php |
— | — | @@ -26,6 +26,11 @@ |
27 | 27 | |
28 | 28 | protected $markerStringFormat = 'getGMaps3MarkerData(lat, lon, \'title\', \'label\', "icon")'; |
29 | 29 | |
| 30 | + protected function getDefaultZoom() { |
| 31 | + global $egMapsGMaps3Zoom; |
| 32 | + return $egMapsGMaps3Zoom; |
| 33 | + } |
| 34 | + |
30 | 35 | /** |
31 | 36 | * @see MapsBaseMap::doMapServiceLoad() |
32 | 37 | * |
Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php |
— | — | @@ -24,6 +24,11 @@ |
25 | 25 | |
26 | 26 | public $serviceName = MapsGoogleMaps3::SERVICE_NAME; |
27 | 27 | |
| 28 | + protected function getDefaultZoom() { |
| 29 | + global $egMapsGMaps3Zoom; |
| 30 | + return $egMapsGMaps3Zoom; |
| 31 | + } |
| 32 | + |
28 | 33 | /** |
29 | 34 | * @see MapsBaseMap::doMapServiceLoad() |
30 | 35 | * |
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php |
— | — | @@ -24,6 +24,11 @@ |
25 | 25 | |
26 | 26 | protected $markerStringFormat = 'getOLMarkerData(lon, lat, \'title\', \'label\', "icon")'; |
27 | 27 | |
| 28 | + protected function getDefaultZoom() { |
| 29 | + global $egMapsOpenLayersZoom; |
| 30 | + return $egMapsOpenLayersZoom; |
| 31 | + } |
| 32 | + |
28 | 33 | /** |
29 | 34 | * @see MapsBaseMap::doMapServiceLoad() |
30 | 35 | * |
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php |
— | — | @@ -17,6 +17,11 @@ |
18 | 18 | |
19 | 19 | public $serviceName = MapsOpenLayers::SERVICE_NAME; |
20 | 20 | |
| 21 | + protected function getDefaultZoom() { |
| 22 | + global $egMapsOpenLayersZoom; |
| 23 | + return $egMapsOpenLayersZoom; |
| 24 | + } |
| 25 | + |
21 | 26 | /** |
22 | 27 | * @see MapsBaseMap::doMapServiceLoad() |
23 | 28 | */ |
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php |
— | — | @@ -84,7 +84,6 @@ |
85 | 85 | ), |
86 | 86 | ); |
87 | 87 | |
88 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsOpenLayersZoom; |
89 | 88 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array( 0, 19 ); |
90 | 89 | } |
91 | 90 | |
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php |
— | — | @@ -21,8 +21,6 @@ |
22 | 22 | * @ingroup Maps |
23 | 23 | * |
24 | 24 | * @author Jeroen De Dauw |
25 | | - * |
26 | | - * TODO: fix zoom - should default to 'null' when no value given and multiple points |
27 | 25 | */ |
28 | 26 | abstract class MapsBasePointMap implements iMapFeature { |
29 | 27 | |
— | — | @@ -120,6 +118,10 @@ |
121 | 119 | |
122 | 120 | $this->setCentre(); |
123 | 121 | |
| 122 | + if ( count( $this->markerData ) <= 1 && $this->zoom == 'null' ) { |
| 123 | + $this->zoom = $this->getDefaultZoom(); |
| 124 | + } |
| 125 | + |
124 | 126 | $this->addSpecificMapHTML( $parser ); |
125 | 127 | |
126 | 128 | return $this->output; |
Index: trunk/extensions/Maps/ParserFunctions/DisplayMap/Maps_BaseMap.php |
— | — | @@ -96,6 +96,10 @@ |
97 | 97 | |
98 | 98 | $this->setCentre(); |
99 | 99 | |
| 100 | + if ( $this->zoom == 'null' ) { |
| 101 | + $htis->zoom = $this->getDefaultZoom(); |
| 102 | + } |
| 103 | + |
100 | 104 | $this->addSpecificMapHTML( $parser ); |
101 | 105 | |
102 | 106 | return $this->output; |
Index: trunk/extensions/Maps/ParserFunctions/Maps_iMapFeature.php |
— | — | @@ -7,6 +7,8 @@ |
8 | 8 | * @ingroup Maps |
9 | 9 | * |
10 | 10 | * @author Jeroen De Dauw |
| 11 | + * |
| 12 | + * TODO: revise this interface |
11 | 13 | */ |
12 | 14 | |
13 | 15 | if ( !defined( 'MEDIAWIKI' ) ) { |
Index: trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php |
— | — | @@ -41,9 +41,6 @@ |
42 | 42 | return true; |
43 | 43 | } |
44 | 44 | |
45 | | - private static function initializeParams() { |
46 | | - } |
47 | | - |
48 | 45 | /** |
49 | 46 | * Returns the output for the call to the specified parser function. |
50 | 47 | * |
— | — | @@ -88,9 +85,9 @@ |
89 | 86 | * again overidden by the service parameters (the ones spesific to the service), |
90 | 87 | * and finally by the spesific parameters (the ones spesific to a service-feature combination). |
91 | 88 | */ |
92 | | - $parameterInfo = array_merge( MapsMapper::getCommonParameters(), $mapClass->getFeatureParameters() ); |
93 | | - $parameterInfo = array_merge( $parameterInfo, $egMapsServices[$service]['parameters'] ); |
94 | | - $parameterInfo = array_merge( $parameterInfo, $mapClass->getSpecificParameterInfo() ); |
| 89 | + $parameterInfo = array_merge_recursive( MapsMapper::getCommonParameters(), $mapClass->getFeatureParameters() ); |
| 90 | + $parameterInfo = array_merge_recursive( $parameterInfo, $egMapsServices[$service]['parameters'] ); |
| 91 | + $parameterInfo = array_merge_recursive( $parameterInfo, $mapClass->getSpecificParameterInfo() ); |
95 | 92 | |
96 | 93 | $parameters = $manager->manageParameters( |
97 | 94 | $parameters, |
Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.'; |
35 | 35 | } |
36 | 36 | else { |
37 | | - define( 'Maps_VERSION', '0.6 a15' ); |
| 37 | + define( 'Maps_VERSION', '0.6 a16' ); |
38 | 38 | |
39 | 39 | // The different coordinate notations. |
40 | 40 | define( 'Maps_COORDS_FLOAT', 'float' ); |
Index: trunk/extensions/Maps/Maps_Mapper.php |
— | — | @@ -227,7 +227,8 @@ |
228 | 228 | 'type' => 'integer', |
229 | 229 | 'criteria' => array( |
230 | 230 | 'not_empty' => array() |
231 | | - ) |
| 231 | + ), |
| 232 | + 'default' => 'null' |
232 | 233 | ), |
233 | 234 | 'width' => array( |
234 | 235 | 'criteria' => array( |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php |
— | — | @@ -24,9 +24,13 @@ |
25 | 25 | |
26 | 26 | public $serviceName = MapsGoogleMaps::SERVICE_NAME; |
27 | 27 | |
| 28 | + protected function getDefaultZoom() { |
| 29 | + global $egMapsGoogleMapsZoom; |
| 30 | + return $egMapsGoogleMapsZoom; |
| 31 | + } |
| 32 | + |
28 | 33 | public function getSpecificParameterInfo() { |
29 | 34 | global $egMapsGMapOverlays; |
30 | | - // TODO: it'd be cool to have this static so it can be cheched in order to only init it once. |
31 | 35 | $this->spesificParameters = array( |
32 | 36 | 'overlays' => array( |
33 | 37 | 'type' => array( 'string', 'list' ), |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | } |
62 | 62 | |
63 | 63 | private static function initializeParams() { |
64 | | - global $egMapsServices, $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, $egMapsGoogleAutozoom, $egMapsGoogleMapsZoom, $egMapsGMapControls; |
| 64 | + global $egMapsServices, $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, $egMapsGoogleAutozoom, $egMapsGMapControls; |
65 | 65 | |
66 | 66 | $allowedTypes = self::getTypeNames(); |
67 | 67 | |
— | — | @@ -98,7 +98,6 @@ |
99 | 99 | ), |
100 | 100 | ); |
101 | 101 | |
102 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsGoogleMapsZoom; |
103 | 102 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array( 0, 20 ); |
104 | 103 | } |
105 | 104 | |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php |
— | — | @@ -26,6 +26,11 @@ |
27 | 27 | |
28 | 28 | protected $markerStringFormat = 'getGMarkerData(lat, lon, \'title\', \'label\', "icon")'; |
29 | 29 | |
| 30 | + protected function getDefaultZoom() { |
| 31 | + global $egMapsGoogleMapsZoom; |
| 32 | + return $egMapsGoogleMapsZoom; |
| 33 | + } |
| 34 | + |
30 | 35 | public function getSpecificParameterInfo() { |
31 | 36 | global $egMapsGMapOverlays; |
32 | 37 | // TODO: it'd be cool to have this static so it can be cheched in order to only init it once. |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php |
— | — | @@ -24,6 +24,11 @@ |
25 | 25 | |
26 | 26 | protected $markerStringFormat = 'getYMarkerData(lat, lon, \'title\', \'label\', "icon")'; |
27 | 27 | |
| 28 | + protected function getDefaultZoom() { |
| 29 | + global $egMapsYahooMapsZoom; |
| 30 | + return $egMapsYahooMapsZoom; |
| 31 | + } |
| 32 | + |
28 | 33 | /** |
29 | 34 | * @see MapsBaseMap::doMapServiceLoad() |
30 | 35 | * |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php |
— | — | @@ -17,6 +17,11 @@ |
18 | 18 | |
19 | 19 | public $serviceName = MapsYahooMaps::SERVICE_NAME; |
20 | 20 | |
| 21 | + protected function getDefaultZoom() { |
| 22 | + global $egMapsYahooMapsZoom; |
| 23 | + return $egMapsYahooMapsZoom; |
| 24 | + } |
| 25 | + |
21 | 26 | /** |
22 | 27 | * @see MapsBaseMap::doMapServiceLoad() |
23 | 28 | */ |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php |
— | — | @@ -96,7 +96,6 @@ |
97 | 97 | ), |
98 | 98 | ); |
99 | 99 | |
100 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsYahooMapsZoom; |
101 | 100 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array( 1, 13 ); |
102 | 101 | } |
103 | 102 | |
Index: trunk/extensions/Maps/Geocoders/Maps_Geocoder.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | * @return array or false |
40 | 40 | */ |
41 | 41 | public static function attemptToGeocode( $coordsOrAddress, $geoservice = '', $mappingService = false, $checkForCoords = true ) { |
42 | | - if ( $checkForCoords ) { |
| 42 | + if ( $checkForCoords ) { |
43 | 43 | if ( MapsCoordinateParser::areCoordinates( $coordsOrAddress ) ) { |
44 | 44 | return MapsCoordinateParser::parseCoordinates( $coordsOrAddress ); |
45 | 45 | } else { |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | } |
98 | 98 | |
99 | 99 | $service = self::getValidGeoService( $service, $mappingService ); |
100 | | - |
| 100 | + |
101 | 101 | // Call the geocode function in the spesific geocoder class. |
102 | 102 | $coordinates = call_user_func( array( $egMapsGeoServices[$service], 'geocode' ), $address ); |
103 | 103 | |