Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js |
— | — | @@ -179,7 +179,6 @@ |
180 | 180 | |
181 | 181 | // FIXME: move this to configuration and avoid this API request |
182 | 182 | mw.getJSON( _this.api_url, { 'action' : 'paraminfo', 'modules' : 'upload' }, function( data ) { |
183 | | - debugger; |
184 | 183 | if ( typeof data.paraminfo == 'undefined' |
185 | 184 | || typeof data.paraminfo.modules == 'undefined' ) |
186 | 185 | { |
— | — | @@ -250,7 +249,11 @@ |
251 | 250 | var $form = $j( this.form_selector ); |
252 | 251 | |
253 | 252 | // Set the form action |
254 | | - $form.attr('action', _this.api_url); |
| 253 | + try{ |
| 254 | + $form.attr('action', _this.api_url); |
| 255 | + }catch(e){ |
| 256 | + mw.log("IE for some reason error's out when you change the action") |
| 257 | + } |
255 | 258 | |
256 | 259 | // Add API action |
257 | 260 | if ( $form.find( "[name='action']" ).length == 0 ){ |
— | — | @@ -304,32 +307,35 @@ |
305 | 308 | $j( '#upProgressDialog' ).html( |
306 | 309 | mw.loading_spinner() |
307 | 310 | ); |
308 | | - |
| 311 | + |
309 | 312 | // Add the iframe |
310 | 313 | _this.iframeId = 'f_' + ( $j( 'iframe' ).length + 1 ); |
311 | | - $j( "body" ).append( '<iframe src="javascript:false;" id="' + _this.iframeId + '" ' + |
312 | | - 'name="' + _this.iframeId + '" style="display:none;" ></iframe>' ); |
| 314 | + $j( "body" ).append( |
| 315 | + $j('<iframe />') |
| 316 | + .attr({ |
| 317 | + 'src':'javascript:false;', |
| 318 | + 'id':_this.iframeId, |
| 319 | + 'name': _this.iframeId |
| 320 | + }) |
| 321 | + .css('display', 'none') |
| 322 | + ); |
313 | 323 | |
| 324 | + |
314 | 325 | // Set the form target to the iframe |
315 | 326 | $form.attr( 'target', _this.iframeId ); |
| 327 | + |
316 | 328 | |
317 | 329 | // Set up the completion callback |
318 | 330 | $j( '#' + _this.iframeId ).load( function() { |
319 | 331 | _this.processIframeResult( $j( this ).get( 0 ) ); |
320 | | - }); |
321 | | - |
322 | | - // Set the action to the API URL: |
323 | | - $form.attr( 'action', _this.api_url ); |
324 | | - |
325 | | - mw.log( 'Do iframe form submit of: ' + $form.attr( 'target' ) + ' to: ' + $form.attr('action') ); |
326 | | - mw.log( ' destName:' + $form.find( "[name='filename']" ).val() ); |
327 | | - mw.log( ' content:' + $form.find( "[name='comment']" ).val() ); |
328 | | - |
| 332 | + }); |
| 333 | + |
329 | 334 | // Do post override |
330 | 335 | _this.form_post_override = true; |
331 | 336 | |
332 | 337 | // Reset the done with action flag |
333 | 338 | _this.action_done = false; |
| 339 | + mw.log("about to submit form:"); |
334 | 340 | $form.submit(); |
335 | 341 | }, |
336 | 342 | |
— | — | @@ -978,17 +984,26 @@ |
979 | 985 | // Add the wpDestFile-warning row |
980 | 986 | if ( $j( '#wpDestFile-warning' ).length == 0 ) { |
981 | 987 | $j( '#mw-htmlform-options tr:last' ) |
982 | | - .after( '<tr><td></td><td id="wpDestFile-warning"></td></tr>' ); |
| 988 | + .after( |
| 989 | + $j('<tr />' ) |
| 990 | + .append( '<td />' ) |
| 991 | + .append( '<td />' ) |
| 992 | + .attr('id', 'wpDestFile-warning') |
| 993 | + ); |
983 | 994 | } |
984 | | - |
| 995 | + mw.log( 'past dest'); |
985 | 996 | // Remove any existing warning |
986 | 997 | $j( opt.warn_target ).empty(); |
987 | | - |
| 998 | + mw.log( 'past remove warn:: ' + _this.selector); |
988 | 999 | // Show the AJAX spinner |
989 | | - $j( _this.selector ) |
990 | | - .append( '<img id="mw-spinner-wpDestFile" ' + |
991 | | - 'src ="' + stylepath + '/common/images/spinner.gif" />' ); |
992 | | - |
| 1000 | + $j( _this.selector ).after( |
| 1001 | + $j('<img />') |
| 1002 | + .attr({ |
| 1003 | + 'id' : "mw-spinner-wpDestFile", |
| 1004 | + 'src' : stylepath + '/common/images/spinner.gif' |
| 1005 | + }) |
| 1006 | + ); |
| 1007 | + mw.log("added spiner"); |
993 | 1008 | var request = { |
994 | 1009 | 'titles': 'File:' + $j( _this.selector ).val(), |
995 | 1010 | 'prop': 'imageinfo', |