http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62147

Revision: 62147
Author:   dale
Date:     2010-02-09 00:23:09 +0000 (Tue, 09 Feb 2010)

Log Message:
-----------
* skip encoding if passthough mode is set. 
* updated isValidLang to work without jQuery 

Modified Paths:
--------------
    
branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js
    branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js
    branches/js2-work/phase3/js/mwEmbed/mwEmbed.js

Modified: 
branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js
===================================================================
--- 
branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js  
    2010-02-08 23:34:09 UTC (rev 62146)
+++ 
branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js  
    2010-02-09 00:23:09 UTC (rev 62147)
@@ -149,7 +149,7 @@
                // Remap the upload form to the "api" form:
                this.remapFormToApi();
                
-               // Check for post action override
+               // Check for post action override       
                if ( this.form_post_override ) {
                        mw.log( 'form_post_override is true, do ordinary form 
submit' );
                        return true;

Modified: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js
===================================================================
--- branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js 
2010-02-08 23:34:09 UTC (rev 62146)
+++ branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js 
2010-02-09 00:23:09 UTC (rev 62147)
@@ -702,13 +702,8 @@
                                _this.updateProgress( progress );
                        },
                        function /* onDone */ () {
-                               mw.log( "done with encoding (no upload) " );
-                               // Set status to 100% for one second
-                               // FIXME: this is either a hack or a waste of 
time, not sure which
-                               _this.updateProgress( 1 );
-                               setTimeout( function() {
-                                       _this.onLocalEncodeDone();
-                               });
+                               mw.log( "done with encoding (no upload) " );    
                        
+                               _this.onLocalEncodeDone();
                        }
                );
        },
@@ -895,10 +890,11 @@
                                function /* onProgress */ ( progress ) {
                                        _this.updateProgress( progress );
                                },
-                               function /* onDone */ () {
-                                       mw.log( 'done with encoding do POST 
upload:' + _this.form.action );
-                                                                               
+                               function /* onDone */ () {                      
                                                                                
                
                                        var uploadRequest = 
_this.getUploadApiRequest();
+                                       
+                                       mw.log( 'done with encoding do POST 
upload:' + JSON.stringify( uploadRequest ) );
+                                       
                                        _this.fogg.post( _this.api_url, 'file', 
JSON.stringify( uploadRequest ) );
                                                
                                        _this.doUploadStatus();
@@ -996,23 +992,25 @@
         */
        doEncode: function( progressCallback, doneCallback ) {
                var _this = this;
-               _this.action_done = false;
-               _this.displayProgressOverlay();
+               _this.action_done = false;      
                
                var encoderSettings = this.getEncoderSettings();
                
-               // Check if encoderSettings passthrough is on ( then skip the 
encode )          
+               // Check if encoderSettings passthrough is on ( then skip the 
encode )                          
                if( encoderSettings['passthrough'] == true){
                        doneCallback();
+                       return ; 
                }
+               // Display progress
+               _this.displayProgressOverlay();
                
                mw.log( 'doEncode: with: ' +  JSON.stringify( encoderSettings ) 
);
                _this.fogg.encode( JSON.stringify( encoderSettings ) );
 
-               //show transcode status:
+               // Show transcode status:
                $j( '#up-status-state' ).html( gM( 
'mwe-upload-transcoded-status' ) );
 
-               //setup a local function for timed callback:
+               // Setup a local function for timed callback:
                var encodingStatus = function() {
                        var status = _this.fogg.status();
 

Modified: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
===================================================================
--- branches/js2-work/phase3/js/mwEmbed/mwEmbed.js      2010-02-08 23:34:09 UTC 
(rev 62146)
+++ branches/js2-work/phase3/js/mwEmbed/mwEmbed.js      2010-02-09 00:23:09 UTC 
(rev 62147)
@@ -380,7 +380,7 @@
        
        /**
         * Checks that convertPlural was given an array and pads it to requested
-        * amound of forms by copying the last one.
+        * amount of forms by copying the last one.
         *
         * @param {Array} forms Forms given to convertPlural
         * @param {Integer} count How many forms should there be at least
@@ -436,9 +436,16 @@
        /**
         * Checks if a language key is valid ( is part of languageCodeList )
         * @param {String} langKey Language key to be checked
+        * @return true if valid language, false if not
         */
        mw.isValidLang = function( langKey ){
-               return ( $j.inArray(langKey,  mw.getConfig( 'languageCodeList') 
) == -1 )
+               var langList = mw.getConfig( 'languageCodeList');
+               for(var i =0; i < langList.length; i++){
+                       if( langList[i] == langKey ){
+                               return true;
+                       } 
+               }               
+               return false;
        }
        
        /**



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to