Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -450,11 +450,6 @@ |
451 | 451 | */ |
452 | 452 | setUploadFilled: function( upload ) { |
453 | 453 | var _this = this; |
454 | | - |
455 | | - if ( _this.uploads.length >= _this.maxUploads ) { |
456 | | - _this.removeUpload( upload ); |
457 | | - return false; |
458 | | - } |
459 | 454 | |
460 | 455 | _this.uploads.push( upload ); |
461 | 456 | |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js |
— | — | @@ -330,14 +330,29 @@ |
331 | 331 | // and create new UploadWizardUpload objects and corresponding interfaces for the rest. |
332 | 332 | // |
333 | 333 | // don't process the very first file, since that's this instance's job. |
334 | | - $j.each( files.slice(1), function( i, file ) { |
335 | | - _this.wizard.newUpload( file ); |
336 | | - } ); |
337 | | - _this.wizard.updateFileCounts(); |
338 | 334 | |
339 | 335 | // this input will use the last one. |
340 | 336 | this.file = files[0]; |
341 | | - |
| 337 | + |
| 338 | + var toManyFiles = files.length + _this.wizard.uploads.length > mw.UploadWizard.config[ 'maxUploads' ]; |
| 339 | + |
| 340 | + if ( toManyFiles ) { |
| 341 | + var remainingFiles = mw.UploadWizard.config[ 'maxUploads' ] - _this.wizard.uploads.length; |
| 342 | + var leftoverFiles = files.length - remainingFiles; |
| 343 | + var files = remainingFiles > 1 ? files.slice( 1, remainingFiles - 1 ) : []; |
| 344 | + // TODO: display some notification that only x of n files where uploaded. |
| 345 | + } |
| 346 | + else { |
| 347 | + var files = files.slice( 1 ); |
| 348 | + } |
| 349 | + |
| 350 | + if ( files.length > 0 ) { |
| 351 | + $j.each( files, function( i, file ) { |
| 352 | + _this.wizard.newUpload( file ); |
| 353 | + } ); |
| 354 | + _this.wizard.updateFileCounts(); |
| 355 | + } |
| 356 | + |
342 | 357 | // TODO check max upload size, alert user if too big |
343 | 358 | this.transportWeight = this.file.size; |
344 | 359 | if ( !mw.isDefined( this.imageinfo ) ) { |