r64310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64309‎ | r64310 | r64311 >
Date:21:28, 28 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - Follow up to r64299 - Fixed JS inclusion and div display
Modified paths:
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Maps.i18n.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_MapFeature.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/DisplayMap/Maps_BaseMap.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/YahooMapFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -52,7 +52,7 @@
5353 * @see MapsBaseMap::addSpecificMapHTML()
5454 *
5555 */
56 - public function addSpecificMapHTML() {
 56+ public function addSpecificMapHTML( Parser $parser ) {
5757 global $wgOut;
5858
5959 $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
@@ -61,13 +61,13 @@
6262 'div',
6363 array(
6464 'id' => $this->mapName,
65 - 'width' => $this->width,
66 - 'height' => $this->height
 65+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
6766 ),
68 - null
 67+ wfMsg('maps-loading-map')
6968 );
7069
71 - $wgOut->addInlineScript( <<<EOT
 70+ $parser->getOutput()->addHeadItem(
 71+ Html::inlineScript( <<<EOT
7272 addOnloadHook(
7373 function() {
7474 initOpenLayer(
@@ -82,7 +82,7 @@
8383 }
8484 );
8585 EOT
86 - );
 86+ ) );
8787 }
8888
8989 }
\ No newline at end of file
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php
@@ -45,7 +45,7 @@
4646 * @see MapsBaseMap::addSpecificMapHTML()
4747 *
4848 */
49 - public function addSpecificMapHTML() {
 49+ public function addSpecificMapHTML( Parser $parser ) {
5050 global $wgOut;
5151
5252 $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
@@ -54,13 +54,13 @@
5555 'div',
5656 array(
5757 'id' => $this->mapName,
58 - 'width' => $this->width,
59 - 'height' => $this->height
 58+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
6059 ),
61 - null
 60+ wfMsg('maps-loading-map')
6261 );
6362
64 - $wgOut->addInlineScript( <<<EOT
 63+ $parser->getOutput()->addHeadItem(
 64+ Html::inlineScript( <<<EOT
6565 addOnloadHook(
6666 function() {
6767 initOpenLayer(
@@ -75,7 +75,7 @@
7676 }
7777 );
7878 EOT
79 - );
 79+ ) );
8080 }
8181
8282 }
\ No newline at end of file
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php
@@ -55,7 +55,7 @@
5656
5757 $this->setCentre();
5858
59 - $this->addSpecificMapHTML();
 59+ $this->addSpecificMapHTML( $parser );
6060 }
6161
6262 return $this->output . $this->errorList;
Index: trunk/extensions/Maps/ParserFunctions/DisplayMap/Maps_BaseMap.php
@@ -47,7 +47,7 @@
4848
4949 $this->setCentre();
5050
51 - $this->addSpecificMapHTML();
 51+ $this->addSpecificMapHTML( $parser );
5252 }
5353
5454 return $this->output . $this->errorList;
Index: trunk/extensions/Maps/Maps.php
@@ -33,7 +33,7 @@
3434 echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.';
3535 }
3636 else {
37 - define( 'Maps_VERSION', '0.6 a2' );
 37+ define( 'Maps_VERSION', '0.6 a3' );
3838
3939 // The different coordinate notations.
4040 define( 'Maps_COORDS_FLOAT', 0 );
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php
@@ -66,10 +66,11 @@
6767 * @see MapsBaseMap::addSpecificMapHTML()
6868 *
6969 */
70 - public function addSpecificMapHTML() {
 70+ public function addSpecificMapHTML( Parser $parser ) {
7171 global $wgOut;
7272
73 - $wgOut->addInlineScript( <<<EOT
 73+ $parser->getOutput()->addHeadItem(
 74+ Html::inlineScript( <<<EOT
7475 addOnloadHook(
7576 function() {
7677 slippymaps['$this->mapName'] = new slippymap_map(
@@ -88,7 +89,7 @@
8990 }
9091 );
9192 EOT
92 - );
 93+ ) );
9394
9495 $this->output .= $this->static ? $this->getStaticMap() : $this->getDynamicMap();
9596 }
@@ -114,11 +115,9 @@
115116 'div',
116117 array(
117118 'id' => $this->mapName,
118 - 'width' => $this->width,
119 - 'height' => $this->height,
120 - 'class' => 'map'
 119+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
121120 ),
122 - null
 121+ wfMsg('maps-loading-map')
123122 );
124123 }
125124
@@ -151,14 +150,12 @@
152151 if ( $this->activatable ) {
153152 $image['onclick'] = "slippymaps['$this->mapName'].init();";
154153 }
155 -
 154+
156155 return Html::element(
157156 'div',
158157 array(
159158 'id' => $this->mapName,
160 - 'width' => $this->width,
161 - 'height' => $this->height,
162 - 'class' => 'map'
 159+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
163160 ),
164161 Html::element(
165162 'img',
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispPoint.php
@@ -52,10 +52,11 @@
5353 * @see MapsBaseMap::addSpecificMapHTML()
5454 *
5555 */
56 - public function addSpecificMapHTML() {
 56+ public function addSpecificMapHTML( Parser $parser ) {
5757 global $wgOut;
5858
59 - $wgOut->addInlineScript( <<<EOT
 59+ $parser->getOutput()->addHeadItem(
 60+ Html::inlineScript( <<<EOT
6061 addOnloadHook(
6162 function() {
6263 slippymaps['$this->mapName'] = new slippymap_map(
@@ -75,17 +76,15 @@
7677 }
7778 );
7879 EOT
79 - );
 80+ ) );
8081
8182 $this->output .= Html::element(
8283 'div',
8384 array(
8485 'id' => $this->mapName,
85 - 'width' => $this->width,
86 - 'height' => $this->height,
87 - 'class' => 'map'
 86+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
8887 ),
89 - null
 88+ wfMsg('maps-loading-map')
9089 );
9190 }
9291 }
\ No newline at end of file
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -62,7 +62,7 @@
6363 * @see MapsBaseMap::addSpecificMapHTML()
6464 *
6565 */
66 - public function addSpecificMapHTML() {
 66+ public function addSpecificMapHTML( Parser $parser ) {
6767 global $wgOut;
6868
6969 MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls );
@@ -71,13 +71,13 @@
7272 'div',
7373 array(
7474 'id' => $this->mapName,
75 - 'width' => $this->width,
76 - 'height' => $this->height
 75+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
7776 ),
78 - null
 77+ wfMsg('maps-loading-map')
7978 );
8079
81 - $wgOut->addInlineScript( <<<EOT
 80+ $parser->getOutput()->addHeadItem(
 81+ Html::inlineScript( <<<EOT
8282 addOnloadHook(
8383 function() {
8484 initializeGoogleMap('$this->mapName',
@@ -94,7 +94,7 @@
9595 }
9696 );
9797 EOT
98 - );
 98+ ) );
9999
100100 }
101101
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -64,7 +64,7 @@
6565 * @see MapsBaseMap::addSpecificMapHTML()
6666 *
6767 */
68 - public function addSpecificMapHTML() {
 68+ public function addSpecificMapHTML( Parser $parser ) {
6969 global $wgOut;
7070
7171 MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls );
@@ -73,14 +73,14 @@
7474 'div',
7575 array(
7676 'id' => $this->mapName,
77 - 'width' => $this->width,
78 - 'height' => $this->height
 77+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
7978 ),
80 - null
 79+ wfMsg('maps-loading-map')
8180 );
8281
83 - $wgOut->addInlineScript(
84 - <<<EOT
 82+ $parser->getOutput()->addHeadItem(
 83+ Html::inlineScript(
 84+ <<<EOT
8585 addOnloadHook(
8686 function() {
8787 initializeGoogleMap('$this->mapName',
@@ -98,6 +98,7 @@
9999 }
100100 );
101101 EOT
 102+ )
102103 );
103104
104105 }
Index: trunk/extensions/Maps/Maps_MapFeature.php
@@ -35,7 +35,7 @@
3636 /**
3737 * Adds the HTML specific to the mapping service to the output
3838 */
39 - protected abstract function addSpecificMapHTML();
 39+ protected abstract function addSpecificMapHTML( Parser $parser );
4040
4141 public $serviceName;
4242
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php
@@ -52,20 +52,20 @@
5353 * @see MapsBaseMap::addSpecificMapHTML()
5454 *
5555 */
56 - public function addSpecificMapHTML() {
 56+ public function addSpecificMapHTML( Parser $parser ) {
5757 global $wgOut;
5858
5959 $this->output .= Html::element(
6060 'div',
6161 array(
6262 'id' => $this->mapName,
63 - 'width' => $this->width,
64 - 'height' => $this->height
 63+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
6564 ),
66 - null
 65+ wfMsg('maps-loading-map')
6766 );
6867
69 - $wgOut->addInlineScript( <<<EOT
 68+ $parser->getOutput()->addHeadItem(
 69+ Html::inlineScript( <<<EOT
7070 addOnloadHook(
7171 function() {
7272 initializeYahooMap(
@@ -77,13 +77,12 @@
7878 [$this->types],
7979 [$this->controls],
8080 $this->autozoom,
81 - [$this->markerString],
82 - $this->height
 81+ [$this->markerString]
8382 );
8483 }
8584 );
8685 EOT
87 - );
 86+ ) );
8887 }
8988
9089 }
Index: trunk/extensions/Maps/YahooMaps/YahooMapFunctions.js
@@ -37,15 +37,15 @@
3838 /**
3939 * Returns YMap object with the provided properties and markers.
4040 */
41 -function initializeYahooMap(mapName, lat, lon, zoom, type, types, controls, scrollWheelZoom, markers, height) {
 41+function initializeYahooMap(mapName, lat, lon, zoom, type, types, controls, scrollWheelZoom, markers) {
4242 var centre = (lon != null && lat != null) ? new YGeoPoint(lat, lon) : null;
43 - return createYahooMap(document.getElementById(mapName), centre, zoom, type, types, controls, scrollWheelZoom, markers, height);
 43+ return createYahooMap(document.getElementById(mapName), centre, zoom, type, types, controls, scrollWheelZoom, markers);
4444 }
4545
4646 /**
4747 * Returns YMap object with the provided properties.
4848 */
49 -function createYahooMap(mapElement, centre, zoom, type, types, controls, scrollWheelZoom, markers, height) {
 49+function createYahooMap(mapElement, centre, zoom, type, types, controls, scrollWheelZoom, markers) {
5050 var typesContainType = false;
5151
5252 for (var i = 0; i < types.length; i++) {
@@ -60,7 +60,7 @@
6161
6262 for (i in controls){
6363 if (controls[i].toLowerCase() == 'auto-zoom') {
64 - if (height > 42) controls[i] = height > 100 ? 'zoom' : 'zoom-short';
 64+ //if (height > 42) controls[i] = height > 100 ? 'zoom' : 'zoom-short';
6565 }
6666
6767 switch (controls[i]) {
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php
@@ -45,20 +45,20 @@
4646 * @see MapsBaseMap::addSpecificMapHTML()
4747 *
4848 */
49 - public function addSpecificMapHTML() {
 49+ public function addSpecificMapHTML( Parser $parser ) {
5050 global $wgOut;
5151
5252 $this->output .= Html::element(
5353 'div',
5454 array(
5555 'id' => $this->mapName,
56 - 'width' => $this->width,
57 - 'height' => $this->height
 56+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
5857 ),
59 - null
 58+ wfMsg('maps-loading-map')
6059 );
6160
62 - $wgOut->addInlineScript( <<<EOT
 61+ $parser->getOutput()->addHeadItem(
 62+ Html::inlineScript( <<<EOT
6363 addOnloadHook(
6464 function() {
6565 initializeYahooMap(
@@ -70,13 +70,12 @@
7171 [$this->types],
7272 [$this->controls],
7373 $this->autozoom,
74 - [],
75 - $this->height
 74+ []
7675 );
7776 }
7877 );
7978 EOT
80 - );
 79+ ) );
8180 }
8281
8382 }
Index: trunk/extensions/Maps/Maps.i18n.php
@@ -20,6 +20,7 @@
2121 'maps_desc' => "Provides the ability to display coordinate data in maps, and geocode addresses ([http://wiki.bn2vs.com/wiki/Maps demo]).
2222 Available mapping services: $1",
2323 'maps_map' => 'Map',
 24+ 'maps-loading-map' => 'Loading map...',
2425
2526 // Coordinate handling
2627 'maps-abb-north' => 'N',
Index: trunk/extensions/Maps/Maps_Settings.php
@@ -149,8 +149,8 @@
150150
151151 # General map configuration
152152
153 -# Integer. The default width and height of a map. These values will only be used when the user does not provide them.
154 -$egMapsMapWidth = 600;
 153+# Integer or string. The default width and height of a map. These values will only be used when the user does not provide them.
 154+$egMapsMapWidth = '100%';
155155 $egMapsMapHeight = 350;
156156
157157 # Array. The minimum and maximum width and height for all maps. First min, then max. Min needs to be smaller then max.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64299Changes for 0.6...jeroendedauw19:09, 28 March 2010

Status & tagging log