r104117 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104116‎ | r104117 | r104118 >
Date:00:33, 24 November 2011
Author:jeroendedauw
Status:ok (Comments)
Tags:neilk 
Comment:
Follow up to r104103;
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -450,11 +450,6 @@
451451 */
452452 setUploadFilled: function( upload ) {
453453 var _this = this;
454 -
455 - if ( _this.uploads.length >= _this.maxUploads ) {
456 - _this.removeUpload( upload );
457 - return false;
458 - }
459454
460455 _this.uploads.push( upload );
461456
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js
@@ -330,14 +330,29 @@
331331 // and create new UploadWizardUpload objects and corresponding interfaces for the rest.
332332 //
333333 // 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();
338334
339335 // this input will use the last one.
340336 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+
342357 // TODO check max upload size, alert user if too big
343358 this.transportWeight = this.file.size;
344359 if ( !mw.isDefined( this.imageinfo ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r104167bug 31341, follow up to r104117jeroendedauw14:44, 24 November 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

Comments

#Comment by NeilK (talk | contribs)   00:39, 24 November 2011

toManyFiles --> tooManyFiles -- otherwise looks good so far. (Have not tried it yet).

#Comment by NeilK (talk | contribs)   19:00, 6 December 2011

seems to work

Status & tagging log