r84734 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84733‎ | r84734 | r84735 >
Date:08:35, 25 March 2011
Author:neilk
Status:deferred
Tags:
Comment:
fixing case of no extension
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -206,6 +206,7 @@
207207 'mwe-upwiz-thanks-wikitext',
208208 'mwe-upwiz-thanks-url',
209209 'mwe-upwiz-upload-error-bad-filename-extension',
 210+ 'mwe-upwiz-upload-error-bad-filename-no-extension',
210211 'mwe-upwiz-allowed-filename-extensions',
211212 'mwe-upwiz-help-allowed-filename-extensions',
212213 'mwe-upwiz-upload-error-duplicate',
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -138,7 +138,8 @@
139139 'mwe-upwiz-thanks-link' => 'This file is now available at <b><tt>$1</tt></b>.',
140140 'mwe-upwiz-thanks-wikitext' => '<b>To use the file in a wiki</b>, copy this text into a page:',
141141 'mwe-upwiz-thanks-url' => '<b>To link to it in HTML</b>, copy this URL address:',
142 - 'mwe-upwiz-upload-error-bad-filename-extension' => 'This wiki does not accept filenames with the extension "$1".',
 142+ 'mwe-upwiz-upload-error-bad-filename-extension' => 'This wiki does not accept filenames that end in the extension ".$1".',
 143+ 'mwe-upwiz-upload-error-bad-filename-no-extension' => 'This wiki requires that files have an extension -- like ".JPG" at the end of the filename.',
143144 'mwe-upwiz-allowed-filename-extensions' => 'The allowed extensions are:',
144145 'mwe-upwiz-help-allowed-filename-extensions' => 'Allowed filename extensions',
145146 'mwe-upwiz-upload-error-duplicate' => 'This file was previously uploaded to this wiki.',
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js
@@ -213,13 +213,18 @@
214214 _this.clearErrors();
215215 _this.upload.extractLocalFileInfo( _this.$fileInputCtrl.val() );
216216 var extension = _this.upload.title.getExtension();
217 - var isGoodExtension = $j.inArray( extension.toLowerCase(), mw.UploadWizard.config[ 'fileExtensions' ] ) !== -1;
218 - if ( isGoodExtension ) {
 217+ var hasExtension = ! mw.isEmpty( extension );
 218+ var isGoodExtension = false;
 219+ if ( hasExtension ) {
 220+ isGoodExtension = $j.inArray( extension.toLowerCase(), mw.UploadWizard.config[ 'fileExtensions' ] ) !== -1;
 221+ }
 222+ if ( hasExtension && isGoodExtension ) {
219223 _this.updateFilename();
220224 } else {
 225+ var errorMessage = hasExtension ? 'mwe-upwiz-upload-error-bad-filename-extension' : 'mwe-upwiz-upload-error-bad-filename-no-extension';
221226 $( '<div>' )
222227 .append(
223 - $j( '<p>' ).msg( 'mwe-upwiz-upload-error-bad-filename-extension', extension ),
 228+ $j( '<p>' ).msg( errorMessage, extension ),
224229 $j( '<p>' ).msg( 'mwe-upwiz-allowed-filename-extensions' ),
225230 $j( '<blockquote>' ).append( $j( '<tt>' ).append(
226231 mw.UploadWizard.config[ 'fileExtensions' ].join( " " )

Status & tagging log