r80826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80825‎ | r80826 | r80827 >
Date:18:35, 23 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r80825
Modified paths:
  • /branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsQP.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersFormInput.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersQP.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsQP.php (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsQP.php
@@ -21,31 +21,14 @@
2222 * @see SMMapPrinter::addSpecificMapHTML
2323 */
2424 public function addSpecificMapHTML() {
25 - $mapName = $this->service->getMapId();
26 -
27 - $this->output .= Html::element(
 25+ return Html::element(
2826 'div',
2927 array(
30 - 'id' => $mapName,
 28+ 'id' => $this->service->getMapId(),
3129 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
3230 ),
3331 wfMsg( 'maps-loading-map' )
3432 );
35 -
36 - MapsMapper::addInlineScript( $this->service, <<<EOT
37 - initializeYahooMap(
38 - "$mapName",
39 - $this->centreLat,
40 - $this->centreLon,
41 - $this->zoom,
42 - $this->type,
43 - [$this->types],
44 - [$this->controls],
45 - $this->autozoom,
46 - $this->markerJs
47 - );
48 -EOT
49 - );
5033 }
5134
5235 /**
Index: branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsFormInput.php
@@ -56,33 +56,14 @@
5757 * @see MapsMapFeature::addSpecificMapHTML
5858 */
5959 public function addSpecificMapHTML() {
60 - $mapName = $this->service->getMapId( false );
61 -
62 - $this->output .= Html::element(
 60+ return Html::element(
6361 'div',
6462 array(
65 - 'id' => $mapName,
 63+ 'id' => $this->service->getMapId( false ),
6664 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
6765 ),
6866 wfMsg( 'maps-loading-map' )
6967 );
70 -
71 - MapsMapper::addInlineScript( $this->service, <<<EOT
72 - makeFormInputYahooMap(
73 - "$mapName",
74 - "$this->coordsFieldName",
75 - $this->centreLat,
76 - $this->centreLon,
77 - $this->zoom,
78 - $this->type,
79 - [$this->types],
80 - [$this->controls],
81 - $this->autozoom,
82 - {$this->markerCoords['lat']},
83 - {$this->markerCoords['lon']}
84 - );
85 -EOT
86 - );
8768
8869 }
8970
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersQP.php
@@ -21,34 +21,14 @@
2222 * @see SMMapPrinter::addSpecificMapHTML
2323 */
2424 public function addSpecificMapHTML() {
25 - global $wgLang;
26 -
27 - $mapName = $this->service->getMapId();
28 -
29 - $this->output .= Html::element(
 25+ return Html::element(
3026 'div',
3127 array(
32 - 'id' => $mapName,
 28+ 'id' => $this->service->getMapId(),
3329 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
3430 ),
3531 wfMsg( 'maps-loading-map' )
3632 );
37 -
38 - $langCode = $wgLang->getCode();
39 -
40 - MapsMapper::addInlineScript( $this->service, <<<EOT
41 - initOpenLayer(
42 - "$mapName",
43 - $this->centreLat,
44 - $this->centreLon,
45 - $this->zoom,
46 - {$this->layers},
47 - [$this->controls],
48 - $this->markerJs,
49 - "$langCode"
50 - );
51 -EOT
52 - );
5333 }
5434
5535 /**
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersFormInput.php
@@ -34,37 +34,14 @@
3535 * @see MapsMapFeature::addSpecificMapHTML
3636 */
3737 public function addSpecificMapHTML() {
38 - global $wgLang;
39 -
40 - $mapName = $this->service->getMapId( false );
41 -
42 - $this->output .= Html::element(
 38+ return Html::element(
4339 'div',
4440 array(
45 - 'id' => $mapName,
 41+ 'id' => $this->service->getMapId( false ),
4642 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
4743 ),
4844 wfMsg( 'maps-loading-map' )
4945 );
50 -
51 - $langCode = $wgLang->getCode();
52 -
53 - MapsMapper::addInlineScript( $this->service,<<<EOT
54 - makeFormInputOpenLayer(
55 - "$mapName",
56 - "$this->coordsFieldName",
57 - $this->centreLat,
58 - $this->centreLon,
59 - $this->zoom,
60 - {$this->markerCoords['lat']},
61 - {$this->markerCoords['lon']},
62 - {$this->layers},
63 - [$this->controls],
64 - "$langCode"
65 - );
66 -EOT
67 - );
68 -
6946 }
7047
71 -}
\ No newline at end of file
 48+}
Index: branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsQP.php
@@ -25,14 +25,13 @@
2626 }
2727
2828 /**
29 - * @see SMMapPrinter::addSpecificMapHTML
 29+ * @see SMMapPrinter::getMapHTML
3030 */
31 - public function addSpecificMapHTML() {
 31+ public function getMapHTML() {
3232 $mapName = $this->service->getMapId();
 33+ $output = $this->service->getOverlayOutput( $mapName, $this->overlays, $this->controls );
3334
34 - $this->service->addOverlayOutput( $this->output, $mapName, $this->overlays, $this->controls );
35 -
36 - $this->output .= Html::element(
 35+ return $output . Html::element(
3736 'div',
3837 array(
3938 'id' => $mapName,
@@ -40,23 +39,6 @@
4140 ),
4241 wfMsg( 'maps-loading-map' )
4342 );
44 -
45 - MapsMapper::addInlineScript( $this->service, <<<EOT
46 - initializeGoogleMap("$mapName",
47 - {
48 - lat: $this->centreLat,
49 - lon: $this->centreLon,
50 - zoom: $this->zoom,
51 - type: $this->type,
52 - types: [$this->types],
53 - controls: [$this->controls],
54 - scrollWheelZoom: $this->autozoom,
55 - kml: [$this->kml]
56 - },
57 - $this->markerJs
58 - );
59 -EOT
60 - );
6143 }
6244
6345 /**
Index: branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -43,45 +43,17 @@
4444 }
4545
4646 /**
47 - * @see MapsMapFeature::addSpecificFormInputHTML
 47+ * @see MapsMapFeature::getMapHTML
4848 */
49 - public function addSpecificMapHTML() {
50 - $mapName = $this->service->getMapId( false );
51 -
52 - // Remove the overlays control in case it's present.
53 - // TODO: make less insane
54 - if ( in_string( 'overlays', $this->controls ) ) {
55 - $this->controls = str_replace( array( ",'overlays'", "'overlays'," ), '', $this->controls );
56 - }
57 -
58 - $this->output .= Html::element(
 49+ public function getMapHTML() {
 50+ return Html::element(
5951 'div',
6052 array(
61 - 'id' => $mapName,
 53+ 'id' => $this->service->getMapId( false ),
6254 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
6355 ),
6456 wfMsg( 'maps-loading-map' )
6557 );
66 -
67 - MapsMapper::addInlineScript( $this->service, <<<EOT
68 - makeGoogleMapFormInput(
69 - "$mapName",
70 - "$this->coordsFieldName",
71 - {
72 - lat: $this->centreLat,
73 - lon: $this->centreLon,
74 - zoom: $this->zoom,
75 - type: $this->type,
76 - types: [$this->types],
77 - controls: [$this->controls],
78 - scrollWheelZoom: $this->autozoom,
79 - kml: [$this->kml]
80 - },
81 - {$this->markerCoords['lat']},
82 - {$this->markerCoords['lon']}
83 - );
84 -EOT
85 - );
8658 }
8759
8860 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80825a bunch of refactoring, stuff probably rather broken nowjeroendedauw18:34, 23 January 2011

Status & tagging log