Better file size limit message display logic
authorGilles Dubuc <gdubuc@wikimedia.org>
Thu, 2 Apr 2015 09:53:12 +0000 (11:53 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 3 Apr 2015 13:41:27 +0000 (13:41 +0000)
Only display upload size limit differentiation message
if there are 2 upload methods.

Bug: T94727
Change-Id: I23c5a5c5e7a30484c242005db831eec5c8c1f4a7

includes/specials/SpecialUpload.php

index 72d02e0..6f9254b 100644 (file)
@@ -885,6 +885,17 @@ class UploadForm extends HTMLForm {
                        );
                }
 
+               $help = $this->msg( 'upload-maxfilesize',
+                               $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] )
+                       )->parse();
+
+               // If the user can also upload by URL, there are 2 different file size limits.
+               // This extra message helps stress which limit corresponds to what.
+               if ( $canUploadByUrl ) {
+                       $help .= $this->msg( 'word-separator' )->escaped();
+                       $help .= $this->msg( 'upload_source_file' )->parse();
+               }
+
                $descriptor['UploadFile'] = array(
                        'class' => 'UploadSourceField',
                        'section' => 'source',
@@ -894,11 +905,7 @@ class UploadForm extends HTMLForm {
                        'label-message' => 'sourcefilename',
                        'upload-type' => 'File',
                        'radio' => &$radio,
-                       'help' => $this->msg( 'upload-maxfilesize',
-                               $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] )
-                       )->parse() .
-                               $this->msg( 'word-separator' )->escaped() .
-                               $this->msg( 'upload_source_file' )->escaped(),
+                       'help' => $help,
                        'checked' => $selectedSourceType == 'file',
                );