r74882 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74881‎ | r74882 | r74883 >
Date:07:43, 17 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7.1 - added support for local images as layer
Modified paths:
  • /trunk/extensions/Maps/includes/Maps_Layer.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_LayerPage.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/OpenLayers/Maps_ParamOLLayers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/Maps_LayerPage.php
@@ -47,7 +47,7 @@
4848 'th',
4949 array(),
5050 wfMsg( 'maps-layer-value' )
51 - )
 51+ )
5252 );
5353
5454 foreach ( $this->getProperties() as $property => $value ) {
Index: trunk/extensions/Maps/includes/Maps_Layer.php
@@ -138,7 +138,7 @@
139139 public function getJavaScriptDefinition() {
140140 // Note: this is currently hardcoded for layers of type image.
141141 $label = Xml::encodeJsVar( $this->properties['label'] );
142 - $source = Xml::encodeJsVar( $this->properties['source'] );
 142+ $source = Xml::encodeJsVar( MapsMapper::getImageUrl( $this->properties['source'] ) );
143143 $lowerBound = Xml::encodeJsVar( (int)$this->properties['lowerbound'] );
144144 $upperBound = Xml::encodeJsVar( (int)$this->properties['upperbound'] );
145145 $leftBound = Xml::encodeJsVar( (int)$this->properties['leftbound'] );
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_ParamOLLayers.php
@@ -95,7 +95,7 @@
9696
9797 foreach ( $layerNames as $layerName ) {
9898 if ( array_key_exists( $layerName, $egMapsOLLayerDependencies ) ) {
99 -
 99+ $layerDependencies[] = $egMapsOLLayerDependencies[$layerName];
100100 }
101101 }
102102
Index: trunk/extensions/Maps/includes/Maps_Mapper.php
@@ -198,4 +198,24 @@
199199 return $params;
200200 }
201201
 202+ /**
 203+ * Resolves the url of images provided as wiki page; leaves others alone.
 204+ *
 205+ * @since 0.7.1
 206+ *
 207+ * @param string $image
 208+ *
 209+ * @return string
 210+ */
 211+ public static function getImageUrl( $image ) {
 212+ $title = Title::newFromText( $image, NS_FILE );
 213+
 214+ if ( $title->getNamespace() == NS_FILE && $title->exists() ) {
 215+ $imagePage = new ImagePage( $title );
 216+ $image = $imagePage->getDisplayedFile()->getURL();
 217+ }
 218+
 219+ return $image;
 220+ }
 221+
202222 }
\ No newline at end of file

Status & tagging log