http://www.mediawiki.org/wiki/Special:Code/MediaWiki/69058
Revision: 69058
Author: jeroendedauw
Date: 2010-07-05 16:47:59 +0000 (Mon, 05 Jul 2010)
Log Message:
-----------
Changes for 0.6.4 - follow up to r69024
Modified Paths:
--------------
trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
trunk/extensions/SemanticMaps/SemanticMaps.php
trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php
trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php
trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php
Modified: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
===================================================================
--- trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
2010-07-05 16:23:04 UTC (rev 69057)
+++ trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
2010-07-05 16:47:59 UTC (rev 69058)
@@ -33,11 +33,6 @@
*/
protected abstract function setQueryPrinterSettings();
- /**
- * Map service specific map count and loading of dependencies.
- */
- protected abstract function doMapServiceLoad();
-
protected abstract function getServiceName();
/**
@@ -90,10 +85,6 @@
// Only create a map when there is at least one result.
if ( count( $this->mLocations ) > 0 || $this->forceshow
) {
- $this->doMapServiceLoad();
-
- $this->setMapName();
-
$this->setZoom();
$this->setCentre();
@@ -304,7 +295,7 @@
* Sets the zoom level to the provided value, or when not set, to the
default.
*/
private function setZoom() {
- if ( strlen( $this->zoom ) < 1 ) {
+ if ( $this->zoom == '' ) {
if ( count( $this->mLocations ) > 1 ) {
$this->zoom = 'null';
}
@@ -320,7 +311,7 @@
*/
private function setCentre() {
// If a centre value is set, use it.
- if ( strlen( $this->centre ) > 0 ) {
+ if ( $this->centre != '' ) {
// Geocode and convert if required.
$centre = MapsGeocoder::attemptToGeocode(
$this->centre, $this->geoservice, $this->mService->getName() );
@@ -347,16 +338,19 @@
}
/**
- * Sets the $mapName field, using the $elementNamePrefix and $elementNr.
+ * Returns the internationalized name of the mapping service.
+ *
+ * @return string
*/
- protected function setMapName() {
- $this->mapName = $this->elementNamePrefix . '_' .
$this->elementNr;
- }
-
public final function getName() {
return wfMsg( 'maps_' . $this->mService->getName() );
}
+ /**
+ * Returns a list of parameter information, for usage by Special:Ask
and others.
+ *
+ * @return array
+ */
public function getParameters() {
global $egMapsMapWidth, $egMapsMapHeight;
Modified: trunk/extensions/SemanticMaps/SemanticMaps.php
===================================================================
--- trunk/extensions/SemanticMaps/SemanticMaps.php 2010-07-05 16:23:04 UTC
(rev 69057)
+++ trunk/extensions/SemanticMaps/SemanticMaps.php 2010-07-05 16:47:59 UTC
(rev 69058)
@@ -35,7 +35,7 @@
// Only initialize the extension when all dependencies are present.
if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) {
- define( 'SM_VERSION', '0.6.4 a9' );
+ define( 'SM_VERSION', '0.6.4 a10' );
$useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) &&
isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath;
$smgScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath :
$wgScriptPath . '/extensions' ) . '/SemanticMaps';
Modified: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php
===================================================================
--- trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php
2010-07-05 16:23:04 UTC (rev 69057)
+++ trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php
2010-07-05 16:47:59 UTC (rev 69058)
@@ -24,10 +24,8 @@
* @see SMMapPrinter::setQueryPrinterSettings()
*/
protected function setQueryPrinterSettings() {
- global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix,
$egMapsGMapOverlays;
+ global $egMapsGoogleMapsZoom, $egMapsGMapOverlays;
- $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
-
$this->defaultZoom = $egMapsGoogleMapsZoom;
$this->specificParameters = array(
@@ -42,21 +40,15 @@
}
/**
- * @see SMMapPrinter::doMapServiceLoad()
+ * @see SMMapPrinter::addSpecificMapHTML()
*/
- protected function doMapServiceLoad() {
- global $egGoogleMapsOnThisPage;
+ protected function addSpecificMapHTML() {
+ global $egMapsGoogleMapsPrefix, $egGoogleMapsOnThisPage;
$egGoogleMapsOnThisPage++;
+ $mapName = $egMapsGoogleMapsPrefix . '_' .
$egGoogleMapsOnThisPage;
- $this->elementNr = $egGoogleMapsOnThisPage;
- }
-
- /**
- * @see SMMapPrinter::addSpecificMapHTML()
- */
- protected function addSpecificMapHTML() {
- $this->mService->addOverlayOutput( $this->output,
$this->mapName, $this->overlays, $this->controls );
+ $this->mService->addOverlayOutput( $this->output, $mapName,
$this->overlays, $this->controls );
// TODO: refactor up like done in maps with display point
$markerItems = array();
@@ -72,7 +64,7 @@
$this->output .= Html::element(
'div',
array(
- 'id' => $this->mapName,
+ 'id' => $mapName,
'style' => "width: $this->width; height:
$this->height; background-color: #cccccc; overflow: hidden;",
),
wfMsg( 'maps-loading-map' )
@@ -81,7 +73,7 @@
$this->mService->addDependency( Html::inlineScript( <<<EOT
addOnloadHook(
function() {
- initializeGoogleMap('$this->mapName',
+ initializeGoogleMap('$mapName',
{
lat: $this->centreLat,
lon: $this->centreLon,
Modified: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php
===================================================================
--- trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php
2010-07-05 16:23:04 UTC (rev 69057)
+++ trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php
2010-07-05 16:47:59 UTC (rev 69058)
@@ -23,29 +23,19 @@
* @see SMMapPrinter::setQueryPrinterSettings()
*/
protected function setQueryPrinterSettings() {
- global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
-
- $this->elementNamePrefix = $egMapsOpenLayersPrefix;
+ global $egMapsOpenLayersZoom;
$this->defaultZoom = $egMapsOpenLayersZoom;
}
-
- /**
- * @see SMMapPrinter::doMapServiceLoad()
- */
- protected function doMapServiceLoad() {
- global $egOpenLayersOnThisPage;
-
- $egOpenLayersOnThisPage++;
-
- $this->elementNr = $egOpenLayersOnThisPage;
- }
/**
* @see SMMapPrinter::addSpecificMapHTML()
*/
protected function addSpecificMapHTML() {
- global $wgLang;
+ global $wgLang, $egMapsOpenLayersPrefix,
$egOpenLayersOnThisPage;
+ $egOpenLayersOnThisPage++;
+ $mapName = $egMapsOpenLayersPrefix . '_' .
$egOpenLayersOnThisPage;
+
// TODO: refactor up like done in maps with display point
$markerItems = array();
@@ -61,7 +51,7 @@
$this->output .= Html::element(
'div',
array(
- 'id' => $this->mapName,
+ 'id' => $mapName,
'style' => "width: $this->width; height:
$this->height; background-color: #cccccc; overflow: hidden;",
),
wfMsg( 'maps-loading-map' )
@@ -75,7 +65,7 @@
addOnloadHook(
function() {
initOpenLayer(
- '$this->mapName',
+ '$mapName',
$this->centreLat,
$this->centreLon,
$this->zoom,
Modified: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php
===================================================================
--- trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php
2010-07-05 16:23:04 UTC (rev 69057)
+++ trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php
2010-07-05 16:47:59 UTC (rev 69058)
@@ -24,26 +24,18 @@
protected function setQueryPrinterSettings() {
global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
- $this->elementNamePrefix = $egMapsYahooMapsPrefix;
-
$this->defaultZoom = $egMapsYahooMapsZoom;
}
/**
- * @see SMMapPrinter::doMapServiceLoad()
+ * @see SMMapPrinter::addSpecificMapHTML()
*/
- protected function doMapServiceLoad() {
- global $egYahooMapsOnThisPage;
+ protected function addSpecificMapHTML() {
+ global $egMapsYahooMapsPrefix, $egYahooMapsOnThisPage;
$egYahooMapsOnThisPage++;
+ $mapName = $egMapsYahooMapsPrefix . '_' .
$egYahooMapsOnThisPage;
- $this->elementNr = $egYahooMapsOnThisPage;
- }
-
- /**
- * @see SMMapPrinter::addSpecificMapHTML()
- */
- protected function addSpecificMapHTML() {
// TODO: refactor up like done in maps with display point
$markerItems = array();
@@ -59,7 +51,7 @@
$this->output .= Html::element(
'div',
array(
- 'id' => $this->mapName,
+ 'id' => $mapName,
'style' => "width: $this->width; height:
$this->height; background-color: #cccccc; overflow: hidden;",
),
wfMsg( 'maps-loading-map' )
@@ -69,7 +61,7 @@
addOnloadHook(
function() {
initializeYahooMap(
- '$this->mapName',
+ '$mapName',
$this->centreLat,
$this->centreLon,
$this->zoom,
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs