From: Aryeh Gregor Date: Fri, 24 Nov 2006 06:41:02 +0000 (+0000) Subject: (bug 7892) Add media count to category page, à la subcats/pages. Used a new count... X-Git-Tag: 1.31.0-rc.0~55103 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=5f1e7225eee1f6d148a17a47212952b8515928ad;p=lhc%2Fweb%2Fwiklou.git (bug 7892) Add media count to category page, à la subcats/pages. Used a new count() method I added to ImageGallery class. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ac50b1dfc9..1d8b8c7e0f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -176,7 +176,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN warning and a request to upgrade. * (bug 6440) Updated indexes to improve backlinking queries (links, templates, images) * Switched 'anon-only' block mode to default for IP blocks -* (bug 3687) Add distinct heading for media files in category display. +* (bug 3687, 7892) Add distinct heading for media files in category display, + with count. * (bug 1578) Add different icons for external links to audio, video, or PDF in Monobook. * Made autoblocks block account creation if the user block has that option enabled. @@ -210,7 +211,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN image page (image/svg+xml, not image/svg). * (bug 7883) Added autoblock whitelisting feature, using which specific ranges can be protected from autoblocking. These ranges are specified, in list format, - in the autoblock_whitelist system message. + in the autoblock_whitelist system message. * Added placeholders for text injection by hooks to EditPage.php == Languages updated == diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 2069ebb7dc..0086a2f968 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -259,6 +259,7 @@ class CategoryViewer { if( $this->showGallery && ! $this->gallery->isEmpty() ) { return "
\n" . '

' . wfMsg( 'category-media-header', htmlspecialchars($this->title->getText()) ) . "

\n" . + wfMsgExt( 'category-media-count', array( 'parse' ), $this->gallery->count() ) . $this->gallery->toHTML() . "\n
"; } else { return ''; diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 7ff456b666..dfd5a98b04 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -206,6 +206,13 @@ class ImageGallery return $s; } + + /** + * @return int Number of images in the gallery + */ + public function count() { + return count( $this->mImages ); + } } //class ?> diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 846e256048..1b4f6574a5 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2056,6 +2056,7 @@ All transwiki import actions are logged at the [[Special:Log/import|import log]] 'spamprotectionmatch' => 'The following text is what triggered our spam filter: $1', 'subcategorycount' => "There {{PLURAL:$1|is one subcategory|are $1 subcategories}} to this category.", 'categoryarticlecount' => "There {{PLURAL:$1|is one article|are $1 articles}} in this category.", +'category-media-count' => "There {{PLURAL:$1|is one file|are $1 files}} in this category.", 'listingcontinuesabbrev' => " cont.", 'spambot_username' => 'MediaWiki spam cleanup', 'spam_reverting' => 'Reverting to last version not containing links to $1',