(bug 28868) Include the number of pages in the default getLongDesc for multipaged...
authorBrian Wolff <bawolff@users.mediawiki.org>
Sat, 7 May 2011 19:34:14 +0000 (19:34 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sat, 7 May 2011 19:34:14 +0000 (19:34 +0000)
This will only include the number of pages if there is at least two pages.
If you have a pdf with a single page, it won't say 1 page. I modeled this
on how animated images will only say x frames if x > 1.

(For reference, this will affect extensions like pdfHandler, but it won't
affect extensions like PagedTiffHandler since that one totally overrides
the default method)

includes/media/Generic.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index 6112140..547f411 100644 (file)
@@ -655,11 +655,22 @@ abstract class ImageHandler extends MediaHandler {
         */
        function getLongDesc( $file ) {
                global $wgLang;
-               return wfMsgExt('file-info-size', 'parseinline',
-                       $wgLang->formatNum( $file->getWidth() ),
-                       $wgLang->formatNum( $file->getHeight() ),
-                       $wgLang->formatSize( $file->getSize() ),
-                       $file->getMimeType() );
+               $pages = $file->pageCount();
+               if ( $pages === false || $pages <= 1 ) {
+                       $msg = wfMsgExt('file-info-size', 'parseinline',
+                               $wgLang->formatNum( $file->getWidth() ),
+                               $wgLang->formatNum( $file->getHeight() ),
+                               $wgLang->formatSize( $file->getSize() ),
+                               $file->getMimeType() );
+               } else {
+                       $msg = wfMsgExt('file-info-size-pages', 'parseinline',
+                               $wgLang->formatNum( $file->getWidth() ),
+                               $wgLang->formatNum( $file->getHeight() ),
+                               $wgLang->formatSize( $file->getSize() ),
+                               $file->getMimeType(),
+                               $wgLang->formatNum( $pages ) );
+               }
+               return $msg;
        }
 
        /**
index a7209d5..6f91d61 100644 (file)
@@ -3622,6 +3622,7 @@ By executing it, your system may be compromised.",
 'widthheightpage'        => '$1×$2, $3 {{PLURAL:$3|page|pages}}',
 'file-info'              => 'file size: $1, MIME type: $2',
 'file-info-size'         => '$1 × $2 pixels, file size: $3, MIME type: $4',
+'file-info-size-pages'   => '$1 × $2 pixels, file size: $3, MIME type: $4, $5 pages',
 'file-nohires'           => '<small>No higher resolution available.</small>',
 'svg-long-desc'          => 'SVG file, nominally $1 × $2 pixels, file size: $3',
 'show-big-image'         => 'Full resolution',
index aff3b0b..8f14a52 100644 (file)
@@ -3067,6 +3067,7 @@ The message appears after the name of the patroller.',
 'widthheightpage'      => 'This message is used on image pages in the dimensions column in the file history section for images  with more than one page. Parameter $1 is the image width (in pixels), parameter $2 is the image height, and parameter $3 is the number of pages.',
 'file-info'            => 'File info displayed on file description page.',
 'file-info-size'       => 'File info displayed on file description page.',
+'file-info-size-pages' => 'File info displayed on file description page, when the file is a multi-page document, with at least two pages. Like {{msg-mw|file-info-size}} but $5 is the total number of pages in the document.',
 'file-nohires'         => 'File info displayed on file description page. For example of message in use see [[:File:Mouse10.gif]].',
 'svg-long-desc'        => 'Displayed under an SVG image at the image description page. Note that argument 3 is a string that includes the file size unit symbol. See for example [[:File:Yes check.svg]].',
 'show-big-image'       => 'Displayed under an image at the image description page, when it is displayed smaller there than it was uploaded.',
index a73a425..7145126 100644 (file)
@@ -2569,6 +2569,7 @@ $wgMessageStructure = array(
                'widthheightpage',
                'file-info',
                'file-info-size',
+               'file-info-size-pages',
                'file-nohires',
                'svg-long-desc',
                'show-big-image',