r98846 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98845‎ | r98846 | r98847 >
Date:02:23, 4 October 2011
Author:neilk
Status:ok
Tags:
Comment:
return empty array for number of files in non-FileAPI browsers; improved comment docs
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js
@@ -243,22 +243,27 @@
244244 },
245245
246246 /**
247 - * Get a list of the files, defaulting to the value from the input form
248 - * @return Array of file objects
 247+ * Get a list of the files from this file input, defaulting to the value from the input form
 248+ * @return {Array} of File objects
249249 */
250250 getFiles: function() {
251251 var files = [];
252 - if( this.providedFile && ! this.$fileInputCtrl.get(0).value ) { // default to the fileinput if it's defined.
253 - files[0] = this.providedFile;
254 - } else {
255 - $j.each( this.$fileInputCtrl.get(0).files, function( i, file ) {
256 - files.push( file );
257 - } );
 252+ if ( mw.fileApi.isAvailable() ) {
 253+ if( this.providedFile && ! this.$fileInputCtrl.get(0).value ) { // default to the fileinput if it's defined.
 254+ files[0] = this.providedFile;
 255+ } else {
 256+ $j.each( this.$fileInputCtrl.get(0).files, function( i, file ) {
 257+ files.push( file );
 258+ } );
 259+ }
258260 }
259261 return files;
260262 },
261263
262 - // get just the filename.
 264+ /**
 265+ * Get just the filename.
 266+ * @return {String}
 267+ */
263268 getFilename: function() {
264269 if( this.providedFile && ! this.$fileInputCtrl.get(0).value ) { // default to the fileinput if it's defined.
265270 return this.providedFile.fileName;

Status & tagging log