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

Revision: 72110
Author:   dale
Date:     2010-09-01 15:32:28 +0000 (Wed, 01 Sep 2010)

Log Message:
-----------
* added jQuery 1.4 loader
* stubs for commons description page
* add asset description on upload

Modified Paths:
--------------
    branches/MwEmbedStandAlone/libraries/jquery/jquery-1.4.2.js
    
branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js
    branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
    
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
    branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
    
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
    
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
    branches/MwEmbedStandAlone/remotes/mediaWiki.js

Modified: branches/MwEmbedStandAlone/libraries/jquery/jquery-1.4.2.js
===================================================================
--- branches/MwEmbedStandAlone/libraries/jquery/jquery-1.4.2.js 2010-09-01 
14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/libraries/jquery/jquery-1.4.2.js 2010-09-01 
15:32:28 UTC (rev 72110)
@@ -13,6 +13,7 @@
  *
  * Date: Sat Feb 13 22:33:48 2010 -0500
  */
+
 (function( window, undefined ) {
 
 // Define a local copy of jQuery

Modified: 
branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js
===================================================================
--- 
branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js  
    2010-09-01 14:34:31 UTC (rev 72109)
+++ 
branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js  
    2010-09-01 15:32:28 UTC (rev 72110)
@@ -328,7 +328,7 @@
                                        }
                                },
                                function() {
-                                       if( menuitem && 
!menuitem.hasClass('divider') && !menuitem.hasClass('disabled')  ){
+                                       if( typeof menuitem != 'undefined' && 
!menuitem.hasClass('divider') && !menuitem.hasClass('disabled')  ){
                                                
$(this).removeClass(options.linkHover).blur().parent().removeClass('active-menuitem');
                                        }
                                }

Modified: 
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js   
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js   
2010-09-01 15:32:28 UTC (rev 72110)
@@ -142,7 +142,7 @@
                        'gsrlimit':  this.provider.limit,
                        'gsroffset': this.provider.offset,
                        'prop':'imageinfo|revisions|categories',
-                       'iiprop':'url|mime|size',
+                       'iiprop':'url|mime|size|metadata',
                        'iiurlwidth': parseInt( this.rsd.thumb_width ),
                        'rvprop':'content'
                };
@@ -230,6 +230,7 @@
                                                'categories':page.categories
                                        }
                                };              
+                               
                                for( var i in page.imageinfo[0].metadata ){
                                        if( page.imageinfo[0].metadata[i].name 
== 'length' ){
                                                resource.duration = 
page.imageinfo[0].metadata[i].value;

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-01 15:32:28 UTC (rev 72110)
@@ -2031,31 +2031,34 @@
        * On clip done action. Called once a clip is done playing
        */
        onClipDone: function() {
-               mw.log( 'EmbedPlayer::onClipDone:' + this.id + ' doneCount:' + 
this.donePlayingCount );                                         
+               mw.log( 'EmbedPlayer::onClipDone:' + this.id + ' doneCount:' + 
this.donePlayingCount + ' stop state:' +this.isStopped() );                     
                         
                var _this = this;                               
-                               
-               
+                                               
                // Only run stopped once: 
                if( !this.isStopped() ){
                        // Stop the monitor: 
                        this.stopMonitor();
                        
+                       // Show the control bar:
+                       this.controlBuilder.showControlBar();   
+                       
                        // Update the clip done playing count:
                        this.donePlayingCount ++;
                
                        // Fire the html5 ended binding
-                       mw.log( "ended" );
                        var onDoneActionObject = {
                                'runBaseControlDone' : true
                        }                               
                        
-                       // Run the ended trigger ( allow the ended object to 
prevent default actions )                          
+                       // Run the ended trigger ( allow the ended object to 
prevent default actions )                  
+                       mw.log("EmbedPlayer::onClipDone:Trigger ended");
                        $j( this ).trigger( 'ended', onDoneActionObject );
                        
                        if( onDoneActionObject.runBaseControlDone ){
                        
                                // Check if we have the "loop" property set
                                if( this.loop ) {
+                                       this.stop();
                                        this.play();
                                        return; 
                                }
@@ -2754,6 +2757,7 @@
                var _this = this;       
                if( this.paused === false ){
                        this.paused = true;
+                       mw.log('EmbedPlayer:trigger pause');
                        $j( this ).trigger('pause');
                }
                mw.log('mwEmbed:embedPlayer::pause() ');        
@@ -2783,38 +2787,34 @@
        */
        stop: function() {
                var _this = this;
-               mw.log( 'mvEmbed:stop:' + this.id );            
+               mw.log( 'mvEmbed:stop:' + this.id );                    
+               
                // no longer seeking:
                this.didSeekJump = false;
                
-               // reset current time and prev time and seek offset
-               this.currentTime = this.previousTime =  this.serverSeekTime = 
0; 
+               // Reset current time and prev time and seek offset
+               this.currentTime = this.previousTime =  this.serverSeekTime = 
0;                
                
-               // Previous player set time             
+               // Issue pause to update interface (only call this parent) 
+               if( !this.paused ){
+                       this.paused = true;
+                       // update the interface
+                       if ( this['parent_pause'] ) {
+                               this.parent_pause();
+                       } else {
+                               this.pause();
+                       }
+               }       
                
-               // First issue pause to update interface (only call this 
parent) 
-               if ( this['parent_pause'] ) {
-                       this.parent_pause();
-               } else {
-                       this.pause();
-               }
+               // Rewrite the html to thumbnail disp
+               this.showThumbnail();
+               this.bufferedPercent = 0; // reset buffer state                 
+               this.controlBuilder.setStatus( this.getTimeRange() );
                
-               // Reset the currentTime: 
-               this.currentTime = 0;
+               // Reset the playhead
+               mw.log("EmbedPlayer::Stop:: Reset play head")
+               this.updatePlayHead( 0 );
                
-               // Check if thumbnail is being displayed in which case do 
nothing
-               if ( this.thumbnail_disp ) {
-                       // already in stooped state
-                       mw.log( 'already in stopped state' );
-                       this.controlBuilder.setStatus( this.getTimeRange() );
-               } else {
-                       // rewrite the html to thumbnail disp
-                       this.showThumbnail();
-                       this.bufferedPercent = 0; // reset buffer state
-                       this.updatePlayHead( 0 );
-                       this.controlBuilder.setStatus( this.getTimeRange() );
-               }
-               
                //Bind play-btn-large play 
                this.$interface.find( '.play-btn-large' )
                .unbind( 'click' )
@@ -3134,10 +3134,10 @@
        * @param {Float} perc Value between 0 and 1 for position of playhead
        */
        updatePlayHead: function( perc ) {
-               $play_head = this.$interface.find( '.play_head' );
-               if ( this.controls &&  $play_head.length != 0 ) {
+               $playHead = this.$interface.find( '.play_head' );
+               if ( this.controls &&  $playHead.length != 0 ) {
                        var val = parseInt( perc * 1000 );
-                       $play_head.slider( 'value', val );
+                       $playHead.slider( 'value', val );
                }               
        },
        

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-09-01 15:32:28 UTC (rev 72110)
@@ -342,7 +342,7 @@
        pause: function() {
                this.getPlayerElement();
                this.parent_pause(); // update interface                
-               if ( this.playerElement ) {
+               if ( this.playerElement ) { // update player
                        this.playerElement.pause();
                }
        },
@@ -495,7 +495,7 @@
        * Handle the native paused event
        */ 
        onPaused: function(){
-               mw.log("native:paused");
+               mw.log( "embedPlayer:native:paused" );
                this.pause();           
        },
        
@@ -503,7 +503,7 @@
        * Handle the native play event 
        */
        onPlay: function(){
-               mw.log("native::play");
+               mw.log("embedPlayer:native::play");
                if( !this.isPlaying () ){
                        this.play();
                }
@@ -556,11 +556,7 @@
        */      
        onended: function() {
                var _this = this;
-               //mw.log( 'native:onended:' + this.playerElement.currentTime + 
' real dur:' +  this.getDuration() );                                           
         
-               // run abstract player onEned if the abstract player still 
things we are playing
-               
-               if( this.isPlaying() ){
-                       this.onClipDone();
-               }
+               mw.log( 'EmbedPlayer:native:onended:' + 
this.playerElement.currentTime + ' real dur:' +  this.getDuration() );          
        
+               this.onClipDone();
        }
 };

Modified: 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js 
    2010-09-01 14:34:31 UTC (rev 72109)
+++ 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js 
    2010-09-01 15:32:28 UTC (rev 72110)
@@ -1309,7 +1309,7 @@
                var $textList =  $j( '<ul />' );
                $j.each( embedPlayer.mediaElement.getSources(), function( 
index, source ) {
                        if(  source.getSrc() ) {
-                               mw.log("add src: "  + source.getTitle() );
+                               mw.log("showDownloadWithSources:: Add src: "  + 
source.getTitle() );
                                var $dl_line = $j( '<li />').append(
                                        $j('<a />')                             
        
                                        .attr( 'href', source.getSrc() )

Modified: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php     
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php     
2010-09-01 15:32:28 UTC (rev 72110)
@@ -125,6 +125,8 @@
        'mwe-sequencer-publishing-status' => 'Publish status:',
        'mwe-sequencer-publishing-error' => 'Publish error',
        'mwe-sequencer-publishing-error-upload-desc' => 'There was an error in 
uploading the published file',
+       'mwe-sequencer-publishing-uploading' => 'Uploading published file',
+       'mwe-sequencer-publishing-updatepage' => 'Updating sequence 
description',
 
        'mwe-sequencer-publishing-success' => 'Publish success',
        'mwe-sequencer-publishing-success-desc' => 'Sequence has successfully 
been published. [$1 Published file]',

Modified: 
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
 2010-09-01 14:34:31 UTC (rev 72109)
+++ 
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
 2010-09-01 15:32:28 UTC (rev 72110)
@@ -371,13 +371,14 @@
                        foggRender.doRender();
                });             
        },
+       
        // Upload the video from a supplied fogg target 
        // note xx this might be better in the firefogg library since it has 
firefogg specific calls  
        // @param {jQuery Object } $dialog
        // @param {firefogg Object} 
        uploadRenderedVideo: function( $dialog, fogg ){
                var _this = this;
-               $j( '#firefoggStatusTarget' ).text( 'uploading' );
+               $j( '#firefoggStatusTarget' ).text( 
gM('mwe-sequencer-publishing-uploading' ) );
                var updateUploadStatus = function(){
                        if( fogg.status() == 'uploading' ){
                                $j('#firefoggPercentDone').text( 
@@ -410,7 +411,17 @@
                                                var apiResult = null;
                                        }
                                }
-                               _this.uploadDone( $dialog, apiResult );
+                               // Check the api response                       
        
+                               if ( !apiResult || apiResult.error || ( 
apiResult.upload && 
+                                               ( apiResult.upload.result == 
"Failure" || apiResult.upload.error ) ) ) {
+                                       
+                                       $dialog.dialog( 'option', 'title', 
gM('mwe-sequencer-publishing-error' ) );
+                                       // xxx improve error handling 
+                                       $dialog.empty().text( gM( 
'mwe-sequencer-publishing-error-upload-desc' ) )
+                                       return ;
+                               }                       
+                               
+                               _this.uploadSuccess( $dialog );
                                return ;
                        }                       
                }
@@ -419,18 +430,17 @@
                        updateUploadStatus();
                })              
        },
-       uploadDone: function($dialog, apiResult){
-               var _this = this;
-               // Check the api response                               
-               if ( !apiResult || apiResult.error || ( apiResult.upload && 
-                               ( apiResult.upload.result == "Failure" || 
apiResult.upload.error ) ) ) {
+       uploadSuccess: function($dialog, apiResult){
+               var _this = this;       
+               // Update the description page:
+               $dialog.html( gM('mwe-sequencer-publishing-updatepage' ) );
+               
+               // Update the file description
+               
this.sequencer.getServer().updateSequenceFileDescription(function(){
                        
-                       $dialog.dialog( 'option', 'title', 
gM('mwe-sequencer-publishing-error' ) );
-                       // xxx improve error handling 
-                       $dialog.empty().text( gM( 
'mwe-sequencer-publishing-error-upload-desc' ) )
-                       return ;
-               }                               
-
+               });
+               
+               
                // Success link to the sequence page / ok closes dialog
                $dialog.dialog( 'option', 'title', 
gM('mwe-sequencer-publishing-success' ) );
                var button = {};

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js        
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js        
2010-09-01 15:32:28 UTC (rev 72110)
@@ -211,7 +211,6 @@
                        // By default the imported resource is its entire 
duration
                        $smilRef.attr( 'dur', resource.duration );
                }
-               
                // Set all available params
                var resourceAttributeMap = {
                        'type' :  'mime',

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js  
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js  
2010-09-01 15:32:28 UTC (rev 72110)
@@ -59,13 +59,19 @@
                                        this.pagePathUrl = 
serverConfig.pagePathUrl;
                                }
                                
+                               if( serverConfig.userName ){
+                                       this.userName = serverConfig.userName;
+                               }
+                               
                        }
                        if( this.isConfigured() ){
                                mw.log("Error: Sequencer server needs a full 
serverConfig to be initialized")
                                return false;
                        }
                },
-               
+               getUserName: function(){
+                       return this.userName;
+               },
 
                // Check if the server exists / is configured 
                isConfigured: function( ){
@@ -216,6 +222,52 @@
                                callback( false );
                        });
                },
+               
+               updateSequenceFileDescription: function(){
+                       var _this = this;
+                       mw.getToken( apiUrl, title, function( token ){
+                               var pageText = ''
+                               if( mw.parseUri( apiUrl ).host == 
'commons.wikimedia.org' ){
+                                       pageText = 
_this.getCommonsDescriptionText()
+                               } else {
+                                       pageText = 
_this.getBaseFileDescription()
+                               }
+                               var request = {
+                                       'action':'edit',
+                                       'token' : token, 
+                                       'title' : 'File:' + 
_this.getVideoFileName(),
+                                       'summary' : 'Automated sequence 
description page for published sequence: ' + _this.getTitle(),
+                                       'text' : pageText
+                               }
+                       })
+               },
+               getBaseFileDescription: function(){
+                       return 'Published sequence file for [[Sequence:' + 
_this.getTitle() + ']]';
+               },
+               getCommonsDescriptionText: function(){
+                       var descText ="{{Information\n" +  
+                               "|Description=" + 
_this.getSequenceFileBaseDescription() + "\n" + 
+                               "|Source= Sequence Sources assets include:\n";
+                       
+                       // loop over every asset:
+                       
this.sequencer.getSmil().getBody().getRefElementsRecurse(null, 0, function( 
$node ){
+                               var $apiKeyParam =  
$node.children("param[name='apiTitleKey']"); 
+                               if( $apiKeyParam.length ){
+                                       descText+= "*[[" + 
$apiKeyParam.attr('value') + "]]\n";
+                               }
+                       });
+                       var dt = new Date();
+                       descText+='|Date=' +  dt.getFullYear() + '-' + 
+                                               pad2(dt.getMonth()+1) + '-' + 
+                                               pad2(dt.getDate()) + "\n" +
+                               "|Author=Last edit by [[User:" + 
_this.getUserName() + "\n" +  
+                               "|Permission= {{Cc-by-nc-sa-2.0-dual}}" + "\n" 
+                                
+                               "}}";
+                       
+                       // Add Published Sequence category ( for now )
+                       descText += "\n[[Category:Published Sequence]]\n";
+               },
+               
                /**
                 * Get the sequence description page url
                 * @param {String} Optional Sequence title key

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js        
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js        
2010-09-01 15:32:28 UTC (rev 72110)
@@ -468,6 +468,7 @@
        },
        
        handleReorder: function ( movedClip ){
+               mw.log("SequencerTimeline:: handleReorder");
                var _this = this;
                var smil = this.sequencer.getSmil();
                var movedIndex = null;                          

Modified: 
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
 2010-09-01 14:34:31 UTC (rev 72109)
+++ 
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
 2010-09-01 15:32:28 UTC (rev 72110)
@@ -79,25 +79,21 @@
        if( mw.getConfig( 'Sequencer.KalturaPlayerEditOverlay' )){
                var embedPlayer = $j( '#' + embedPlayerId ).get(0);
 
-               $j( embedPlayer ).bind( 'pause', function() {
-                       // For now don't overlay smil players ( used in editor 
) 
-                       // xxx in the future we should have an editor class
-                       if( embedPlayer.supports['overlays'] &&  
embedPlayer.instanceOf.toLowerCase() != 'smil' ){
-                               mw.remoteSequencerAddEditOverlay( embedPlayerId 
)
-                               // xxx should use getter setter
-                               
embedPlayer.controlBuilder.displayOptionsMenuFlag = true;
-                       }                       
+               $j( embedPlayer ).bind( 'pause', function() {           
+                       mw.remoteSequencerAddEditOverlay( embedPlayerId )
+                       // xxx should use getter setter
+                       embedPlayer.controlBuilder.displayOptionsMenuFlag = 
true;               
                        return true;
                })
-               $j( embedPlayer ).bind( 'ended', function( onDoneAction ){
+               $j( embedPlayer ).bind( 'ended', function( onDoneAction ){      
                
                        // pause event should fire 
-                       //mw.remoteSequencerAddEditOverlay( embedPlayerId )
+                       mw.remoteSequencerAddEditOverlay( embedPlayerId );
                        
                        // show the credits screen after 3 seconds 
-                       setTimeout(function(){
+                       setTimeout(function(){                          
                                $j( embedPlayer ).siblings( 
'.kalturaEditOverlay' ).fadeOut( 'fast' );
                                
embedPlayer.$interface.find('.k-menu').fadeIn('fast');
-                       },3000)
+                       }, 3000)
                        
                        // On end runs before interface bindings (give the dom 
10ms to build out the menu )
                        setTimeout(function(){
@@ -113,6 +109,16 @@
 });
 mw.remoteSequencerAddEditOverlay = function( embedPlayerId ){
        var embedPlayer = $j( '#' + embedPlayerId ).get(0);
+
+       // Check if we can do the overlay::
+       if( !embedPlayer.supports['overlays'] 
+       || embedPlayer.instanceOf.toLowerCase() == 'smil'
+       || embedPlayer.getHeight() < 180 
+       || embedPlayer.getWidth() < 240
+       ){              
+               return ;
+       }
+       
        if(! $j( '#' + embedPlayerId ).siblings( '.kalturaEditOverlay' ).length 
){
                var editLink = '#';
                if( mw.isLocalDomain( mw.getApiProviderURL( 
embedPlayer.apiProvider ) ) 
@@ -509,7 +515,8 @@
                                'type' : 'mediaWiki',
                                'url' : _this.getApiUrl(),
                                'titleKey' : wgPageName,
-                               'pagePathUrl' : wgServer + wgArticlePath
+                               'pagePathUrl' : wgServer + wgArticlePath,
+                               'userName' : wgUserName
                        },
                // Set the add media wizard to only include commons:   
                addMedia : {

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-09-01 14:34:31 UTC (rev 72109)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-09-01 15:32:28 UTC (rev 72110)
@@ -277,7 +277,9 @@
         */
        getRefElementsRecurse: function( $node, startOffset, callback ){
                var _this = this;
-               
+               if( ! $node ){
+                       $node = this.getDom();
+               }
                // Make sure $node is wrapped in jQuery object
                $node = $j( $node );
                

Modified: branches/MwEmbedStandAlone/remotes/mediaWiki.js
===================================================================
--- branches/MwEmbedStandAlone/remotes/mediaWiki.js     2010-09-01 14:34:31 UTC 
(rev 72109)
+++ branches/MwEmbedStandAlone/remotes/mediaWiki.js     2010-09-01 15:32:28 UTC 
(rev 72110)
@@ -526,14 +526,21 @@
        if( typeof classSet == 'function') {
                callback = classSet;
        }       
+
        // Inject mwEmbed if needed
        if ( typeof MW_EMBED_VERSION == 'undefined' ) {
                if ( mwUseScriptLoader ) {
                        var rurl = mwEmbedHostPath + 
'/ResourceLoader.php?class=';
                        
                        var coma = '';
+                       
+                       
                        // Add jQuery too if we need it: 
-                       if ( typeof window.jQuery == 'undefined' ) {
+                       if ( typeof window.jQuery == 'undefined' 
+                               ||
+                               // force load jquery if version 1.3.2 ( issues 
) 
+                               jQuery.fn.jquery == '1.3.2') 
+                       {
                                rurl += 'window.jQuery';
                                coma = ',';
                        }       
@@ -555,17 +562,29 @@
                        rurl += '&' + mwGetReqArgs();
                        importScriptURI( rurl );
                } else { 
-                       // load mwEmbed js
-                       importScriptURI( mwEmbedHostPath + '/mwEmbed.js?' + 
mwGetReqArgs() );
                        
-                       // Load the class set as part of mwReady callback
-                       var instanceCallback = callback;
-                       var callback = function(){
-                               mw.load( classSet, function(){
-                                       instanceCallback();
-                               })
+                       // force load jQuery ( issues with '1.3.2' .data 
handling 
+                       if( jQuery && jQuery.fn.jquery== '1.3.2' ){
+                               console.log('load: ' + mwEmbedHostPath + 
'/libraries/jquery/jquery-1.4.2.js' );
+                               importScriptURI( mwEmbedHostPath + 
'/libraries/jquery/jquery-1.4.2.js?' + mwGetReqArgs() );
                        }
-                       
+                       waitForJQueryUpgrade = function(){
+                               if( jQuery && jQuery.fn.jquery== '1.3.2' ){     
                                
+                                       setTimeout( waitForJQueryUpgrade, 20);
+                               } else {
+                                       // load mwEmbed js
+                                       importScriptURI( mwEmbedHostPath + 
'/mwEmbed.js?' + mwGetReqArgs() );
+                                       
+                                       // Load the class set as part of 
mwReady callback
+                                       var instanceCallback = callback;
+                                       var callback = function(){
+                                               mw.load( classSet, function(){
+                                                       instanceCallback();
+                                               })
+                                       }
+                               }
+                       }
+                       waitForJQueryUpgrade();
                }
        }
        waitMwEmbedReady( callback );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to