r104167 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104166‎ | r104167 | r104168 >
Date:14:44, 24 November 2011
Author:jeroendedauw
Status:ok
Tags:neilk 
Comment:
bug 31341, follow up to r104117
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -399,6 +399,9 @@
400400 'wm-license-cc-by-sa-3.0-no-text',
401401 'wm-license-cc-by-sa-3.0-pl-text',
402402 'wm-license-cc-by-sa-3.0-ro-text',
 403+ 'mwe-upwiz-to-many-files-ok',
 404+ 'mwe-upwiz-to-many-files-text',
 405+ 'mwe-upwiz-to-many-files',
403406 ),
404407 'group' => 'ext.uploadWizard'
405408 ),
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -214,6 +214,9 @@
215215 'mwe-upwiz-error-license-wikitext-too-long' => 'The wikitext you entered is too long.',
216216 'mwe-upwiz-error-license-wikitext-invalid' => 'This does not seem to be valid wikitext, or does not contain a license.',
217217 'mwe-upwiz-details-error-count' => 'There {{PLURAL:$1|is one error|are $1 errors}} with the {{PLURAL:$2|form|forms}} above. Correct the errors, and try submitting again.',
 218+ 'mwe-upwiz-to-many-files-ok' => 'Ok',
 219+ 'mwe-upwiz-to-many-files-text' => 'You can only upload $1 {{PLURAL:$1|file|files}} in one go. You tried to add $2 {{PLURAL:$2|file|files}}, so $3 {{PLURAL:$3|file|files}} have been omitted.',
 220+ 'mwe-upwiz-to-many-files' => 'To many files',
218221
219222 /* LICENSES & combinations of licenses */
220223 /* may be a good idea to shift to WikimediaLicenseTexts? */
@@ -584,6 +587,9 @@
585588 'mwe-upwiz-prefs-def-3rdparty' => 'Form input label',
586589 'mwe-upwiz-prefs-def-license-ownwork' => 'Radio button option',
587590 'mwe-upwiz-prefs-def-license-3rdparty' => 'Radio button option',
 591+ 'mwe-upwiz-to-many-files-ok' => 'Ok button text',
 592+ 'mwe-upwiz-to-many-files-text' => 'Error message informing the user there are to manuy uploads in a dialog. Each param is a file count.',
 593+ 'mwe-upwiz-to-many-files' => 'Error dialog title',
588594 );
589595
590596 /** Afrikaans (Afrikaans)
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js
@@ -334,13 +334,12 @@
335335 // this input will use the last one.
336336 this.file = files[0];
337337
338 - var toManyFiles = files.length + _this.wizard.uploads.length > mw.UploadWizard.config[ 'maxUploads' ];
 338+ var tooManyFiles = files.length + _this.wizard.uploads.length > mw.UploadWizard.config[ 'maxUploads' ];
339339
340 - if ( toManyFiles ) {
 340+ if ( tooManyFiles ) {
341341 var remainingFiles = mw.UploadWizard.config[ 'maxUploads' ] - _this.wizard.uploads.length;
342 - var leftoverFiles = files.length - remainingFiles;
 342+ _this.showToManyFilesWarning( files.length - remainingFiles );
343343 var files = remainingFiles > 1 ? files.slice( 1, remainingFiles - 1 ) : [];
344 - // TODO: display some notification that only x of n files where uploaded.
345344 }
346345 else {
347346 var files = files.slice( 1 );
@@ -384,7 +383,36 @@
385384
386385 },
387386
388 -
 387+ /**
 388+ * Shows an error dialog informing the user that some uploads have been omitted
 389+ * since they went over the max files limit.
 390+ * @param {Integer}
 391+ */
 392+ showToManyFilesWarning: function( filesIgnored ) {
 393+ var buttons = [
 394+ {
 395+ text: gM( 'mwe-upwiz-to-many-files-ok' ),
 396+ click: function() {
 397+ $( this ).dialog( "close" );
 398+ }
 399+ }
 400+ ];
 401+ $j( '<div></div>' )
 402+ .msg(
 403+ 'mwe-upwiz-to-many-files-text',
 404+ mw.UploadWizard.config[ 'maxUploads' ],
 405+ mw.UploadWizard.config[ 'maxUploads' ] + filesIgnored,
 406+ filesIgnored
 407+ )
 408+ .dialog( {
 409+ width: 500,
 410+ zIndex: 200000,
 411+ autoOpen: true,
 412+ title: gM( 'mwe-upwiz-to-many-files' ),
 413+ modal: true,
 414+ buttons: buttons
 415+ } );
 416+ },
389417
390418
391419 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r104169follow-up to r104167: spelling fixes ("to many"->"too many")erik14:58, 24 November 2011
r105441fix off by one error from bug 31341 and error message tweaksjeroendedauw17:03, 7 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104103fixing bug 31341 - maybe not the most elegant solution, but it worksjeroendedauw23:37, 23 November 2011
r104117Follow up to r104103;jeroendedauw00:33, 24 November 2011

Status & tagging log