Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js |
— | — | @@ -7,6 +7,23 @@ |
8 | 8 | */ |
9 | 9 | ( function( $j ) { |
10 | 10 | |
| 11 | +/** |
| 12 | + * Constructor for objects representing uploads. The workhorse of this entire extension. |
| 13 | + * |
| 14 | + * The upload knows nothing of other uploads. It manages its own interface, and transporting its own data, to |
| 15 | + * the server. |
| 16 | + * |
| 17 | + * Upload objects are usually created without a file, they are just associated with a form. |
| 18 | + * There is an "empty" fileInput which is invisibly floating above certain buttons in the interface, like "Add a file". When |
| 19 | + * this fileInput gets a file, this upload becomes 'filled'. |
| 20 | + * |
| 21 | + * On some browsers, the user may select multiple files. So upon such a 'filled' event, we add the first File to this Upload, and |
| 22 | + * then create other UploadWizardUpload objects from the individual Files, using the optional providedFile parameter. |
| 23 | + * |
| 24 | + * @param {UploadWizard} wizard |
| 25 | + * @param {HTMLDivElement} filesDiv - where we will dump our the interfaces for uploads |
| 26 | + * @param {File} providedFile - optional; only used on browsers which support FileAPI. |
| 27 | + */ |
11 | 28 | mw.UploadWizardUpload = function( wizard, filesDiv, providedFile ) { |
12 | 29 | |
13 | 30 | this.index = mw.UploadWizardUpload.prototype.count; |
— | — | @@ -261,7 +278,7 @@ |
262 | 279 | * Error out if filename or its contents are determined to be unacceptable |
263 | 280 | * Proceed to thumbnail extraction and image info if acceptable |
264 | 281 | * @param {string} the filename |
265 | | - * @param {Array} the list of files. usually one, can be more for multi-file select. |
| 282 | + * @param {Array} of Files. usually one, can be more for multi-file select. |
266 | 283 | * @param {Function()} callback when ok, and upload object is ready |
267 | 284 | * @param {Function(String, Mixed)} callback when filename or contents in error. Signature of string code, mixed info |
268 | 285 | */ |
— | — | @@ -286,7 +303,6 @@ |
287 | 304 | |
288 | 305 | if( duplicate ) { |
289 | 306 | fileNameErr( 'dup', basename ); |
290 | | - return false; |
291 | 307 | } |
292 | 308 | |
293 | 309 | try { |
— | — | @@ -312,7 +328,6 @@ |
313 | 329 | // |
314 | 330 | // don't process the very first file, since that's this instance's job. |
315 | 331 | $j.each( files.slice(1), function( i, file ) { |
316 | | - //_this.wizard.setUploadFilled( _this.wizard.newUpload( file ) ); |
317 | 332 | _this.wizard.newUpload( file ); |
318 | 333 | } ); |
319 | 334 | _this.wizard.updateFileCounts(); |