Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -399,6 +399,9 @@ |
400 | 400 | 'wm-license-cc-by-sa-3.0-no-text', |
401 | 401 | 'wm-license-cc-by-sa-3.0-pl-text', |
402 | 402 | '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', |
403 | 406 | ), |
404 | 407 | 'group' => 'ext.uploadWizard' |
405 | 408 | ), |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -214,6 +214,9 @@ |
215 | 215 | 'mwe-upwiz-error-license-wikitext-too-long' => 'The wikitext you entered is too long.', |
216 | 216 | 'mwe-upwiz-error-license-wikitext-invalid' => 'This does not seem to be valid wikitext, or does not contain a license.', |
217 | 217 | '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', |
218 | 221 | |
219 | 222 | /* LICENSES & combinations of licenses */ |
220 | 223 | /* may be a good idea to shift to WikimediaLicenseTexts? */ |
— | — | @@ -584,6 +587,9 @@ |
585 | 588 | 'mwe-upwiz-prefs-def-3rdparty' => 'Form input label', |
586 | 589 | 'mwe-upwiz-prefs-def-license-ownwork' => 'Radio button option', |
587 | 590 | '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', |
588 | 594 | ); |
589 | 595 | |
590 | 596 | /** Afrikaans (Afrikaans) |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js |
— | — | @@ -334,13 +334,12 @@ |
335 | 335 | // this input will use the last one. |
336 | 336 | this.file = files[0]; |
337 | 337 | |
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' ]; |
339 | 339 | |
340 | | - if ( toManyFiles ) { |
| 340 | + if ( tooManyFiles ) { |
341 | 341 | var remainingFiles = mw.UploadWizard.config[ 'maxUploads' ] - _this.wizard.uploads.length; |
342 | | - var leftoverFiles = files.length - remainingFiles; |
| 342 | + _this.showToManyFilesWarning( files.length - remainingFiles ); |
343 | 343 | var files = remainingFiles > 1 ? files.slice( 1, remainingFiles - 1 ) : []; |
344 | | - // TODO: display some notification that only x of n files where uploaded. |
345 | 344 | } |
346 | 345 | else { |
347 | 346 | var files = files.slice( 1 ); |
— | — | @@ -384,7 +383,36 @@ |
385 | 384 | |
386 | 385 | }, |
387 | 386 | |
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 | + }, |
389 | 417 | |
390 | 418 | |
391 | 419 | /** |