r72887 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72886‎ | r72887 | r72888 >
Date:23:32, 12 September 2010
Author:dale
Status:deferred
Tags:
Comment:
some polish on the page helpers.
Flattened sequence file pages link to sequencer.
Added withJs to 'edit this sequence' link in embed code
Modified paths:
  • /branches/MwEmbedStandAlone/modules/AddMedia/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/AddMedia/loader.js
@@ -58,9 +58,9 @@
5959 '$j.browserTest', // ( textSelection uses browserTest )
6060 '$j.ui'
6161 ], [
62 - '$j.ui.resizable',
 62+ '$j.widget',
6363 '$j.ui.mouse',
64 - '$j.widget',
 64+ '$j.ui.resizable',
6565 '$j.ui.position',
6666 '$j.ui.draggable',
6767 '$j.ui.dialog',
Index: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
@@ -2713,7 +2713,7 @@
27142714 getTemplateDescription: function( resource ) {
27152715 // setup the resource description from resource description:
27162716 // FIXME: i18n, namespace
2717 - var description = '{{Information ' + "\n";
 2717+ var description ='{{Information ' + "\n";
27182718
27192719 if ( resource.desc ) {
27202720 description += '|Description= ' + resource.desc + "\n";
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
@@ -88,6 +88,9 @@
8989 $menuBar = $j( '<ul />' )
9090 .addClass( 'k-menu-bar' );
9191
 92+ // dont include about player menu item ( @@ should be moved to a init function )
 93+ delete ctrlObj.supportedMenuItems['aboutPlayerLibrary'];
 94+
9295 // Output menu item containers:
9396 for ( var menuItem in ctrlObj.supportedMenuItems ) {
9497 $menuBar.append(
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
@@ -356,41 +356,46 @@
357357 }, function(){
358358 // this should be depreciated ( hidden interface bug in mwEmbed )
359359 $j('#publishVideoTarget').parent().show();
360 - // Start up the render
361 - var foggRender = $j('#publishVideoTarget').firefoggRender({
362 - 'statusTarget' : '#firefoggStatusTarget',
363 - 'saveToLocalFile' : localFile,
364 - 'onProgress' : function( progress ){
365 - var progressPrecent = ( Math.round( progress * 10000 ) / 100 );
366 - $j('#firefoggPercentDone').text(
367 - progressPrecent +
368 - '%'
369 - )
370 - $j("#firefoggProgressbar").progressbar({
371 - "value" : Math.round( progress * 100 )
372 - });
373 - // xxx WTF? no idea why progressbar above is not working
374 - $j("#firefoggProgressbar .ui-progressbar-value").css('width', Math.round( progress * 10000 ) / 100 + '%');
375 - },
376 - 'doneRenderCallback': function( fogg ){
377 - if( localFile ){
378 - $dialog.html( gM('mwe-sequencer-save_done') );
379 - } else {
380 - _this.uploadRenderedVideo( $dialog, fogg );
 360+
 361+ // wait 100ms before starting the firefogg render ( avoids page lock
 362+ // and ensures we don't get a loading spinner for first frame of render)
 363+ setTimeout(function(){
 364+ // Start up the render
 365+ var foggRender = $j('#publishVideoTarget').firefoggRender({
 366+ 'statusTarget' : '#firefoggStatusTarget',
 367+ 'saveToLocalFile' : localFile,
 368+ 'onProgress' : function( progress ){
 369+ var progressPrecent = ( Math.round( progress * 10000 ) / 100 );
 370+ $j('#firefoggPercentDone').text(
 371+ progressPrecent +
 372+ '%'
 373+ )
 374+ $j("#firefoggProgressbar").progressbar({
 375+ "value" : Math.round( progress * 100 )
 376+ });
 377+ // xxx WTF? no idea why progressbar above is not working
 378+ $j("#firefoggProgressbar .ui-progressbar-value").css('width', Math.round( progress * 10000 ) / 100 + '%');
 379+ },
 380+ 'doneRenderCallback': function( fogg ){
 381+ if( localFile ){
 382+ $dialog.html( gM('mwe-sequencer-save_done') );
 383+ } else {
 384+ _this.uploadRenderedVideo( $dialog, fogg );
 385+ }
381386 }
 387+ });
 388+ var buttons = {};
 389+ buttons[ gM('mwe-cancel') ] = function(){
 390+ foggRender.stopRender();
 391+ $j( this ).dialog( 'close' );
382392 }
383 - });
384 - var buttons = {};
385 - buttons[ gM('mwe-cancel') ] = function(){
386 - foggRender.stopRender();
387 - $j( this ).dialog( 'close' );
388 - }
389 - // Add cancel button
390 - $dialog.dialog( "option", "buttons", buttons );
391 - if( !foggRender.doRender() ){
392 - // do render returns false on firefox gui cancel close the dialog:
393 - $dialog.dialog("close");
394 - }
 393+ // Add cancel button
 394+ $dialog.dialog( "option", "buttons", buttons );
 395+ if( !foggRender.doRender() ){
 396+ // do render returns false on firefox gui cancel close the dialog:
 397+ $dialog.dialog("close");
 398+ }
 399+ }, 100);
395400 });
396401 },
397402
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
@@ -118,7 +118,7 @@
119119 wrapSequencerWikiText : function( xmlString ){
120120 var _this = this;
121121 if( !_this.currentSequencePage.pageStart ){
122 - _this.currentSequencePage.pageStart ="\nTo edit this sequence " +
 122+ _this.currentSequencePage.pageStart ="\nTo edit or view this sequence " +
123123 '[{{fullurl:{{FULLPAGENAME}}|withJS=MediaWiki:MwEmbed.js}} enable the sequencer] for this page';
124124 }
125125 return _this.currentSequencePage.pageStart +
@@ -313,7 +313,12 @@
314314 getCommonsDescriptionText: function(){
315315 var _this = this;
316316
317 - var descText ="{{Information\n" +
 317+ var descText = '<!-- ' +
 318+ "Note: this is an automated file description for a published video sequence. \n"
 319+ "Changes to this wikitext will be overwiten. Please add metadata and categories to\n" +
 320+ _this.getTitleKey() + " instead --> \n";
 321+
 322+ descText += "{{Information\n" +
318323 "|Description=" + _this.getBaseFileDescription() + "\n" +
319324 "|Source= Sequence Sources assets include:\n";
320325
@@ -335,10 +340,11 @@
336341 pad2(dt.getMonth()+1) + '-' +
337342 pad2(dt.getDate()) + "\n" +
338343 "|Author=Last edit by [[User:" + _this.getUserName() + "]]\n" +
339 - "|Permission= {{Cc-by-nc-sa-2.0-dual}}" + "\n" +
 344+ "For full editor list see history page of [[" + _this.getTitleKey() + "]] \n" +
 345+ "|Permission={{Cc-by-sa-3.0}} and {{GFDL|migration=redundant}}" + "\n" +
340346 "}}";
341347
342 - // Add Published Sequence category ( for now )
 348+ // Add Published Sequence category ( for now )
343349 descText += "\n[[Category:Published Sequence]]\n";
344350 return descText;
345351 },
Index: branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
@@ -37,7 +37,7 @@
3838 *
3939 * @param {String} url The url to be wrapped
4040 */
41 -mw.getRemoteSequencerLink = function( url ){
 41+mw.getRemoteSequencerLink = function( url ){
4242 if( mw.getConfig( 'Sequencer.WithJsMwEmbedUrlHelper' ) ){
4343 if( url.indexOf('?') == -1){
4444 url+='?'
@@ -90,7 +90,7 @@
9191 || embedPlayer.instanceOf.toLowerCase() == 'smil'
9292 || embedPlayer.getHeight() < 180
9393 || embedPlayer.getWidth() < 240
94 - // For now require that the video is a flat sequence special key: Sequence-
 94+ // Require that the video is a flat sequence special key: Sequence-
9595 || embedPlayer.apiTitleKey.indexOf('Sequence-') != 0
9696 ){
9797 return ;
@@ -200,9 +200,12 @@
201201 * @param {Object} options RemoteMwSequencer options
202202 */
203203 init: function( options ) {
204 - this.action = ( options.action )? options.action : this.action;
205 - this.title = ( options.title )? options.title : this.title;
206 - this.target = ( options.target )? options.target : this.target;
 204+ if( ! options.action || ! options.titleKey || ! options.target){
 205+ mw.log("Error sequence remote missing action, title or target");
 206+ }
 207+ this.action = options.action;
 208+ this.titleKey = options.titleKey;
 209+ this.target = options.target;
207210 },
208211
209212 drawUI: function() {
@@ -251,6 +254,17 @@
252255 }
253256 },
254257
 258+ showViewFlattenedFile: function(){
 259+ var _this = this;
 260+ //just update the edit button:
 261+ $j('#ca-edit a')
 262+ .html( $j('<span />').text( gM('mwe-sequencer-edit-sequence' ) ) )
 263+ .click(function(){
 264+ _this.showEditor();
 265+ return false;
 266+ })
 267+ },
 268+
255269 showEditUI: function(){
256270 var _this = this;
257271 $j('#bodyContent').prepend(
@@ -444,7 +458,7 @@
445459
446460 return '[[' + this.getSequenceFileKey() + "|thumb|400px|right|\n\n" +
447461 "Sequence " + this.getTitle() + " \n\n" +
448 - "<br/>Edit this sequence with the [" +
 462+ "&lt;br&gt;Edit this sequence with the [" +
449463 mw.getRemoteSequencerLink ( editLink ) +
450464 ' kaltura editor] ]]';
451465 },
@@ -491,7 +505,7 @@
492506 server: {
493507 'type' : 'mediaWiki',
494508 'url' : _this.getApiUrl(),
495 - 'titleKey' : wgPageName,
 509+ 'titleKey' : _this.titleKey,
496510 'pagePathUrl' : wgServer + wgArticlePath,
497511 'userName' : wgUserName
498512 },
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -72,11 +72,13 @@
7373 * Wikimedia specific config
7474 ********************************/
7575 mw.setConfig( 'Sequencer.KalturaPlayerEditOverlay', true );
 76+mw.setConfig( 'Sequencer.WithJsMwEmbedUrlHelper', true );
7677 mw.setConfig( 'EmbedPlayer.KalturaAttribution', true );
7778 mw.setConfig( 'SwarmTransport.Enable', true );
7879 mw.setConfig( 'SmilPlayer.AssetDomainWhiteList', ['upload.wikimedia.org'] );
7980
8081
 82+
8183 // Use wikibits onLoad hook: ( since we don't have js2 / mw object loaded )
8284 addOnloadHook( function() {
8385 doPageSpecificRewrite();
@@ -135,8 +137,8 @@
136138 } );
137139 return ;
138140 }
139 - }
140 -
 141+ }
 142+
141143 // Remote Sequencer
142144 if( wgPageName.indexOf( "Sequence:" ) === 0 ){
143145 //console.log( 'spl: ' + typeof mwSetPageToLoading );
@@ -226,14 +228,25 @@
227229 if ( vidIdList.length > 0 ) {
228230 // Reverse order the array so videos at the "top" get swapped first:
229231 vidIdList = vidIdList.reverse();
230 - mwLoadPlayer( function(){
231 - //Load the "EmbedPlayer" module:
232 - // All the actual code was requested in our single script-loader call
233 - // but the "load" request applies the setup.
234 - mw.load( 'EmbedPlayer', function() {
235 - // Do utility rewrite of OggHandler content:
236 - rewrite_for_OggHandler( vidIdList );
237 - } );
 232+ mwLoadPlayer( function(){
 233+
 234+ // Check for flat file page:
 235+ var flatFilePretext = "File:Sequence-";
 236+ if( wgPageName.indexOf(flatFilePretext ) === 0
 237+ &&
 238+ wgPageName.indexOf('.ogv') !== -1 )
 239+ {
 240+ var sequenceTitle = 'Sequence:' + wgPageName.substring( flatFilePretext.length, wgPageName.length - 4 );
 241+ window.mwSequencerRemote = new mw.MediaWikiRemoteSequencer({
 242+ 'action': wgAction,
 243+ 'titleKey' : sequenceTitle,
 244+ 'target' : '#bodyContent'
 245+ });
 246+ window.mwSequencerRemote.showViewFlattenedFile()
 247+ }
 248+
 249+ // Do utility rewrite of OggHandler content:
 250+ rewrite_for_OggHandler( vidIdList );
238251 } );
239252 return ;
240253 }

Status & tagging log