r38799 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38798‎ | r38799 | r38800 >
Date:18:46, 7 August 2008
Author:raymond
Status:old
Tags:
Comment:
Add a more descriptive message to the links-to-image section for the case that more than 100 pages link to a file.
Ths existing link to Whatlinkshere at the end of the list is easily be overseen if not scrolled to the bottom.
Fixes the (cosmetic) bug that the list shows 101 entries instead of 100.
Question: Should we make the hardcoded limit of 100 configurable via DefaultSettings?
Modified paths:
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1057,6 +1057,7 @@
10581058 'filehist-comment',
10591059 'imagelinks',
10601060 'linkstoimage',
 1061+ 'linkstoimage-more',
10611062 'nolinkstoimage',
10621063 'morelinkstoimage',
10631064 'redirectstofile',
Index: trunk/phase3/includes/ImagePage.php
@@ -645,10 +645,16 @@
646646 $wgOut->addWikiMsg( 'nolinkstoimage' );
647647 $wgOut->addHTML( "</div>\n" );
648648 return;
 649+ } elseif ( $count <= $limit - 1 ) {
 650+ $wgOut->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" );
 651+ $wgOut->addWikiMsg( 'linkstoimage', $count );
 652+ $wgOut->addHTML( "<ul class='mw-imagepage-linktoimage'>\n" );
 653+ } else {
 654+ // More links than the limit. Add a link to [[Special:Whatlinkshere]]
 655+ $wgOut->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" );
 656+ $wgOut->addWikiMsg( 'linkstoimage-more', $limit, $this->mTitle->getPrefixedDBkey() );
 657+ $wgOut->addHTML( "<ul class='mw-imagepage-linktoimage'>\n" );
649658 }
650 - $wgOut->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" );
651 - $wgOut->addWikiMsg( 'linkstoimage', $count );
652 - $wgOut->addHTML( "<ul class='mw-imagepage-linktoimage'>\n" );
653659
654660 $sk = $wgUser->getSkin();
655661 $count = 0;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1762,6 +1762,9 @@
17631763 'filehist-comment' => 'Comment',
17641764 'imagelinks' => 'Links',
17651765 'linkstoimage' => 'The following {{PLURAL:$1|page links|$1 pages link}} to this file:',
 1766+'linkstoimage-more' => 'More than $1 {{PLURAL:$2|page links|pages link}} to this file.
 1767+The following list shows the {{PLURAL:$1|first page link|first $1 page links}} to this file only.
 1768+For a full list follow [[Special:Whatlinkshere/$2|this link]].',
17661769 'nolinkstoimage' => 'There are no pages that link to this file.',
17671770 'morelinkstoimage' => 'View [[Special:Whatlinkshere/$1|more links]] to this file.',
17681771 'redirectstofile' => 'The following {{PLURAL:$1|file redirects|$1 files redirect}} to this file:',

Follow-up revisions

RevisionCommit summaryAuthorDate
r38806Fix for r38799. typo.raymond20:00, 7 August 2008
r38948Cleanup to r38799 ("Add a more descriptive message to the links-to-image sect...brion20:55, 8 August 2008

Status & tagging log