http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87651

Revision: 87651
Author:   bawolff
Date:     2011-05-07 19:34:14 +0000 (Sat, 07 May 2011)
Log Message:
-----------
(bug 28868) Include the number of pages in the default getLongDesc for 
multipaged documents

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)

Modified Paths:
--------------
    trunk/phase3/includes/media/Generic.php
    trunk/phase3/languages/messages/MessagesEn.php
    trunk/phase3/languages/messages/MessagesQqq.php
    trunk/phase3/maintenance/language/messages.inc

Modified: trunk/phase3/includes/media/Generic.php
===================================================================
--- trunk/phase3/includes/media/Generic.php     2011-05-07 18:59:20 UTC (rev 
87650)
+++ trunk/phase3/includes/media/Generic.php     2011-05-07 19:34:14 UTC (rev 
87651)
@@ -655,11 +655,22 @@
         */
        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;
        }
 
        /**

Modified: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php      2011-05-07 18:59:20 UTC 
(rev 87650)
+++ trunk/phase3/languages/messages/MessagesEn.php      2011-05-07 19:34:14 UTC 
(rev 87651)
@@ -3622,6 +3622,7 @@
 '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',

Modified: trunk/phase3/languages/messages/MessagesQqq.php
===================================================================
--- trunk/phase3/languages/messages/MessagesQqq.php     2011-05-07 18:59:20 UTC 
(rev 87650)
+++ trunk/phase3/languages/messages/MessagesQqq.php     2011-05-07 19:34:14 UTC 
(rev 87651)
@@ -3067,6 +3067,7 @@
 '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.',

Modified: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc      2011-05-07 18:59:20 UTC 
(rev 87650)
+++ trunk/phase3/maintenance/language/messages.inc      2011-05-07 19:34:14 UTC 
(rev 87651)
@@ -2569,6 +2569,7 @@
                'widthheightpage',
                'file-info',
                'file-info-size',
+               'file-info-size-pages',
                'file-nohires',
                'svg-long-desc',
                'show-big-image',


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to