r71622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71621‎ | r71622 | r71623 >
Date:05:40, 25 August 2010
Author:dale
Status:deferred
Tags:
Comment:
more sequencer publish support ( still not complete )
minor jquery menu fix
Modified paths:
  • /branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
@@ -649,7 +649,10 @@
650650 if( this.embedPlayer.getPlayerHeight() == 0 ){
651651 return false;
652652 }
653 - // Past alll tests OverlayControls is true:
 653+ if( this.embedPlayer.controls === false ){
 654+ return false;
 655+ }
 656+ // Past all tests OverlayControls is true:
654657 return true;
655658 },
656659
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js
@@ -6,7 +6,7 @@
77 * Set the jQuery bindings:
88 */
99 ( function( $ ) {
10 - $.fn.firefoggRender = function( options, callback ) {
 10+ $.fn.firefoggRender = function( options ) {
1111 if(!options)
1212 options = {};
1313 options.playerTarget = this.selector;
@@ -39,7 +39,13 @@
4040
4141 // Start time for rendering
4242 startTime: 0,
43 -
 43+
 44+ // Callback for when the render with a pointer to the firefogg object
 45+ doneRenderCallback: null,
 46+
 47+ // Bollean attribute if we should save to local file
 48+ saveToLocalFile : true,
 49+
4450 // Constructor
4551 init:function( options ) {
4652 var _this = this;
@@ -73,13 +79,19 @@
7480 this.statusTarget = options ['statusTarget'];
7581 }
7682
 83+ if( options [ 'doneRenderCallback' ] ){
 84+ this.doneRenderCallback = options [ 'doneRenderCallback' ];
 85+ }
 86+
 87+ if( options['saveToLocalFile'] ){
 88+ this.saveToLocalFile = options['saveToLocalFile'] ;
 89+ }
7790 // If no height width provided use target DOM width/height
7891 if( !this.renderOptions.width && !this.renderOptions.height ) {
7992 this.renderOptions.width = $j(this.playerTarget).width();
8093 this.renderOptions.height = $j(this.playerTarget).height();
8194 }
8295
83 -
8496 },
8597 getPlayer: function(){
8698 return $j( this.playerTarget ).get( 0 );
@@ -87,9 +99,11 @@
88100 // Start rendering
89101 doRender: function() {
90102 var _this = this;
91 - // Make sure we get a target destination
92 - if( !_this.fogg.saveVideoAs() ){
93 - return false;
 103+ // Check if we save the file to disk:
 104+ if( this.saveToLocalFile ){
 105+ if( !_this.fogg.saveVideoAs() ){
 106+ return false;
 107+ }
94108 }
95109 // Set the render time to "startTime" of the render request
96110 this.renderTime = this.startTime;
@@ -148,7 +162,7 @@
149163 _this.doFinalRender();
150164 } else {
151165 // Don't block on render requests
152 - setTimeout(function(){
 166+ setTimeout( function(){
153167 _this.doNextFrame();
154168 },1 )
155169 }
@@ -165,23 +179,32 @@
166180 /**
167181 * Issue the call to firefogg to render out the ogg video
168182 */
169 - doFinalRender: function() {
 183+ doFinalRender: function() {
170184 mw.log("FirefoggRender:: doFinalRenderr" );
171185 this.fogg.render();
172 - this.updateStatus();
 186+ this.checkRenderStatus();
173187 },
174188
175189 /**
176190 * Update the render status
177191 */
178 - updateStatus: function() {
179 - var _this = this;
 192+ checkRenderStatus: function() {
 193+ var _this = this;
 194+ // Check if we are still rendering
180195 var rstatus = _this.fogg.renderstatus();
181 - $j( _this.statusTarget ).text( rstatus );
 196+ $j( _this.statusTarget ).text( rstatus );
182197 if ( rstatus != 'done' && rstatus != 'rendering failed' ) {
183198 setTimeout( function() {
184 - _this.updateStatus();
 199+ _this.checkRenderStatus();
185200 }, 100 );
 201+ return ;
186202 }
 203+ if( rstatus == 'rendering failed' ){
 204+ mw.log("Error: rendering failed");
 205+ return ;
 206+ }
 207+ if( this.doneRenderCallback ){
 208+ this.doneRenderCallback( this )
 209+ }
187210 }
188211 }
\ No newline at end of file
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
@@ -162,13 +162,13 @@
163163 */
164164 getSmilSource: function( callback ){
165165 var _this = this;
166 - if( !this.smilSource ){
167 - if( this.getOption( 'newSequence' ) ){
168 - this.smilSource = this.getDataUrl( this.getNewSmilXML() );
 166+ if( !_this.smilSource ){
 167+ if( _this.getOption( 'newSequence' ) ){
 168+ _this.smilSource = _this.getDataUrl( _this.getNewSmilXML() );
169169 } else {
170170 mw.log("Load smil source from server")
171171 // Try to load from the server
172 - this.getServer().getSmilXml(function( smilXml ){
 172+ _this.getServer().getSmilXml(function( smilXml ){
173173 _this.smilSource = _this.getDataUrl( smilXml );
174174 callback( _this.smilSource )
175175 })
@@ -177,9 +177,12 @@
178178 }
179179 }
180180 // return the smilSource
181 - callback( this.smilSource )
 181+ callback( _this.smilSource )
182182 },
183183 getDataUrl: function( xmlString ){
 184+ if( ! xmlString ){
 185+ xmlString = this.getSmil().getXMLString();
 186+ }
184187 return 'data:text/xml;charset=utf-8,' + escape( xmlString );
185188 },
186189 getNewSmilXML: function( ){
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
@@ -77,6 +77,8 @@
7878 '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.',
7979
8080 'mwe-sequencer-loading-publish-render' => 'Loading publisher...',
 81+ 'mwe-sequencer-running-publish' => 'Publishing sequence, please wait...',
 82+ 'mwe-sequencer-publishing-status' => 'Publish status:',
8183
8284 'mwe-sequencer-transition_in' => 'Transition in',
8385 'mwe-sequencer-transition_out' => 'Transition out',
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
@@ -85,15 +85,17 @@
8686 },
8787 /**
8888 * Display the publish dialog
89 - * ( confim the user has firefogg and rights to save a new version of the file )
 89+ * ( confirm the user has firefogg and rights to save a new version of the file )
9090 */
9191 publish: function(){
 92+ var _this = this;
9293 // add a loading dialog
9394 var $dialog = mw.addDialog({
9495 'resizable':'true',
9596 'title' : gM('mwe-sequencer-loading-publish-render'),
9697 'content' : gM('mwe-sequencer-loading-publish-render'),
97 - 'width' : 450
 98+ 'width' : 450,
 99+ 'height' : 400
98100 });
99101 $dialog.append( $j('<div />').loadingSpinner() );
100102 // Grab the firefogg render
@@ -103,25 +105,71 @@
104106 'only_fogg':true
105107 });
106108 if ( !myFogg.getFirefogg() ) {
107 - $dialog.empty().append( $j('<div />').attr('id', 'show_install_firefogg') );
 109+ $dialog.empty().append(
 110+ $j('<div />').attr('id', 'show_install_firefogg')
 111+ );
108112 myFogg.showInstallFirefog( '#show_install_firefogg' );
109113 return ;
110114 }
111 -
 115+
112116 // Build a data-url of the current sequence:
113 - $j( '<div />' ).attr('id', 'publishVideoTarget');
 117+ $dialog.dialog( "option", "title", gM('mwe-sequencer-running-publish') );
114118
115 - // Start up the render
116 - var foggRender = $j('#videoCrossfade').firefoggRender({
117 - 'statusTarget': '#targetFoggStatus'
118 - });
119 - /*
120 - foggRender.doRender();
121 -
122 - $j('#renderToFile').text('Stop Render').click(function(){
123 - foggRender.stopRender();
124 - });
125 - */
 119+ $dialog.empty().append(
 120+ $j( '<video />' )
 121+ .attr({
 122+ 'id': 'publishVideoTarget',
 123+ 'src' : _this.sequencer.getDataUrl(),
 124+ 'type' : 'application/smil'
 125+ })
 126+ .css({
 127+ 'width' : '400px',
 128+ 'height' : '300px'
 129+ })
 130+ ,
 131+ $j('<div />' )
 132+ .css( 'clear', 'both' ),
 133+ $j('<span />' ).text( gM( 'mwe-sequencer-publishing-status') ),
 134+ $j('<span />' ).attr( 'id', 'firefoggStatusTarget' ),
 135+ $j('<span />')
 136+ .css('float', 'right')
 137+ .text("%")
 138+ );
 139+
 140+ // Embed the player and continue application flow
 141+ $j('#publishVideoTarget').embedPlayer({
 142+ 'controls' : false
 143+ }, function(){
 144+ // this should be depreciated ( hidden interface bug in mwEmbed )
 145+ $j('#publishVideoTarget').parent().show();
 146+ // Start up the render
 147+ var foggRender = $j('#publishVideoTarget').firefoggRender({
 148+ 'statusTarget' : '#firefoggStatusTarget',
 149+ 'saveToLocalFile' : false,
 150+ 'doneRenderCallback': function( fogg ){
 151+ _this.uploadRenderedVideo( $dialog, fogg );
 152+ }
 153+ });
 154+ var buttons = {};
 155+ buttons[ gM('mwe-cancel') ] = function(){
 156+ foggRender.stopRender();
 157+ $j( this ).dialog( 'close' );
 158+ }
 159+ // Add cancel button
 160+ $dialog.dialog( "option", "buttons", buttons );
 161+ foggRender.doRender();
 162+ });
126163 });
 164+ },
 165+ // Upload the video from a supplied fogg target
 166+ // note xx this might be better handlded in a firefogg library
 167+ // @param {jQuery Object } $dialog
 168+ // @param {firefogg Object}
 169+ uploadRenderedVideo: function( $dialog, fogg ){
 170+ var uploadStatus = function(){
 171+ }
 172+ this.sequencer.getServer().getVideoUploadSettings( function( url, request ){
 173+ fogg.post( url, 'file', request )
 174+ })
127175 }
128176 }
\ No newline at end of file
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
@@ -33,6 +33,8 @@
3434 this.apiUrl = serverConfig.url;
3535 if( serverConfig.titleKey )
3636 this.titleKey = serverConfig.titleKey;
 37+ } else {
 38+ mw.log("Error: Sequencer server needs a serverConfig to be initialized")
3739 }
3840 },
3941
@@ -91,6 +93,19 @@
9294 }
9395 })
9496 })
 97+ },
 98+
 99+ /**
 100+ * @return {String}
 101+ */
 102+ getVideoTitleKey: function(){
 103+ return 'File:' + this.titleKey.replace( ':', '-');
 104+ },
 105+
 106+ // get upload settings runs the callback with the post url and request data
 107+ getVideoUploadSettings: function( callback ){
 108+ var _this = this;
 109+ mw.getToken( this.apiUrl, this.getVideoTitleKey, function( saveToken ){
95110 }
96111 }
97112
Index: branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js
@@ -328,7 +328,7 @@
329329 }
330330 },
331331 function() {
332 - if( !menuitem.hasClass('divider') && !menuitem.hasClass('disabled') ){
 332+ if( menuitem && !menuitem.hasClass('divider') && !menuitem.hasClass('disabled') ){
333333 $(this).removeClass(options.linkHover).blur().parent().removeClass('active-menuitem');
334334 }
335335 }

Status & tagging log