Created a new page, "SpecialAllmessages.php", which builds
authorNicholas Pisarro, Jr <npassoc@users.mediawiki.org>
Mon, 1 Mar 2004 13:40:58 +0000 (13:40 +0000)
committerNicholas Pisarro, Jr <npassoc@users.mediawiki.org>
Mon, 1 Mar 2004 13:40:58 +0000 (13:40 +0000)
the equivalent of "MediaWiki:All_message" at run time
instead of install time.

This page is currently shown on "Special:Specialpages" by
those with SysOp access.

The table has a background color. Entries where the current
text is different than the default text are show with a
different background color.

It might be possible to better optimize this table's
construction.

includes/SpecialAllmessages.php [new file with mode: 0644]
languages/Language.php

diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php
new file mode 100644 (file)
index 0000000..f805af2
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+
+function wfSpecialAllmessages()
+{
+       global $wgUser, $wgOut, $wgAllMessagesEn, $wgServer, $wgScript, $wgLang;
+       $fname = "wfSpecialAllmessages";
+       
+       $talk = $wgLang->getNsText( NS_TALK );
+       $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK );
+       $mwMsg =& MagicWord::get( MAG_MSG );
+       $navText = str_replace( "$1", "allmessagestext", $mwMsg->getSynonym( 0 ) );
+       $navText .= "
+
+<table border=1 cellspacing=0 width=100%><tr bgcolor=#b2b2ff><td>
+  '''Name'''
+</td><td>
+  '''Default text'''
+</td><td>
+  '''Current text'''
+</td></tr>";
+       
+       $first = true;
+       $sortedArray = $wgAllMessagesEn;
+       ksort( $sortedArray );
+       
+       foreach ( $sortedArray as $key => $enMsg ) {
+               
+               $titleObj = Title::newFromText( $key );
+               $title = $titleObj->getDBkey();
+               
+               $message = wfMsgNoDB( $key );
+               $mw = wfMsg ( $key );
+
+               $colorIt = ($message == $mw) ? " bgcolor=\"#f0f0ff\"" : " bgcolor=\"#ffe2e2\"";
+               
+               $message = wfEscapeWikiText( $message );
+               $mw = wfEscapeWikiText( $mw );
+               
+# [$wgServer$wgScript?title=MediaWiki:$title&action=edit $key]<br>
+               $navText .= 
+"<tr$colorIt><td>
+  [[MediaWiki:$title|$key]]<br>
+  [[$mwtalk:$title|$talk]]
+</td><td>
+  $message
+</td><td>
+  $mw
+</td></tr>";
+       }
+
+       $navText .= "</table>";
+
+       $wgOut->addWikiText( $navText );
+
+       return;
+}
+
+?>
index 795041a..2b1022b 100644 (file)
@@ -403,6 +403,7 @@ $wgLanguageNamesEn =& $wgLanguageNames;
 /* private */ $wgSysopSpecialPagesEn = array(
        "Blockip"               => "Block a user/IP address",
        "Asksql"                => "Query the database",
+       "Allmessages"   => "All system messages",
        "Undelete"              => "Restore deleted pages",
        "Makesysop"             => "Turn a user into a sysop"
 );