Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -213,6 +213,8 @@ |
214 | 214 | 'mwe-upwiz-media-type', |
215 | 215 | 'mwe-upwiz-date-created', |
216 | 216 | 'mwe-upwiz-location', |
| 217 | + 'mwe-upwiz-location-lat', |
| 218 | + 'mwe-upwiz-location-lon', |
217 | 219 | 'mwe-upwiz-copyright-info', |
218 | 220 | 'mwe-upwiz-author', |
219 | 221 | 'mwe-upwiz-autoconverted', |
— | — | @@ -259,6 +261,7 @@ |
260 | 262 | 'mwe-upwiz-tooltip-date', |
261 | 263 | 'mwe-upwiz-tooltip-categories', |
262 | 264 | 'mwe-upwiz-tooltip-other', |
| 265 | + 'mwe-upwiz-tooltip-location', |
263 | 266 | 'mwe-upwiz-tooltip-more-info', |
264 | 267 | 'mwe-upwiz-file-need-file', |
265 | 268 | 'mwe-upwiz-deeds-need-deed', |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -121,6 +121,8 @@ |
122 | 122 | 'mwe-upwiz-media-type' => 'Media type', |
123 | 123 | 'mwe-upwiz-date-created' => 'Date created', |
124 | 124 | 'mwe-upwiz-location' => 'Location', |
| 125 | + 'mwe-upwiz-location-lat' => 'Latitude', |
| 126 | + 'mwe-upwiz-location-lon' => 'Longitude', |
125 | 127 | 'mwe-upwiz-copyright-info' => 'Release rights', |
126 | 128 | 'mwe-upwiz-author' => 'Author(s)', |
127 | 129 | 'mwe-upwiz-autoconverted' => 'This file was automatically converted to the $1 format', |
— | — | @@ -170,6 +172,7 @@ |
171 | 173 | 'mwe-upwiz-tooltip-date' => 'Date this work was created or first published (YYYY-MM-DD format).', |
172 | 174 | 'mwe-upwiz-tooltip-categories' => 'Add [$1 categories] to your file to make it easier to find.', |
173 | 175 | 'mwe-upwiz-tooltip-other' => 'Any other information you want to include about this work — geographic coordinates, links to other versions, etc.', |
| 176 | + 'mwe-upwiz-tooltip-location' => 'Coordinates of the location where this media file was created.', |
174 | 177 | 'mwe-upwiz-tooltip-more-info' => 'Learn more.', |
175 | 178 | 'mwe-upwiz-file-need-file' => 'Please add an upload first.', |
176 | 179 | 'mwe-upwiz-deeds-need-deed' => 'Please explain where you got {{PLURAL:$1|this file|these files}} and how this site can use {{PLURAL:$1|it|them}}, by selecting one of the options.', |
— | — | @@ -436,7 +439,9 @@ |
437 | 440 | |
438 | 441 | {{Identical|Title}}', |
439 | 442 | 'mwe-upwiz-date-created' => '[[File:Commons-uw-L52P.png|right|thumb|Screenshot showing a sample of this message]]', |
440 | | - 'mwe-upwiz-location' => '{{Identical|Location}}', |
| 443 | + 'mwe-upwiz-location' => '{{Identical|Location}} - the location the media exists on the planet, further described by lat and lon', |
| 444 | + 'mwe-upwiz-location-lat' => 'Latitude - the GPS coordinate, expressed in signed decimal degrees', |
| 445 | + 'mwe-upwiz-location-lon' => 'Longitude - the GPS coordinate, expressed in signed decimal degrees', |
441 | 446 | 'mwe-upwiz-other' => '[[File:Commons-uw-L52P.png|right|thumb|Screenshot showing a sample of this message]] |
442 | 447 | |
443 | 448 | {{Identical|Other information}}', |
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css |
— | — | @@ -706,3 +706,11 @@ |
707 | 707 | padding: 0.5em; |
708 | 708 | } |
709 | 709 | |
| 710 | +.mwe-location-lat { |
| 711 | + float:left; |
| 712 | + font-style:italic; |
| 713 | +} |
| 714 | + |
| 715 | +.mwe-location-lon { |
| 716 | + font-style:italic; |
| 717 | +} |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -156,11 +156,30 @@ |
157 | 157 | .growTextArea(); |
158 | 158 | |
159 | 159 | var otherInformationDiv = $j('<div></div>') |
160 | | - .append( $j( '<div class="mwe-upwiz-details-more-label">' ).append( gM( 'mwe-upwiz-other' ) ).addHint( 'other' ) ) |
| 160 | + .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-other' ) ).addHint( 'other' ) ) |
161 | 161 | .append( _this.otherInformationInput ); |
162 | 162 | |
| 163 | + var latId = "location-latitude" + _this.upload.index; |
| 164 | + var lonId = "location-longitude" + _this.upload.index; |
| 165 | + _this.latInput = $j( '<input type="text" id="' + latId + '" name="' + latId + '" type="text" class="mwe-loc-lat" size="10"/>' ); |
| 166 | + _this.lonInput = $j( '<input type="text" id="' + lonId + '" name="' + lonId + '" type="text" class="mwe-loc-lon" size="10"/>' ); |
| 167 | + |
| 168 | + var latDiv = $j( '<div class="mwe-location-lat"></div>' ) |
| 169 | + .append( $j ( '<div class="mwe-location-lat-label"></div>' ).append( gM( 'mwe-upwiz-location-lat' ) ) ) |
| 170 | + .append( _this.latInput ); |
| 171 | + var lonDiv = $j( '<div class="mwe-location-lon"></div>' ) |
| 172 | + .append( $j ( '<div class="mwe-location-lon-label"></div>' ).append( gM( 'mwe-upwiz-location-lon' ) ) ) |
| 173 | + .append( _this.lonInput ); |
| 174 | + |
| 175 | + var locationDiv = $j( '<div class="mwe-location"></div>' ) |
| 176 | + .append( $j ('<div class="mwe-location-label"></div>' ) |
| 177 | + .append( gM( 'mwe-upwiz-location' ) ) |
| 178 | + .addHint( 'location' ) ) |
| 179 | + .append( latDiv ) |
| 180 | + .append( lonDiv ); |
| 181 | + |
163 | 182 | $j( moreDetailsDiv ).append( |
164 | | - // location goes here |
| 183 | + locationDiv, |
165 | 184 | $categoriesDiv, |
166 | 185 | otherInformationDiv |
167 | 186 | ); |
— | — | @@ -611,36 +630,23 @@ |
612 | 631 | /** |
613 | 632 | * Prefill location inputs (and/or scroll to position on map) from image info and metadata |
614 | 633 | * |
615 | | - * At least for my test images, the EXIF parser on MediaWiki is not giving back any data for |
616 | | - * GPSLatitude, GPSLongitude, or GPSAltitudeRef. It is giving the lat/long Refs, the Altitude, and the MapDatum |
617 | | - * So, this is broken until we fix MediaWiki's parser, OR, parse it ourselves somehow |
618 | | - * |
619 | | - * in Image namespace |
620 | | - * GPSTag Long ?? |
621 | | - * |
622 | | - * in GPSInfo namespace |
623 | | - * GPSVersionID byte* 2000 = 2.0.0.0 |
624 | | - * GPSLatitude rational |
625 | | - * GPSLatitudeRef ascii (N | S) or North | South |
626 | | - * GPSLongitude rational |
627 | | - * GPSLongitudeRef ascii (E | W) or East | West |
628 | | - * GPSAltitude rational |
629 | | - * GPSAltitudeRef byte (0 | 1) above or below sea level |
630 | | - * GPSImgDirection rational |
631 | | - * GPSImgDirectionRef ascii (M | T) magnetic or true north |
632 | | - * GPSMapDatum ascii "WGS-84" is the standard |
633 | | - * |
634 | | - * A 'rational' is a string like this: |
635 | | - * "53/1 0/1 201867/4096" --> 53 deg 0 min 49.284 seconds |
636 | | - * "2/1 11/1 64639/4096" --> 2 deg 11 min 15.781 seconds |
637 | | - * "122/1" -- 122 m (altitude) |
| 634 | + * As of MediaWiki 1.18, the exif parser translates the rational GPS data tagged by the camera |
| 635 | + * to decimal format. Let's just use that. |
| 636 | + * Leaving out altitude ref for now (for no good reason). |
638 | 637 | */ |
639 | 638 | prefillLocation: function() { |
640 | | - /* unimplemented -- awaiting bawolff's GSoC 2010 project to be committedd... */ return; |
| 639 | + _this = this; |
| 640 | + if ( _this.upload.imageinfo.metadata ) { |
| 641 | + $j( _this.latInput ).val( _this.upload.imageinfo.metadata['gpslatitude'] ); |
| 642 | + $j( _this.lonInput ).val( _this.upload.imageinfo.metadata['gpslongitude'] ); |
| 643 | + } |
641 | 644 | }, |
642 | 645 | |
643 | 646 | /** |
644 | 647 | * Given a decimal latitude and longitude, return filled out {{Location}} template |
| 648 | + * |
| 649 | + * The {{Location dec}} template is preferred and makes this conversion unnecessary. This function is not used. |
| 650 | + * |
645 | 651 | * @param latitude decimal latitude ( -90.0 >= n >= 90.0 ; south = negative ) |
646 | 652 | * @param longitude decimal longitude ( -180.0 >= n >= 180.0 ; west = negative ) |
647 | 653 | * @param scale (optional) how rough the geocoding is. |
— | — | @@ -770,11 +776,14 @@ |
771 | 777 | } |
772 | 778 | |
773 | 779 | wikiText += "=={{int:filedesc}}==\n"; |
| 780 | + var lat = $j.trim( $j( _this.latInput ).val() ); |
| 781 | + var lon = $j.trim( $j( _this.lonInput ).val() ); |
| 782 | + if( lat ){ //only add the tag if the data exists; assume that if lat exists, long will as well |
| 783 | + wikiText += '{{Location dec|'+ lat + '|' + lon + '}}\n'; |
| 784 | + } |
774 | 785 | |
775 | 786 | wikiText += '{{Information\n' + info + '}}\n\n'; |
776 | 787 | |
777 | | - // add a location template if possible |
778 | | - |
779 | 788 | // add an "anything else" template if needed |
780 | 789 | var otherInfoWikiText = $j.trim( $j( _this.otherInformationInput ).val() ); |
781 | 790 | if ( ! mw.isEmpty( otherInfoWikiText ) ) { |