http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71863
Revision: 71863
Author: dale
Date: 2010-08-28 22:30:26 +0000 (Sat, 28 Aug 2010)
Log Message:
-----------
* sync with latest kaltura html5 lib updates
** some skin theme loading fixes
** server side seek for kaltura player
* other minor cleanup
Modified Paths:
--------------
branches/MwEmbedStandAlone/README
branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerKplayer.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsEdit.js
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
branches/MwEmbedStandAlone/mwEmbed.js
branches/MwEmbedStandAlone/remotes/mediaWiki.js
Added Paths:
-----------
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_ServerSideSeek.html
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html
Modified: branches/MwEmbedStandAlone/README
===================================================================
--- branches/MwEmbedStandAlone/README 2010-08-28 19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/README 2010-08-28 22:30:26 UTC (rev 71863)
@@ -1,5 +1,5 @@
-# Kaltura HTML5 Media Javascript Library
+
## Library Overview
[html5]: https://developer.mozilla.org/En/Using_audio_and_video_in_FireFox
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js 2010-08-28
19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js 2010-08-28
22:30:26 UTC (rev 71863)
@@ -14,7 +14,7 @@
// A default apiProvider ( ie where to lookup subtitles, video
properties etc )
// NOTE: Each player instance can also specify a specific
provider
- "EmbedPlayer.ApiProvider" : "commons",
+ "EmbedPlayer.ApiProvider" : "local",
// What tags will be re-written to video player by default
// Set to empty string or null to avoid automatic video tag
rewrites to embedPlayer
@@ -210,41 +210,26 @@
* @param {Array} dependencyRequest The library request array
*/
mw.embedPlayerUpdateLibraryRequest = function(playerElement,
dependencyRequest ){
- var playerClassName = $j( playerElement ).attr( 'class' );
- var playerSkins = {};
-
- // Set playerClassName to default
- if( ! playerClassName ){
- playerClassName = mw.getConfig( 'EmbedPlayer.SkinName'
);
- }
- // compre with lower case:
- playerClassName = playerClassName.toLowerCase();
- for( var n=0; n < mw.validSkins.length ; n++ ) {
- // Get any other skins that we need to load
- // That way skin js can be part of the single
script-loader request:
- if( playerClassName.indexOf( mw.validSkins[ n
].toLowerCase() ) !== -1) {
- // Add skin name to playerSkins
- playerSkins[ mw.validSkins[ n ].toLowerCase() ]
= true;
- }
+ var skinName = $j( playerElement ).attr( 'class' );
+ // Set playerClassName to default if unset or not a valid skin
+ if( ! skinName || $j.inArray( skinName.toLowerCase(),
mw.validSkins ) == -1 ){
+ skinName = mw.getConfig( 'EmbedPlayer.SkinName' );
}
+ skinName = skinName.toLowerCase();
+ // Add the skin to the request
+ var skinCaseName = skinName.charAt(0).toUpperCase() +
skinName.substr(1);
+ // The skin js:
+ if( $j.inArray( 'mw.PlayerSkin' + skinCaseName,
dependencyRequest ) == -1 ){
+ dependencyRequest.push( 'mw.PlayerSkin' + skinCaseName
);
+ }
+ // The skin css
+ if( $j.inArray( 'mw.style.PlayerSkin' + skinCaseName,
dependencyRequest ) == -1 ){
+ dependencyRequest.push( 'mw.style.PlayerSkin' +
skinCaseName );
+ }
-
- // Add the player skins css and js to the load request:
- for( var pSkin in playerSkins ) {
- // Make sure first letter of skin is upper case to load
skin class:
- var f = pSkin.charAt(0).toUpperCase();
- pSkin = f + pSkin.substr(1);
-
- // Add skin js
- dependencyRequest.push( 'mw.PlayerSkin' + pSkin );
- // Add the skin css
- dependencyRequest.push( 'mw.style.PlayerSkin' + pSkin );
- }
-
// Allow extension to extend the request.
$j( mw ).trigger( 'LoaderEmbedPlayerUpdateRequest',
[ playerElement, dependencyRequest ] );
-
}
} )( window.mw );
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
2010-08-28 19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -75,7 +75,7 @@
/*
* The default video attributes supported by embedPlayer
*/
-mw.setConfig( 'embedPlayerAttributes', {
+mw.setConfig( 'EmbedPlayer.Attributes', {
/*
* Base html element attributes:
*/
@@ -264,7 +264,7 @@
* Attributes Object can include any key value pair that would
otherwise be
* an attribute in the html element.
*
- * also see: mw.getConfig( 'embedPlayerAttributes' )
+ * also see: mw.getConfig( 'EmbedPlayer.Attributes' )
*
* @param {Function=} callback Optional Function to be called once video
interfaces are ready
*
@@ -369,6 +369,8 @@
// Functions to run after the video interface is ready
callbackFunctions : null,
+ playerElementQueue: [],
+
/**
* Constructor initializes callbackFunctions and playerList
*/
@@ -422,13 +424,13 @@
playerElement.id = 'vid' + ( this.playerList.length + 1
);
}
mw.log('EmbedPlayerManager: addElement:: ' + playerElement.id );
-
+
// Add the element id to playerList
this.playerList.push( playerElement.id );
// Check for player attributes such as skins or plugins
attributes
// that add to the request set
- var playerDependencyRequest = [ ];
+ var playerDependencyRequest = [];
// merge in any custom attributes
$j.extend( playerElement, attributes );
@@ -436,10 +438,11 @@
// Update the list of dependent libraries for the player
// ( allows extensions to add to the dependency list )
mw.embedPlayerUpdateLibraryRequest( playerElement,
playerDependencyRequest );
-
+
// Load any skins we need then swap in the interface
- mw.load( playerDependencyRequest, function() {
- var waitForMeta = true;
+ mw.load( playerDependencyRequest, function() {
+ var waitForMeta = true;
+
// Be sure to "stop" the target ( sometimes firefox
keeps playing the video even
// though its been removed from the DOM )
if( playerElement.pause ){
@@ -497,7 +500,7 @@
playerElement.removeEventListener(
"loadedmetadata", runPlayerSwap, true );
playerElement.addEventListener(
"loadedmetadata", runPlayerSwap, true );
- // Time-out of 5 seconds ( maybe still playable
but no timely metadata )
+ // Time-out of 5 seconds ( maybe still playable
but no timely metadata )
setTimeout( runPlayerSwap, 5000 );
return ;
} else {
@@ -850,11 +853,11 @@
},
/** URI function.
- * @param {Number} seek_time_sec Int: Used to adjust the URI for url
based seeks)
+ * @param {Number} serverSeekTime Int: Used to adjust the URI for url
based seeks)
* @return {String} the URI of the source.
*/
- getSrc : function( seek_time_sec ) {
- if ( !seek_time_sec || !this.URLTimeEncoding ) {
+ getSrc : function( serverSeekTime ) {
+ if ( !serverSeekTime || !this.URLTimeEncoding ) {
return this.src;
}
var endvar = '';
@@ -863,7 +866,7 @@
}
return mw.replaceUrlParams( this.src,
{
- 't': mw.seconds2npt( seek_time_sec ) + endvar
+ 't': mw.seconds2npt( serverSeekTime ) + endvar
}
);
},
@@ -1032,6 +1035,7 @@
if ( $j( videoElement ).attr( "src" ) ) {
_this.tryAddSource( videoElement );
}
+
// Process elements source children
$j( videoElement ).find( 'source,track' ).each( function( ) {
_this.tryAddSource( this );
@@ -1126,7 +1130,7 @@
* Selects the default source via cookie preference, default marked, or
by id order
*/
autoSelectSource: function() {
- mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' );
+ mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' +
this.id);
// Select the default source
var playableSources = this.getPlayableSources();
var flash_flag = ogg_flag = false;
@@ -1359,7 +1363,7 @@
'cmmlData': null,
// Stores the seek time request, Updated by the doSeek function
- 'seek_time_sec' : 0,
+ 'serverSeekTime' : 0,
// If the embedPlayer is current 'seeking'
'seeking' : false,
@@ -1390,14 +1394,18 @@
customAttributes = { };
}
- var playerAttributes = mw.getConfig( 'embedPlayerAttributes' );
-
+ var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes'
);
// Setup the player Interface from supported attributes:
for ( var attr in playerAttributes ) {
if ( customAttributes[ attr ] || customAttributes[ attr
] === false ) {
this[ attr ] = customAttributes[ attr ];
- } else if ( element.getAttribute( attr ) ) {
- this[ attr ] = element.getAttribute( attr );
+ } else if ( element.getAttribute( attr ) != null ) {
+ // boolean attributes
+ if( element.getAttribute( attr ) == '' ){
+ this[ attr ] = true;
+ } else {
+ this[ attr ] = element.getAttribute(
attr );
+ }
} else {
this[attr] = playerAttributes[attr];
}
@@ -1612,7 +1620,7 @@
// Scope the end of check for player sources so it can be
called in a callback
var finishCheckPlayerSources = function(){
// Run embedPlayer sources hook
- mw.runTriggersCallback( _this,
'checkPlayerSourcesEvent', function(){
+ mw.runTriggersCallback( _this,
'checkPlayerSourcesEvent', function(){
_this.checkForTimedText();
})
}
@@ -1643,7 +1651,7 @@
// Set local apiProvider via config if not defined
if( !_this.apiProvider ) {
- _this.apiProvider = 'local';
+ _this.apiProvider = mw.getConfig(
'EmbedPlayer.ApiProvider' );
}
// Setup the request
@@ -1930,7 +1938,8 @@
},
/**
- * Seek function (should be implemented by embed player interface )
+ * Seek function ( should be implemented by embedPlayer interface
playerNative, playerKplayer etc. )
+ * embedPlayer doSeek only handles URL time seeks
*/
doSeek: function( percent ) {
var _this = this;
@@ -1940,18 +1949,21 @@
$j( this.embedPlayer ).trigger( 'onSeek' );
// See if we should do a server side seek ( player independent
)
- if ( this.supportsURLTimeEncoding() ) {
- // Make sure this.seek_time_sec is up-to-date:
- this.seek_time_sec = mw.npt2seconds( this.start_npt ) +
parseFloat( percent * this.getDuration() );
- mw.log( 'EmbedPlayer::doSeek:: updated seek_time_sec: '
+ mw.seconds2npt ( this.seek_time_sec ) );
+ if ( this.supportsURLTimeEncoding() ) {
+ mw.log( 'EmbedPlayer::doSeek:: updated serverSeekTime:
' + mw.seconds2npt ( this.serverSeekTime ) );
this.stop();
this.didSeekJump = true;
+ // Make sure this.serverSeekTime is up-to-date:
+ this.serverSeekTime = mw.npt2seconds( this.start_npt )
+ parseFloat( percent * this.getDuration() );
// Update the slider
- this.updatePlayHead( percent );
- }
+ this.updatePlayHead( percent );
+ }
+
// Do play request in 100ms ( give the dom time to swap out the
embed player )
- setTimeout( function() {
+ setTimeout( function() {
+ _this.seeking = false;
_this.play()
+ _this.monitor();
}, 100 );
// Run the onSeeking interface update
@@ -2050,7 +2062,7 @@
// Stop the clip (load the thumbnail etc)
this.stop();
- this.seek_time_sec = 0;
+ this.serverSeekTime = 0;
this.updatePlayHead( 0 );
// Make sure we are not in preview mode( no end
clip actions in preview mode)
@@ -2215,9 +2227,9 @@
// reset seek_offset:
if ( this.mediaElement.selectedSource.URLTimeEncoding ) {
- this.seek_time_sec = 0;
+ this.serverSeekTime = 0;
} else {
- this.seek_time_sec = mw.npt2seconds( start_npt );
+ this.serverSeekTime = mw.npt2seconds( start_npt );
}
},
@@ -2773,8 +2785,8 @@
// no longer seeking:
this.didSeekJump = false;
- // reset current time and prev time
- this.currentTime = this.previousTime = 0;
+ // reset current time and prev time and seek offset
+ this.currentTime = this.previousTime = this.serverSeekTime =
0;
// Previous player set time
@@ -2979,7 +2991,12 @@
// Update currentTime via embedPlayer
_this.currentTime = _this.getPlayerElementTime();
-
+
+ // Update any offsets from server seek
+ if( _this.serverSeekTime && _this.supportsURLTimeEncoding ){
+ _this.currentTime = _this.serverSeekTime +
_this.getPlayerElementTime()
+ }
+
// Update the previousTime ( so we can know if the
user-javascript changed currentTime )
_this.previousTime = _this.currentTime;
@@ -3004,7 +3021,7 @@
_this.muted = _this.getPlayerElementMuted();
}
- //mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + (
parseInt( this.getDuration() ) + 1 ) + ' is seek: ' + this.seeking );
+ //mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + (
parseInt( this.getDuration() ) + 1 ) + ' is seeking: ' + this.seeking );
if ( this.currentTime >= 0 && this.duration ) {
if ( !this.userSlide && !this.seeking ) {
if ( parseInt( this.startOffset ) != 0 ) {
@@ -3054,7 +3071,8 @@
if( ! this.isStopped() ) {
if( !this.monitorInterval ){
this.monitorInterval = setInterval( function(){
- _this.monitor();
+ if( _this.monitor )
+ _this.monitor();
}, this.monitorRate )
}
} else {
@@ -3163,9 +3181,9 @@
} ).show();
this.jump_time = options['start'];
- this.seek_time_sec = mw.npt2seconds( options['start'] );
+ this.serverSeekTime = mw.npt2seconds( options['start'] );
// trim output to
- this.controlBuilder.setStatus( gM( 'mwe-embedplayer-seek_to',
mw.seconds2npt( this.seek_time_sec ) ) );
+ this.controlBuilder.setStatus( gM( 'mwe-embedplayer-seek_to',
mw.seconds2npt( this.serverSeekTime ) ) );
mw.log( 'DO update: ' + this.jump_time );
this.updateThumbTime( rel_start_sec );
},
@@ -3191,7 +3209,7 @@
*/
getSrc: function() {
if( this.mediaElement.selectedSource ){
- return this.mediaElement.selectedSource.getSrc(
this.seek_time_sec );
+ return this.mediaElement.selectedSource.getSrc(
this.serverSeekTime );
}
return false;
},
Modified:
branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerKplayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerKplayer.js
2010-08-28 19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerKplayer.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -207,6 +207,16 @@
*/
doSeek: function( percentage ) {
var _this = this;
+ if ( this.supportsURLTimeEncoding() ){
+ // Make sure we could not do a local seek instead:
+ if ( !( percentage < this.bufferedPercent &&
this.playerElement.duration && !this.didSeekJump )) {
+ // We support URLTimeEncoding call parent seek:
+ this.parent_doSeek( percentage );
+ return;
+ }
+ }
+
+
if( this.playerElement ) {
var seekTime = percentage * this.getDuration();
Modified:
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
===================================================================
---
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
2010-08-28 19:25:37 UTC (rev 71862)
+++
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -323,7 +323,7 @@
},
/**
- * Show the credit screen (presently specific to kaltura skin )
+ * Show the credit screen ( presently specific to kaltura skin )
*/
showCredits: function() {
// Set up the shortcuts:
Added:
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_ServerSideSeek.html
===================================================================
---
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_ServerSideSeek.html
(rev 0)
+++
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_ServerSideSeek.html
2010-08-28 22:30:26 UTC (rev 71863)
@@ -0,0 +1,14 @@
+<html>
+ <head>
+ <script type="text/javascript" src="http://html5.kaltura.org/js"></script>
+ </head>
+ <body>
+ <h2>mwEmbed / archive.org server side seek</h2>
+
+ <video
poster="http://www.archive.org/download/night_of_the_living_dead/format=Thumbnail&x.jpg"
+ style="width:400px;height:300px" durationHint="5717.21">
+ <source URLTimeEncoding="true"
src="http://www.archive.org/download/night_of_the_living_dead/night_of_the_living_dead_512kb.mp4"/>
+ <source URLTimeEncoding="true"
src="http://www.archive.org/download/night_of_the_living_dead/night_of_the_living_dead.ogv"/>
+ </video>
+ </body>
+</html>
Added: branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html
(rev 0)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html
2010-08-28 22:30:26 UTC (rev 71863)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Player sources</title>
+
+<script type="text/javascript" src="../../../mwEmbed.js?debug=true"></script>
+</head>
+<body>
+
+
+<video
poster="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream.jpg"
+ duration="10:53" preload="auto">
+ <source type="video/webm"
src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream_400p.webm"
/>
+ <source type="video/h264"
src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream_iphone.m4v"
/>
+ <source type="video/ogg"
src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream_400p.ogv"
/>
+</video>
+
+
+</body>
+</html>
\ No newline at end of file
Modified: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
2010-08-28 19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
2010-08-28 22:30:26 UTC (rev 71863)
@@ -12,10 +12,12 @@
'mwe-sequencer-visual-editor'=> "Visual sequence editor",
'mwe-sequencer-text-editor-warn'=> 'Text XML editor ( not recommended )
',
+ 'mwe-sequencer-restore-text-edit' => '[$1 Restore text editor] ( note
this <i>highly</i> recommended that you use the visual editor )',
+
'mwe-sequencer-loading-timeline' => 'Loading timeline ...',
'mwe-sequencer-loading-player' => 'Loading player ...',
'mwe-sequencer-loading-menu' => 'Loading menu ...',
- 'mwe-sequencer-loading-asset' => 'Loading asset ...',
+ 'mwe-sequencer-loading-asset' => 'Loading asset ...',
'mwe-sequencer-no_selected_resource' => '<h3>No resource selected</h3>
Select a clip to enable editing.',
'mwe-sequencer-untitled-sequence' => 'Untitled sequence',
@@ -84,11 +86,11 @@
'mwe-sequencer-save_done' => 'Save complete',
'mwe-sequencer-open-summary' => "Enter the name of the sequence you
would like to open",
-
+ 'mwe-sequencer-new-summary' => "Enter the name of the sequence you
would like to create",
- 'mwe-sequencer-not-published' => 'This sequence has not yet been
published. <i>Browser preview is shown</i>. <b>[$1 Review and publish this
sequence]</b>.',
- 'mwe-sequencer-published-out-of-date' =>'This published sequence is not
the most recent version. You can <b>[$1 review and publish]</b> the most recent
version.',
+ 'mwe-sequencer-not-published' => 'This sequence has not yet been
published. Select <i>sequence -> publish</i> in the <b>[$1 sequence editor]</b>
to publish this sequence.',
+ 'mwe-sequencer-published-out-of-date' =>'This published sequence is not
the most recent version. Select <i>sequence -> publish</i> in the <b>[$1
sequence editor]</b> to publish this sequence',
'mwe-sequencer-already-published' => "The most recent version of this
sequence is already published",
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsEdit.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsEdit.js
2010-08-28 19:25:37 UTC (rev 71862)
+++
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsEdit.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -76,7 +76,7 @@
// Enable the undo option:
this.sequencer.getMenu().enableMenuItem( 'edit', 'undo' );
- this.sequencer.getMenu().enableMenuItem( 'sequencer', 'save' );
+ this.sequencer.getMenu().enableMenuItem( 'sequence', 'save' );
},
/**
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
2010-08-28 19:25:37 UTC (rev 71862)
+++
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -15,8 +15,73 @@
init: function( sequencer ) {
this.sequencer = sequencer;
},
-
/**
+ * present an new dialog to the user and open the sequence in a new
window
+ * ( presently very similar to open )
+ */
+ newSequence : function(){
+ var _this = this;
+ var $content = $j('<div />').append(
+ gM('mwe-sequencer-new-summary' ),
+ $j('<input />')
+ .css({ 'width': 400 })
+ .attr({
+ 'id' : 'sequenceNewNameInput',
+ 'maxlength': 255
+ })
+ // Make sure keys press does not affect the
sequencer interface
+ .sequencerInput( _this.sequencer )
+ );
+ // XXX todo we should have an autocomplete on sequence name!
+
+ var buttons = {};
+ buttons[ gM('mwe-cancel') ] = function(){ $j( this ).dialog(
'cancel' ) };
+
+ // For now just support server based open .. ideally we could
browse for file
+ var $dialog = mw.addDialog({
+ 'resizable':'true',
+ 'title' : gM('mwe-sequencer-menu-sequence-new-desc'),
+ 'content' : $content,
+ 'buttons' : buttons,
+ 'width' : 450
+ });
+ // Add a special open button
+ $dialog.parent().find( '.ui-dialog-buttonpane' ).prepend(
+ $j.button({
+ 'icon' : 'document',
+ 'text' : gM('mwe-sequencer-menu-sequence-new')
+ })
+ // Match button layout
+ .css({
+ 'margin':'0.5em 0.4em 0.5em 0',
+ 'padding' : '0.2em 1.4em 0.3em'
+ })
+ .attr({
+ 'id' : 'sequenceOpenButton',
+ 'target' : '_new',
+ 'href' : '#'
+ }).click( function(){
+ // Update the link
+ $j(this).attr({
+ 'href':
+ mw.getRemoteSequencerLink(
+ mw.escapeQuotesHTML(
+
_this.sequencer.getServer().getSequenceEditUrl(
+
// ( Sequence: is automatically pre-appended with getSequencePageUrl
+
// ( don't use Sequence: in the title )
+
$j('#sequenceNewNameInput').val().replace(/Sequence:/i, '')
+ )
+ )
+ )
+ });
+ // Close the dialog
+ $j(this).dialog( 'close' );
+ // Follow the link
+ return true;
+ })
+ )
+ },
+ /**
* present an open dialog to the user, and open the sequence in a new
window
*/
open: function(){
@@ -412,7 +477,7 @@
if( _this.sequencer.getOption('onExitCallback')
){
// Send a flag of weather the sequence
'changed' or not
_this.sequencer.getOption('onExitCallback')(
-
_this.sequencer.getServer().hasSequenceBeenSaved()
+
_this.sequencer.getServer().hasSequenceBeenSavedOrPublished()
);
}
$j( this ).remove();
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
2010-08-28 19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -36,7 +36,7 @@
'save_divider': 'divider',
'save' : {
'icon' : 'disk',
- 'disabled' : true,
+ 'disabled' : false,
'shortCut' : 'ctrl S',
'action' : function( _this ){
mw.log("SequencerMenu::save");
@@ -279,6 +279,9 @@
},
enableMenuItem: function( menuKey, menuItemKey ){
+ if( !this.menuConfig[ menuKey ] || !this.menuConfig[ menuKey ][
menuItemKey ] ){
+ mw.log("Error: SequencerMenu: " + menuKey + ' ' +
menuItemKey + ' is not defined');
+ }
this.menuConfig[ menuKey ][ menuItemKey ].disabled = false;
$menuItemTarget = $j('#' + this.getMenuItemId( menuKey,
menuItemKey ) );
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
2010-08-28 19:25:37 UTC (rev 71862)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -100,11 +100,11 @@
hasLocalChanges: function(){
return ( this.serverSmilXml !=
this.sequencer.getSmil().getXMLString() );
},
- // Check if the sequence was saved in this edit sesssion
- hasSequenceBeenSaved: function(){
- return this.sequenceSaved;
+ // Check if the sequence was saved in this edit session
+ hasSequenceBeenSavedOrPublished: function(){
+ return this.sequenceSaved || this.sequencePublished
},
- // Get a save token, if unable to do so return false
+ // Get a save token, if unable to do so return false
getSaveToken: function( callback ){
var _this = this;
if( this.saveToken != null ){
@@ -196,8 +196,9 @@
'prop':'revisions',
'titles' : _this.titleKey,
'rvprop' : 'user|comment|timestamp'
- };
+ };
mw.getJSON( _this.getApiUrl(), request, function( data
) {
+ debugger;
if( data.query && data.pages ){
for( page_id in data.pages ){
var page = data.pages[page_id];
@@ -227,13 +228,8 @@
* Get the sequencer 'edit' url
*/
getSequenceEditUrl: function( titleKey ){
- if( !titleKey )
- titleKey = this.titleKey;
- // Check that we have a pagePathUrl config:
- if( !this.pagePathUrl ){
- return false;
- }
- return this.pagePathUrl.replace( '$1', 'Sequence:' +
titleKey);
+ var viewUrl = this.getSequenceViewUrl( titleKey );
+ return mw.replaceUrlParams(viewUrl, {'action':'edit'})
},
/**
@@ -262,6 +258,10 @@
callback( _this.getApiUrl(), request );
});
});
+ },
+ // Setter for sequencePublished
+ sequencePublishUploadDone: function(){
+ this.sequencePublished = true;
}
}
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-08-28 19:25:37 UTC (rev 71862)
+++
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-08-28 22:30:26 UTC (rev 71863)
@@ -11,11 +11,13 @@
"mwe-sequencer-edit-sequence",
"mwe-sequencer-embed-sequence",
"mwe-sequencer-embed-sequence-desc",
- "mwe-sequencer-loading-sequencer",
+ "mwe-sequencer-loading-sequencer",
"mwe-sequencer-visual-editor",
"mwe-sequencer-text-editor-warn",
+ "mwe-sequencer-restore-text-edit",
+ "mwe-sequencer-loading-publish-render",
"mwe-sequencer-not-published",
"mwe-sequencer-published-out-of-date"
@@ -55,7 +57,8 @@
this.target = ( options.target )? options.target : this.target;
},
- drawUI: function() {
+ drawUI: function() {
+
// Check page action
if( this.action == 'view' ) {
this.showViewUI();
@@ -101,34 +104,44 @@
},
showEditUI: function(){
-
+ var _this = this;
$j('#bodyContent').prepend(
// Append switch visual / text editor links
- $j('<div />')
+ /*$j('<div />')
.append(
$j.button({
'icon' : 'video',
'text' : gM(
"mwe-sequencer-visual-editor")
}).click( function(){
- $j('#sequencerContainer').show();
- $j('#editform').hide();
+ $j('#editform').hide();
+ $j('#sequencerContainer').show();
}),
$j.button({
- 'icon' : 'script'
+ 'icon' : 'script',
'text' :
gM("mwe-sequencer-text-editor-warn")
}).click(function(){
$j('#sequencerContainer').hide();
$j('#editform').show();
- }),
- $j('<div />')
- .css({
- 'width' : '100%',
- 'height' : '700px'
- })
- .attr({
- 'id', 'sequencerContainer'
- })
+ })
+ )*/
+ ).append(
+ $j('<div />')
+ .css({
+ 'position' : 'relative',
+ 'width' : '100%',
+ 'height' : '620px'
+ })
+ .attr({
+ 'id': 'sequencerContainer'
+ }),
+ $j('<div />')
+ .append(
+ gM("mwe-sequencer-restore-text-edit", $j('<a
/>').click(function(){
+ $j('#sequencerContainer').hide();
+ $j('#editform').show();
+ }) )
)
+ .css( {'cursor': 'pointer', 'font-size':'x-small' })
);
// load the sequence editor with the sequencerContainer target
mw.load( 'Sequencer', function(){
@@ -161,65 +174,73 @@
// no flattened file found
$embedPlayer.append(
$j( '<div />').append(
-
gM('mwe-sequencer-not-published')
+
gM('mwe-sequencer-not-published',
+ $j('<a
/>').click( function(){
+
_this.showEditor();
+ })
+ )
)
.addClass( 'ui-state-highlight'
)
- )
- return ;
- }
- for( var pageId in data.query.pages) {
- var page = data.query.pages[ pageId ];
-
- // Check that the file has a later
revision than the
- // page. ( up to date sequences always
are later than
- // the revision of the page saved ).
- if( page.revisions && page.revisions[0]
){
- if( page.revisions[0].revid <
wgCurRevisionId ){
- // flattened file out
of date
- $embedPlayer.append(
- $j('<div
/>').append(
-
gM('mwe-sequencer-published-out-of-date')
- ).addClass(
'ui-state-highlight' )
- )
+ )
+ } else {
+ for( var pageId in data.query.pages) {
+ var page = data.query.pages[
pageId ];
+
+ // Check that the file has a
later revision than the
+ // page. ( up to date sequences
always are later than
+ // the revision of the page
saved ).
+ if( page.revisions &&
page.revisions[0] ){
+ if(
page.revisions[0].revid < wgCurRevisionId ){
+ // flattened
file out of date
+
$embedPlayer.append(
+
$j('<div />').append(
+
gM('mwe-sequencer-published-out-of-date',
+
$j('<a />').click( function(){
+
_this.showEditor();
+
})
+
)
+
).addClass( 'ui-state-highlight' )
+ )
+ }
}
- }
- if( page.imageinfo && page.imageinfo[0]
){
- var imageinfo =
page.imageinfo[0];
- var duration = 0;
- for( var i=0;i<
imageinfo.metadata.length; i++){
- if(
imageinfo.metadata[i].name == 'length' ){
- duration =
Math.round(
-
imageinfo.metadata[i].value * 1000
- ) / 1000;
+ if( page.imageinfo &&
page.imageinfo[0] ){
+ var imageinfo =
page.imageinfo[0];
+ var duration = 0;
+ for( var i=0;i<
imageinfo.metadata.length; i++){
+ if(
imageinfo.metadata[i].name == 'length' ){
+
duration = Math.round(
+
imageinfo.metadata[i].value * 1000
+ ) /
1000;
+ }
}
+ // Append a player to
the embedPlayer target
+ // -- special title key
sequence name bound
+ $embedPlayer.append(
+ $j('<video />')
+ .attr({
+ 'id' :
'embedSequencePlayer',
+
'poster' : imageinfo.thumburl,
+
'durationHint' : duration,
+
'apiTitleKey' : page.title.replace('File:',''),
+ })
+
.addClass('kskin')
+ .css({
+
'width': imageinfo.thumbwidth,
+
'height' : imageinfo.thumbheight
+ })
+ .append(
+ // ogg
source
+
$j('<source />')
+ .attr({
+
'type': 'video/ogg',
+
'src' : imageinfo.url
+ })
+ )
+ )
}
- // Append a player to the
embedPlayer target
- // -- special title key
sequence name bound
- $embedPlayer.append(
- $j('<video />')
- .attr({
- 'id' :
'embedSequencePlayer',
- 'poster' :
imageinfo.thumburl,
- 'durationHint'
: duration,
- 'apiTitleKey' :
page.title.replace('File:',''),
- })
- .addClass('kskin')
- .css({
- 'width':
imageinfo.thumbwidth,
- 'height' :
imageinfo.thumbheight
- })
- .append(
- // ogg source
- $j('<source />')
- .attr({
- 'type':
'video/ogg',
- 'src' :
imageinfo.url
- })
- )
- )
- }
- }
- var width = ( imageinfo.thumbwidth
)?imageinfo.thumbwidth : '400px';
+ }
+ }
+ var width = ( imageinfo && imageinfo.thumbwidth
)?imageinfo.thumbwidth : '400px';
// Display embed sequence
$j( _this.target ).empty().append(
$j('<div />')
@@ -294,9 +315,8 @@
)
.css( {'width':'200px', 'margin':'auto'})
)
- )
- mw.load( 'Sequencer', function(){
- var _this = this;
+ )
+ mw.load( 'Sequencer', function(){
// Send a jquery ui style destroy command ( in case the
editor is re-invoked )
$j('#edit_sequence_container').sequencer( 'destroy');
$j('#edit_sequence_container').sequencer(
_this.getSequencerConfig() );
Modified: branches/MwEmbedStandAlone/mwEmbed.js
===================================================================
--- branches/MwEmbedStandAlone/mwEmbed.js 2010-08-28 19:25:37 UTC (rev
71862)
+++ branches/MwEmbedStandAlone/mwEmbed.js 2010-08-28 22:30:26 UTC (rev
71863)
@@ -505,7 +505,7 @@
// Issue the load request check check loadStates to see
if we are
// "done"
for( var loadName in loadStates ) {
- mw.log("loadMany: load: " + loadName );
+ //mw.log("loadMany: load: " + loadName );
this.load( loadName, function ( loadName ) {
loadStates[ loadName ] = 1;
@@ -1834,6 +1834,18 @@
return parsedUrl.protocol + '://' + parsedUrl.authority
+ parsedUrl.directory + src;
}
};
+ /**
+ * Check if a given source string is likely a url
+ *
+ * @return {boolean}
+ * true if a url
+ * false if a string
+ */
+ mw.isUrl = function( src ){
+ var parsedSrc = mw.parseUri( src );
+ // if the url is just a string source and host will match
+ return ( parsedSrc.host != parsedSrc.source );
+ };
/**
* Escape quotes in a text string
@@ -1987,23 +1999,30 @@
* @return true if found, return false if not found
*/
mw.hasJQueryUiCss = function(){
- var hasUiCss = false;
+ var hasUiCss = false;
+ var cssStyleSheetNames = ['jquery-ui-1.7.2.css',
'jquery-ui.css'];
// Load the jQuery ui skin if usability skin not set
$j( 'link' ).each( function( na, linkNode ){
- if( $j( linkNode ).attr( 'href' ).indexOf(
'jquery-ui-1.7.2.css' ) != -1 ) {
- hasUiCss = true;
- return true;
- }
+ $j.each( cssStyleSheetNames, function(inx, sheetName ){
+ if( $j( linkNode ).attr( 'href' ).indexOf(
sheetName ) != -1 ){
+ hasUiCss = true;
+ return true;
+ }
+ })
} );
- // Check all the "style" nodes for @import of
jquery-ui-1.7.2.css
+ // Check all the "style" nodes for @import for sheet name
// xxx Note: we could do this a bit cleaner with regEx
$j( 'style' ).each( function( na, styleNode ){
- if( $j( styleNode ).text().indexOf( '@import' ) != -1
- && $j( styleNode ).text().indexOf(
'jquery-ui-1.7.2.css' ) != -1 ){
+ $j.each( cssStyleSheetNames, function(inx, sheetName ){
+ if( $j( styleNode ).text().indexOf( '@import' )
!= -1
+ &&
+ $j( styleNode ).text().indexOf(
sheetName ) != -1 )
+ {
hasUiCss=true;
- }
- });
-
+ return true;
+ }
+ });
+ });
return hasUiCss;
}
Modified: branches/MwEmbedStandAlone/remotes/mediaWiki.js
===================================================================
--- branches/MwEmbedStandAlone/remotes/mediaWiki.js 2010-08-28 19:25:37 UTC
(rev 71862)
+++ branches/MwEmbedStandAlone/remotes/mediaWiki.js 2010-08-28 22:30:26 UTC
(rev 71863)
@@ -132,11 +132,12 @@
if( wgAction == 'edit' ){
mwAddCommonStyleSheet();
var body = document.getElementById(
'bodyContent' );
- body.innerHTML = "<div
class=\"loadingSpinner\"></div>" + body.innerHTML;
+ body.innerHTML = "<div class=\"loadingSpinner
sequenceLoader\"></div>" + body.innerHTML;
}
loadMwEmbed( [ 'mw.MediaWikiRemoteSequencer' ],
function(){
- $j('.loadingSpinner').remove();
- $j('#editform').hide();
+ $j('#editform,.mw-newarticletext').hide();
+ $j('.sequenceLoader').hide();
+
var remote = new mw.MediaWikiRemoteSequencer({
'action': wgAction,
'title' : wgTitle,
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs