r63670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63669‎ | r63670 | r63671 >
Date:05:02, 13 March 2010
Author:neilk
Status:deferred
Tags:
Comment:
some nomenclature change for clarity
- completed -> transported (because we're not done yet)
- metadata -> details (MediaWiki calls EXIF info metadata)

refactored to make a real Upload object as a repository for info extracted from API calls
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/css/uploadWizard.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.ApiUploadHandler.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.IframeTransport.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js
@@ -1,13 +1,13 @@
22 mw.addMessages( {
33 'mwe-upwiz-tab-file': 'Step 1',
4 - 'mwe-upwiz-tab-metadata': 'Step 2',
 4+ 'mwe-upwiz-tab-details': 'Step 2',
55 'mwe-upwiz-tab-thanks': 'Step 3',
66 'mwe-upwiz-intro': 'Introductory text (short)',
77 'mwe-upwiz-select-files': 'Select files:',
88 'mwe-upwiz-add-file-n': 'Add another file',
99 'mwe-upwiz-add-file-0': 'Add a file',
1010 'mwe-upwiz-browse': 'Browse...',
11 - 'mwe-upwiz-completed': 'OK',
 11+ 'mwe-upwiz-transported': 'OK',
1212 'mwe-upwiz-click-here': 'Click here to select a file',
1313 'mwe-upwiz-uploading': 'uploading...',
1414 'mwe-upwiz-remove-upload': 'Remove this file from the list of files to upload',
@@ -16,7 +16,7 @@
1717 'mwe-upwiz-upload-count': '$1 of $2 files uploaded',
1818 'mwe-upwiz-progressbar-uploading': 'uploading',
1919 'mwe-upwiz-remaining': '$1 remaining',
20 - 'mwe-upwiz-intro-metadata': 'Thank you for uploading your works! Now we need some basic information in order to complete your upload.',
 20+ 'mwe-upwiz-intro-details': 'Thank you for uploading your works! Now we need some basic information in order to complete your upload.',
2121 'mwe-upwiz-provenance-ownwork': 'They are entirely your own work.',
2222 'mwe-upwiz-provenance-ownwork-assert': 'I, $1, the copyright holder of this work, hereby grant anyone the right to use these works for any purpose, as long as they credit me and share derivative work under the same terms.',
2323 'mwe-upwiz-provenance-ownwork-assert-note': 'This means you release your work under a double Creative Commons Attribution ShareAlike and GFDL license.',
@@ -64,7 +64,89 @@
6565 } );
6666
6767
 68+/**
 69+ * Represents the upload -- in its local and remote state. (Possibly those could be separate objects too...)
 70+ * This is our 'model' object if we are thinking MVC. Needs to be better factored, lots of feature envy with the UploadWizard
 71+ */
 72+mw.UploadWizardUpload = function() {
 73+ var _this = this;
 74+ _this._thumbnails = {};
 75+ _this.imageinfo = {};
 76+};
6877
 78+mw.UploadWizardUpload.prototype = {
 79+ /**
 80+ * Accept the result from a successful API upload transport, and fill our own info
 81+ *
 82+ * @param result The JSON object from a successful API upload result.
 83+ */
 84+ extractImageInfo: function( result ) {
 85+ var _this = this;
 86+
 87+ _this.filename = result.upload.filename;
 88+ _this.title = "File:" + _this.filename;
 89+
 90+ for (var key in result.upload.imageinfo) {
 91+ _this.imageinfo[key] = result.upload.imageinfo[key];
 92+ }
 93+ },
 94+
 95+ /**
 96+ * Supply information to create a thumbnail for this Upload. Runs async, with a callback.
 97+ * It is assumed you don't call this until it's been transported.
 98+ *
 99+ * XXX should check if we really need this second API call or if we can get MediaWiki to make us a thumbnail URL upon upload
 100+ *
 101+ * @param width - desired width of thumbnail (height will scale to match)
 102+ * @param callback - callback to execute once thumbnail has been obtained -- must accept object with properties of width, height, and url.
 103+ */
 104+ getThumbnail: function( width, callback ) {
 105+ var _this = this;
 106+ if ( _this._thumbnails[ "width" + width ] !== undefined ) {
 107+ callback( _this.thumbnails[ "width" + width ] );
 108+ return;
 109+ }
 110+
 111+ var apiUrl = mw.getLocalApiUrl();
 112+
 113+ var params = {
 114+ 'titles': _this.title,
 115+ 'iiurlwidth': width,
 116+ 'prop': 'imageinfo',
 117+ 'iiprop': 'url'
 118+ };
 119+
 120+ mw.getJSON( apiUrl, params, function( data ) {
 121+ if ( !data || !data.query || !data.query.pages ) {
 122+ mw.log(" No data? ")
 123+ // XXX do something about the thumbnail spinner, maybe call the callback with a broken image.
 124+ return;
 125+ }
 126+
 127+ if ( data.query.pages[-1] ) {
 128+ // XXX do something about the thumbnail spinner, maybe call the callback with a broken image.
 129+ return;
 130+ }
 131+ for ( var page_id in data.query.pages ) {
 132+ var page = data.query.pages[ page_id ];
 133+ if ( ! page.imageinfo ) {
 134+ // not found? error
 135+ } else {
 136+ var imageInfo = page.imageinfo[0];
 137+ var thumbnail = {
 138+ width: imageInfo.thumbwidth,
 139+ height: imageInfo.thumbheight,
 140+ url: imageInfo.url
 141+ }
 142+ _this._thumbnails[ "width" + width ] = thumbnail;
 143+ callback( thumbnail );
 144+ }
 145+ }
 146+ } );
 147+
 148+ }
 149+};
 150+
69151 /**
70152 * Create an interface fragment corresponding to a file input, suitable for Upload Wizard.
71153 * @param filenameAcceptedCb Execute if good filename entered into this interface; useful for knowing if we're ready to upload
@@ -105,7 +187,7 @@
106188 .append( _this.errorDiv );
107189
108190 // _this.progressBar = ( no progress bar for individual uploads yet )
109 - // add a metadata thing to metadata
 191+ // add a details thing to details
110192 };
111193
112194 mw.UploadWizardUploadInterface.prototype = {
@@ -141,14 +223,14 @@
142224 },
143225
144226 /**
145 - * Execute when this upload is completed; cleans up interface.
 227+ * Execute when this upload is transported; cleans up interface.
146228 * @param result AJAx result object
147229 */
148 - completed: function( result ) {
 230+ transported: function( result ) {
149231 var _this = this;
150232 $j( _this.progressMessage ).removeClass( 'mwe-upwiz-status-progress' )
151 - .addClass( 'mwe-upwiz-status-completed' )
152 - .html( gM( 'mwe-upwiz-completed' ) );
 233+ .addClass( 'mwe-upwiz-status-transported' )
 234+ .html( gM( 'mwe-upwiz-transported' ) );
153235 },
154236
155237 /**
@@ -276,7 +358,7 @@
277359 };
278360
279361 /**
280 - * Object that represents an indvidual language description, in the metadata portion of Upload Wizard
 362+ * Object that represents an indvidual language description, in the details portion of Upload Wizard
281363 * @param languageCode
282364 */
283365 mw.UploadWizardDescription = function( languageCode ) {
@@ -313,26 +395,31 @@
314396 };
315397
316398 /**
317 - * Object that represents the Metadata (step 2) portion of the UploadWizard
 399+ * Object that represents the Details (step 2) portion of the UploadWizard
 400+ * n.b. each upload gets its own details.
 401+ *
 402+ * @param UploadWizardUpload
318403 * @param containerDiv The div to put the interface into
319404 */
320 -mw.UploadWizardMetadata = function( containerDiv ) {
 405+mw.UploadWizardDetails = function( upload, containerDiv ) {
321406
322407 var _this = this;
 408+ _this.upload = upload;
 409+
323410 _this.descriptions = [];
324411
325 - _this.div = $j( '<div class="mwe-upwiz-metadata-file"></div>' );
 412+ _this.div = $j( '<div class="mwe-upwiz-details-file"></div>' );
326413
327414 _this.macroDiv = $j( '<div class="mwe-upwiz-macro"></div>' )
328415 .append( $j( '<input type="submit" value="test edit"/>' ).click( function( ) { _this.submit( ) } ));
329416
330417 _this.thumbnailDiv = $j( '<div class="mwe-upwiz-thumbnail"></div>' );
331418
332 - _this.errorDiv = $j( '<div class="mwe-upwiz-metadata-error"></div>' );
 419+ _this.errorDiv = $j( '<div class="mwe-upwiz-details-error"></div>' );
333420
334 - _this.dataDiv = $j( '<div class="mwe-upwiz-metadata-data"></div>' );
 421+ _this.dataDiv = $j( '<div class="mwe-upwiz-details-data"></div>' );
335422
336 - _this.descriptionsDiv = $j( '<div class="mwe-upwiz-metadata-descriptions"></div>' );
 423+ _this.descriptionsDiv = $j( '<div class="mwe-upwiz-details-descriptions"></div>' );
337424
338425 _this.descriptionAdder = $j( '<a id="mwe-upwiz-desc-add"/>' )
339426 .attr( 'href', '#' )
@@ -340,10 +427,10 @@
341428 .click( function( ) { _this.addDescription( ) } );
342429
343430 _this.descriptionsContainerDiv =
344 - $j( '<div class="mwe-upwiz-metadata-descriptions-container"></div>' )
345 - .append( $j( '<div class="mwe-upwiz-metadata-descriptions-title">' + gM( 'mwe-upwiz-desc' ) + '</div>' ) )
 431+ $j( '<div class="mwe-upwiz-details-descriptions-container"></div>' )
 432+ .append( $j( '<div class="mwe-upwiz-details-descriptions-title">' + gM( 'mwe-upwiz-desc' ) + '</div>' ) )
346433 .append( _this.descriptionsDiv )
347 - .append( $j( '<div class="mwe-upwiz-metadata-descriptions-add"></div>' )
 434+ .append( $j( '<div class="mwe-upwiz-details-descriptions-add"></div>' )
348435 .append( _this.descriptionAdder ) );
349436
350437
@@ -383,7 +470,7 @@
384471
385472 };
386473
387 -mw.UploadWizardMetadata.prototype = {
 474+mw.UploadWizardDetails.prototype = {
388475
389476 /**
390477 * Do anything related to a change in the number of descriptions
@@ -427,7 +514,7 @@
428515 },
429516
430517 /**
431 - * Display an error with metadata
 518+ * Display an error with details
432519 * XXX this is a lot like upload ui's error -- should merge
433520 */
434521 error: function() {
@@ -475,19 +562,18 @@
476563 * Given the API result pull some info into the form ( for instance, extracted from EXIF, desired filename )
477564 * @param result Upload API result object
478565 */
479 - populateFromResult: function( result ) {
 566+ populate: function() {
480567 var _this = this;
481 - var upload = result.upload;
482 - mw.log( "populating from result" );
483 - _this.setThumbnail( upload.filename, mw.getConfig( 'thumbnailWidth' ));
484 - //_this.setSource( upload. result );
 568+ mw.log( "populating details from upload" );
 569+ _this.setThumbnail( mw.getConfig( 'thumbnailWidth' ) );
 570+ //_this.setDate();
 571+
 572+ //_this.setSource();
485573
486 - //_this.setFilename( upload.filename );
 574+ //_this.setFilename();
487575
488 - //_this.setDescription(); // is there anything worthwhile here? image comment?
489 - //_this.setDate( upload.metadata );
490 - //_this.setLocation( upload.metadata ); // we could be VERY clever with location sensing...
491 - //_this.setAuthor( _this.config.user, upload.exif.Copyright );
 576+ //_this.setLocation(); // we could be VERY clever with location sensing...
 577+ //_this.setAuthor();
492578 },
493579
494580 /**
@@ -495,71 +581,31 @@
496582 * @param filename
497583 * @param width
498584 */
499 - setThumbnail: function( filename, width ) {
 585+ setThumbnail: function( width ) {
500586 var _this = this;
501587
502 - var callback = function( imageInfo ) {
503 - var thumbnail = $j( '<img class="mwe-upwiz-thumbnail"/>' ).get( 0 );
504 - thumbnail.width = imageInfo.thumbwidth;
505 - thumbnail.height = imageInfo.thumbheight;
506 - thumbnail.src = imageInfo.thumburl;
 588+ var callback = function( thumbnail ) {
507589 // side effect: will replace thumbnail's loadingSpinner
508 - _this.thumbnailDiv.html( thumbnail );
 590+ _this.thumbnailDiv.html(
 591+ $j('<a>')
 592+ .attr( 'href', _this.upload.imageinfo.descriptionurl )
 593+ .append(
 594+ $j( '<img/>' )
 595+ .addClass( "mwe-upwiz-thumbnail" )
 596+ .attr( 'width', thumbnail.width )
 597+ .attr( 'height', thumbnail.height )
 598+ .attr( 'src', thumbnail.url ) ) );
509599 };
510600
511601 _this.thumbnailDiv.loadingSpinner();
512 - _this.getThumbnail( "File:" + filename, width, callback );
 602+ _this.upload.getThumbnail( width, callback );
513603
514604 },
515605
516606 /**
517 - * use iinfo to get thumbnail info
518 - * this API method can be used to get a lot of thumbnails at once, but that may not be so useful for us ATM
519 - * this is mostly ripped off from mw.UploadHandler's doDestCheck, but: stripped of UI, does only one, does not check for name collisions.
520 - * @param title - name of the file on mediawiki (e.g. File:Foo.jpg)
521 - * @param width - desired width of thumbnail (height will scale to match)
522 - * @param setThumbnailCb - callback to execute once info has been obtained (for instance, put it into the interface)
523 - * @param apiUrl - where to get your API results
 607+ * Convert entire details for this file into wikiText, which will then be posted to the file
 608+ * @return wikitext representing all details
524609 */
525 - getThumbnail: function( title, width, setThumbnailCb, apiUrl ) {
526 -
527 - if ( apiUrl === undefined ) {
528 - apiUrl = mw.getLocalApiUrl();
529 - }
530 -
531 - var params = {
532 - 'titles': title,
533 - 'iiurlwidth': width,
534 - 'prop': 'imageinfo',
535 - 'iiprop': 'url|mime|size'
536 - };
537 -
538 - mw.getJSON( apiUrl, params, function( data ) {
539 - if ( !data || !data.query || !data.query.pages ) {
540 - mw.log(" No data? ")
541 - return;
542 - }
543 -
544 - if ( data.query.pages[-1] ) {
545 - // not found ? error
546 - }
547 - for ( var page_id in data.query.pages ) {
548 - var page = data.query.pages[ page_id ];
549 - if ( ! page.imageinfo ) {
550 - // not found? error
551 - } else {
552 - var imageInfo = page.imageinfo[0];
553 - setThumbnailCb( imageInfo );
554 - }
555 - }
556 - } );
557 - },
558 -
559 -
560 - /**
561 - * Convert entire metadata for this file into wikiText, which will then be posted to the file
562 - * @return wikitext representing all metadata
563 - */
564610 getWikiText: function() {
565611 var _this = this;
566612 wikiText = '';
@@ -623,9 +669,9 @@
624670 // check descriptions
625671
626672 // are we changing the name ( moving the file? ) if so, do that first, and the rest of this submission has to become
627 - // a callback when that is completed?
 673+ // a callback when that is transported?
628674
629 - // XXX check state of metadata for okayness ( license selected, at least one desc, sane filename )
 675+ // XXX check state of details for okayness ( license selected, at least one desc, sane filename )
630676 var wikiText = _this.getWikiText();
631677 mw.log( wikiText );
632678 // do some api call to edit the info
@@ -656,12 +702,14 @@
657703 mw.UploadWizard = function() {
658704
659705 this.uploadHandlerClass = mw.getConfig('uploadHandlerClass') || this.getUploadHandlerClass();
660 - this.isCompleted = false;
 706+ this.isTransported = false;
661707
662708 this.uploads = [];
663709 // leading underline for privacy. DO NOT TAMPER.
664710 this._uploadsQueued = [];
665711 this._uploadsInProgress = [];
 712+ this._uploadsTransported = [];
 713+ this._uploadsEditingDetails = [];
666714 this._uploadsCompleted = [];
667715
668716 this.uploadsBeginTime = null;
@@ -671,7 +719,7 @@
672720 mw.UploadWizard.prototype = {
673721 maxUploads: 10, // XXX get this from config
674722 maxSimultaneousUploads: 2, // XXX get this from config
675 - tabs: [ 'file', 'metadata', 'thanks' ],
 723+ tabs: [ 'file', 'details', 'thanks' ],
676724
677725 /*
678726 // list possible upload handlers in order of preference
@@ -719,7 +767,7 @@
720768 '<div id="mwe-upwiz-tabs">'
721769 + '<ul>'
722770 + '<li id="mwe-upwiz-tab-file">' + gM('mwe-upwiz-tab-file') + '</li>'
723 - + '<li id="mwe-upwiz-tab-metadata">' + gM('mwe-upwiz-tab-metadata') + '</li>'
 771+ + '<li id="mwe-upwiz-tab-details">' + gM('mwe-upwiz-tab-details') + '</li>'
724772 + '<li id="mwe-upwiz-tab-thanks">' + gM('mwe-upwiz-tab-thanks') + '</li>'
725773 + '</ul>'
726774 + '</div>'
@@ -742,9 +790,9 @@
743791 + '<div style="clear: left;"></div>'
744792 + '</div>'
745793 + '</div>'
746 - + '<div id="mwe-upwiz-tabdiv-metadata">'
747 - + '<div id="mwe-upwiz-metadata-macro"></div>'
748 - + '<div id="mwe-upwiz-metadata-files"></div>'
 794+ + '<div id="mwe-upwiz-tabdiv-details">'
 795+ + '<div id="mwe-upwiz-details-macro"></div>'
 796+ + '<div id="mwe-upwiz-details-files"></div>'
749797 + '</div>'
750798 + '<div id="mwe-upwiz-tabdiv-thanks">'
751799 + '<div id="mwe-upwiz-thanks"></div>'
@@ -795,7 +843,7 @@
796844 /**
797845 * add an Upload
798846 * we create the upload interface, a handler to transport it to the server,
799 - * and UI for the upload itself and the "metadata" at the second step of the wizard.
 847+ * and UI for the upload itself and the "details" at the second step of the wizard.
800848 * Finally stuff it into an array of uploads.
801849 * @return boolean success
802850 */
@@ -806,15 +854,10 @@
807855 return false;
808856 }
809857
810 - // could (should?) be an object, but so far it doesn't have its own methods really.
811 - // plus, here in UploadWizard, we have additional concepts like metadata...
812 - var upload = {};
 858+ var upload = new mw.UploadWizardUpload();
813859
814 - // API
815 - // XXX hardcoded for now. Maybe passed through config or guessed at here.
816 - // upload.api = new mw.UploadApiProcessor( function( result ) { _this.uploadCompleted );
 860+ // XXX much of the following should be moved to UploadWizardUpload constructor.
817861
818 -
819862 // UI
820863 // originalFilename is the basename of the file on our file system. This is what we really wanted ( probably ).
821864 // the system will upload with a temporary filename and we'll get that back from the API return when we upload
@@ -836,18 +879,17 @@
837880 upload.handler.addProgressCb( function( fraction ) { _this.uploadProgress( upload, fraction ) } );
838881
839882 // this is only the UI one, so is the result even going to be there?
840 - upload.handler.addCompletedCb( function( result ) { _this.uploadCompleted( upload, result ) } );
 883+ upload.handler.addTransportedCb( function( result ) { _this.uploadTransported( upload, result ) } );
841884
842885 // not sure about this...UI only?
843886 // this will tell us that at least one of our uploads has had an error -- may change messaging,
844887 // like, please fix below
845888 upload.handler.addErrorCb( function( error ) { _this.uploadError( upload, error ) } );
846889
847 - // metadata
848 - upload.metadata = new mw.UploadWizardMetadata( $j( '#mwe-upwiz-metadata-files' ));
 890+ // details
 891+ upload.details = new mw.UploadWizardDetails( upload, $j( '#mwe-upwiz-details-files' ));
849892
850893
851 -
852894 _this.uploads.push( upload );
853895
854896 $j( "#mwe-upwiz-files" ).append( upload.ui.div );
@@ -872,7 +914,7 @@
873915 removeUpload: function( upload ) {
874916 var _this = this;
875917 $j( upload.ui.div ).remove();
876 - $j( upload.metadata.div ).remove();
 918+ $j( upload.details.div ).remove();
877919 mw.UploadWizardUtil.removeItem( _this.uploads, upload );
878920 _this.updateFileCounts();
879921 },
@@ -944,7 +986,7 @@
945987 * Uploads must be 'queued' to be considered for uploading
946988 * making this another thread of execution, because we want to avoid any race condition
947989 * this way, this is the only "thread" that can start uploads
948 - * it may miss a newly completed upload but it will get it eventually
 990+ * it may miss a newly transported upload but it will get it eventually
949991 *
950992 */
951993 _startUploadsQueued: function() {
@@ -971,7 +1013,7 @@
9721014 */
9731015 showProgress: function() {
9741016 var _this = this;
975 - if ( _this.isCompleted ) {
 1017+ if ( _this.isTransported ) {
9761018 return;
9771019 }
9781020
@@ -991,7 +1033,7 @@
9921034
9931035 /**
9941036 * Show the progress bar for the entire Upload Wizard.
995 - * @param fraction fraction completed (float between 0 and 1)
 1037+ * @param fraction fraction transported (float between 0 and 1)
9961038 */
9971039 showProgressBar: function( fraction ) {
9981040 $j( '#mwe-upwiz-progress-bar' ).progressbar( 'value', parseInt( fraction * 100 ) );
@@ -1011,15 +1053,15 @@
10121054 * Calculate remaining time for all uploads to complete.
10131055 *
10141056 * @param beginTime time in whatever unit getTime returns, presume epoch milliseconds
1015 - * @param fractionCompleted fraction completed
 1057+ * @param fractionTransported fraction transported
10161058 * @return time in whatever units getTime() returns; presumed milliseconds
10171059 */
1018 - getRemainingTime: function ( beginTime, fractionCompleted ) {
 1060+ getRemainingTime: function ( beginTime, fractionTransported ) {
10191061 if ( beginTime ) {
10201062 var elapsedTime = ( new Date() ).getTime() - beginTime;
1021 - if ( fractionCompleted > 0.0 && elapsedTime > 0 ) { // or some other minimums for good data
1022 - var rate = fractionCompleted / elapsedTime;
1023 - return parseInt( ( 1.0 - fractionCompleted ) / rate );
 1063+ if ( fractionTransported > 0.0 && elapsedTime > 0 ) { // or some other minimums for good data
 1064+ var rate = fractionTransported / elapsedTime;
 1065+ return parseInt( ( 1.0 - fractionTransported ) / rate );
10241066 }
10251067 }
10261068 return null;
@@ -1040,25 +1082,26 @@
10411083 },
10421084
10431085 /**
1044 - * To be executed when an individual upload finishes. Processes the result and updates step 2's metadata
 1086+ * To be executed when an individual upload finishes. Processes the result and updates step 2's details
10451087 * @param upload an Upload object
10461088 * @param result the API result in parsed JSON form
10471089 */
1048 - uploadCompleted: function( upload, result ) {
 1090+ uploadTransported: function( upload, result ) {
10491091 var _this = this;
1050 - _this._uploadsCompleted.push( upload );
 1092+ _this._uploadsTransported.push( upload );
10511093 mw.UploadWizardUtil.removeItem( _this._uploadsInProgress, upload );
10521094
10531095 if ( result.upload && result.upload.imageinfo && result.upload.imageinfo.descriptionurl ) {
10541096 // success
1055 - setTimeout( function() {
1056 - upload.metadata.populateFromResult( result ); }, 0 );
 1097+ _this._uploadsEditingDetails.push( upload );
 1098+ upload.extractImageInfo( result );
 1099+ upload.details.populate();
10571100
10581101 } else if ( result.upload && result.upload.sessionkey ) {
10591102 // there was a warning - type error which prevented it from adding the result to the db
10601103 if ( result.upload.warnings.duplicate ) {
10611104 var duplicates = result.upload.warnings.duplicate;
1062 - _this.metadata.errorDuplicate( result.upload.sessionkey, duplicates );
 1105+ _this.details.errorDuplicate( result.upload.sessionkey, duplicates );
10631106 }
10641107
10651108 // XXX namespace collision
@@ -1072,8 +1115,8 @@
10731116
10741117
10751118 /**
1076 - * Occurs whenever we need to update the interface based on how many files are there or have completed
1077 - * Also detects if all uploads have completed and kicks off the process that eventually gets us to Step 2.
 1119+ * Occurs whenever we need to update the interface based on how many files are there or have transported
 1120+ * Also detects if all uploads have transported and kicks off the process that eventually gets us to Step 2.
10781121 */
10791122 updateFileCounts: function() {
10801123 mw.log( "update counts" );
@@ -1099,11 +1142,11 @@
11001143 }
11011144
11021145
1103 - $j( '#mwe-upwiz-count' ).html( gM( 'mwe-upwiz-upload-count', [ _this._uploadsCompleted.length, _this.uploads.length ] ) );
 1146+ $j( '#mwe-upwiz-count' ).html( gM( 'mwe-upwiz-upload-count', [ _this._uploadsTransported.length, _this.uploads.length ] ) );
11041147
1105 - if ( _this.uploads.length > 0 && _this._uploadsCompleted.length == _this.uploads.length ) {
 1148+ if ( _this.uploads.length > 0 && _this._uploadsTransported.length == _this.uploads.length ) {
11061149 // is this enough to stop the progress monitor?
1107 - _this.isCompleted = true;
 1150+ _this.isTransported = true;
11081151 // set progress to 100%
11091152 _this.showProgressBar( 1 );
11101153 _this.showRemainingTime( 0 );
@@ -1112,7 +1155,7 @@
11131156 // likewise, the remaining time should disappear, fadeout maybe.
11141157
11151158 // do some sort of "all done" thing for the UI - advance to next tab maybe.
1116 - _this.moveToTab( 'metadata' );
 1159+ _this.moveToTab( 'details' );
11171160 }
11181161
11191162 },
@@ -1139,14 +1182,14 @@
11401183 /**
11411184 *
11421185 */
1143 - createMetadata: function() {
 1186+ createDetails: function() {
11441187
11451188 },
11461189
11471190 /**
11481191 *
11491192 */
1150 - submitMetadata: function() {
 1193+ submitDetails: function() {
11511194
11521195 },
11531196
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/css/uploadWizard.css
@@ -154,7 +154,7 @@
155155 background: #ffffe0;
156156 }
157157
158 -.mwe-upwiz-metadata-error {
 158+.mwe-upwiz-details-error {
159159 display: none;
160160 background: #ffffe0;
161161 }
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.ApiUploadHandler.js
@@ -17,7 +17,7 @@
1818
1919 var form = _this.ui.form;
2020
21 - _this.completedCallbacks = [];
 21+ _this.transportedCallbacks = [];
2222 _this.progressCallbacks = [];
2323 _this.errorCallbacks = [];
2424
@@ -28,7 +28,7 @@
2929 _this.transport = new mw.IframeTransport(
3030 _this.ui.form,
3131 function( fraction ){ _this.progress( fraction ) },
32 - function( result ) { _this.completed( result ) }
 32+ function( result ) { _this.transported( result ) }
3333 );
3434
3535 };
@@ -47,9 +47,9 @@
4848 * Allow other parties to register interest in when we finish uploading
4949 * @param callback
5050 */
51 - addCompletedCb: function( f ) {
 51+ addTransportedCb: function( f ) {
5252 var _this = this;
53 - _this.completedCallbacks.push( f );
 53+ _this.transportedCallbacks.push( f );
5454 },
5555
5656 /**
@@ -144,15 +144,15 @@
145145 },
146146
147147 /**
148 - * Central dispatch function for everyone else interested if we've completed
 148+ * Central dispatch function for everyone else interested if we've transported
149149 * @param result javascript object representing MediaWiki API result.
150150 */
151 - completed: function( result ) {
152 - mw.log( "api: upload completed!" );
 151+ transported: function( result ) {
 152+ mw.log( "api: upload transported!" );
153153 var _this = this;
154 - _this.ui.completed();
155 - for ( var i = 0; i < _this.completedCallbacks.length; i++ ) {
156 - _this.completedCallbacks[i]( result );
 154+ _this.ui.transported();
 155+ for ( var i = 0; i < _this.transportedCallbacks.length; i++ ) {
 156+ _this.transportedCallbacks[i]( result );
157157 }
158158 },
159159
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.IframeTransport.js
@@ -4,14 +4,14 @@
55 * @param form an HTML form
66 * @param progressCb callback to execute when we've started. (does not do float here because iframes can't
77 * monitor fractional progress).
8 - * @param completedCb callback to execute when we've finished the upload
 8+ * @param transportedCb callback to execute when we've finished the upload
99 */
10 -mw.IframeTransport = function( form, progressCb, completedCb ) {
 10+mw.IframeTransport = function( form, progressCb, transportedCb ) {
1111 var _this = this;
1212
1313 _this.form = form;
1414 _this.progressCb = progressCb;
15 - _this.completedCb = completedCb;
 15+ _this.transportedCb = transportedCb;
1616
1717 _this.iframeId = 'f_' + ( $j( 'iframe' ).length + 1 );
1818
@@ -101,7 +101,7 @@
102102 response = doc;
103103 }
104104 // Process the API result
105 - _this.completedCb( response );
 105+ _this.transportedCb( response );
106106 }
107107 };
108108

Status & tagging log