Show legend of Special:SpecialPages more gradually
authorUmherirrender <umherirrender_de.wp@web.de>
Fri, 7 Jul 2017 15:15:43 +0000 (17:15 +0200)
committerFlorianschmidtwelzow <florian.schmidt.stargatewissen@gmail.com>
Mon, 24 Jul 2017 15:34:21 +0000 (15:34 +0000)
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
languages/i18n/en.json
languages/i18n/qqq.json

index 451669c..4f29082 100644 (file)
@@ -130,9 +130,29 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
                        );
                }
 
-               if ( $includesRestrictedPages || $includesCachedPages ) {
-                       $out->wrapWikiMsg( "<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top' );
-                       $out->wrapWikiMsg( "<div class=\"mw-specialpages-notes\">\n$1\n</div>", '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(
+                               "<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top'
+                       );
+                       $out->addWikiText(
+                               "<div class=\"mw-specialpages-notes\">\n" .
+                               implode( "\n", $notes ) .
+                               "\n</div>"
+                       );
                }
        }
 }
index 7d107d9..a88e21d 100644 (file)
        "specialpages": "Special pages",
        "specialpages-summary": "",
        "specialpages-note-top": "Legend",
-       "specialpages-note": "* Normal special pages.\n* <span class=\"mw-specialpagerestricted\">Restricted special pages.</span>",
+       "specialpages-note-restricted": "* Normal special pages.\n* <span class=\"mw-specialpagerestricted\">Restricted special pages.</span>",
+       "specialpages-note-cached": "-",
        "specialpages-group-maintenance": "Maintenance reports",
        "specialpages-group-other": "Other special pages",
        "specialpages-group-login": "Login / create account",
index 4d854d9..b25b019 100644 (file)
        "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]]}}",