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

Revision: 70148
Author:   dale
Date:     2010-07-29 17:58:02 +0000 (Thu, 29 Jul 2010)

Log Message:
-----------
stubs for undo support

Modified Paths:
--------------
    branches/MwEmbedStandAlone/modules/Sequencer/loader.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
    branches/MwEmbedStandAlone/remotes/mediaWiki.js

Added Paths:
-----------
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js

Removed Paths:
-------------
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js

Modified: branches/MwEmbedStandAlone/modules/Sequencer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/loader.js      2010-07-29 
17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/loader.js      2010-07-29 
17:58:02 UTC (rev 70148)
@@ -36,7 +36,10 @@
        
        mw.setDefaultConfig({
                // If the sequencer should attribute kaltura
-               "Sequencer.KalturaAttribution" : true
+               "Sequencer.KalturaAttribution" : true,
+
+               // The size of the undo stack 
+               "Sequencer.numberOfUndos" : 100
        })
        
        

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js        
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js        
2010-07-29 17:58:02 UTC (rev 70148)
@@ -93,6 +93,23 @@
        },
        
        /**
+        * Update the smil xml and then update the interface
+        */
+       updateSmilXML: function( smilXML ){
+               mw.log("Sequencer::updateSmilXML");
+               var _this = this;
+               
+               // Update the embedPlayer smil: 
+               this.getSmil().updateFromString( smilXML );
+               
+               // Get a duration ( forceRefresh to clear the cache ) 
+               this.getEmbedPlayer().getDuration( true );
+               
+               // redraw the timeline
+               this.getTimeline().drawTimeline();
+       },
+       
+       /**
         * Draw the initial sequence ui, uses ui.layout for adjustable layout  
         */
        drawUI: function( ){
@@ -116,6 +133,8 @@
                        // Add the timeline
                        _this.getTimeline().drawTimeline();     
                        
+                       // initialize the edit actions ( stores the initial 
state for undo / redo actions )  
+                       _this.getActionsEdit();
                });             
                // Draw the top level menu
                this.getMenu().drawMenu();
@@ -153,9 +172,6 @@
                }
                return this.actionsEdit;
        },
-       
-       
-       
        getRender: function(){
                if( !this.render ){
                        this.render = new mw.SequencerRender( this );

Deleted: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js     
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js     
2010-07-29 17:58:02 UTC (rev 70148)
@@ -1,23 +0,0 @@
-/**
- * Handles dialogs for sequence actions such as 
- *     "save sequence",
- *     "rename", 
- *     "publish"
- *  
- * Hooks into sequencerApiProvider to run the actual api operations  
- */
-
-mw.SequencerActionsEdit = function( sequencer ) {
-       return this.init( sequencer );
-};
-
-mw.SequencerActionsEdit.prototype = {
-       init: function( sequencer ) {
-               this.sequencer = sequencer; 
-       },      
-       selectAll: function(){
-               //Select all the items in the timeline
-               $target = this.sequencer.getTimeline().getTimelineContainer();
-               $target.find( '.timelineClip' ).addClass( 'selectedClip' );
-       }       
-}
\ No newline at end of file

Copied: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js 
(from rev 69945, 
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js)
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js     
                        (rev 0)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js     
2010-07-29 17:58:02 UTC (rev 70148)
@@ -0,0 +1,74 @@
+/**
+ * Handles dialogs for sequence actions such as 
+ *     "save sequence",
+ *     "rename", 
+ *     "publish"
+ *  
+ * Hooks into sequencerApiProvider to run the actual api operations  
+ */
+
+mw.SequencerActionsEdit = function( sequencer ) {
+       return this.init( sequencer );
+};
+
+mw.SequencerActionsEdit.prototype = {
+       
+       // Stores the local edit history to support undo / redo  
+       editStack : [],
+       
+       // Store the edit index  
+       editIndex : 0,
+       
+       // The numbers of undos supported 
+       numberOfUndos : mw.getConfig( 'Sequencer.numberOfUndos' ),
+       
+       init: function( sequencer ) {
+               this.sequencer = sequencer; 
+               // Set the initial edit state: 
+               this.editStack.push(  this.sequencer.getSmil().getXMLString() );
+       },      
+       
+       selectAll: function(){
+               //Select all the items in the timeline
+               $target = this.sequencer.getTimeline().getTimelineContainer();
+               $target.find( '.timelineClip' ).addClass( 'selectedClip' );
+       },
+       
+       /**
+        * Apply a smil xml transform state ( to support undo / redo ) 
+        */
+       registerEdit: function(){       
+               // Throw away any edit history after the current editIndex: 
+               if( this.editStack.length && this.editIndex > 
this.editStack.length ) {
+                       this.editStack = this.editStack.splice(0, 
this.editIndex);
+               }
+               
+               // @@TODO would be good to just compute the diff in JS and 
store that
+               // ( instead of the full xml text ) 
+               this.editStack.push(  this.sequencer.getSmil().getXMLString() );
+               
+               // Update the editIndex
+               this.editIndex = this.editStack.length - 1;
+       },
+       
+       /**
+        * Undo an edit action
+        */
+       undo: function(){
+               this.editIndex--;               
+               // Change to previous state 
+               this.sequencer.updateSmilXML( this.editStack[ this.editIndex ] 
);
+       },
+       
+       /**
+        * Redo an edit action
+        */
+       redo: function(){
+               this.editIndex ++;
+               if( this.editStack[ this.editIndex ] ) {
+                       this.sequencer.updateSmilXML( this.editStack[ 
this.editIndex ] );
+               } else {
+                       mw.log( 'SequencerActionsEdit::Redo: Already at most 
recent edit avaliable');
+               }
+       }
+}
\ No newline at end of file

Deleted: 
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js 
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js 
2010-07-29 17:58:02 UTC (rev 70148)
@@ -1,26 +0,0 @@
-/**
- * Handles dialogs for sequence actions such as 
- *     "save sequence",
- *     "rename", 
- *     "publish"
- *  
- * Hooks into sequencerApiProvider to run the actual api operations  
- */
-
-mw.SequencerActionsSequence = function( sequencer ) {
-       return this.init( sequencer );
-};
-
-mw.SequencerActionsSequence.prototype = {
-       init: function( sequencer ) {
-               this.sequencer = sequencer; 
-       },      
-       save: function(){
-               // Check if we have an api provider defined
-               if( this.sequencer.apiProvider ){
-                       
-               }
-               // No apiProvider show xml
-               
-       }       
-}
\ No newline at end of file

Copied: 
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js 
(from rev 69945, 
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js)
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js 
                        (rev 0)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsSequence.js 
2010-07-29 17:58:02 UTC (rev 70148)
@@ -0,0 +1,26 @@
+/**
+ * Handles dialogs for sequence actions such as 
+ *     "save sequence",
+ *     "rename", 
+ *     "publish"
+ *  
+ * Hooks into sequencerApiProvider to run the actual api operations  
+ */
+
+mw.SequencerActionsSequence = function( sequencer ) {
+       return this.init( sequencer );
+};
+
+mw.SequencerActionsSequence.prototype = {
+       init: function( sequencer ) {
+               this.sequencer = sequencer; 
+       },      
+       save: function(){
+               // Check if we have an api provider defined
+               if( this.sequencer.apiProvider ){
+                       
+               }
+               // No apiProvider show xml
+               
+       }       
+}
\ No newline at end of file

Deleted: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js     
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js     
2010-07-29 17:58:02 UTC (rev 70148)
@@ -1,53 +0,0 @@
-
-/**
- * Handles actions for view menu 
- * such as view sequence xml 
- */
-
-mw.SequencerActionsView = function( sequencer ) {
-       return this.init( sequencer );
-};
-
-mw.SequencerActionsView.prototype = {
-       init: function( sequencer ) {
-               this.sequencer = sequencer; 
-       },
-       
-       /**
-        * Sequencer "viewXml" action
-        * presents a dialog that displays the current smil xml document
-        */
-       viewXML: function(){
-               var _this = this;
-               // For now just show the sequence output
-               $viewSmilXmlDialog = mw.addDialog({
-                       'title' : gM('mwe-sequenceedit-menu-view-smilxml'),
-                       'dragable': true,       
-                       'height' : 480,
-                       'width' : 640,
-                       'resizable': true,              
-                       'content' : $j('<div />').append(
-                               // Add a loading div
-                               $j('<div />')
-                               .addClass('syntaxhighlighter_loader')
-                               .loadingSpinner(),
-                               
-                               $j('<pre />')                           
-                               .addClass( 'brush: xml; ruler: true;' )
-                               .css({
-                                       'display': 'none'
-                               })
-                               .html(    
-                                       mw.escapeQuotesHTML( 
_this.sequencer.smil.getXMLString() ) 
-                               )
-                       )                       
-               })
-
-               // load and run the syntax highlighter:
-               $j( $viewSmilXmlDialog.find('pre') ).syntaxHighlighter( 
function(){
-                       
$viewSmilXmlDialog.find('.syntaxhighlighter_loader').remove();
-                       $viewSmilXmlDialog.find('pre').fadeIn();
-               });
-               
-       }
-}

Copied: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js 
(from rev 69945, 
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js)
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js     
                        (rev 0)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsView.js     
2010-07-29 17:58:02 UTC (rev 70148)
@@ -0,0 +1,104 @@
+
+/**
+ * Handles actions for view menu 
+ * such as view sequence xml 
+ */
+
+mw.SequencerActionsView = function( sequencer ) {
+       return this.init( sequencer );
+};
+
+mw.SequencerActionsView.prototype = {
+       init: function( sequencer ) {
+               this.sequencer = sequencer; 
+       },
+       
+       /**
+        * Sequencer "viewXml" action
+        * presents a dialog that displays the current smil xml document
+        */
+       viewXML: function(){
+               var _this = this;
+               // For now just show the sequence output
+               $viewSmilXmlDialog = mw.addDialog({
+                       'title' : gM('mwe-sequenceedit-menu-view-smilxml'),
+                       'dragable': true,       
+                       'height' : 480,
+                       'width' : 640,
+                       'resizable': true,              
+                       'content' : $j('<div />')
+                               .append(
+                               // Add a loading div
+                               $j('<div />')
+                               .addClass('syntaxhighlighter_loader')
+                               .loadingSpinner(),
+                               
+                               $j('<pre />')                           
+                               .addClass( 'brush: xml; ruler: true;' )
+                               .css({
+                                       'display': 'none'
+                               })
+                               .html(    
+                                       mw.escapeQuotesHTML( _this.formatXML( 
_this.sequencer.getSmil().getXMLString() ) ) 
+                               )
+                       )                       
+               })
+
+               // load and run the syntax highlighter:
+               $j( $viewSmilXmlDialog.find('pre') ).syntaxHighlighter( 
function(){
+                       
$viewSmilXmlDialog.find('.syntaxhighlighter_loader').remove();
+                       $viewSmilXmlDialog.find('pre').fadeIn();
+               });
+               
+       },
+       formatXML: function (xml) {
+               var reg = /(>)(<)(\/*)/g;
+               var wsexp = / *(.*) +\n/g;
+               var contexp = /(<.+>)(.+\n)/g;
+               xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, 
'$1\n').replace(contexp, '$1\n$2');
+               var pad = 0;
+               var formatted = '';
+               var lines = xml.split('\n');
+               var indent = 0;
+               var lastType = 'other';
+               // 4 types of tags - single, closing, opening, other (text, 
doctype, comment) - 4*4 = 16 transitions 
+               var transitions = {
+                   'single->single'    : 0,
+                   'single->closing'   : -1,
+                   'single->opening'   : 0,
+                   'single->other'     : 0,
+                   'closing->single'   : 0,
+                   'closing->closing'  : -1,
+                   'closing->opening'  : 0,
+                   'closing->other'    : 0,
+                   'opening->single'   : 1,
+                   'opening->closing'  : 0, 
+                   'opening->opening'  : 1,
+                   'opening->other'    : 1,
+                   'other->single'     : 0,
+                   'other->closing'    : -1,
+                   'other->opening'    : 0,
+                   'other->other'      : 0
+               };
+
+               for (var i=0; i < lines.length; i++) {
+                   var ln = lines[i];
+                   var single = Boolean(ln.match(/<.+\/>/)); // is this line a 
single tag? ex. <br />
+                   var closing = Boolean(ln.match(/<\/.+>/)); // is this a 
closing tag? ex. </a>
+                   var opening = Boolean(ln.match(/<[^!].*>/)); // is this 
even a tag (that's not <!something>)
+                   var type = single ? 'single' : closing ? 'closing' : 
opening ? 'opening' : 'other';
+                   var fromTo = lastType + '->' + type;
+                   lastType = type;
+                   var padding = '';
+
+                   indent += transitions[fromTo];
+                   for (var j = 0; j < indent; j++) {
+                       padding += '    ';
+                   }
+
+                   formatted += padding + ln + '\n';
+               }
+
+               return formatted;
+       }
+}

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js    
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js    
2010-07-29 17:58:02 UTC (rev 70148)
@@ -57,14 +57,14 @@
                                        'shortCut' : 'ctrl Z',
                                        'icon' : 'arrowreturnthick-1-w',
                                        'action': function( _this ){
-                                               mw.log("SequencerMenu::undo");
+                                               
_this.sequencer.getActionsEdit().undo();
                                        }
                                },
                                'redo' : {
                                        'shortCut' : 'ctrl Y',
                                        'icon' : 'arrowreturnthick-1-e',
-                                       'action' : function( _this ){
-                                               mw.log("SequencerMenu::redo");
+                                       'action' : function( _this ){           
                                
+                                               
_this.sequencer.getActionsEdit().redo();
                                        }
                                },
                                'divider': true,

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js        
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js        
2010-07-29 17:58:02 UTC (rev 70148)
@@ -109,8 +109,9 @@
                // for now assume all tracks start at zero:
                var startOffset = 0;
                
-               // For every ref node in this sequence draw its thumb: 
-               smil.getBody().getRefElementsRecurse( sequenceNode, 
startOffset, function( $node ){                             
+               // For every ref node in this sequence draw its thumb:          
+               smil.getBody().getRefElementsRecurse( sequenceNode, 
startOffset, function( $node ){
+                       mw.log('SequenceTimeline::drawTrackThumbs:' + 
$node.attr('id') );
                        // Check Buffer for when the first frame of the 
smilNode can be grabbed:                
                        smil.getBuffer().bufferedSeek( $node, 0, function(){
                                //mw.log("getTrackClipInterface::bufferedSeek 
for " + smil.getAssetId( $node ));
@@ -207,37 +208,26 @@
        },
        
        /**
-        * @param {Element} selectedClip to be removed
-        */
-       removeClip: function(selectedClip){
-               var smil = this.sequencer.getSmil();
-               // remove  clip directly 
-               if( selectedClip ){
-                       // Remove from smil dom:
-                       smil.removeById( $j(selectedClip).data('smilId') );
-                       // Remove from timeline dom: 
-                       $j( selectedClip ).unbind().fadeOut(function(){ 
-                               $j(this).remove() 
-                       });                     
-                       // Invalidate / update embedPlayer duration: 
-                       this.sequencer.getEmbedPlayer().getDuration( true );
-               }
-       },
-       /**
         * Remove selected clips and update the smil player
         */
-       removeSelectedClips: function(  ){              
+       removeSelectedClips: function(){                                
                var smil = this.sequencer.getSmil();
-               // modify the smil.dom and rebuild
                this.getTimelineContainer().find( '.selectedClip' 
).each(function( inx, selectedClip ){
                        // Remove from smil dom:
                        smil.removeById( $j(selectedClip).data('smilId') );
                        // Remove from timeline dom: 
-                       $j( selectedClip ).remove();                    
+                       $j( selectedClip ).fadeOut('fast', function(){
+                               $j(this).remove();
+                       });
                })              
+               
                // Invalidate / update embedPlayer duration: 
                this.sequencer.getEmbedPlayer().getDuration( true );
+
+               // Register the edit state for undo / redo 
+               this.sequencer.getActionsEdit().registerEdit();
        },
+       
        handleReorder: function ( movedClip ){
                var _this = this;
                var smil = this.sequencer.getSmil();
@@ -390,8 +380,12 @@
                        )
                        .hide()
                        .buttonHover()
-                       .click( function(){                                     
-                               _this.removeClip( $timelineClip )
+                       .click( function(){
+                               // de-select any other selected clips
+                               _this.getTimelineContainer().removeClass( 
'selectedClip' );
+                               // add the selected clip class to the current: 
+                               $timelineClip.addClass( 'selectedClip' );
+                               _this.removeSelectedClips();
                        })
                )
                // Add mouse over thumb "edit", "remove"  button

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js 
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js 
2010-07-29 17:58:02 UTC (rev 70148)
@@ -65,7 +65,7 @@
        
        /**
         * set the virtual smil volume ( will key all underling assets against 
this volume )
-        * ( of course we don't try to normalize across clips anything like 
that right now )
+        * ( we can't presently "normalize" across clips )
         */
        setPlayerElementVolume: function( percent ){
                this.volume = percent;
@@ -80,8 +80,10 @@
                //mw.log('EmbedPlayerSmil::setCurrentTime: ' + time );          
                // Set "loading" spinner here)
                if( !hideLoader ){
-                       $j( this ).getAbsoluteOverlaySpinner()
-                               .attr('id', 'loadingSpinner_' + this.id )
+                       if( $j('#loadingSpinner_' + this.id  ).length == 0 ){
+                               $j( this ).getAbsoluteOverlaySpinner()
+                                       .attr('id', 'loadingSpinner_' + this.id 
)
+                       }
                }
                // Start seek
                this.controlBuilder.onSeek();

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-07-29 
17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-07-29 
17:58:02 UTC (rev 70148)
@@ -43,6 +43,9 @@
 
        // The abstract embed player parent
        embedPlayer : null,
+       
+       // The jQuery dom object of the smil xml
+       $dom : null,
 
        /**
         * Constructor
@@ -81,13 +84,13 @@
         * Set smil from xml string
         * 
         * @param {string}
-        *            SmilXmlString Xml string of smil to be processed
+        *            SmilXmlString Xml string of smil to be loaded
         */
-       loadFromString : function(smilXmlString) {
+       loadFromString : function( smilXmlString ) {
                // Load the parsed string into the local "dom"
-               this.$dom = $j(smilXmlString);
+               this.$dom = $j( smilXmlString );
 
-               mw.log("Smil::loadFromString: loaded smil dom: " + this.$dom);
+               mw.log("Smil::loadFromString: loaded smil dom: " + 
this.$dom.length + "\n" + smilXmlString );
 
                // Clear out the layout
                this.layout = null;
@@ -101,7 +104,10 @@
                // Clear out the "buffer" object
                this.buffer = null;
        },
-
+       updateFromString: function( smilXmlString ){
+               var tmpDom = $j( smilXmlString );
+               // merge in xml changes? 
+       },
        /**
         * Internal function to get the jQuery smil dom
         */
@@ -143,13 +149,13 @@
        
        /**
         * Checks if two times are within the framerate time range 
-        * useful for results of a seek request no exactly matching
-        * the seek time.  
+        * useful for results of a seek request not exactly matching
+        * the seek time, but within a single frame.
         */     
-       isSameFrameTime: function( time1, time2){
+       isSameFrameTime: function( time1, time2 ){
                var frameRange = 1 / mw.getConfig( 'SmilPlayer.framerate');
                if ( Math.abs( time1 - time2 ) <  frameRange ) {
-                       mw.log( Math.abs( time1 - time2 ) +  ' IS < ' + 
frameRange );
+                       //mw.log( Math.abs( time1 - time2 ) +  ' IS < ' + 
frameRange );
                        return true;
                } else {
                        return false;

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-07-29 17:58:02 UTC (rev 70148)
@@ -50,7 +50,12 @@
                if( !$node.attr('id')
                        && !$node.attr( 'xml:id' )
                ){
-                       $node.attr('id', _this.getNodeSmilType( $node ) + '_' + 
_this.idIndex );
+                       // Make sure the id does not already exist ( should be 
a rare case ) 
+                       var idString = _this.getNodeSmilType( $node ) + '_' + 
_this.idIndex;
+                       if( this.$dom.find( '#' + idString ).length != 0 ){
+                               idString+= '_' + Math.random();
+                       }
+                       $node.attr('id',  idString);
                        mw.log('SmilBody:: gave: ' + $node.get(0).nodeName + ' 
id: ' + $node.attr('id') );
                        _this.idIndex++;
                }
@@ -409,6 +414,8 @@
         * animation, audio, img, text, textstream and video -> 'ref',  
         */
        getNodeSmilType: function( $node ){
+               if( typeof wgMyCoolGlobal != 'undefined')
+                       debugger;
                var blockType = $j( $node ).get(0).nodeName;
                
                if( this.smilBlockTypeMap[ blockType ] ){

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-07-29 17:57:10 UTC (rev 70147)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-07-29 17:58:02 UTC (rev 70148)
@@ -67,7 +67,7 @@
                        var nodeBuffredTime = relativeStartTime + 
                                ( _this.smil.getBody().getClipDuration( 
smilElement ) * nodeBufferedPercent );
                        
-                       //mw.log(" asset:" +  $j( smilElement ).attr('id') + ' 
is buffred:' + nodeBufferedPercent  + 'buffer time: ' + nodeBuffredTime );
+                       //mw.log(" asset:" +  $j( smilElement ).attr('id') + ' 
is buffered:' + nodeBufferedPercent  + 'buffer time: ' + nodeBuffredTime );
                        
                        
                        // Update min time buffered ( if the element is not 
100% buffered )                     

Modified: branches/MwEmbedStandAlone/remotes/mediaWiki.js
===================================================================
--- branches/MwEmbedStandAlone/remotes/mediaWiki.js     2010-07-29 17:57:10 UTC 
(rev 70147)
+++ branches/MwEmbedStandAlone/remotes/mediaWiki.js     2010-07-29 17:58:02 UTC 
(rev 70148)
@@ -124,8 +124,8 @@
                //console.log( 'spl: ' + typeof mwSetPageToLoading );
                // If on a view page set content to "loading" 
                mwSetPageToLoading();
-               loadMwEmbed( [ 'mw.RemoteSequenceEdit' ], function(){
-                       var remote = new mw.RemoteSequenceEdit({
+               loadMwEmbed( [ 'mw.RemoteSequencer' ], function(){
+                       var remote = new mw.RemoteSequencer({
                                'action': wgAction,
                                'title' : wgTitle,
                                'target' : '#bodyContent'
@@ -394,11 +394,11 @@
                                                                // close the 
dialog
                                                                
$j(this).dialog( 'close' ).remove();
                                                        };
-                                                       mw.addDialog(           
                        
-                                                               
decodeURIComponent( apiTitleKey.replace(/_/g, ' ') ),
-                                                               html_out,
-                                                               buttons
-                                                       )
+                                                       mw.addDialog( {         
                
+                                                               'title' : 
decodeURIComponent( apiTitleKey.replace(/_/g, ' ') ),
+                                                               'content' : 
html_out,
+                                                               'buttons' : 
buttons
+                                                       })
                                                        // Dialog size setup is 
a bit strange:                                                  
                                                        .css( {
                                                                'height' : 
dialogHeight + 'px'



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

Reply via email to