r64061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64060‎ | r64061 | r64062 >
Date:06:30, 23 March 2010
Author:dale
Status:deferred
Tags:
Comment:
Reinstate the ['name'=comment'] filed since commons hacks removes wgUploadDesction from the form
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js
@@ -218,10 +218,25 @@
219219 return false;
220220 }
221221 }
 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+
222237 // 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"
224239 if ( this.formDirectSubmit ) {
225 - mw.log("direct submit: ");
 240+ mw.log("direct submit: " );
226241 return true;
227242 }
228243
@@ -379,7 +394,7 @@
380395 )
381396 }
382397
383 - // Add JSON response format
 398+ // Add JSON response format (jsonfm so that IE does not prompt save dialog box on iframe result )
384399 if ( $form.find( "[name='format']" ).length == 0 ) {
385400 $form.append(
386401 $j( '<input />' )
@@ -459,19 +474,6 @@
460475 // Do normal post upload override
461476 _this.formDirectSubmit = true;
462477
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 -
476478
477479 mw.log('About to submit:' + $form.find("[name='comment']").val() );
478480 /*

Status & tagging log