Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMaps.php |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | |
16 | 16 | final class SMYahooMaps extends SMMapPrinter { |
17 | 17 | |
| 18 | + public $serviceName = MapsYahooMaps::SERVICE_NAME; |
| 19 | + |
18 | 20 | public function getName() { |
19 | 21 | wfLoadExtensionMessages('SemanticMaps'); |
20 | 22 | return wfMsg('sm_yahoomaps_printername'); |
— | — | @@ -41,6 +43,8 @@ |
42 | 44 | $egYahooMapsOnThisPage++; |
43 | 45 | |
44 | 46 | $this->elementNr = $egYahooMapsOnThisPage; |
| 47 | + |
| 48 | + $this->defaultParams = MapsYahooMaps::getDefaultParams(); |
45 | 49 | } |
46 | 50 | |
47 | 51 | /** |
— | — | @@ -56,6 +60,8 @@ |
57 | 61 | MapsUtils::makePxValue($this->width); |
58 | 62 | MapsUtils::makePxValue($this->height); |
59 | 63 | |
| 64 | + $this->autozoom = MapsYahooMaps::getAutozoomJSValue($this->autozoom); |
| 65 | + |
60 | 66 | $markerItems = array(); |
61 | 67 | |
62 | 68 | foreach ($this->m_locations as $location) { |
Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | } |
16 | 16 | |
17 | 17 | final class SMYahooMapsFormInput extends SMFormInput {
|
| 18 | + |
| 19 | + public $serviceName = MapsYahooMaps::SERVICE_NAME; |
18 | 20 |
|
19 | 21 | /** |
20 | 22 | * @see MapsMapFeature::setMapSettings() |
— | — | @@ -25,8 +27,10 @@ |
26 | 28 | $this->elementNamePrefix = $egMapsYahooMapsPrefix; |
27 | 29 | $this->showAddresFunction = 'showYAddress'; |
28 | 30 | |
29 | | - $this->earthZoom = 17; |
30 | | - $this->defaultZoom = $egMapsYahooMapsZoom; |
| 31 | + $this->earthZoom = 17; |
| 32 | + |
| 33 | + $this->defaultParams = MapsYahooMaps::getDefaultParams(); |
| 34 | + $this->defaultZoom = $egMapsYahooMapsZoom; |
31 | 35 | } |
32 | 36 | |
33 | 37 | /** |
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayers.php |
— | — | @@ -15,6 +15,8 @@ |
16 | 16 | |
17 | 17 | final class SMOpenLayers extends SMMapPrinter { |
18 | 18 | |
| 19 | + public $serviceName = MapsOpenLayers::SERVICE_NAME; |
| 20 | + |
19 | 21 | public function getName() { |
20 | 22 | wfLoadExtensionMessages('SemanticMaps'); |
21 | 23 | return wfMsg('sm_openlayers_printername'); |
— | — | @@ -29,6 +31,8 @@ |
30 | 32 | |
31 | 33 | $this->elementNamePrefix = $egMapsOpenLayersPrefix; |
32 | 34 | $this->defaultZoom = $egMapsOpenLayersZoom; |
| 35 | + |
| 36 | + $this->defaultParams = MapsOpenLayers::getDefaultParams(); |
33 | 37 | } |
34 | 38 | |
35 | 39 | /** |
— | — | @@ -52,6 +56,8 @@ |
53 | 57 | global $wgJsMimeType; |
54 | 58 | |
55 | 59 | $controlItems = MapsOpenLayers::createControlsString($this->controls); |
| 60 | + |
| 61 | + MapsMapper::enforceArrayValues($this->layers); |
56 | 62 | $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies($this->output, $this->layers); |
57 | 63 | |
58 | 64 | MapsUtils::makePxValue($this->width); |
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php |
— | — | @@ -15,6 +15,8 @@ |
16 | 16 | |
17 | 17 | final class SMOpenLayersFormInput extends SMFormInput {
|
18 | 18 | |
| 19 | + public $serviceName = MapsOpenLayers::SERVICE_NAME; |
| 20 | + |
19 | 21 | /** |
20 | 22 | * @see MapsMapFeature::setMapSettings() |
21 | 23 | * |
— | — | @@ -26,7 +28,9 @@ |
27 | 29 | $this->showAddresFunction = 'showOLAddress'; |
28 | 30 | |
29 | 31 | $this->earthZoom = 1; |
30 | | - $this->defaultZoom = $egMapsOpenLayersZoom; |
| 32 | + |
| 33 | + $this->defaultParams = MapsOpenLayers::getDefaultParams(); |
| 34 | + $this->defaultZoom = $egMapsOpenLayersZoom; |
31 | 35 | } |
32 | 36 | |
33 | 37 | /** |
Index: trunk/extensions/SemanticMaps/SM_MapPrinter.php |
— | — | @@ -32,6 +32,10 @@ |
33 | 33 | */ |
34 | 34 | protected abstract function addSpecificMapHTML(); |
35 | 35 | |
| 36 | + public $serviceName; |
| 37 | + |
| 38 | + protected $defaultParams = array(); |
| 39 | + |
36 | 40 | protected $m_locations = array(); |
37 | 41 | |
38 | 42 | protected $defaultZoom; |
— | — | @@ -57,16 +61,14 @@ |
58 | 62 | public final function getResultText($res, $outputmode) { |
59 | 63 | $this->formatResultData($res, $outputmode); |
60 | 64 | |
61 | | - $this->manageMapProperties(); |
62 | | - |
63 | 65 | $this->setQueryPrinterSettings(); |
64 | 66 | |
| 67 | + $this->manageMapProperties($this->m_params, 'SMMapPrinter'); |
| 68 | + |
65 | 69 | $this->doMapServiceLoad(); |
66 | 70 | |
67 | | - $this->mapName = $this->elementNamePrefix.'_'.$this->elementNr; |
| 71 | + $this->setMapName(); |
68 | 72 | |
69 | | - $this->autozoom = ($this->autozoom == 'no' || $this->autozoom == 'off') ? 'false' : 'true'; |
70 | | - |
71 | 73 | $this->setZoom(); |
72 | 74 | |
73 | 75 | $this->setCentre(); |
— | — | @@ -166,16 +168,21 @@ |
167 | 169 | return $icon; |
168 | 170 | } |
169 | 171 | |
170 | | - private function manageMapProperties() { |
171 | | - $this->m_params = MapsMapper::setDefaultParValues($this->m_params, true); |
| 172 | + private function manageMapProperties($mapProperties, $className) { |
| 173 | + global $egMapsServices; |
172 | 174 | |
| 175 | + $mapProperties = MapsMapper::getValidParams($mapProperties, $egMapsServices[$this->serviceName]['parameters']); |
| 176 | + $mapProperties = MapsMapper::setDefaultParValues($mapProperties, $this->defaultParams); |
| 177 | + |
173 | 178 | // Go through the array with map parameters and create new variables |
174 | 179 | // with the name of the key and value of the item if they don't exist on class level yet. |
175 | | - foreach($this->m_params as $paramName => $paramValue) { |
176 | | - if (!property_exists('SMMapPrinter', $paramName)) { |
| 180 | + foreach($mapProperties as $paramName => $paramValue) { |
| 181 | + if (!property_exists($className, $paramName)) { |
177 | 182 | $this->{$paramName} = $paramValue; |
178 | 183 | } |
179 | 184 | } |
| 185 | + |
| 186 | + MapsMapper::enforceArrayValues($this->controls); |
180 | 187 | } |
181 | 188 | |
182 | 189 | /** |
— | — | @@ -208,4 +215,12 @@ |
209 | 216 | } |
210 | 217 | } |
211 | 218 | |
| 219 | + /** |
| 220 | + * Sets the $mapName field, using the $elementNamePrefix and $elementNr. |
| 221 | + * |
| 222 | + */ |
| 223 | + protected function setMapName() { |
| 224 | + $this->mapName = $this->elementNamePrefix.'_'.$this->elementNr; |
| 225 | + } |
| 226 | + |
212 | 227 | } |
Index: trunk/extensions/SemanticMaps/SM_FormInput.php |
— | — | @@ -90,18 +90,15 @@ |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | | - * Sets the zoom so the whole map is visible in case there is no maker yet, |
95 | | - * and sets it to the default when there is a marker but no zoom parameter. |
96 | | - * |
97 | | - * @param unknown_type $defaultZoom The mapping service's default zoom level |
98 | | - * @param unknown_type $earthZoom The mapping service's earth-level zoom (on which the complete map is visible) |
| 94 | + * Sets the zoom so the whole map is visible in case there is no maker yet, |
| 95 | + * and sets it to the default when there is a marker but no zoom parameter. |
99 | 96 | */ |
100 | 97 | private function setZoom() { |
101 | | - if (empty($this->coordinates)) { |
102 | | - $this->zoom = $this->earthZoom; |
103 | | - } else if (strlen($this->zoom) < 1) { |
104 | | - $this->zoom = $this->defaultZoom; |
105 | | - } |
| 98 | + if (empty($this->coordinates)) { |
| 99 | + $this->zoom = $this->earthZoom; |
| 100 | + } else if (strlen($this->zoom) < 1) { |
| 101 | + $this->zoom = $this->defaultZoom; |
| 102 | + } |
106 | 103 | } |
107 | 104 | |
108 | 105 | /** |
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMaps.php |
— | — | @@ -16,6 +16,8 @@ |
17 | 17 | |
18 | 18 | final class SMGoogleMaps extends SMMapPrinter { |
19 | 19 | |
| 20 | + public $serviceName = MapsGoogleMaps::SERVICE_NAME; |
| 21 | + |
20 | 22 | public function getName() { |
21 | 23 | wfLoadExtensionMessages('SemanticMaps'); |
22 | 24 | return wfMsg('sm_googlemaps_printername'); |
— | — | @@ -31,6 +33,8 @@ |
32 | 34 | $this->elementNamePrefix = $egMapsGoogleMapsPrefix; |
33 | 35 | |
34 | 36 | $this->defaultZoom = $egMapsGoogleMapsZoom; |
| 37 | + |
| 38 | + $this->defaultParams = MapsGoogleMaps::getDefaultParams(); |
35 | 39 | } |
36 | 40 | |
37 | 41 | /** |
— | — | @@ -58,12 +62,14 @@ |
59 | 63 | global $wgJsMimeType; |
60 | 64 | |
61 | 65 | $enableEarth = MapsGoogleMaps::getEarthValue($this->earth); |
62 | | - $this->earth = MapsGoogleMaps::getJSEarthValue($enableEarth); |
| 66 | + $this->earth = MapsMapper::getJSBoolValue($enableEarth); |
63 | 67 | |
64 | 68 | // Get the Google Maps names for the control and map types |
65 | 69 | $this->type = MapsGoogleMaps::getGMapType($this->type, $enableEarth); |
66 | 70 | $control = MapsGoogleMaps::getGControlType($this->controls); |
67 | 71 | |
| 72 | + $this->autozoom = MapsGoogleMaps::getAutozoomJSValue($this->autozoom); |
| 73 | + |
68 | 74 | $markerItems = array(); |
69 | 75 | |
70 | 76 | foreach ($this->m_locations as $location) { |
— | — | @@ -71,7 +77,7 @@ |
72 | 78 | list($lat, $lon, $title, $label, $icon) = $location; |
73 | 79 | $title = str_replace("'", "\'", $title); |
74 | 80 | $label = str_replace("'", "\'", $label); |
75 | | - $markerItems[] = "getGMarkerData($lat, $lon, '$title', '$label')"; |
| 81 | + $markerItems[] = "getGMarkerData($lat, $lon, '$title', '$label', '')"; |
76 | 82 | } |
77 | 83 | |
78 | 84 | $markersString = implode(',', $markerItems); |
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php |
— | — | @@ -17,6 +17,8 @@ |
18 | 18 | |
19 | 19 | final class SMGoogleMapsFormInput extends SMFormInput {
|
20 | 20 | |
| 21 | + public $serviceName = MapsGoogleMaps::SERVICE_NAME; |
| 22 | + |
21 | 23 | /** |
22 | 24 | * @see MapsMapFeature::setMapSettings() |
23 | 25 | * |
— | — | @@ -28,7 +30,9 @@ |
29 | 31 | $this->showAddresFunction = 'showGAddress'; |
30 | 32 | |
31 | 33 | $this->earthZoom = 1; |
32 | | - $this->defaultZoom = $egMapsGoogleMapsZoom; |
| 34 | + |
| 35 | + $this->defaultParams = MapsGoogleMaps::getDefaultParams(); |
| 36 | + $this->defaultZoom = $egMapsGoogleMapsZoom; |
33 | 37 | } |
34 | 38 | |
35 | 39 | |