Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/302057

Change subject: Fix latitude and longitude parameters
......................................................................

Fix latitude and longitude parameters

Change-Id: I42633839ec59a9d574c9716e0277adaa6be49249
---
M includes/QuickSearchLookup.php
1 file changed, 13 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSearchLookup 
refs/changes/57/302057/1

diff --git a/includes/QuickSearchLookup.php b/includes/QuickSearchLookup.php
index 6118aad..426bdda 100644
--- a/includes/QuickSearchLookup.php
+++ b/includes/QuickSearchLookup.php
@@ -170,19 +170,9 @@
                                        // add the JavaScript module to expand 
the map
                                        $out->addModules( array( 
'ext.QuickSearchLookup.script' ) );
 
-                                       // build the params for the URL
-                                       $params = $coord['lat'] . '_N_' . 
$coord['lon'] . '_W';
-                                       // lat and long has to be nulled to 
avoid duble adding them in self::buildOSMParams
-                                       $coord['lat'] = null;
-                                       $coord['lon'] = null;
-                                       $addParams = $this->buildOSMParams( 
$coord );
-                                       // add additional params, if there are 
any
-                                       if ( $addParams ) {
-                                               $params .= $addParams;
-                                       }
                                        // add the params to the url params list
                                        $urlParamsArray = array(
-                                               'params' => $params,
+                                               'params' => 
$this->buildOSMParams( $coord ),
                                                'title' => $title,
                                                'lang' => 
$wgContLang->getCode(),
                                                'uselang' => $wgLang->getCode(),
@@ -369,6 +359,18 @@
         */
        private function buildOSMParams( array $data ) {
                $res = '';
+               // build the params for the URL
+               if ( $coord['lat'] < 0 ) {
+                       $res .= $coord['lat'] . '_S_';
+               } else {
+                       $res .= $coord['lat'] . '_N_';
+               }
+
+               if ( $coord['long'] < 0 ) {
+                       $res .= $coord['lon'] . '_W_';
+               } else {
+                       $res .= $coord['lon'] . '_E_';
+               }
                foreach ( $data as $type => $info ) {
                        if ( $info ) {
                                $res .= '_' . $type . ':' . $info;

-- 
To view, visit https://gerrit.wikimedia.org/r/302057
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42633839ec59a9d574c9716e0277adaa6be49249
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSearchLookup
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to