Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsQP.php |
— | — | @@ -88,4 +88,17 @@ |
89 | 89 | |
90 | 90 | } |
91 | 91 | |
| 92 | + public function getParameters() { |
| 93 | + $params = parent::getParameters(); |
| 94 | + |
| 95 | + $allowedTypes = MapsYahooMaps::getTypeNames(); |
| 96 | + |
| 97 | + $params[] = array('name' => 'controls', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_controls'), 'values' => MapsYahooMaps::getControlNames()); |
| 98 | + $params[] = array('name' => 'types', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_types'), 'values' => $allowedTypes); |
| 99 | + $params[] = array('name' => 'type', 'type' => 'enumeration', 'description' => wfMsg('semanticmaps_paramdesc_type'), 'values' => $allowedTypes); |
| 100 | + $params[] = array('name' => 'autozoom', 'type' => 'enumeration', 'description' => wfMsg('semanticmaps_paramdesc_autozoom'), 'values' => array('on', 'off')); |
| 101 | + |
| 102 | + return $params; |
| 103 | + } |
| 104 | + |
92 | 105 | } |
\ No newline at end of file |
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFunctions.js |
— | — | @@ -60,31 +60,6 @@ |
61 | 61 | if (!window.OLMaps) window.OLMaps = new Object; |
62 | 62 | eval("window.OLMaps." + mapName + " = map;"); |
63 | 63 | } |
64 | | - |
65 | | - |
66 | | -/** |
67 | | - * This function holds spesific functionallity for the Open Layers form input of Semantic Maps |
68 | | - * TODO: Refactor as much code as possible to non specific functions |
69 | | - */ |
70 | | -function showOLAddress(address, mapName, outputElementName, notFoundFormat) { |
71 | | - |
72 | | - var map = OLMaps[mapName]; |
73 | | - var geocoder = new GClientGeocoder(); |
74 | | - |
75 | | - geocoder.getLatLng(address, |
76 | | - function(point) { |
77 | | - if (!point) { |
78 | | - window.alert(address + ' ' + notFoundFormat); |
79 | | - } else { |
80 | | - var loc = new OpenLayers.LonLat(point.x, point.y); |
81 | | - |
82 | | - replaceMarker(mapName, loc); |
83 | | - document.getElementById(outputElementName).value = convertLatToDMS(point.y) + ', ' + convertLngToDMS(point.x); |
84 | | - } |
85 | | - } |
86 | | - ); |
87 | | - |
88 | | -} |
89 | 64 | |
90 | 65 | /** |
91 | 66 | * Remove all markers from an OL map (that's in window.OLMaps), and place a new one. |
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersQP.php |
— | — | @@ -80,4 +80,13 @@ |
81 | 81 | /*]]>*/ </script>"; |
82 | 82 | } |
83 | 83 | |
| 84 | + public function getParameters() { |
| 85 | + $params = parent::getParameters(); |
| 86 | + |
| 87 | + $params[] = array('name' => 'controls', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_controls'), 'values' => MapsOpenLayers::getControlNames()); |
| 88 | + $params[] = array('name' => 'layers', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_layers'), 'values' => MapsOpenLayers::getLayerNames()); |
| 89 | + |
| 90 | + return $params; |
| 91 | + } |
| 92 | + |
84 | 93 | } |
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php |
— | — | @@ -25,7 +25,6 @@ |
26 | 26 | global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix; |
27 | 27 | |
28 | 28 | $this->elementNamePrefix = $egMapsOpenLayersPrefix; |
29 | | - $this->showAddresFunction = 'showOLAddress'; |
30 | 29 | |
31 | 30 | $this->earthZoom = 1; |
32 | 31 | |
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFunctions.js |
— | — | @@ -9,16 +9,15 @@ |
10 | 10 | |
11 | 11 | /** |
12 | 12 | * This function holds spesific functionallity for the OpenStreetMap form input of Semantic Maps |
13 | | - * TODO: Refactor as much code as possible to non specific functions |
14 | 13 | */ |
15 | | -function makeOSMFormInput(mapName, locationFieldName, lat, lon, zoom, marker_lat, marker_lon, layers, controls, height) { |
| 14 | +function makeOSMFormInput(mapName, locationFieldName, mapParams) { |
16 | 15 | var markers = Array(); |
17 | 16 | |
18 | 17 | // Show a starting marker only if marker coordinates are provided |
19 | | - if (marker_lat != null && marker_lon != null) { |
20 | | - markers.push(getOSMMarkerData(marker_lon, marker_lat, '', '')); |
| 18 | + if (mapParams.lat != null && mapParams.lon != null) { |
| 19 | + mapParams.markers = [(getOSMMarkerData(mapParams.lon, mapParams.lat, '', ''))]; |
21 | 20 | } |
22 | | - |
| 21 | + |
23 | 22 | // Click event handler for updating the location of the marker |
24 | 23 | // TODO / FIXME: This will probably cause problems when used for multiple maps on one page. |
25 | 24 | OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { |
— | — | @@ -42,7 +41,7 @@ |
43 | 42 | 'click': this.trigger |
44 | 43 | }, this.handlerOptions |
45 | 44 | ); |
46 | | - }, |
| 45 | + }, |
47 | 46 | |
48 | 47 | trigger: function(e) { |
49 | 48 | replaceMarker(mapName, map.getLonLatFromViewPortPx(e.xy)); |
— | — | @@ -50,41 +49,15 @@ |
51 | 50 | } |
52 | 51 | |
53 | 52 | }); |
54 | | - |
| 53 | + |
55 | 54 | var clickHanler = new OpenLayers.Control.Click(); |
56 | | - controls.push(clickHanler); |
| 55 | + mapParams.initializedContols = [clickHanler]; |
| 56 | + |
| 57 | + var map = new slippymap_map(mapName, mapParams); |
57 | 58 | |
58 | | - var map = initOpenLayer(mapName, lon, lat, zoom, layers, controls, markers, height); |
59 | | - |
60 | | - // Make the map variable available for other functions |
61 | | - if (!window.OSMMaps) window.OSMMaps = new Object; |
62 | | - eval("window.OSMMaps." + mapName + " = map;"); |
| 59 | + // Make the map variable available for other functions |
| 60 | + eval("window.slippymaps." + mapName + " = map;"); |
63 | 61 | } |
64 | | - |
65 | | - |
66 | | -/** |
67 | | - * This function holds spesific functionallity for the OpenStreetMap form input of Semantic Maps |
68 | | - * TODO: Refactor as much code as possible to non specific functions |
69 | | - */ |
70 | | -function showOSMAddress(address, mapName, outputElementName, notFoundFormat) { |
71 | | - |
72 | | - var map = OSMMaps[mapName]; |
73 | | - var geocoder = new GClientGeocoder(); |
74 | | - |
75 | | - geocoder.getLatLng(address, |
76 | | - function(point) { |
77 | | - if (!point) { |
78 | | - window.alert(address + ' ' + notFoundFormat); |
79 | | - } else { |
80 | | - var loc = new OpenLayers.LonLat(point.x, point.y); |
81 | | - |
82 | | - replaceMarker(mapName, loc); |
83 | | - document.getElementById(outputElementName).value = convertLatToDMS(point.y) + ', ' + convertLngToDMS(point.x); |
84 | | - } |
85 | | - } |
86 | | - ); |
87 | | - |
88 | | -} |
89 | 62 | |
90 | 63 | /** |
91 | 64 | * Remove all markers from an OSM map (that's in window.OSMMaps), and place a new one. |
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMQP.php |
— | — | @@ -92,4 +92,12 @@ |
93 | 93 | EOT; |
94 | 94 | } |
95 | 95 | |
| 96 | + public function getParameters() { |
| 97 | + $params = parent::getParameters(); |
| 98 | + |
| 99 | + $params[] = array('name' => 'controls', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_controls'), 'values' => MapsOSM::getControlNames()); |
| 100 | + |
| 101 | + return $params; |
| 102 | + } |
| 103 | + |
96 | 104 | } |
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php |
— | — | @@ -24,8 +24,7 @@ |
25 | 25 | protected function setMapSettings() { |
26 | 26 | global $egMapsOSMZoom, $egMapsOSMPrefix; |
27 | 27 | |
28 | | - $this->elementNamePrefix = $egMapsOSMPrefix; |
29 | | - $this->showAddresFunction = 'showOSMAddress'; |
| 28 | + $this->elementNamePrefix = $egMapsOSMPrefix; |
30 | 29 | |
31 | 30 | $this->earthZoom = 1; |
32 | 31 | |
— | — | @@ -74,8 +73,9 @@ |
75 | 74 | |
76 | 75 | $this->output .= <<<EOT |
77 | 76 | <script type='$wgJsMimeType'> |
78 | | - slippymaps['$this->mapName'] = new slippymap_map( |
| 77 | + makeOSMFormInput( |
79 | 78 | '$this->mapName', |
| 79 | + '$this->coordsFieldName', |
80 | 80 | { |
81 | 81 | mode: 'osm-wm', |
82 | 82 | layer: 'osm-like', |
— | — | @@ -86,9 +86,10 @@ |
87 | 87 | width: $this->width, |
88 | 88 | height: $this->height, |
89 | 89 | controls: [$controlItems], |
90 | | - coordField: '$this->coordsFieldName' |
91 | 90 | } |
92 | | - ); |
| 91 | + ); |
| 92 | + |
| 93 | + |
93 | 94 | </script> |
94 | 95 | |
95 | 96 | <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'> |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | // Only initialize the extension when all dependencies are present. |
28 | 28 | if (defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' )) { |
29 | | - define('SM_VERSION', '0.5 a18'); |
| 29 | + define('SM_VERSION', '0.5 a19'); |
30 | 30 | |
31 | 31 | $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps'; |
32 | 32 | $smgIP = $IP . '/extensions/SemanticMaps'; |
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php |
— | — | @@ -309,4 +309,16 @@ |
310 | 310 | return wfMsg('maps_' . $this->serviceName); |
311 | 311 | } |
312 | 312 | |
| 313 | + public function getParameters() { |
| 314 | + global $egMapsMapWidth, $egMapsMapHeight; |
| 315 | + |
| 316 | + $params = parent::exportFormatParameters(); |
| 317 | + |
| 318 | + $params[] = array('name' => 'zoom', 'type' => 'int', 'description' => wfMsg('semanticmaps_paramdesc_zoom')); |
| 319 | + $params[] = array('name' => 'width', 'type' => 'int', 'description' => wfMsgExt('semanticmaps_paramdesc_width', 'parsemag', $egMapsMapWidth)); |
| 320 | + $params[] = array('name' => 'height', 'type' => 'int', 'description' => wfMsgExt('semanticmaps_paramdesc_height', 'parsemag', $egMapsMapHeight)); |
| 321 | + |
| 322 | + return $params; |
| 323 | + } |
| 324 | + |
313 | 325 | } |
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsQP.php |
— | — | @@ -120,11 +120,19 @@ |
121 | 121 | $this->output .= $onloadFunctions; |
122 | 122 | } |
123 | 123 | |
124 | | - public function getParameters() { |
125 | | - return array_merge(parent::getParameters(), |
126 | | - array() |
127 | | - ); |
128 | | - } |
| 124 | + public function getParameters() { |
| 125 | + $params = parent::getParameters(); |
| 126 | + |
| 127 | + $allowedTypes = MapsGoogleMaps::getTypeNames(); |
| 128 | + |
| 129 | + $params[] = array('name' => 'controls', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_controls'), 'values' => MapsGoogleMaps::getControlNames()); |
| 130 | + $params[] = array('name' => 'types', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_types'), 'values' => $allowedTypes); |
| 131 | + $params[] = array('name' => 'type', 'type' => 'enumeration', 'description' => wfMsg('semanticmaps_paramdesc_type'), 'values' => $allowedTypes); |
| 132 | + $params[] = array('name' => 'overlays', 'type' => 'enum-list', 'description' => wfMsg('semanticmaps_paramdesc_overlays'), 'values' => MapsGoogleMaps::getOverlayNames()); |
| 133 | + $params[] = array('name' => 'autozoom', 'type' => 'enumeration', 'description' => wfMsg('semanticmaps_paramdesc_autozoom'), 'values' => array('on', 'off')); |
| 134 | + |
| 135 | + return $params; |
| 136 | + } |
129 | 137 | |
130 | 138 | } |
131 | 139 | |