some firefogg fixes for target form selection
authorMichael Dale <dale@users.mediawiki.org>
Mon, 27 Jul 2009 18:05:29 +0000 (18:05 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Mon, 27 Jul 2009 18:05:29 +0000 (18:05 +0000)
js2/mwEmbed/libAddMedia/mvFirefogg.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/uploadPage.js

index 6e690be..eefa41e 100644 (file)
@@ -292,8 +292,10 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                this.doControlBindings();
        },
        getEditForm:function(){
-               js_log('get form: action=' + $j(this.selector).parents().find("form").attr('action'));
-               return $j(this.selector).parents().find("form").get(0);
+               if( this.target_edit_from )
+                       return this.pe_getEditForm();
+               //else try to get the parent "from" of the file selector:  
+               return $j(this.selector).parents('form:first').get(0);
        },   
        selectFogg:function(){                  
                var _this = this;
@@ -413,7 +415,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        },      
        doUploadSwitch:function(){                              
                var _this = this;
-               js_log("firefogg: doUploadSwitch:: " + this.fogg_enabled);
+               js_log("firefogg: doUploadSwitch:: " + this.fogg_enabled + ' up mode:' +  _this.upload_mode);
                //make sure firefogg is enabled otherwise do parent UploadSwich:                
                if( !this.fogg_enabled || !this.firefogg_form_action )
                        return _this.pe_doUploadSwitch();
@@ -429,9 +431,9 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        },
        //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready
        doChunkUpload : function(){
+               js_log('doChunkUpload::');
                var _this = this;                       
-               _this.action_done = false;                      
-               
+               _this.action_done = false;                                      
                //extension should already be ogg but since its user editable,
                //check again
                //we are transcoding so we know it will be an ogg
@@ -449,17 +451,17 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                
                //build the api url: 
                var aReq ={
-                       'action'        : 'upload',
-                       'format'        : 'json',
-                       'filename'      : _this.formData['wpDestFile'],
-                       'comment'       : _this.formData['wpUploadDescription'],
-                       'enablechunks': true
+                       'action'                : 'upload',
+                       'format'                : 'json',
+                       'filename'              : _this.formData['wpDestFile'],
+                       'comment'               : _this.formData['wpUploadDescription'],
+                       'enablechunks'  : 'true'
                };
                //check for editToken:
                if(!this.etoken)
                        this.etoken = _this.formData['wpEditToken'];
                        
-               if(this.etoken)
+               if( this.etoken )
                        aReq['token'] = this.etoken;
                
                if( _this.formData['wpWatchthis'] )
@@ -634,7 +636,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                var sstring = 'var wgTitle = "' + this.formData['wpDestFile'].replace('_',' ');         
                
                if(wgArticlePath){
-                       var result_txt = gM('mv_upload_done', wgArticlePath.replace(/\$1/, 'File:' + this.formData['wpDestFile'] ) );
+                       var result_txt = gM('mv_upload_done', wgArticlePath.replace(/\$1/, 'File:' + _this.formData['wpDestFile'] ) );
                }else{
                        result_txt = 'File has uploaded but api "done" url was provided. Check the log for result page output';
                }               
@@ -646,7 +648,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        js_log( 'upload done got redirect found: ' + sstring + ' r:' + _this.upload_done_action );                                                                              
                        if( _this.upload_done_action == 'redirect' ){
                                $j( '#dlbox-centered' ).html( '<h3>Upload Completed:</h3>' + result_txt + '<br>' + form_txt);
-                               window.location = wgArticlePath.replace( /\$1/, 'File:' + formData['wpDestFile'] );
+                               window.location = wgArticlePath.replace( /\$1/, 'File:' + _this.formData['wpDestFile'] );
                        }else{
                                //check if the add_done_action is a callback:
                                if( typeof _this.upload_done_action == 'function' )
index 4939ab7..f33c1a4 100644 (file)
@@ -160,7 +160,7 @@ mvEmbed = {
                //ie8 does not play well with the jQuery video,audio,playlist selector use native: 
                if($j.browser.msie && $j.browser.version >= 8){
                        jtags = j_selector.split(',');                          
-                       for(var i=0;i<jtags.length;i++){                                
+                       for( var i=0; i < jtags.length; i++){                           
                                $j( document.getElementsByTagName( jtags[i] )).each(function(){
                                        eAction(this);
                                });
@@ -2094,12 +2094,11 @@ embedVideo.prototype = {
                                return false;
                        });
                });
-       },
-       /*download list is too complicated ... rewrite for clarity: */
+       },      
        showVideoDownload:function(){           
                //load the roe if available (to populate out download options:
                //js_log('f:showVideoDownload '+ this.roe + ' ' + this.media_element.addedROEData);
-               if(this.roe && this.media_element.addedROEData==false){
+               if(this.roe && this.media_element.addedROEData == false){
                        var _this = this;
                        this.displayHTML(gM('loading_txt'));
                        do_request(this.roe, function(data)
index 101885f..9318b59 100644 (file)
@@ -89,7 +89,6 @@ var mwUploadHelper = {
        },   
        /**
         * doDestCheck checks the destination
-        * @@todo we should be able to configure its "targets" via parent config
         */
        doDestCheck:function(){         
                var _this = this;
@@ -135,7 +134,7 @@ var mwUploadHelper = {
                                                                                        '<div class="magnify">' +
                                                                                                '<a title="' + gM('thumbnail-more') + '" class="internal" ' +
                                                                                                        'href="' + img.descriptionurl +'"><img width="15" height="11" alt="" ' +
-                                                                                                       'src="' + stylepath +"/>" +
+                                                                                                       'src="' + stylepath + "/common/images/magnify-clip.png\" />" +
                                                                                                '</a>'+
                                                                                        '</div>'+
                                                                                        gM('fileexists-thumb') +
@@ -151,7 +150,6 @@ var mwUploadHelper = {
        },
        /**
         * doDestinationFill fills in a destination file-name based on a source asset name. 
-        * @@todo we should be able to configure its "targets" via parent config
         */
        doDestinationFill:function( targetElm ){
                js_log("doDestinationFill")