r54672 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54671‎ | r54672 | r54673 >
Date:17:04, 9 August 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.3.
Modified paths:
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMaps.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMaps.php
@@ -29,7 +29,10 @@
3030 global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
3131
3232 $this->elementNamePrefix = $egMapsYahooMapsPrefix;
33 - $this->defaultZoom = $egMapsYahooMapsZoom;
 33+
 34+ $this->defaultZoom = $egMapsYahooMapsZoom;
 35+
 36+ $this->defaultParams = MapsYahooMapsUtils::getDefaultParams();
3437 }
3538
3639 /**
@@ -43,8 +46,6 @@
4447 $egYahooMapsOnThisPage++;
4548
4649 $this->elementNr = $egYahooMapsOnThisPage;
47 -
48 - $this->defaultParams = MapsYahooMapsUtils::getDefaultParams();
4950 }
5051
5152 /**
@@ -54,7 +55,7 @@
5556 protected function addSpecificMapHTML() {
5657 global $wgJsMimeType;
5758
58 - $this->type = MapsYahooMapsUtils::getYMapType($this->type);
 59+ $this->type = MapsYahooMapsUtils::getYMapType($this->type, true);
5960 $this->controls = MapsYahooMapsUtils::createControlsString($this->controls);
6061
6162 MapsUtils::makePxValue($this->width);
@@ -72,14 +73,18 @@
7374 $markerItems[] = "getYMarkerData($lat, $lon, '$title', '$label', '')";
7475 }
7576
76 - $markersString = implode(',', $markerItems);
 77+ $markersString = implode(',', $markerItems);
 78+
 79+ $this->types = explode(",", $this->types);
7780
 81+ $typesString = MapsYahooMapsUtils::createTypesString($this->types);
 82+
7883 $this->output .= "
7984 <div id='$this->mapName' style='width: $this->width; height: $this->height;'></div>
8085
8186 <script type='$wgJsMimeType'>/*<![CDATA[*/
8287 addLoadEvent(
83 - initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$this->controls], $this->autozoom, [$markersString])
 88+ initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString])
8489 );
8590 /*]]>*/</script>";
8691
Index: trunk/extensions/SemanticMaps/SM_MapPrinter.php
@@ -63,7 +63,7 @@
6464
6565 $this->setQueryPrinterSettings();
6666
67 - $this->manageMapProperties($this->m_params, 'SMMapPrinter');
 67+ $this->manageMapProperties($this->m_params);
6868
6969 $this->doMapServiceLoad();
7070
@@ -168,26 +168,28 @@
169169 return $icon;
170170 }
171171
172 - private function manageMapProperties($mapProperties, $className) {
 172+ private function manageMapProperties($mapProperties) {
173173 global $egMapsServices;
174174
175175 $mapProperties = MapsMapper::getValidParams($mapProperties, $egMapsServices[$this->serviceName]['parameters']);
176176 $mapProperties = MapsMapper::setDefaultParValues($mapProperties, $this->defaultParams);
177177
 178+ if (isset($this->serviceName)) $mapProperties['service'] = $this->serviceName;
 179+
178180 // Go through the array with map parameters and create new variables
179181 // with the name of the key and value of the item if they don't exist on class level yet.
180182 foreach($mapProperties as $paramName => $paramValue) {
181 - if (!property_exists($className, $paramName)) {
 183+ if (!property_exists(__CLASS__, $paramName)) {
182184 $this->{$paramName} = $paramValue;
183185 }
184186 }
185 -
 187+
186188 MapsMapper::enforceArrayValues($this->controls);
187189 }
188190
189191 /**
190192 * Sets the zoom level to the provided value, or when not set, to the default.
191 - *
 193+ *r
192194 */
193195 private function setZoom() {
194196 if (strlen($this->zoom) < 1) {
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMaps.php
@@ -62,10 +62,10 @@
6363 global $wgJsMimeType;
6464
6565 $enableEarth = MapsGoogleMapsUtils::getEarthValue($this->earth);
66 - $this->earth = MapsMapper::getJSBoolValue($enableEarth);
6766
6867 // Get the Google Maps names for the control and map types
69 - $this->type = MapsGoogleMapsUtils::getGMapType($this->type, $enableEarth);
 68+ $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true);
 69+
7070 $control = MapsGoogleMapsUtils::getGControlType($this->controls);
7171
7272 $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom);
@@ -82,11 +82,15 @@
8383
8484 $markersString = implode(',', $markerItems);
8585
 86+ $this->types = explode(",", $this->types);
 87+
 88+ $typesString = MapsGoogleMapsUtils::createTypesString($this->types, $enableEarth);
 89+
8690 $this->output .= <<<END
8791 <div id="$this->mapName" class="$this->class" style="$this->style" ></div>
8892 <script type="$wgJsMimeType"> /*<![CDATA[*/
8993 addLoadEvent(
90 - initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, new $control(), $this->autozoom, $this->earth, [$markersString])
 94+ initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], new $control(), $this->autozoom, [$markersString])
9195 );
9296 /*]]>*/ </script>
9397
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -60,17 +60,21 @@
6161 protected function addSpecificMapHTML() {
6262 global $wgJsMimeType;
6363
64 - $enableEarth = $this-earth == 'on' || $this->earth == 'yes';
65 - $earth = $enableEarth ? 'true' : 'false';
 64+ $enableEarth = MapsGoogleMapsUtils::getEarthValue($this->earth);
6665
67 - $this->type = MapsGoogleMapsUtils::getGMapType($this->type, $enableEarth);
 66+ $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true);
 67+
6868 $control = MapsGoogleMapsUtils::getGControlType($this->controls);
6969
 70+ $this->types = explode(",", $this->types);
 71+
 72+ $typesString = MapsMapper::createTypesString($this->types, $enableEarth);
 73+
7074 $this->output .= "
7175 <div id='".$this->mapName."' class='".$this->class."'></div>
7276
7377 <script type='$wgJsMimeType'>/*<![CDATA[*/
74 - addLoadEvent(makeFormInputGoogleMap('".$this->mapName."', '".$this->coordsFieldName."', ".$this->width.", ".$this->height.", ".$this->centre_lat.", ".$this->centre_lon.", ".$this->zoom.", ".$this->marker_lat.", ".$this->marker_lon.", ".$this->type.", new $control(), ".$this->autozoom.", $earth));
 78+ addLoadEvent(makeFormInputGoogleMap('$this->mapName', '$this->coordsFieldName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->marker_lat, $this->marker_lon, $this->type, [$typesString], new $control(), $this->autozoom));
7579 window.unload = GUnload;
7680 /*]]>*/</script>";
7781 }

Status & tagging log