r101324 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101323‎ | r101324 | r101325 >
Date:22:59, 30 October 2011
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
follow up to r99941, took care of Neils comments
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/uploadWizard.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -219,6 +219,7 @@
220220 'mwe-upwiz-location',
221221 'mwe-upwiz-location-lat',
222222 'mwe-upwiz-location-lon',
 223+ 'mwe-upwiz-location-alt',
223224 'mwe-upwiz-copyright-info',
224225 'mwe-upwiz-author',
225226 'mwe-upwiz-autoconverted',
@@ -273,6 +274,9 @@
274275 'mwe-upwiz-license-show-all',
275276 'mwe-upwiz-license-show-recommended',
276277 'mwe-upwiz-error-signature-blank',
 278+ 'mwe-upwiz-error-latitude',
 279+ 'mwe-upwiz-error-longitude',
 280+ 'mwe-upwiz-error-altitude',
277281 'mwe-upwiz-error-signature-too-long',
278282 'mwe-upwiz-error-signature-too-short',
279283 'mwe-upwiz-error-signature-bad-chars',
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -125,6 +125,7 @@
126126 'mwe-upwiz-location' => 'Location',
127127 'mwe-upwiz-location-lat' => 'Latitude',
128128 'mwe-upwiz-location-lon' => 'Longitude',
 129+ 'mwe-upwiz-location-alt' => 'Altitude',
129130 'mwe-upwiz-copyright-info' => 'Release rights',
130131 'mwe-upwiz-author' => 'Author(s)',
131132 'mwe-upwiz-autoconverted' => 'This file was automatically converted to the $1 format',
@@ -182,6 +183,9 @@
183184 'mwe-upwiz-license-show-all' => 'Use a different license',
184185 'mwe-upwiz-license-show-recommended' => 'Use the recommended license',
185186 'mwe-upwiz-error-signature-blank' => 'You must sign the field below with your username or real name.',
 187+ 'mwe-upwiz-error-latitude' => 'The latitude needs to be between -90 and 90.',
 188+ 'mwe-upwiz-error-longitude' => 'The longitude needs to be between -180 and 180.',
 189+ 'mwe-upwiz-error-altitude' => 'The altitude needs to be a number.',
186190 'mwe-upwiz-error-signature-too-long' => 'Your signature is too long.
187191 Make it shorter than $1 {{PLURAL:$1|character|characters}}.',
188192 'mwe-upwiz-error-signature-too-short' => 'Your signature is too short.
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css
@@ -712,5 +712,10 @@
713713 }
714714
715715 .mwe-location-lon {
 716+ float:left;
716717 font-style:italic;
717718 }
 719+
 720+.mwe-location-alt {
 721+ font-style:italic;
 722+}
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -161,8 +161,11 @@
162162
163163 var latId = "location-latitude" + _this.upload.index;
164164 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"/>' );
 165+ var altId = "location-altitude" + _this.upload.index;
 166+
 167+ _this.latInput = $j( '<input type="text" id="' + latId + '" name="' + latId + '" class="mwe-loc-lat" size="10"/>' );
 168+ _this.lonInput = $j( '<input type="text" id="' + lonId + '" name="' + lonId + '" class="mwe-loc-lon" size="10"/>' );
 169+ _this.altInput = $j( '<input type="text" id="' + altId + '" name="' + altId + '" class="mwe-loc-alt" size="10"/>' );
167170
168171 var latDiv = $j( '<div class="mwe-location-lat"></div>' )
169172 .append( $j ( '<div class="mwe-location-lat-label"></div>' ).append( gM( 'mwe-upwiz-location-lat' ) ) )
@@ -170,13 +173,20 @@
171174 var lonDiv = $j( '<div class="mwe-location-lon"></div>' )
172175 .append( $j ( '<div class="mwe-location-lon-label"></div>' ).append( gM( 'mwe-upwiz-location-lon' ) ) )
173176 .append( _this.lonInput );
 177+ var altDiv = $j( '<div class="mwe-location-alt"></div>' )
 178+ .append( $j ( '<div class="mwe-location-alt-label"></div>' ).append( gM( 'mwe-upwiz-location-alt' ) ) )
 179+ .append( _this.altInput );
174180
175181 var locationDiv = $j( '<div class="mwe-location"></div>' )
176182 .append( $j ('<div class="mwe-location-label"></div>' )
177183 .append( gM( 'mwe-upwiz-location' ) )
178184 .addHint( 'location' ) )
179 - .append( latDiv )
180 - .append( lonDiv );
 185+ .append(
 186+ $j( '<div class="mwe-upwiz-details-input-error"><label class="mwe-validator-error" for="' + latId + '" generated="true"/></div>' ),
 187+ $j( '<div class="mwe-upwiz-details-input-error"><label class="mwe-validator-error" for="' + lonId + '" generated="true"/></div>' ),
 188+ $j( '<div class="mwe-upwiz-details-input-error"><label class="mwe-validator-error" for="' + altId + '" generated="true"/></div>' ),
 189+ latDiv, lonDiv, altDiv
 190+ );
181191
182192 $j( moreDetailsDiv ).append(
183193 locationDiv,
@@ -287,6 +297,31 @@
288298 }
289299 } );
290300 }
 301+
 302+ _this.latInput.rules( "add", {
 303+ min: -90,
 304+ max: 90,
 305+ messages: {
 306+ min: gM( 'mwe-upwiz-error-latitude' ),
 307+ max: gM( 'mwe-upwiz-error-latitude' )
 308+ }
 309+ } );
 310+
 311+ _this.lonInput.rules( "add", {
 312+ min: -180,
 313+ max: 180,
 314+ messages: {
 315+ min: gM( 'mwe-upwiz-error-longitude' ),
 316+ max: gM( 'mwe-upwiz-error-longitude' )
 317+ }
 318+ } );
 319+
 320+ _this.altInput.rules( "add", {
 321+ number: true,
 322+ messages: {
 323+ number: gM( 'mwe-upwiz-error-altitude' ),
 324+ }
 325+ } );
291326
292327 mw.UploadWizardUtil.makeToggler( moreDetailsCtrlDiv, moreDetailsDiv );
293328
@@ -634,10 +669,20 @@
635670 * Leaving out altitude ref for now (for no good reason).
636671 */
637672 prefillLocation: function() {
638 - _this = this;
 673+ var _this = this;
 674+
639675 if ( _this.upload.imageinfo.metadata ) {
640 - $j( _this.latInput ).val( _this.upload.imageinfo.metadata['gpslatitude'] );
641 - $j( _this.lonInput ).val( _this.upload.imageinfo.metadata['gpslongitude'] );
 676+ var m = _this.upload.imageinfo.metadata;
 677+
 678+ if ( mw.isDefined( m['gpslatitude'] ) ) {
 679+ $j( _this.latInput ).val( m['gpslatitude'] );
 680+ }
 681+ if ( mw.isDefined( m['gpslongitude'] ) ) {
 682+ $j( _this.lonInput ).val( m['gpslongitude'] );
 683+ }
 684+ if ( mw.isDefined( m['gpsaltitude'] ) ) {
 685+ $j( _this.altInput ).val( m['gpsaltitude'] );
 686+ }
642687 }
643688 },
644689
@@ -775,10 +820,16 @@
776821 }
777822
778823 wikiText += "=={{int:filedesc}}==\n";
 824+
779825 var lat = $j.trim( $j( _this.latInput ).val() );
780826 var lon = $j.trim( $j( _this.lonInput ).val() );
781 - if( lat ){ //only add the tag if the data exists; assume that if lat exists, long will as well
782 - wikiText += '{{Location dec|'+ lat + '|' + lon + '}}\n';
 827+ var alt = $j.trim( $j( _this.altInput ).val() );
 828+
 829+ // Do not require the altitude to be set, to prevent people from entering 0
 830+ // while it's actually unknown.
 831+ // When none is provided, this will result in {{Location dec|int|int|}}.
 832+ if( lat !== '' && lon !== '' ) {
 833+ wikiText += '{{Location dec|'+ lat + '|' + lon + '|' + alt + '}}\n';
783834 }
784835
785836 wikiText += '{{Information\n' + info + '}}\n\n';

Follow-up revisions

RevisionCommit summaryAuthorDate
r101332Follow up to r101324;jeroendedauw00:54, 31 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99941Applied modified patch by Ben Hartshorne <bhartshorne at wikimedia dot org>:...erik04:39, 16 October 2011

Comments

#Comment by Siebrand (talk | contribs)   23:02, 30 October 2011

Please add message documentation for the newly added messages. Thanks.

Status & tagging log