Follow-up r83218: Added var declarations. Html escape the largefileserver message...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 5 Mar 2011 19:47:04 +0000 (19:47 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 5 Mar 2011 19:47:04 +0000 (19:47 +0000)
resources/mediawiki.special/mediawiki.special.upload.js
resources/mediawiki/mediawiki.js

index ee86ea9..69b80e6 100644 (file)
@@ -196,7 +196,7 @@ jQuery( function( $ ) {
         */
        function checkMaxUploadSize( file ) {
                function getMaxUploadSize( type ) {
-                       sizes = mw.config.get( 'wgMaxUploadSize' );
+                       var sizes = mw.config.get( 'wgMaxUploadSize' );
                        if ( sizes[type] !== undefined ) {
                                return sizes[type];
                        }
@@ -204,10 +204,10 @@ jQuery( function( $ ) {
                }
                $( '.mw-upload-source-error' ).remove();
                
-               maxSize = getMaxUploadSize( 'file' ); 
+               var maxSize = getMaxUploadSize( 'file' ); 
                if ( file.size > maxSize ) {
-                       error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' + 
-                                       mw.msg( 'largefileserver', file.size, maxSize ) + '</p>' );
+                       var error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' + 
+                                       mw.message( 'largefileserver', file.size, maxSize ).escaped() + '</p>' );
                        $( '#wpUploadFile' ).after( error );
                        return false;
                }
index 2e30aae..b84a2c3 100644 (file)
@@ -254,6 +254,16 @@ window.mediaWiki = new ( function( $ ) {
                        var index = parseInt( match, 10 ) - 1;
                        return index in parameters ? parameters[index] : '$' + match;
                } );
+               
+               if ( this.format === 'plain' ) {
+                       return text;
+               }
+               if ( this.format === 'escaped' ) {
+                       // According to Message.php this needs {{-transformation, which is
+                       // still todo
+                       return mediaWiki.html.escape( text );
+               }
+               
                /* This should be fixed up when we have a parser
                if ( this.format === 'parse' && 'language' in mediaWiki ) {
                        text = mediaWiki.language.parse( text );
@@ -281,6 +291,16 @@ window.mediaWiki = new ( function( $ ) {
                this.format = 'plain';
                return this.toString();
        };
+       
+       /**
+        * Changes the format to html escaped and converts message to string
+        * 
+        * @return {string} String form of html escaped message
+        */
+       Message.prototype.escaped = function() {
+               this.format = 'escaped';
+               return this.toString();
+       }
 
        /**
         * Checks if message exists