r55273 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55272‎ | r55273 | r55274 >
Date:21:12, 18 August 2009
Author:dale
Status:deferred
Tags:
Comment:
* fixes for multiple iframes target mismatch for single page
** lays groundwork for multiple in-page uploads
Modified paths:
  • /trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -77,10 +77,9 @@
7878 }
7979 },
8080 setupForm:function(){
81 - var _this = this;
 81+ var _this = this;
8282 //set up the local pointer to the edit form:
83 - _this.editForm = _this.getEditForm();
84 - $j(_this.editForm).attr('target', 'f_1');
 83+ _this.editForm = _this.getEditForm();
8584 if( _this.editForm ){
8685 //set up the org_onsubmit if not set:
8786 if( typeof( _this.org_onsubmit ) == 'undefined' && _this.editForm.onsubmit )
@@ -182,15 +181,20 @@
183182 ( $j('#wpSourceTypeFile').length == 0 || $j('#wpSourceTypeFile').get(0).checked )
184183 ){
185184 //@@TODO check for sendAsBinnary to support firefox 3.5 progress
186 - //else remap to iframe target
187 - var id = 'f_' + ($j('iframe').length + 1);
188 - $j("body").append('<iframe src="javascript:false;" id="' + id + '" ' +
189 - 'name="' + id + '" style="display:none;" ></iframe>');
 185+
 186+ //set the form target to iframe target:
 187+ _this.iframeId = 'f_' + ($j('iframe').length + 1);
 188+ $j(_this.editForm).attr('target', _this.iframeId);
 189+
 190+ //add the iframe
 191+ $j("body").append('<iframe src="javascript:false;" id="' + _this.iframeId + '" ' +
 192+ 'name="' + _this.iframeId + '" style="display:none;" ></iframe>');
 193+
190194 //set up the done binding
191 - $j('#' + id).load(function(){
192 - var iframe = $j(this).get(0);
193 - _this.proccessIframeResult( iframe );
 195+ $j('#' + _this.iframeId).load(function(){
 196+ _this.proccessIframeResult( $j(this).get(0) );
194197 });
 198+
195199 //set the editForm iframe target
196200 //$j(_this.editForm).attr('target', id);
197201
@@ -215,17 +219,14 @@
216220 //update the status to 100% progress bar (no status in iframe submit)
217221 $j('#up-progressbar' ).progressbar('value', parseInt( 100 ) );
218222 $j('#up-status-container').html( gM('upload-in-progress') );
219 -
220 -
221 - js_log('do iframe form submit');
222223
 224+ js_log('do iframe form submit to: ' + $j(_this.editForm).attr('target'));
223225
224226 //do post override
225227 _this.form_post_override = true;
226228 //reset the done with action flag:
227 - _this.action_done = false;
228 - //do the submit :
229 - js_log('do the submit');
 229+ _this.action_done = false;
 230+
230231 _this.editForm.submit();
231232
232233 return false;

Status & tagging log