r64301 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64300‎ | r64301 | r64302 >
Date:19:18, 28 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r64299 - fixed some forgotten JS
Modified paths:
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/OpenLayerFunctions.js (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/OSMFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -77,8 +77,7 @@
7878 $this->zoom,
7979 [$layerItems],
8080 [$this->controls],
81 - [$this->markerString],
82 - $this->height
 81+ [$this->markerString]
8382 );
8483 }
8584 );
Index: trunk/extensions/Maps/OpenLayers/OpenLayerFunctions.js
@@ -11,9 +11,9 @@
1212 * Creates and initializes an OpenLayers map.
1313 * The resulting map is returned by the function but no further handling is required in most cases.
1414 */
15 -function initOpenLayer(mapName, lon, lat, zoom, mapTypes, controls, marker_data, height){
 15+function initOpenLayer(mapName, lon, lat, zoom, mapTypes, controls, marker_data){
1616
17 - // Create a new OpenLayers map with without any controls on it
 17+ // Create a new OpenLayers map with without any controls on it.
1818 var mapOptions = {
1919 projection: new OpenLayers.Projection("EPSG:900913"),
2020 displayProjection: new OpenLayers.Projection("EPSG:4326"),
@@ -26,13 +26,13 @@
2727
2828 var map = new OpenLayers.Map(mapName, mapOptions);
2929
30 - // Add the controls
 30+ // Add the controls.
3131 for (i in controls) {
3232
33 - // If a string is provided, find the correct name for the control, and use eval to create the object itself
 33+ // If a string is provided, find the correct name for the control, and use eval to create the object itself.
3434 if (typeof controls[i] == 'string') {
3535 if (controls[i].toLowerCase() == 'autopanzoom') {
36 - if (height > 140) controls[i] = height > 320 ? 'panzoombar' : 'panzoom';
 36+ //if (height > 140) controls[i] = height > 320 ? 'panzoombar' : 'panzoom';
3737 }
3838
3939 control = getValidControlName(controls[i]);
@@ -42,16 +42,16 @@
4343 }
4444 }
4545 else {
46 - map.addControl(controls[i]); // If a control is provided, instead a string, just add it
47 - controls[i].activate(); // And activate it
 46+ map.addControl(controls[i]); // If a control is provided, instead a string, just add it.
 47+ controls[i].activate(); // And activate it.
4848 }
4949
5050 }
5151
52 - // Add the base layers
 52+ // Add the base layers.
5353 for (i in mapTypes) map.addLayer(mapTypes[i]);
5454
55 - // Layer to hold the markers
 55+ // Layer to hold the markers.
5656 var markerLayer = new OpenLayers.Layer.Markers('Markers');
5757 markerLayer.id= 'markerLayer';
5858 map.addLayer(markerLayer);
@@ -66,19 +66,19 @@
6767
6868 for (i in marker_data) {
6969 marker_data[i].lonlat.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
70 - if (bounds != null) bounds.extend(marker_data[i].lonlat); // Extend the bounds when no center is set
71 - markerLayer.addMarker(getOLMarker(markerLayer, marker_data[i], map.getProjectionObject())); // Create and add the marker
 70+ if (bounds != null) bounds.extend(marker_data[i].lonlat); // Extend the bounds when no center is set.
 71+ markerLayer.addMarker(getOLMarker(markerLayer, marker_data[i], map.getProjectionObject())); // Create and add the marker.
7272 }
7373
74 - if (bounds != null) map.zoomToExtent(bounds); // If a bounds object has been created, use it to set the zoom and center
 74+ if (bounds != null) map.zoomToExtent(bounds); // If a bounds object has been created, use it to set the zoom and center.
7575
76 - if (centerIsSet) { // When the center is provided, set it
 76+ if (centerIsSet) { // When the center is provided, set it.
7777 var centre = new OpenLayers.LonLat(lon, lat);
7878 centre.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
7979 map.setCenter(centre);
8080 }
8181
82 - if (zoom != null) map.zoomTo(zoom); // When the zoom is provided, set it
 82+ if (zoom != null) map.zoomTo(zoom); // When the zoom is provided, set it.
8383
8484 return map;
8585 }
@@ -119,12 +119,12 @@
120120
121121 if (markerData.title.length + markerData.label.length > 0 ) {
122122
123 - // This is the handler for the mousedown event on the marker, and displays the popup
 123+ // This is the handler for the mousedown event on the marker, and displays the popup.
124124 marker.events.register('mousedown', marker,
125125 function(evt) {
126126 var popup = new OpenLayers.Feature(markerLayer, markerData.lonlat).createPopup(true);
127127
128 - if (markerData.title.length > 0 && markerData.label.length > 0) { // Add the title and label to the popup text
 128+ if (markerData.title.length > 0 && markerData.label.length > 0) { // Add the title and label to the popup text.
129129 popup.setContentHTML('<b>' + markerData.title + '</b><hr />' + markerData.label);
130130 }
131131 else {
@@ -133,7 +133,7 @@
134134
135135 popup.setOpacity(0.85);
136136 markerLayer.map.addPopup(popup);
137 - OpenLayers.Event.stop(evt); // Stop the event
 137+ OpenLayers.Event.stop(evt); // Stop the event.
138138 }
139139 );
140140
@@ -155,6 +155,12 @@
156156 function initOLSettings(minWidth, minHeight) {
157157 OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
158158 OpenLayers.Util.onImageLoadErrorColor = 'transparent';
159 - OpenLayers.Feature.prototype.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {'autoSize': true, 'minSize': new OpenLayers.Size(minWidth, minHeight)});
 159+ OpenLayers.Feature.prototype.popupClass = OpenLayers.Class(
 160+ OpenLayers.Popup.FramedCloud,
 161+ {
 162+ 'autoSize': true,
 163+ 'minSize': new OpenLayers.Size(minWidth, minHeight)
 164+ }
 165+ );
160166 }
161167
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php
@@ -70,8 +70,7 @@
7171 $this->zoom,
7272 [$layerItems],
7373 [$this->controls],
74 - [],
75 - $this->height
 74+ []
7675 );
7776 }
7877 );
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php
@@ -81,8 +81,6 @@
8282 lat: $this->centre_lat,
8383 lon: $this->centre_lon,
8484 zoom: $this->zoom,
85 - width: $this->width,
86 - height: $this->height,
8785 markers: [],
8886 controls: [$this->controls]
8987 }
Index: trunk/extensions/Maps/OpenStreetMap/OSMFunctions.js
@@ -43,16 +43,6 @@
4444 var mapId = 0;
4545 var layer = null;
4646
47 -if (false) { // wgSlippyMapSlippyByDefault
48 - addOnloadHook(slippymap_init);
49 -}
50 -
51 -function slippymap_init() {
52 - for(keyName in slippymaps) {
53 - slippymaps[keyName].init();
54 - }
55 -}
56 -
5747 /**
5848 * Gets a valid control name (with excat lower and upper case letters),
5949 * or returns false when the control is not allowed.
@@ -89,7 +79,7 @@
9080 for (i in this.controls) {
9181 if (typeof controls[i] == 'string') {
9282 if (this.controls[i].toLowerCase() == 'autopanzoom') {
93 - if (this.height > 140) this.controls[i] = this.height > 320 ? 'panzoombar' : 'panzoom';
 83+ //if (this.height > 140) this.controls[i] = this.height > 320 ? 'panzoombar' : 'panzoom';
9484 }
9585
9686 control = getValidControlName(this.controls[i]);
@@ -99,8 +89,8 @@
10090 }
10191 }
10292 else {
103 - this.mapOptions.controls.push(controls[i]); // If a control is provided, instead a string, just add it
104 - controls[i].activate(); // And activate it
 93+ this.mapOptions.controls.push(controls[i]); // If a control is provided, instead a string, just add it.
 94+ controls[i].activate(); // And activate it.
10595 }
10696 }
10797 }
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispPoint.php
@@ -67,8 +67,6 @@
6868 lat: $this->centre_lat,
6969 lon: $this->centre_lon,
7070 zoom: $this->zoom,
71 - width: $this->width,
72 - height: $this->height,
7371 markers: [$this->markerString],
7472 controls: [$this->controls]
7573 }

Past revisions this follows-up on

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

Status & tagging log