r64062 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64061‎ | r64062 | r64063 >
Date:07:37, 23 March 2010
Author:dale
Status:deferred
Tags:
Comment:
* fixed redirect issue in mediaWikiSearch
* fixed ignorewarning image description submit in add-media-wizard
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.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
@@ -231,7 +231,10 @@
232232 })
233233 )
234234 }
235 - $form.find("[name='comment']").val( _this.getUploadDescription() );
 235+ var uploadDesc = _this.getUploadDescription();
 236+ if( uploadDesc ) {
 237+ $form.find("[name='comment']").val( uploadDesc );
 238+ }
236239
237240 // Check for post action
238241 // formDirectSubmit is needed to actually do the upload via a form "submit"
@@ -506,6 +509,7 @@
507510 *
508511 * NOTE: wpUploadDescription should be a configuration option.
509512 *
 513+ * @param {Boolean} useCache If the upload description cache can be used.
510514 * @return {String}
511515 * value of wpUploadDescription
512516 */
@@ -516,6 +520,9 @@
517521 // Else try with the form name:
518522 comment_value = $j( "[name='comment']").val();
519523 }
 524+ if( !comment_value){
 525+ comment_value = $j( this.form ).find( "[name='comment']" ).val();
 526+ }
520527 mw.log( 'getUploadDescription:: base:' + comment_value + ' ucr:' + this.rewriteDescriptionText );
521528 // Set license, copyStatus, source if available ( generally not available SpecialUpload needs some refactoring )
522529 if ( this.rewriteDescriptionText ) {
@@ -527,6 +534,7 @@
528535 comment_value = this.getCommentText( comment_value, license, copyStatus, source );
529536 }
530537 mw.log( 'getCommentText:: new val:' + comment_value );
 538+ this.uploadDescription = comment_value;
531539 return comment_value;
532540 },
533541
@@ -810,8 +818,8 @@
811819 'ignorewarnings': 1,
812820 'token' : _this.getToken(),
813821 'filename' : _this.getFileName(),
814 - 'comment' : _this.getUploadDescription()
815 - };
 822+ 'comment' : _this.getUploadDescription( )
 823+ };
816824
817825 //run the upload from stash request
818826 mw.getJSON(_this.apiUrl, request, function( data ) {
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js
@@ -49,26 +49,9 @@
5050 'redirects' : true
5151 }
5252 mw.getJSON(this.provider.apiUrl, request, function( data ) {
53 - // check for redirect
54 - for ( var i in data.query.pages ) {
55 - var page = data.query.pages[i];
56 - if ( page.revisions[0]['*'] ) {
57 - var re = new RegExp( /[^\[]*\[\[([^\]]*)/ );
58 - var pt = page.revisions[0]['*'].match( re );
59 - if ( pt[1] ) {
60 - _this.addByTitle( pt[1], callback, redirect_count++ );
61 - return ;
62 - } else {
63 - mw.log( 'Error: addByTitle could not proccess redirect' );
64 - callback( false );
65 - return false;
66 - }
67 - }
68 - }
69 - // if not a redirect do the callback directly:
70 - callback( _this.addSingleResult( data ) );
71 - }
72 - );
 53+ // call addSingleResult
 54+ callback( _this.addSingleResult( data ) );
 55+ });
7356 },
7457
7558 /**
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js
@@ -71,7 +71,7 @@
7272
7373 // Generate a new context object: (its oky that optional arguments are null )
7474 var context = createContext({
75 - 'apiUrl' : apiUrl,// currentServerApiUrl
 75+ 'apiUrl' : apiUrl, // currentServerApiUrl
7676 'apiReq' : requestQuery,
7777 'callback' : callback,
7878 'timeoutCb' : callbackTimeout
@@ -587,6 +587,7 @@
588588 )
589589 // Add the security note as well:
590590 $dialogMsg.append(
 591+ $j('<br />'),
591592 gM( 'mwe-remember-loging' )
592593 )
593594
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 = 'r115';
 8+var mwRemoteVersion = 'r116';
99
1010 // Log the mwRemote version ( will determine what version of js we get )
1111 if( window.console ){

Status & tagging log