r64048 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64047‎ | r64048 | r64049 >
Date:23:14, 22 March 2010
Author:dale
Status:deferred
Tags:
Comment:
some updates around upload description handling
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js
@@ -222,7 +222,6 @@
223223 // formDirectSubmit is needed to actualy do the upload via a form "submit"
224224 if ( this.formDirectSubmit ) {
225225 mw.log("direct submit: ");
226 -
227226 return true;
228227 }
229228
@@ -456,10 +455,16 @@
457456 $j( '#' + _this.iframeId ).load( function() {
458457 _this.processIframeResult( $j( this ).get( 0 ) );
459458 });
 459+
 460+ // Do normal post upload override
 461+ _this.formDirectSubmit = true;
460462
461 - // Do normal post upload override
462 - _this.formDirectSubmit = true;
 463+ // Update the wpDescription
 464+ $form.find("[name='comment']").val( _this.getUploadDescription() );
 465+
 466+
463467 mw.log('About to submit:');
 468+
464469 $form.find('input').each( function(){
465470 mw.log( $j(this).attr( 'name' ) + ' :: ' + $j(this).val() );
466471 })
@@ -502,7 +507,7 @@
503508 mw.log( 'getUploadDescription:: base:' + comment_value + ' ucr:' + this.rewriteDescriptionText );
504509 // Set license, copyStatus, source if available ( generally not available SpecialUpload needs some refactoring )
505510 if ( this.rewriteDescriptionText ) {
506 - var license = ( $j("[name='wpLicense']").length ) ? $j("[name='wpLicense']").val() : '';
 511+ var license = ( $j("[name='wpLicense']").length ) ? $j("[name='wpLicense']").val() : '';
507512 var copyStatus = ( $j("[name='wpUploadCopyStatus']" ).length ) ? $j("[name='wpUploadCopyStatus']" ).val() : '';
508513 var source = ( $j("[name='wpSource']").length ) ? $j("[name='wpSource']").val() : '';
509514
@@ -523,19 +528,17 @@
524529 * @param {String} copyStatus the copyright status field
525530 * @param {String} source The source filed
526531 */
527 - getCommentText: function( comment, license, copyStatus, source ) {
528 - var licensetxt = '';
529 - if ( license != '' ) {
530 - licensetxt = '== ' + gM( 'license-header' ) + " ==\n" + '{{' + license + '}}' + "\n";
531 - }
532 - pageText = '== ' + gM( 'filedesc' ) + " ==\n" + comment + "\n";
 532+ getCommentText: function( comment, license, copyStatus, source ) {
 533+ var pageText = '== ' + gM( 'filedesc' ) + " ==\n" + comment + "\n";
533534 if( copyStatus ){
534 - pageText += '== ' + gM( 'filestatus' ) + " ==\n" + copyStatus + "\n" +
535 - licensetxt;
 535+ pageText += '== ' + gM( 'filestatus' ) + " ==\n" + copyStatus + "\n";
536536 }
537537 if( source ){
538 - pageText += '== ' + gM( 'filesource' ) + " ==\n" + source ;
 538+ pageText += '== ' + gM( 'filesource' ) + " ==\n" + source + "\n";
539539 }
 540+ if ( license ) {
 541+ pageText += '== ' + gM( 'license-header' ) + " ==\n" + '{{' + license + '}}' + "\n";
 542+ }
540543 return pageText;
541544 },
542545
@@ -792,13 +795,11 @@
793796 'sessionkey': _this.warnings_sessionkey,
794797 'ignorewarnings': 1,
795798 'token' : _this.getToken(),
796 - 'filename' : _this.getFileName()
 799+ 'filename' : _this.getFileName(),
 800+ 'comment' : $j( this.form ).find( "[name='comment']" ).val()
797801 };
798 - // presently we don't let the user update desc at ignoreWarningsSubmit
799 - /*
800 - 'comment' : _this.getUploadDescription()
801 - */
802802
 803+
803804 //run the upload from stash request
804805 mw.getJSON(_this.apiUrl, request, function( data ) {
805806 _this.processApiResult( data );
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js
@@ -962,8 +962,9 @@
963963 } );
964964
965965 }
 966+ // Update the formData 'comment' per the upload description
 967+ $j(this.form).find("[name='comment']").val( _this.getUploadDescription() );
966968
967 -
968969 // Get the input form data into an array
969970 mw.log( 'get this.formData ::' );
970971 var data = $j( this.form ).serializeArray();
@@ -977,8 +978,10 @@
978979 this.formData[ data[i]['name'] ] = data[i]['value'];
979980 }
980981 }
981 - }
 982+ }
 983+
982984
 985+
983986 // Get the edit token from formData if it's not set already
984987 if ( !_this.editToken && _this.formData['token'] ) {
985988 _this.editToken = _this.formData['token'];
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -4,7 +4,7 @@
55 */
66 var urlparts = getRemoteEmbedPath();
77 var mwEmbedHostPath = urlparts[0];
8 -var mwRemoteVersion = 'r112';
 8+var mwRemoteVersion = 'r113';
99
1010 // Log the mwRemote version ( will determine what version of js we get )
1111 if( window.console ){

Status & tagging log