Inchikutty has uploaded a new change for review.
https://gerrit.wikimedia.org/r/94587
Change subject: OPW Microtask:adding button to show osm map
......................................................................
OPW Microtask:adding button to show osm map
Task objective: Introduce a button near coordinate input fields of
UploadWizard,which when clicked will open a newtab locating the
coordinates in OpenstreetMap.bug 56614 , bug 56612
Change-Id: I44e92fdda6cebf5188ccfade3863219558423d8f
---
M resources/mw.UploadWizardDetails.js
1 file changed, 24 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/87/94587/1
diff --git a/resources/mw.UploadWizardDetails.js
b/resources/mw.UploadWizardDetails.js
index 6553c49..9fdf0f2 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -25,7 +25,7 @@
_this.descriptions = [];
_this.div = $( '<div class="mwe-upwiz-info-file ui-helper-clearfix
filled"></div>' );
-
+
_this.thumbnailDiv = $( '<div class="mwe-upwiz-thumbnail
mwe-upwiz-thumbnail-side"></div>' );
_this.dataDiv = $( '<div class="mwe-upwiz-data"></div>' );
@@ -150,16 +150,16 @@
var latId = "location-latitude" + _this.upload.index;
var lonId = "location-longitude" + _this.upload.index;
//var altId = "location-altitude" + _this.upload.index;
-
- _this.$latInput = $( '<input type="text" id="' + latId + '" name="' +
latId + '" class="mwe-loc-lat" size="10"/>' );
- _this.$lonInput = $( '<input type="text" id="' + lonId + '" name="' +
lonId + '" class="mwe-loc-lon" size="10"/>' );
+
+ _this.$latInput = $( '<input type="text" id="' + latId + '" name="' +
latId + '" class="mwe-loc-lat" size="10" value=""/>' );
+ _this.$lonInput = $( '<input type="text" id="' + lonId + '" name="' +
lonId + '" class="mwe-loc-lon" size="10" value=""/>' );
//_this.altInput = $( '<input type="text" id="' + altId + '" name="' +
altId + '" class="mwe-loc-alt" size="10"/>' );
-
+
// Do not prefill with "0"
_this.$latInput.val( mw.UploadWizard.config.defaults.lat );
_this.$lonInput.val( mw.UploadWizard.config.defaults.lon );
//_this.altInput.val( mw.UploadWizard.config.defaultAlt );
-
+
var latDiv = $( '<div class="mwe-location-lat"></div>' )
.append( $( '<div class="mwe-location-lat-label"></div>'
).text( mw.message( 'mwe-upwiz-location-lat' ).text() ) )
.append( _this.$latInput );
@@ -169,6 +169,20 @@
//var altDiv = $( '<div class="mwe-location-alt"></div>' )
// .append( $( '<div class="mwe-location-alt-label"></div>'
).append( mw.message( 'mwe-upwiz-location-alt' ).text() ) )
// .append( _this.altInput );
+
+ // Function openosm():"Used for showing a button next to input
coordinates which when clicked can open location on OSM in a new tab."
+ function openosm(){
+ var _this=this;
+ var latd= _this.$('#'+latId).val();
+ var lond=_this.$('#'+lonId).val();
+ window.open
("http://www.openstreetmap.org/?lat="+latd+"&lon="+lond+"&zoom=9&layers=M");
+ }
+ // _this.ShowMap is used to create the button which uses function
openosm(); and it is appended to locationDiv in order to do so!
+ _this.$ShowMap=$('<input type="button" class="mwe-upwiz-buttons"
value="see location" size="20"/>')
+ //.append(lat,lon)
+ .click( function(){
+ openosm();
+ } );
var locationDiv = $( '<div class="mwe-location
mwe-upwiz-details-fieldname-input ui-helper-clearfix"></div>' )
.append( $ ('<div class="mwe-location-label"></div>' )
@@ -179,7 +193,7 @@
$( '<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( _this.$ShowMap );
$( moreDetailsDiv ).append(
locationDiv,
@@ -1426,7 +1440,9 @@
this.setStatus( statusLine );
},
-
+
+
//window.open("https://www.openstreetmap.org?lat=lat&lon=lon&zoom=7&layers=M");
+
/**
* Decide how to treat various errors
* @param {String} error code
--
To view, visit https://gerrit.wikimedia.org/r/94587
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I44e92fdda6cebf5188ccfade3863219558423d8f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Inchikutty <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits