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

Revision: 72146
Author:   dale
Date:     2010-09-01 18:49:59 +0000 (Wed, 01 Sep 2010)

Log Message:
-----------
sequence description page fixes

Modified Paths:
--------------
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
    branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
    
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
    
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
    branches/MwEmbedStandAlone/remotes/mediaWiki.js

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-01 18:46:02 UTC (rev 72145)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-01 18:49:59 UTC (rev 72146)
@@ -2726,10 +2726,13 @@
                 .attr( 'title', gM( 'mwe-embedplayer-pause_clip' ) );
                 
                 
-                //Run play hook: 
+                // Run play hook: 
                 mw.log("playEvent");
                 $j( this ).trigger( 'playEvent' );
                
+                // Start monitor
+                this.monitor();
+                
                  // If we previously finished playing this clip run the 
"replay hook"
                 if( this.donePlayingCount > 0 ) {
                        mw.log("replayEvent");

Modified: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php     
2010-09-01 18:46:02 UTC (rev 72145)
+++ branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php     
2010-09-01 18:49:59 UTC (rev 72146)
@@ -125,6 +125,7 @@
        '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-error-adding-desc' => 'There was an error 
adding the file description',
        'mwe-sequencer-publishing-uploading' => 'Uploading published file',
        'mwe-sequencer-publishing-updatepage' => 'Updating sequence 
description',
 

Modified: 
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
 2010-09-01 18:46:02 UTC (rev 72145)
+++ 
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
 2010-09-01 18:49:59 UTC (rev 72146)
@@ -436,11 +436,17 @@
                $dialog.html( gM('mwe-sequencer-publishing-updatepage' ) );
                
                // Update the file description
-               
this.sequencer.getServer().updateSequenceFileDescription(function(){
-                       
-               });
-               
-               
+               this.sequencer.getServer().updateSequenceFileDescription( 
function( status ){
+                       if( status === true ){
+                               _this.fileDescriptionSuccess( $dialog );
+                       } else {
+                               // xxx do better error handling 
+                               $dialog.empty().text( gM( 
'mwe-sequencer-publishing-error-adding-desc' ) ); 
+                       }
+               });                                     
+       },
+       fileDescriptionSuccess: function( $dialog ){
+               var _this = this;
                // 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.FirefoggRender.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js   
2010-09-01 18:46:02 UTC (rev 72145)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js   
2010-09-01 18:49:59 UTC (rev 72146)
@@ -177,7 +177,7 @@
                                // Don't block on render
                                setTimeout( function(){
                                        _this.doNextFrame();
-                               },1 )
+                               }, 10 );
                        }
                }, true /* hide the buffer overlay */ );
        },

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js        
2010-09-01 18:46:02 UTC (rev 72145)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js        
2010-09-01 18:49:59 UTC (rev 72146)
@@ -79,9 +79,6 @@
                                                }
                                                widgetFocus = true;
                                        })
-                                       .click(function(){
-                                               $j(this).focus();               
                                
-                                       })
                                        // add the sequencer input binding
                                        .sequencerInput(  _this.sequencer  )
                                )

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js  
2010-09-01 18:46:02 UTC (rev 72145)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js  
2010-09-01 18:49:59 UTC (rev 72146)
@@ -72,7 +72,9 @@
                getUserName: function(){
                        return this.userName;
                },
-
+               getTitleKey: function(){
+                       return this.titleKey;
+               },
                // Check if the server exists / is configured 
                isConfigured: function( ){
                        if( !this.apiType || !this.apiUrl || !this.titleKey){
@@ -95,7 +97,7 @@
                 */
                getSmilXml: function( callback ){
                        var _this = this;                                       
        
-                       mw.getTitleText( this.getApiUrl(), this.titleKey, 
function( smilXml ){
+                       mw.getTitleText( this.getApiUrl(), this.getTitleKey(), 
function( smilXml ){
                                // set smil to empty string if unset:
                                if(!smilXml )
                                        smilXml = '';
@@ -124,7 +126,7 @@
                                callback ( this.saveToken );
                                return ;        
                        }
-                       mw.getToken( this.getApiUrl(), this.titleKey, function( 
saveToken ){
+                       mw.getToken( this.getApiUrl(), this.getTitleKey(), 
function( saveToken ){
                                _this.saveToken = saveToken;
                                callback ( _this.saveToken )
                        });
@@ -223,11 +225,12 @@
                        });
                },
                
-               updateSequenceFileDescription: function(){
+               updateSequenceFileDescription: function( callback ){
                        var _this = this;
-                       mw.getToken( apiUrl, title, function( token ){
+                       mw.getToken( _this.getApiUrl(), 'File:' + 
_this.getVideoFileName(), function( token ){
                                var pageText = ''
-                               if( mw.parseUri( apiUrl ).host == 
'commons.wikimedia.org' ){
+                               // Check if we should use commons asset 
description template:
+                               if( mw.parseUri( _this.getApiUrl() ).host == 
'commons.wikimedia.org' ){
                                        pageText = 
_this.getCommonsDescriptionText()
                                } else {
                                        pageText = 
_this.getBaseFileDescription()
@@ -236,36 +239,53 @@
                                        'action':'edit',
                                        'token' : token, 
                                        'title' : 'File:' + 
_this.getVideoFileName(),
-                                       'summary' : 'Automated sequence 
description page for published sequence: ' + _this.getTitle(),
+                                       'summary' : 'Automated sequence 
description page for published sequence: ' + _this.getTitleKey(),
                                        'text' : pageText
-                               }
+                               };
+                               mw.getJSON( _this.getApiUrl(), request, 
function(data){
+                                       if( data && data.edit && 
data.edit.result == "Success"){
+                                               callback( true );
+                                       } else {
+                                               callback( false )
+                                       }
+                               });
                        })
                },
                getBaseFileDescription: function(){
-                       return 'Published sequence file for [[Sequence:' + 
_this.getTitle() + ']]';
+                       var _this = this;
+                       return 'Published sequence for [['+ _this.getTitleKey() 
+ ']]';
                },
                getCommonsDescriptionText: function(){
+                       var _this = this;
+                       
                        var descText ="{{Information\n" +  
-                               "|Description=" + 
_this.getSequenceFileBaseDescription() + "\n" + 
+                               "|Description=" + 
_this.getBaseFileDescription() + "\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";
+                                       descText+= "* [[:" + 
$apiKeyParam.attr('value') + "]]\n";
                                }
                        });
+                       var pad2 = function(num){
+                               if( parseInt( num ) < 10 ){
+                                       return '0' + num;
+                               }
+                               return num;
+                       }
                        var dt = new Date();
                        descText+='|Date=' +  dt.getFullYear() + '-' + 
                                                pad2(dt.getMonth()+1) + '-' + 
                                                pad2(dt.getDate()) + "\n" +
-                               "|Author=Last edit by [[User:" + 
_this.getUserName() + "\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";
+                       return descText;
                },
                
                /**
@@ -274,7 +294,7 @@
                 */
                getSequenceViewUrl: function( titleKey ){
                        if( !titleKey )
-                               titleKey = this.titleKey;
+                               titleKey = this.getTitleKey();
                        // Check that we have a pagePathUrl config: 
                        if( !this.pagePathUrl ){
                                return false;
@@ -294,7 +314,7 @@
                 * @return {String}
                 */
                getVideoFileName: function(){
-                       return this.titleKey.replace( ':', '-') + '.ogv';
+                       return this.getTitleKey().replace( ':', '-') + '.ogv';
                },
                
                // get upload settings runs the callback with the post url and 
request data 

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js   
2010-09-01 18:46:02 UTC (rev 72145)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js   
2010-09-01 18:49:59 UTC (rev 72146)
@@ -377,31 +377,37 @@
                                var sliderToTime = function( sliderval ){
                                        return parseInt( fullClipDuration * ( 
sliderval / 1000 ) );
                                }
-                               var timeToSlider = function( time ){
+                               var timeToSlider = function( time ){            
                        
                                        return parseInt( ( time / 
fullClipDuration ) * 1000 );
                                }
                                
                                
-                               var onInputChange = function( sliderIndex, 
value ){
+                               var onInputChange = function( sliderIndex, 
timeValue ){
+                                       // Register the change
                                        
_this.editWidgets.trimTimeline.onChange( _this, target, smilClip);
-                                       // Get the value
+                                       // Update the slider
                                        if( fullClipDuration ){
-                                               var uiValues = 
$j(_this.sequencer.id + '_trimTimeline' ).slider( 'option', 'values');
-                                               uiValues[ sliderIndex, 
timeToSlider( value) ];
-                                               // Set the value
-                                               $j( _this.sequencer.id + 
'_trimTimeline' ).slider( 'option', 'values', uiValues);
+                                               $j('#'+_this.sequencer.id + 
'_trimTimeline' )
+                                                       .slider( 
+                                                                       
"values", 
+                                                                       
sliderIndex, 
+                                                                       
timeToSlider( timeValue )
+                                                       );                      
                
                                        }
                                }
                                
                                // Add a trim binding:                          
 
                                $j('#' + _this.getEditToolInputId( 'trim', 
'clipBegin') )
                                .change( function(){                            
        
-                                       onInputChange( 0, $j(this).val() );
+                                       var timeValue = smil.parseTime(  
$j(this).val() );
+                                       onInputChange( 0, timeValue);
                                });
                                
                                 $j('#' + _this.getEditToolInputId( 'trim', 
'dur') ) 
-                               .change( function(){                            
        
-                                       onInputChange( 1, $j(this).val() );
+                               .change( function(){                    
+                                       var timeValue = smil.parseTime(  
$j(this).val() ) + 
+                                        smil.parseTime( $j('#' + 
_this.getEditToolInputId( 'trim', 'clipBegin') ).val() );
+                                       onInputChange( 1, timeValue );
                                });
                                 
                                // Update the thumbnails:                       
        

Modified: 
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
 2010-09-01 18:46:02 UTC (rev 72145)
+++ 
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
 2010-09-01 18:49:59 UTC (rev 72146)
@@ -115,6 +115,8 @@
        || embedPlayer.instanceOf.toLowerCase() == 'smil'
        || embedPlayer.getHeight() < 180 
        || embedPlayer.getWidth() < 240
+       // For now require that the video is a flat sequence special key: 
Sequence-
+       || embedPlayer.apiTitleKey.indexOf('Sequence-') != 0
        ){              
                return ;
        }
@@ -246,8 +248,8 @@
                var _this = this;
                if( wgArticleId == 0 ) {
                        // Update create button 
-                       $j('#ca-edit span a')
-                               .text( gM('mwe-sequencer-create-sequence' ))
+                       $j('#ca-edit a')
+                               .html( $j('<span />').text( 
gM('mwe-sequencer-create-sequence' ) ) )
                                .click(function(){
                                        _this.showEditor();
                                        return false;
@@ -263,8 +265,8 @@
                        );
                } else {                                                
                        // Update edit button 
-                       $j('#ca-edit span a')
-                               .text( gM('mwe-sequencer-edit-sequence' ))
+                       $j('#ca-edit a')
+                               .html( $j('<span />').text( 
gM('mwe-sequencer-edit-sequence' ) ) )
                                .click(function(){
                                        _this.showEditor();
                                        return false;

Modified: branches/MwEmbedStandAlone/remotes/mediaWiki.js
===================================================================
--- branches/MwEmbedStandAlone/remotes/mediaWiki.js     2010-09-01 18:46:02 UTC 
(rev 72145)
+++ branches/MwEmbedStandAlone/remotes/mediaWiki.js     2010-09-01 18:49:59 UTC 
(rev 72146)
@@ -540,7 +540,7 @@
                // Add jQuery too if we need it: 
                if ( typeof window.jQuery == 'undefined' 
                        ||
-                       // force load jquery if version 1.3.2 ( issues ) 
+                       // force load jquery if version 1.3.2 ( issues with 
'1.3.2' .data handling )
                        jQuery.fn.jquery == '1.3.2') 
                {
                        rurl += 'window.jQuery';
@@ -566,13 +566,14 @@
                waitMwEmbedReady( callback );
        } else { 
                
-               // 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() );
-               }               
+               // Force load jQuery for debug mode             
+               var jQueryRequested = false;
                waitForJQueryUpgrade = function(){
-                       if( jQuery && jQuery.fn.jquery== '1.3.2' ){             
                        
+                       if( jQuery && jQuery.fn.jquery== '1.3.2' ){
+                               if( ! jQueryRequested ){
+                                       jQueryRequested = true;
+                                       importScriptURI( mwEmbedHostPath + 
'/libraries/jquery/jquery-1.4.2.js?' + mwGetReqArgs() );
+                               }
                                setTimeout( waitForJQueryUpgrade, 5);
                        } else {
                                // load mwEmbed js



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

Reply via email to