r50114 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50113‎ | r50114 | r50115 >
Date:23:22, 1 May 2009
Author:dale
Status:deferred
Tags:
Comment:
fixes for upload
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvUploader.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_baseEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js
@@ -212,6 +212,12 @@
213213 var _this = this;
214214 _this.fogg.encode( JSON.stringify( _this.encoder_settings ) );
215215
 216+ //show transcode status:
 217+ $j('#fogg-status-transcode').show();
 218+
 219+ //hide the fogg-status-upload
 220+ $j('#fogg-status-upload').hide();
 221+
216222 //setup a local function for timed callback:
217223 var encodingStatus = function() {
218224 var status = _this.fogg.status();
@@ -222,15 +228,7 @@
223229 //loop to get new status if still encoding
224230 if( _this.fogg.state == 'encoding' ) {
225231 setTimeout(encodingStatus, 500);
226 - }else if ( _this.fogg.state == 'encoding done' ) { //encoding done, state can also be 'encoding failed'
227 - //now call the upload function
228 -
229 - //hide the fogg-status-transcode
230 - $j('#fogg-status-transcode').hide();
231 -
232 - //show the fogg-status-upload
233 - $j('#fogg-status-upload').show();
234 -
 232+ }else if ( _this.fogg.state == 'encoding done' ) { //encoding done, state can also be 'encoding failed
235233 // ignore warnings & set source type
236234 //_this.formData[ 'wpIgnoreWarning' ]='true';
237235 _this.formData[ 'wpSourceType' ]='file';
@@ -255,6 +253,10 @@
256254 },
257255 doUploadStatus:function() {
258256 var _this = this;
 257+ //setup display for upload status:
 258+ $j('#fogg-status-transcode').hide();
 259+ $j('#fogg-status-upload').show();
 260+
259261 _this.oldResponseText = '';
260262 //setup a local function for timed callback:
261263 var uploadStatus = function(){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js
@@ -328,8 +328,8 @@
329329 '<form id="rsd_form" action="javascript:return false;" method="GET">'+
330330 '<table style="width:100%;background-color:transparent;">' +
331331 '<tr>'+
332 - '<td style="width:110px">'+
333 - '<h3> Media Search </h3>'+
 332+ '<td style="width:120px">'+
 333+ '<h3>' + gM('mv_media_search') +'</h3>'+
334334 '</td>'+
335335 '<td style="width:190px">'+
336336 '<input type="text" tabindex="1" value="' + dq + '" maxlength="512" id="rsd_q" name="rsd_q" '+
@@ -1253,10 +1253,11 @@
12541254 var about_desc ='';
12551255 if( this.content_providers[this.disp_item] ){
12561256 var cp = this.content_providers[this.disp_item];
1257 - about_desc ='<div style="position:absolute;bottom:0px;left:5px;"><i>About <a href="'+ cp.homepage + '" target="_new" >'+ cp.title +'</a> </i></div>';
 1257+ about_desc ='<span style="position:relative;top:0px;font-style:italic;">' +
 1258+ ' <i> Results From <a href="'+ cp.homepage + '" target="_new" >'+ cp.title +'</a> </i></span>';
12581259 }
1259 - $j('#rsd_results').append( about_desc + '<div id="rds_results_bar">'+
1260 - '<span style="position:relative;top:-5px;font-style:italic;">'+
 1260+ $j('#rsd_results').append( '<div id="rds_results_bar">'+
 1261+ '<span style="position:relative;top:0px;font-style:italic;">'+
12611262 gM('rsd_layout')+' '+
12621263 '</span>'+
12631264 '<img id="msc_box_layout" ' +
@@ -1267,7 +1268,8 @@
12681269 'title = "' + gM('rsd_list_layout') + '" '+
12691270 'src = "' + ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) + '" '+
12701271 'style="width:20px;height:20px;cursor:pointer;">'+
1271 - '<span id="rsd_paging_ctrl" style="position:absolute;right:5px;"></span>'+
 1272+ '<span id="rsd_paging_ctrl" style="position:absolute;right:5px;top:5px;"></span>'+
 1273+ about_desc +
12721274 '</div>'
12731275 );
12741276 //get paging with bindings:
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvUploader.js
@@ -259,13 +259,13 @@
260260 _this.doUploadSwitch();
261261 }
262262 },
263 - doUploadSwitch:function(){
 263+ doUploadSwitch:function(){
264264 js_log('mvUPload:doUploadSwitch()');
265265 var _this = this;
266266 //issue a normal post request
267 - if( _this.upload_mode == 'post' || $j('#wpSourceTypeFile').get(0).checked ){
 267+ if( _this.upload_mode == 'post' || $j('#wpSourceTypeFile').get(0).checked ){
268268 //update the status
269 - $j('#dlbox-centered').html('<h5>' + _this.getProgressTitle() + '</h5>' +
 269+ $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' +
270270 mv_get_loading_img( 'left:40%;top:20%')
271271 );
272272
@@ -275,7 +275,7 @@
276276 $j(_this.editForm).append('<input type="hidden" name="wpUpload" value="' + $j('#wpUpload').val() + '"/>');
277277 //do the submit :
278278 _this.editForm.submit();
279 - }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){
 279+ }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){
280280 //if the api is supported.. && source type is http do upload with http status updates
281281 _this.doHttpUpload();
282282 }else{
@@ -283,15 +283,21 @@
284284 }
285285 },
286286 doHttpUpload:function(){
 287+ var _this = this;
287288 //build the api query:
288 - js_log('do doHttpUpload upload!');
289 -
290 - /*do_api_req( {
291 - 'data':{ 'action':'upload','modules':'upload' },
292 - 'url':_this.api_url
293 - }, function(data){
294 - js_log('result data:')
295 - }); */
 289+ js_log('do doHttpUpload upload!');
 290+ do_api_req({
 291+ 'data':{
 292+ 'action' : 'upload',
 293+ 'url' : $j('#wpUploadFileURL').val(),
 294+ 'filename' : $j('#wpDestFile').val(),
 295+ 'comment' : $j('#wpUploadDescription').val(),
 296+ },
 297+ 'url' : _this.api_url
 298+ }, function( data ){
 299+ js_log('result data got:');
 300+ //start a timmed updates
 301+ });
296302 },
297303 getProgressTitle:function(){
298304 return gM('upload-in-progress');
@@ -311,9 +317,9 @@
312318 '<div id="fogg-pbar-container" style="border:solid thin gray;width:90%;height:15px;" >' +
313319 '<div id="fogg-progressbar" style="background:#AAC;width:0%;height:15px;"></div>' +
314320 '</div>' +
315 - '<span id="fogg-pstatus">0%</span>' +
316 - '<span id="fogg-status-transcode">' + gM('upload-transcoded-status') + '</span>'+
317 - '<span style="display:none" id="fogg-status-upload">' + gM('uploaded-status') + '</span>' +
 321+ '<span id="fogg-pstatus">0% </span>' +
 322+ '<span style="display:none" id="fogg-status-transcode">' + gM('upload-transcoded-status') + '</span>'+
 323+ '<span id="fogg-status-upload">' + gM('uploaded-status') + '</span>' +
318324 '</div>' +
319325 '<div id="dlbox-overlay" class="dlbox-overlay" style="background:#000;cursor:wait;height:100%;'+
320326 'left:0;top:0;position:fixed;width:100%;z-index:99;filter:alpha(opacity=60);'+
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -718,28 +718,27 @@
719719
720720 //does a remote or local api request based on request url
721721 //@param options: url, data, cbParam, callback
722 -function do_api_req( options, callback ){
723 - if(typeof options.data != 'object'){
724 - js_log('Error: request paramaters must be an object');
725 - return false;
 722+function do_api_req( options, callback ){
 723+ if(typeof options.data != 'object'){
 724+ return js_error('Error: request paramaters must be an object');;
726725 }
 726+ //gennerate the url if its missing:
727727 if( typeof options.url == 'undefined' ){
728 - if(!wgServer || ! wgScriptPath){
729 - js_log('Error: no api url');
730 - return false;
 728+ if(!wgServer || ! wgScriptPath){
 729+ return js_error('Error: no api url for api request');;
731730 }
732731 if (wgServer && wgScript)
733732 options.url = wgServer + wgScript;
734733 //update to api.php (if index.php was in the wgScript path):
735734 options.url = options.url.replace(/index.php/, 'api.php');
736735 }
737 - if(typeof options.data == 'undefined')
 736+ if( typeof options.data == 'undefined' )
738737 options.data = {};
739738
740739 //force format to json (if not already set)
741740 options.data['format'] = 'json';
742741
743 - js_log('do api req: ' + options.url +' data' + options.data );
 742+ js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );
744743 //build request string:
745744 if( parseUri( document.URL ).host == parseUri( options.url ).host ){
746745 //local request do api request directly
@@ -749,7 +748,7 @@
750749 data: options.data,
751750 dataType:'json', //api requests _should_ always return JSON data:
752751 async: false,
753 - success:function(data){
 752+ success:function(data){
754753 callback( data );
755754 },
756755 error:function(e){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_baseEmbed.js
@@ -2364,21 +2364,22 @@
23652365 || typeof HTMLVideoElement == 'function' ) // Opera
23662366 {
23672367 //do another test for safari:
2368 - if( this.safari ){
2369 - /*var dummyvid = document.createElement("video");
 2368+ if( this.safari ){
23702369 try{
 2370+ var dummyvid = document.createElement("video");
23712371 if (dummyvid.canPlayType("video/ogg;codecs=\"theora,vorbis\"") == "probably")
23722372 {
23732373 this.players.addPlayer( videoElementPlayer );
23742374 } else {
2375 - could add some user nagging to install the xiph qt
 2375+ //@@todo add some user nagging to install the xiph qt
23762376 }
2377 - }*/
 2377+ }catch(e){
 2378+ js_log('could not run canPlayType in safari');
 2379+ }
23782380 }else{
23792381 this.players.addPlayer( videoElementPlayer );
23802382 }
2381 - }
2382 -
 2383+ }
23832384
23842385 // Mozilla plugins
23852386 if( navigator.mimeTypes && navigator.mimeTypes.length > 0) {

Status & tagging log