r69058 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69057‎ | r69058 | r69059 >
Date:16:47, 5 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6.4 - follow up to r69024
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php
@@ -24,26 +24,18 @@
2525 protected function setQueryPrinterSettings() {
2626 global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
2727
28 - $this->elementNamePrefix = $egMapsYahooMapsPrefix;
29 -
3028 $this->defaultZoom = $egMapsYahooMapsZoom;
3129 }
3230
3331 /**
34 - * @see SMMapPrinter::doMapServiceLoad()
 32+ * @see SMMapPrinter::addSpecificMapHTML()
3533 */
36 - protected function doMapServiceLoad() {
37 - global $egYahooMapsOnThisPage;
 34+ protected function addSpecificMapHTML() {
 35+ global $egMapsYahooMapsPrefix, $egYahooMapsOnThisPage;
3836
3937 $egYahooMapsOnThisPage++;
 38+ $mapName = $egMapsYahooMapsPrefix . '_' . $egYahooMapsOnThisPage;
4039
41 - $this->elementNr = $egYahooMapsOnThisPage;
42 - }
43 -
44 - /**
45 - * @see SMMapPrinter::addSpecificMapHTML()
46 - */
47 - protected function addSpecificMapHTML() {
4840 // TODO: refactor up like done in maps with display point
4941 $markerItems = array();
5042
@@ -59,7 +51,7 @@
6052 $this->output .= Html::element(
6153 'div',
6254 array(
63 - 'id' => $this->mapName,
 55+ 'id' => $mapName,
6456 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
6557 ),
6658 wfMsg( 'maps-loading-map' )
@@ -69,7 +61,7 @@
7062 addOnloadHook(
7163 function() {
7264 initializeYahooMap(
73 - '$this->mapName',
 65+ '$mapName',
7466 $this->centreLat,
7567 $this->centreLon,
7668 $this->zoom,
Index: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php
@@ -23,29 +23,19 @@
2424 * @see SMMapPrinter::setQueryPrinterSettings()
2525 */
2626 protected function setQueryPrinterSettings() {
27 - global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
28 -
29 - $this->elementNamePrefix = $egMapsOpenLayersPrefix;
 27+ global $egMapsOpenLayersZoom;
3028 $this->defaultZoom = $egMapsOpenLayersZoom;
3129 }
32 -
33 - /**
34 - * @see SMMapPrinter::doMapServiceLoad()
35 - */
36 - protected function doMapServiceLoad() {
37 - global $egOpenLayersOnThisPage;
38 -
39 - $egOpenLayersOnThisPage++;
40 -
41 - $this->elementNr = $egOpenLayersOnThisPage;
42 - }
4330
4431 /**
4532 * @see SMMapPrinter::addSpecificMapHTML()
4633 */
4734 protected function addSpecificMapHTML() {
48 - global $wgLang;
 35+ global $wgLang, $egMapsOpenLayersPrefix, $egOpenLayersOnThisPage;
4936
 37+ $egOpenLayersOnThisPage++;
 38+ $mapName = $egMapsOpenLayersPrefix . '_' . $egOpenLayersOnThisPage;
 39+
5040 // TODO: refactor up like done in maps with display point
5141 $markerItems = array();
5242
@@ -61,7 +51,7 @@
6252 $this->output .= Html::element(
6353 'div',
6454 array(
65 - 'id' => $this->mapName,
 55+ 'id' => $mapName,
6656 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
6757 ),
6858 wfMsg( 'maps-loading-map' )
@@ -75,7 +65,7 @@
7666 addOnloadHook(
7767 function() {
7868 initOpenLayer(
79 - '$this->mapName',
 69+ '$mapName',
8070 $this->centreLat,
8171 $this->centreLon,
8272 $this->zoom,
Index: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php
@@ -24,10 +24,8 @@
2525 * @see SMMapPrinter::setQueryPrinterSettings()
2626 */
2727 protected function setQueryPrinterSettings() {
28 - global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix, $egMapsGMapOverlays;
 28+ global $egMapsGoogleMapsZoom, $egMapsGMapOverlays;
2929
30 - $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
31 -
3230 $this->defaultZoom = $egMapsGoogleMapsZoom;
3331
3432 $this->specificParameters = array(
@@ -42,21 +40,15 @@
4341 }
4442
4543 /**
46 - * @see SMMapPrinter::doMapServiceLoad()
 44+ * @see SMMapPrinter::addSpecificMapHTML()
4745 */
48 - protected function doMapServiceLoad() {
49 - global $egGoogleMapsOnThisPage;
 46+ protected function addSpecificMapHTML() {
 47+ global $egMapsGoogleMapsPrefix, $egGoogleMapsOnThisPage;
5048
5149 $egGoogleMapsOnThisPage++;
 50+ $mapName = $egMapsGoogleMapsPrefix . '_' . $egGoogleMapsOnThisPage;
5251
53 - $this->elementNr = $egGoogleMapsOnThisPage;
54 - }
55 -
56 - /**
57 - * @see SMMapPrinter::addSpecificMapHTML()
58 - */
59 - protected function addSpecificMapHTML() {
60 - $this->mService->addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls );
 52+ $this->mService->addOverlayOutput( $this->output, $mapName, $this->overlays, $this->controls );
6153
6254 // TODO: refactor up like done in maps with display point
6355 $markerItems = array();
@@ -72,7 +64,7 @@
7365 $this->output .= Html::element(
7466 'div',
7567 array(
76 - 'id' => $this->mapName,
 68+ 'id' => $mapName,
7769 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
7870 ),
7971 wfMsg( 'maps-loading-map' )
@@ -81,7 +73,7 @@
8274 $this->mService->addDependency( Html::inlineScript( <<<EOT
8375 addOnloadHook(
8476 function() {
85 - initializeGoogleMap('$this->mapName',
 77+ initializeGoogleMap('$mapName',
8678 {
8779 lat: $this->centreLat,
8880 lon: $this->centreLon,
Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -35,7 +35,7 @@
3636
3737 // Only initialize the extension when all dependencies are present.
3838 if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) {
39 - define( 'SM_VERSION', '0.6.4 a9' );
 39+ define( 'SM_VERSION', '0.6.4 a10' );
4040
4141 $useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath;
4242 $smgScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/SemanticMaps';
Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
@@ -33,11 +33,6 @@
3434 */
3535 protected abstract function setQueryPrinterSettings();
3636
37 - /**
38 - * Map service specific map count and loading of dependencies.
39 - */
40 - protected abstract function doMapServiceLoad();
41 -
4237 protected abstract function getServiceName();
4338
4439 /**
@@ -90,10 +85,6 @@
9186
9287 // Only create a map when there is at least one result.
9388 if ( count( $this->mLocations ) > 0 || $this->forceshow ) {
94 - $this->doMapServiceLoad();
95 -
96 - $this->setMapName();
97 -
9889 $this->setZoom();
9990
10091 $this->setCentre();
@@ -304,7 +295,7 @@
305296 * Sets the zoom level to the provided value, or when not set, to the default.
306297 */
307298 private function setZoom() {
308 - if ( strlen( $this->zoom ) < 1 ) {
 299+ if ( $this->zoom == '' ) {
309300 if ( count( $this->mLocations ) > 1 ) {
310301 $this->zoom = 'null';
311302 }
@@ -320,7 +311,7 @@
321312 */
322313 private function setCentre() {
323314 // If a centre value is set, use it.
324 - if ( strlen( $this->centre ) > 0 ) {
 315+ if ( $this->centre != '' ) {
325316 // Geocode and convert if required.
326317 $centre = MapsGeocoder::attemptToGeocode( $this->centre, $this->geoservice, $this->mService->getName() );
327318
@@ -347,16 +338,19 @@
348339 }
349340
350341 /**
351 - * Sets the $mapName field, using the $elementNamePrefix and $elementNr.
 342+ * Returns the internationalized name of the mapping service.
 343+ *
 344+ * @return string
352345 */
353 - protected function setMapName() {
354 - $this->mapName = $this->elementNamePrefix . '_' . $this->elementNr;
355 - }
356 -
357346 public final function getName() {
358347 return wfMsg( 'maps_' . $this->mService->getName() );
359348 }
360349
 350+ /**
 351+ * Returns a list of parameter information, for usage by Special:Ask and others.
 352+ *
 353+ * @return array
 354+ */
361355 public function getParameters() {
362356 global $egMapsMapWidth, $egMapsMapHeight;
363357

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69024Changes for 0.6.4 - follow up to moving service specific behavior and data to...jeroendedauw22:10, 4 July 2010

Status & tagging log