r83318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83317‎ | r83318 | r83319 >
Date:19:47, 5 March 2011
Author:btongminh
Status:ok
Tags:
Comment:
Follow-up r83218: Added var declarations. Html escape the largefileserver message. Introduced mediaWiki.Message.escaped() to bring the interface up to date with the PHP Message interface.
Modified paths:
  • /trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js
@@ -196,7 +196,7 @@
197197 */
198198 function checkMaxUploadSize( file ) {
199199 function getMaxUploadSize( type ) {
200 - sizes = mw.config.get( 'wgMaxUploadSize' );
 200+ var sizes = mw.config.get( 'wgMaxUploadSize' );
201201 if ( sizes[type] !== undefined ) {
202202 return sizes[type];
203203 }
@@ -204,10 +204,10 @@
205205 }
206206 $( '.mw-upload-source-error' ).remove();
207207
208 - maxSize = getMaxUploadSize( 'file' );
 208+ var maxSize = getMaxUploadSize( 'file' );
209209 if ( file.size > maxSize ) {
210 - error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' +
211 - mw.msg( 'largefileserver', file.size, maxSize ) + '</p>' );
 210+ var error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' +
 211+ mw.message( 'largefileserver', file.size, maxSize ).escaped() + '</p>' );
212212 $( '#wpUploadFile' ).after( error );
213213 return false;
214214 }
Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -254,6 +254,16 @@
255255 var index = parseInt( match, 10 ) - 1;
256256 return index in parameters ? parameters[index] : '$' + match;
257257 } );
 258+
 259+ if ( this.format === 'plain' ) {
 260+ return text;
 261+ }
 262+ if ( this.format === 'escaped' ) {
 263+ // According to Message.php this needs {{-transformation, which is
 264+ // still todo
 265+ return mediaWiki.html.escape( text );
 266+ }
 267+
258268 /* This should be fixed up when we have a parser
259269 if ( this.format === 'parse' && 'language' in mediaWiki ) {
260270 text = mediaWiki.language.parse( text );
@@ -281,6 +291,16 @@
282292 this.format = 'plain';
283293 return this.toString();
284294 };
 295+
 296+ /**
 297+ * Changes the format to html escaped and converts message to string
 298+ *
 299+ * @return {string} String form of html escaped message
 300+ */
 301+ Message.prototype.escaped = function() {
 302+ this.format = 'escaped';
 303+ return this.toString();
 304+ }
285305
286306 /**
287307 * Checks if message exists

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83218(bug 26995) File size is now checked before uploading in HTML5 browsers...btongminh15:38, 4 March 2011

Status & tagging log