r51329 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51328‎ | r51329 | r51330 >
Date:06:31, 2 June 2009
Author:dale
Status:deferred
Tags:
Comment:
fixes for non-friefog upload interface.
Modified paths:
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/skins/mvpcf/styles.css (modified) (history)
  • /branches/new-upload/phase3/js2/uploadPage.js (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/js2/uploadPage.js
@@ -8,6 +8,7 @@
99 //set up the upoload form bindings once all dom manipluation is done
1010 var mwUploadHelper = {
1111 init:function(){
 12+ var _this = this;
1213 if( wgEnableFirefogg ){
1314 //setup the upload handler to firefogg (supports our upload proccess) (should work with the http uploads too)
1415 $j('#wpUploadFile').firefogg({
@@ -35,30 +36,35 @@
3637 }
3738
3839 //check if we have http enabled & setup enable/disable toggle:
39 - if($j('#wpUploadFileURL').length != 0){
40 - var toggleUpType = function( set ){
41 - $j('#wpSourceTypeFile').get(0).checked = set;
42 - $j('#wpUploadFile').get(0).disabled = !set;
43 -
44 - $j('#wpSourceTypeURL').get(0).checked = !set;
45 - $j('#wpUploadFileURL').get(0).disabled = set;
46 - }
 40+ if($j('#wpUploadFileURL').length != 0){
4741 //set the initial toggleUpType
48 - toggleUpType(true);
 42+ _this.toggleUpType(true);
4943
5044 $j("input[name='wpSourceType']").click(function(){
51 - toggleUpType( this.id == 'wpSourceTypeFile' );
52 - });
53 - }
 45+ _this.toggleUpType( this.id == 'wpSourceTypeFile' );
 46+ });
 47+ }
5448 $j('#wpUploadFile,#wpUploadFileURL').focus(function(){
55 - toggleUpType( this.id == 'wpUploadFile' );
 49+ _this.toggleUpType( this.id == 'wpUploadFile' );
5650 }).change(function(){ //also setup the onChange event binding:
5751 if ( wgUploadAutoFill ) {
5852 mwUploadHelper.doDestinationFill( this );
5953 }
60 - });
61 - },
 54+ });
 55+ },
6256 /**
 57+ * toggleUpType sets the upload radio buttons
 58+ *
 59+ * boolean set
 60+ */
 61+ toggleUpType:function( set ){
 62+ $j('#wpSourceTypeFile').attr('checked', set);
 63+ $j('#wpUploadFile').attr('disabled', !set);
 64+
 65+ $j('#wpSourceTypeURL').attr('checked', !set);
 66+ $j('#wpUploadFileURL').attr('disabled', set);
 67+ },
 68+ /**
6369 * doDestCheck checks the destination
6470 * @@todo we should be able to configure its "targets" via parent config
6571 */
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -145,15 +145,18 @@
146146 _this.doUploadSwitch();
147147 }
148148 },
149 - doUploadSwitch:function(){
150 - js_log('mvUPload:doUploadSwitch()');
 149+ doUploadSwitch:function(){
151150 var _this = this;
 151+ js_log('mvUPload:doUploadSwitch():' + _this.upload_mode);
152152 //issue a normal post request
153 - if( _this.upload_mode == 'post' || $j('#wpSourceTypeFile').get(0).checked ){
154 - js_log('do normal submit form');
155 - //update the status to loading img:
156 - _this.updateProgressWin(_this.getProgressTitle(), mv_get_loading_img( 'left:40%;top:20%'));
 153+ if( _this.upload_mode == 'post' || //we don't support the upload api
 154+ (_this.upload_mode=='api' && $j('#wpSourceTypeFile').length ==0) // web form uplaod
 155+ ){
 156+ js_log('do ormal submit form');
 157+ //update the status to 100% progress bar:
 158+ $j( '#up-progressbar' ).progressbar('value', parseInt( 100 ) );
157159
 160+ $j('#up-status-container').html( gM('upload-in-progress') );
158161 //do normal post upload no status indicators (also since its a file I think we have to submit the form)
159162 _this.form_post_override = true;
160163
@@ -441,7 +444,7 @@
442445 },
443446 updateProgress:function( perc ){
444447 //js_log('update progress: ' + perc);
445 - $j('#up-progressbar').progressbar('value', parseInt( perc * 100 ) );
 448+ $j( '#up-progressbar' ).progressbar('value', parseInt( perc * 100 ) );
446449 $j( '#up-pstatus' ).html( parseInt( perc * 100 ) + '% - ' );
447450 },
448451 /*update to jQuery.ui progress display type */
@@ -476,8 +479,10 @@
477480 //set initial content:
478481 '<div id="up-pbar-container" style="border:solid thin gray;width:90%;height:15px;" >' +
479482 '<div id="up-progressbar" style="height:15px;"></div>' +
 483+ '<div id="up-status-container">'+
480484 '<span id="up-pstatus">0% - </span> ' +
481 - '<span id="up-status-state">' + gM('uploaded-status') + '</span> ' +
 485+ '<span id="up-status-state">' + gM('uploaded-status') + '</span> ' +
 486+ '</div>'+
482487 '</div>'
483488 )
484489 //setup progress bar:
Index: branches/new-upload/phase3/js2/mwEmbed/skins/mvpcf/styles.css
@@ -197,7 +197,7 @@
198198 height: 29px;
199199 overflow: visible;
200200 font-size: 10.4px;
201 - width: 88px;
 201+ width: 95px;
202202 float: right;
203203 display: inline;
204204 border:none;

Status & tagging log