Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [59433] trunk/phase3/js2

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


dale at svn

Nov 25, 2009, 11:34 AM

Post #1 of 1 (63 views)
Permalink
SVN: [59433] trunk/phase3/js2

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

Revision: 59433
Author: dale
Date: 2009-11-25 19:34:49 +0000 (Wed, 25 Nov 2009)

Log Message:
-----------
* restored basic firefogg upload functionality per r59320 breakage
* show preview of encoding video by default

Modified Paths:
--------------
trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js
trunk/phase3/js2/uploadPage.js

Modified: trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
===================================================================
--- trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js 2009-11-25 19:29:07 UTC (rev 59432)
+++ trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js 2009-11-25 19:34:49 UTC (rev 59433)
@@ -28,11 +28,8 @@

var default_firefogg_options = {
// Callback for upload completion
- 'done_upload_cb': false,
+ 'done_upload_cb': false,

- // True if Firefogg is enabled in the client
- 'have_firefogg': false,
-
// The API URL to upload to
'api_url': null,

@@ -86,7 +83,10 @@
'firefogg_form_action': true,

// True if we should show a preview of the encoding progress
- 'show_preview': false
+ 'show_preview': true,
+
+ //If we should enable chunk uploads ( mediaWiki api supports chunk uploads)
+ 'enable_chunks' : false
};


@@ -242,7 +242,6 @@

// Now show the form
$j( _this.selector ).show();
-
if ( _this.getFirefogg() ) {
// Firefogg enabled
// If we're in upload mode, show the input filename
@@ -395,10 +394,11 @@
* Display an upload progress overlay. Overrides the function in mvBaseUploadInterface.
*/
displayProgressOverlay: function() {
- this.pe_displayProgressOverlay();
+ this.pe_displayProgressOverlay();
// If we are uploading video (not in passthrough mode), show preview button
- if( this.getFirefogg() && !this.getEncoderSettings()['passthrough']
- && !this.isCopyUpload() )
+ if( this.getFirefogg()
+ && !this.isCopyUpload()
+ && !this.getEncoderSettings()['passthrough'] )
{
this.createPreviewControls();
}
@@ -409,10 +409,19 @@
*/
createPreviewControls: function() {
var _this = this;
+
+ // Set the initial button html:
+ var buttonHtml = '';
+ if( _this.show_preview == true ){
+ buttonHtml = $j.btnHtml( gM( 'fogg-hidepreview' ), 'fogg_preview', 'triangle-1-s' );
+ } else {
+ buttonHtml = $j.btnHtml( gM( 'fogg-preview' ), 'fogg_preview', 'triangle-1-e' );
+ }
+
// Add the preview button and canvas
$j( '#upProgressDialog' ).append(
'<div style="clear:both;height:3em"/>' +
- $j.btnHtml( gM( 'fogg-preview' ), 'fogg_preview', 'triangle-1-e' ) +
+ buttonHtml +
'<div style="padding:10px;">' +
'<canvas style="margin:auto;" id="fogg_preview_canvas" />' +
'</div>'
@@ -421,14 +430,6 @@
// Set the initial state
if ( _this.show_preview == true ) {
$j( '#fogg_preview_canvas' ).show();
- } else {
- // Fix the icon class
- $j( this ).children( '.ui-icon' )
- .removeClass( 'ui-icon-triangle-1-s' )
- .addClass( 'ui-icon-triangle-1-e' );
- // Set the button text
- $j( this ).children( '.btnText' ).text( gM( 'fogg-preview' ) );
- $j( '#fogg_preview_canvas' ).hide();
}

// Bind the preview button
@@ -556,7 +557,7 @@
*/
updateSourceFileUI: function() {
js_log( 'videoSelectReady' );
-
+ var _this = this;
if ( !_this.fogg.sourceInfo || !_this.fogg.sourceFilename ) {
// Something wrong with the source file?
js_log( 'selectSourceFile: sourceInfo/sourceFilename missing' );
@@ -620,7 +621,7 @@
return false;
}
try {
- this.sourceFileInfo = JSON.parse( firefogg.sourceInfo );
+ this.sourceFileInfo = JSON.parse( this.fogg.sourceInfo );
} catch ( e ) {
js_error( 'error could not parse fogg sourceInfo' );
return false;
@@ -797,21 +798,23 @@
js_log( "firefogg: doUpload:: " +
( this.getFirefogg() ? 'on' : 'off' ) +
' up mode:' + _this.upload_mode );
-
- // If Firefogg is disabled, just invoke the parent method
- if( !this.getFirefogg() || !this.firefogg_form_action ) {
+
+ // If Firefogg is disabled or doing an copyByUrl upload, just invoke the parent method
+ if( !this.getFirefogg() || this.isCopyUpload() ) {
_this.pe_doUpload();
return;
}
-
- if ( _this.upload_mode == 'post' ) {
+ // We can do a chunk upload
+ if( _this.upload_mode == 'post' && _this.enable_chunks ){
+ _this.doChunkUpload();
+ } else if ( _this.upload_mode == 'post' ) {
// Encode and then do a post upload
_this.doEncode(
function /* onProgress */ ( progress ) {
_this.updateProgress( progress );
},
function /* onDone */ () {
- js_log( 'done with encoding do POST upload:' + _this.editForm.action );
+ js_log( 'done with encoding do POST upload:' + _this.form.action );
// ignore warnings & set source type
//_this.formData[ 'wpIgnoreWarning' ]='true';
_this.formData['wpSourceType'] = 'upload';
@@ -824,9 +827,6 @@
_this.doUploadStatus();
}
);
- } else if ( _this.upload_mode == 'api' ) {
- // We have the API so we can do a chunk upload
- _this.doChunkUpload();
} else {
js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
}
@@ -1027,34 +1027,30 @@
js_log( 'Error:firefogg upload error: ' + _this.fogg.state );
return;
}
-
- if ( _this.upload_mode == 'api' ) {
- if ( apiResult && apiResult.resultUrl ) {
- var buttons = {};
- buttons[ gM( 'mwe-go-to-resource' ) ] = function() {
- window.location = apiResult.resultUrl;
- }
- var go_to_url_txt = gM( 'mwe-go-to-resource' );
- var showMessage = true;
- if ( typeof _this.done_upload_cb == 'function' ) {
- // Call the callback
- // It will return false if it doesn't want us to show our own "done" message
- showMessage = _this.done_upload_cb( _this.formData );
- }
- if ( showMessage ) {
- _this.updateProgressWin( gM( 'mwe-successfulupload' ),
- gM( 'mwe-upload_done', apiResult.resultUrl ), buttons );
- } else {
- this.action_done = true;
- $j( '#upProgressDialog' ).empty().dialog( 'close' );
- }
+ if ( apiResult && apiResult.resultUrl ) {
+ var buttons = {};
+ buttons[ gM( 'mwe-go-to-resource' ) ] = function() {
+ window.location = apiResult.resultUrl;
+ }
+ var go_to_url_txt = gM( 'mwe-go-to-resource' );
+ var showMessage = true;
+ if ( typeof _this.done_upload_cb == 'function' ) {
+ // Call the callback
+ // It will return false if it doesn't want us to show our own "done" message
+ showMessage = _this.done_upload_cb( _this.formData );
+ }
+ if ( showMessage ) {
+ _this.updateProgressWin( gM( 'mwe-successfulupload' ),
+ gM( 'mwe-upload_done', apiResult.resultUrl ), buttons );
} else {
- // Done state with error? Not really possible given how firefogg works...
- js_log( " Upload done in chunks mode, but no resultUrl!" );
+ this.action_done = true;
+ $j( '#upProgressDialog' ).empty().dialog( 'close' );
}
} else {
- js_log( "Error:: not supported upload mode" + _this.upload_mode );
+ // Done state with error? Not really possible given how firefogg works...
+ js_log( " Upload done in chunks mode, but no resultUrl!" );
}
+
}
uploadStatus();
},
@@ -1068,7 +1064,7 @@
}
js_log( 'firefogg:cancel' )
if ( confirm( gM( 'mwe-cancel-confim' ) ) ) {
- // FIXME: sillyness
+ // FIXME: sillyness ( upstream firefogg cancel fix needed )
if ( navigator.oscpu && navigator.oscpu.search( 'Win' ) >= 0 ) {
alert( 'sorry we do not yet support cancel on windows' );
} else {

Modified: trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js
===================================================================
--- trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js 2009-11-25 19:29:07 UTC (rev 59432)
+++ trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js 2009-11-25 19:34:49 UTC (rev 59433)
@@ -133,9 +133,15 @@
// set up the binding per the config
if ( opt.enable_fogg ) {
$j( "#wpUploadFile" ).firefogg( {
- // an api url (we won't submit directly to action of the form)
+ // An api url (we won't submit directly to action of the form)
'api_url' : opt.api_target,
+
+ // If we should do a form rewrite
'form_rewrite': true,
+
+ // MediaWiki API supports chunk uploads:
+ 'enable_chunks' : true,
+
'edit_form_selector' : '#suf-upload',
'new_source_cb' : function( orgFilename, oggName ) {
$j( "#wpDestFile" ).val( oggName ).doDestCheck( {

Modified: trunk/phase3/js2/uploadPage.js
===================================================================
--- trunk/phase3/js2/uploadPage.js 2009-11-25 19:29:07 UTC (rev 59432)
+++ trunk/phase3/js2/uploadPage.js 2009-11-25 19:34:49 UTC (rev 59433)
@@ -10,7 +10,7 @@
var _this = this;
// If wgEnableFirefogg is not boolean false, set to true
if ( typeof wgEnableFirefogg == 'undefined' )
- wgEnableFirefogg = true;
+ wgEnableFirefogg = true;

if ( wgEnableFirefogg ) {
// Set up the upload handler to Firefogg. Should work with the HTTP uploads too.
@@ -18,6 +18,8 @@
// An API URL (we won't submit directly to action of the form)
'api_url': wgServer + wgScriptPath + '/api.php',
'form_rewrite': true,
+ // MediaWiki API supports chunk uploads:
+ 'enable_chunks' : true,
'edit_form_selector': mwUploadFormSelector,
'new_source_cb': function( orgFilename, oggName ) {
$j( '#wpDestFile' ).val( oggName );



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

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.