From 93bf26720a72ee288e84f0b349cfee442ed64faa Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 7 Jul 2017 17:15:43 +0200 Subject: [PATCH] Show legend of Special:SpecialPages more gradually The legend is shown when restricted or cached pages are shown, but for cached pages the legend does not contains a text, because there is no default styling of cached special pages. Break the note into two messages and disable the message for cached pages by default. Wikis having style for cached pages can use this message to create a legend. Change-Id: Iec429d450ba7019bbd2cd2301a8280a562341387 --- includes/specials/SpecialSpecialpages.php | 26 ++++++++++++++++++++--- languages/i18n/en.json | 3 ++- languages/i18n/qqq.json | 3 ++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialSpecialpages.php b/includes/specials/SpecialSpecialpages.php index 451669ce61..4f29082227 100644 --- a/includes/specials/SpecialSpecialpages.php +++ b/includes/specials/SpecialSpecialpages.php @@ -130,9 +130,29 @@ class SpecialSpecialpages extends UnlistedSpecialPage { ); } - if ( $includesRestrictedPages || $includesCachedPages ) { - $out->wrapWikiMsg( "

$1

", 'specialpages-note-top' ); - $out->wrapWikiMsg( "
\n$1\n
", 'specialpages-note' ); + // add legend + $notes = []; + if ( $includesRestrictedPages ) { + $restricedMsg = $this->msg( 'specialpages-note-restricted' ); + if ( !$restricedMsg->isDisabled() ) { + $notes[] = $restricedMsg->plain(); + } + } + if ( $includesCachedPages ) { + $cachedMsg = $this->msg( 'specialpages-note-cached' ); + if ( !$cachedMsg->isDisabled() ) { + $notes[] = $cachedMsg->plain(); + } + } + if ( $notes !== [] ) { + $out->wrapWikiMsg( + "

$1

", 'specialpages-note-top' + ); + $out->addWikiText( + "
\n" . + implode( "\n", $notes ) . + "\n
" + ); } } } diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 7d107d9b63..a88e21d083 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3773,7 +3773,8 @@ "specialpages": "Special pages", "specialpages-summary": "", "specialpages-note-top": "Legend", - "specialpages-note": "* Normal special pages.\n* Restricted special pages.", + "specialpages-note-restricted": "* Normal special pages.\n* Restricted special pages.", + "specialpages-note-cached": "-", "specialpages-group-maintenance": "Maintenance reports", "specialpages-group-other": "Other special pages", "specialpages-group-login": "Login / create account", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 4d854d909a..b25b019ac0 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -3963,7 +3963,8 @@ "specialpages": "{{doc-special|SpecialPages|unlisted=1}}\nDisplay name of link to [[Special:SpecialPages]] shown on all pages in the toolbox.\n\nSee also:\n* {{msg-mw|Specialpages}}\n* {{msg-mw|Accesskey-t-specialpages}}\n* {{msg-mw|Tooltip-t-specialpages}}\n{{Identical|Special page}}", "specialpages-summary": "{{doc-specialpagesummary|specialpages}}", "specialpages-note-top": "Heading for {{msg-mw|specialpages-note}}.\n{{Identical|Legend}}", - "specialpages-note": "Footer note for the [[Special:SpecialPages]] page", + "specialpages-note-restricted": "Footer note for the [[Special:SpecialPages]] page", + "specialpages-note-cached": "{{ignore}}\nFooter note for the [[Special:SpecialPages]] page", "specialpages-group-maintenance": "{{doc-special-group|like=[[Special:DoubleRedirects]], [[Special:LonelyPages]] and [[Special:WantedPages]]}}", "specialpages-group-other": "{{doc-special-group|like=[[Special:AdminLinks]] and [[Special:BookSources]]}}", "specialpages-group-login": "{{doc-special-group|like=[[Special:UserLogin]]}}", -- 2.20.1