r64320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64319‎ | r64320 | r64321 >
Date:22:28, 28 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - Follow up to r64299 - Changed output of the maps to match the changes made in Maps for Yahoo! Maps
Modified paths:
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFunctions.js (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFunctions.js (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsQP.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFunctions.js
@@ -11,8 +11,8 @@
1212 * This function holds spesific functionallity for the Yahoo! Maps form input of Semantic Maps
1313 * TODO: Refactor as much code as possible to non specific functions
1414 */
15 -function makeFormInputYahooMap(mapName, locationFieldName, lat, lon, zoom, type, types, controls, scrollWheelZoom, marker_lat, marker_lon, height) {
16 - var map = createYahooMap(document.getElementById(mapName), new YGeoPoint(lat, lon), zoom, type, types, controls, scrollWheelZoom, [getYMarkerData(marker_lat, marker_lon, '', '', '')], height);
 15+function makeFormInputYahooMap(mapName, locationFieldName, lat, lon, zoom, type, types, controls, scrollWheelZoom, marker_lat, marker_lon) {
 16+ var map = createYahooMap(document.getElementById(mapName), new YGeoPoint(lat, lon), zoom, type, types, controls, scrollWheelZoom, [getYMarkerData(marker_lat, marker_lon, '', '', '')]);
1717
1818 // Show a starting marker only if marker coordinates are provided
1919 if (marker_lat != null && marker_lon != null) {
Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsQP.php
@@ -46,12 +46,11 @@
4747 *
4848 */
4949 protected function addSpecificMapHTML( Parser $parser ) {
50 - global $wgJsMimeType;
51 -
 50+ // TODO: refactor up like done in maps with display point
5251 $markerItems = array();
5352
5453 foreach ( $this->m_locations as $location ) {
55 - // Create a string containing the marker JS
 54+ // Create a string containing the marker JS.
5655 list( $lat, $lon, $title, $label, $icon ) = $location;
5756
5857 $markerItems[] = "getYMarkerData($lat, $lon, '$title', '$label', '$icon')";
@@ -59,18 +58,37 @@
6059
6160 $markersString = implode( ',', $markerItems );
6261
63 - $this->output .= "
64 - <div id='$this->mapName' style='width: {$this->width}px; height: {$this->height}px;'></div>
 62+ $this->output .= Html::element(
 63+ 'div',
 64+ array(
 65+ 'id' => $this->mapName,
 66+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
 67+ ),
 68+ wfMsg('maps-loading-map')
 69+ );
6570
66 - <script type='$wgJsMimeType'>/*<![CDATA[*/
67 - addOnloadHook(
68 - function() {
69 - initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$this->types], [$this->controls], $this->autozoom, [$markersString], $this->height);
70 - }
 71+ $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
 72+
 73+ $parser->getOutput()->addHeadItem(
 74+ Html::inlineScript( <<<EOT
 75+addOnloadHook(
 76+ function() {
 77+ initOpenLayer(
 78+ '$this->mapName',
 79+ $this->centre_lat,
 80+ $this->centre_lon,
 81+ $this->zoom,
 82+ $this->type,
 83+ [$this->types],
 84+ [$this->controls],
 85+ $this->autozoom,
 86+ [$markersString]
7187 );
72 - /*]]>*/</script>";
73 -
7488 }
 89+);
 90+EOT
 91+ ) );
 92+ }
7593
7694 /**
7795 * Returns type info, descriptions and allowed values for this QP's parameters after adding the spesific ones to the list.
Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php
@@ -68,15 +68,38 @@
6969 *
7070 */
7171 protected function addSpecificMapHTML( Parser $parser ) {
72 - global $wgJsMimeType;
 72+ $this->output .= Html::element(
 73+ 'div',
 74+ array(
 75+ 'id' => $this->mapName,
 76+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
 77+ ),
 78+ wfMsg('maps-loading-map')
 79+ );
7380
74 - $this->output .= "
75 - <div id='" . $this->mapName . "' style='width: {$this->width}px; height: {$this->height}px;'></div>
76 -
77 - <script type='$wgJsMimeType'>/*<![CDATA[*/
78 - addOnloadHook(function() {makeFormInputYahooMap('$this->mapName', '$this->coordsFieldName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$this->types], [$this->controls], $this->autozoom, $this->marker_lat, $this->centre_lon, $this->height);});
79 - /*]]>*/</script>";
 81+ $parser->getOutput()->addHeadItem(
 82+ Html::inlineScript( <<<EOT
 83+addOnloadHook(
 84+ function() {
 85+ makeFormInputYahooMap(
 86+ '$this->mapName',
 87+ '$this->coordsFieldName',
 88+ $this->centre_lat,
 89+ $this->centre_lon,
 90+ $this->zoom,
 91+ $this->type,
 92+ [$this->types],
 93+ [$this->controls],
 94+ $this->autozoom,
 95+ $this->marker_lat,
 96+ $this->marker_lon
 97+ );
8098 }
 99+);
 100+EOT
 101+ ) );
 102+
 103+ }
81104
82105 /**
83106 * @see SMFormInput::manageGeocoding()
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFunctions.js
@@ -13,8 +13,7 @@
1414 */
1515 function makeGoogleMapFormInput(mapName, locationFieldName, mapOptions, marker_lat, marker_lon) {
1616 if (GBrowserIsCompatible()) {
17 - mapOptions.centre = new GLatLng(mapOptions.lat, mapOptions.lon);
18 - mapOptions.size = new GSize(mapOptions.width, mapOptions.height);
 17+ mapOptions.centre = new GLatLng(mapOptions.lat, mapOptions.lon);
1918 var map = createGoogleMap(mapName, mapOptions, [getGMarkerData(marker_lat, marker_lon, '', '', '')]);
2019
2120 // Show a starting marker only if marker coordinates are provided

Past revisions this follows-up on

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

Status & tagging log