jenkins-bot has submitted this change and it was merged.

Change subject: Introducing a button to show coordinates in OSM
......................................................................


Introducing a button to show coordinates in OSM

This patch introduces a button near coordinate input fields of
UploadWizard,which when clicked will open a new tab locating the
coordinates in OpenStreetMap.

Bug: 56614
Bug: 56612
Change-Id: I44e92fdda6cebf5188ccfade3863219558423d8f
---
M UploadWizard.i18n.php
M UploadWizardHooks.php
M resources/mw.UploadWizardDetails.js
3 files changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UploadWizard.i18n.php b/UploadWizard.i18n.php
index c5b5d07..49aa8c4 100644
--- a/UploadWizard.i18n.php
+++ b/UploadWizard.i18n.php
@@ -148,6 +148,7 @@
        'mwe-upwiz-media-type' => 'Media type',
        'mwe-upwiz-date-created' => 'Date created',
        'mwe-upwiz-location' => 'Location',
+       'mwe-upwiz-location-button' => 'Show on map',
        'mwe-upwiz-location-lat' => 'Latitude',
        'mwe-upwiz-location-lon' => 'Longitude',
        'mwe-upwiz-location-alt' => 'Altitude',
@@ -804,6 +805,7 @@
 {{Identical|Date created}}',
        'mwe-upwiz-location' => 'The location the media exists on the planet, 
further described by lat and lon.
 {{Identical|Location}}',
+       'mwe-upwiz-location-button' => 'Label for button which opens location 
on OpenStreetMap using entered input coordinates.',
        'mwe-upwiz-location-lat' => 'Latitude - the GPS coordinate, expressed 
in signed decimal degrees.
 {{Identical|Latitude}}',
        'mwe-upwiz-location-lon' => 'Longitude - the GPS coordinate, expressed 
in signed decimal degrees.
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index 42df5eb..9bda599 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -253,6 +253,7 @@
                                'mwe-upwiz-media-type',
                                'mwe-upwiz-date-created',
                                'mwe-upwiz-location',
+                               'mwe-upwiz-location-button',
                                'mwe-upwiz-location-lat',
                                'mwe-upwiz-location-lon',
                                'mwe-upwiz-location-alt',
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index 6553c49..fe509a4 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -170,6 +170,18 @@
        //      .append( $( '<div class="mwe-location-alt-label"></div>' 
).append( mw.message( 'mwe-upwiz-location-alt' ).text() ) )
        //      .append( _this.altInput );
 
+       var showMap = $( '<button>' ).prop( 'type', 'button' ).prop( 'size', 20 
)
+               .addClass( 'mwe-upwiz-buttons' )
+               .msg( 'mwe-upwiz-location-button' )
+               .button()
+               .click( function( ) {
+                       var latd = _this.$latInput.val(),
+                               lond = _this.$lonInput.val(),
+                               mapLink = new mw.Uri( 
'https://openstreetmap.org/' )
+                                       .extend( { zoom: 9, layers: 'M', lat: 
+latd, lon: +lond } );
+                       window.open( mapLink.toString() );
+               } );
+
        var locationDiv = $( '<div class="mwe-location 
mwe-upwiz-details-fieldname-input ui-helper-clearfix"></div>' )
                .append( $ ('<div class="mwe-location-label"></div>' )
                .append( mw.message( 'mwe-upwiz-location' ).escaped() )
@@ -179,7 +191,8 @@
                        $( '<div class="mwe-upwiz-details-input-error"><label 
class="mwe-validator-error" for="' + lonId + '" generated="true"/></div>' ),
                        //$( '<div class="mwe-upwiz-details-input-error"><label 
class="mwe-validator-error" for="' + altId + '" generated="true"/></div>' ),
                        latDiv, lonDiv //, altDiv
-               );
+               )
+               .append( showMap );
 
        $( moreDetailsDiv ).append(
                locationDiv,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I44e92fdda6cebf5188ccfade3863219558423d8f
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Inchikutty <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Qgil <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to