Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js |
— | — | @@ -218,10 +218,25 @@ |
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | } |
| 222 | + |
| 223 | + // Reinstate the ['name'=comment'] filed since |
| 224 | + // commons hacks removes wgUploadDesction from the form |
| 225 | + var $form = $j( this.form ); |
| 226 | + if( $form.find("[name='comment']").length == 0) { |
| 227 | + $form.append( |
| 228 | + $j('<input />') |
| 229 | + .attr({ |
| 230 | + 'name': 'comment', |
| 231 | + 'type' : 'hidden' |
| 232 | + }) |
| 233 | + ) |
| 234 | + } |
| 235 | + $form.find("[name='comment']").val( _this.getUploadDescription() ); |
| 236 | + |
222 | 237 | // Check for post action |
223 | | - // formDirectSubmit is needed to actualy do the upload via a form "submit" |
| 238 | + // formDirectSubmit is needed to actually do the upload via a form "submit" |
224 | 239 | if ( this.formDirectSubmit ) { |
225 | | - mw.log("direct submit: "); |
| 240 | + mw.log("direct submit: " ); |
226 | 241 | return true; |
227 | 242 | } |
228 | 243 | |
— | — | @@ -379,7 +394,7 @@ |
380 | 395 | ) |
381 | 396 | } |
382 | 397 | |
383 | | - // Add JSON response format |
| 398 | + // Add JSON response format (jsonfm so that IE does not prompt save dialog box on iframe result ) |
384 | 399 | if ( $form.find( "[name='format']" ).length == 0 ) { |
385 | 400 | $form.append( |
386 | 401 | $j( '<input />' ) |
— | — | @@ -459,19 +474,6 @@ |
460 | 475 | // Do normal post upload override |
461 | 476 | _this.formDirectSubmit = true; |
462 | 477 | |
463 | | - // Update the wpDescription ( add if not present) |
464 | | - // commons does some ugly hacks that remove wgUploadDesction from the form |
465 | | - if( $form.find("[name='comment']").length == 0) { |
466 | | - $form.append( |
467 | | - $j('<input />') |
468 | | - .attr({ |
469 | | - 'name': 'comment', |
470 | | - 'type' : 'hidden' |
471 | | - }) |
472 | | - ) |
473 | | - } |
474 | | - $form.find("[name='comment']").val( _this.getUploadDescription() ); |
475 | | - |
476 | 478 | |
477 | 479 | mw.log('About to submit:' + $form.find("[name='comment']").val() ); |
478 | 480 | /* |