http://www.mediawiki.org/wiki/Special:Code/MediaWiki/56324

Revision: 56324
Author:   siebrand
Date:     2009-09-14 18:58:25 +0000 (Mon, 14 Sep 2009)

Log Message:
-----------
Support GENDER in 'renameuser-renamed-notice', changing 
LogEventsList::showLogExtract for that:
* param $msgKey from String to Array, where first element is the message key, 
additional elements are parameters for the key

Comment by Nikerabbit: "... that is cargo train number of parameters :o". I 
tried not to make it worse.

Modified Paths:
--------------
    trunk/extensions/Renameuser/SpecialRenameuser.i18n.php
    trunk/extensions/Renameuser/SpecialRenameuser.php
    trunk/phase3/includes/LogEventsList.php

Modified: trunk/extensions/Renameuser/SpecialRenameuser.i18n.php
===================================================================
--- trunk/extensions/Renameuser/SpecialRenameuser.i18n.php      2009-09-14 
18:40:45 UTC (rev 56323)
+++ trunk/extensions/Renameuser/SpecialRenameuser.i18n.php      2009-09-14 
18:58:25 UTC (rev 56324)
@@ -42,7 +42,7 @@
        'right-renameuser'      => 'Rename users',
        
        'renameuser-renamed-notice' => 'This user has been renamed.
-The rename log is provided below for reference.',
+The rename log is provided below for reference.', # Supports GENDER
 );
 
 /** Message documentation (Message documentation)
@@ -58,6 +58,7 @@
 * Parameter $1 is the original username
 * Parameter $2 is the new username',
        'right-renameuser' => '{{doc-right}}',
+       'renameuser-renamed-notice' => 'This message supports the use of 
GENDER.',
 );
 
 /** Afrikaans (Afrikaans)

Modified: trunk/extensions/Renameuser/SpecialRenameuser.php
===================================================================
--- trunk/extensions/Renameuser/SpecialRenameuser.php   2009-09-14 18:40:45 UTC 
(rev 56323)
+++ trunk/extensions/Renameuser/SpecialRenameuser.php   2009-09-14 18:58:25 UTC 
(rev 56324)
@@ -47,7 +47,7 @@
        if( !$title || $title->getNamespace() !== NS_USER ) {
                $rv = ''; // handled in comment, the old way
        } else {
-               $titleLink = $skin ? 
+               $titleLink = $skin ?
                        $skin->makeLinkObj( $title, htmlspecialchars( 
$title->getPrefixedText() ) ) : $title->getText();
                # Add title to params
                array_unshift( $params, $titleLink );
@@ -70,8 +70,7 @@
        if ( $title->getNamespace() == NS_USER || $title->getNamespace() == 
NS_USER_TALK ) {
                // Get the title for the base userpage
                $page = Title::makeTitle( NS_USER, str_replace( ' ', '_', 
$title->getBaseText() ) )->getPrefixedDBkey();
-               LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', 
10, array(), false, 'renameuser-renamed-notice' );
+               LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', 
10, array(), false, array( 'renameuser-renamed-notice', $title->getBaseText() ) 
);
        }
        return true;
 }
-

Modified: trunk/phase3/includes/LogEventsList.php
===================================================================
--- trunk/phase3/includes/LogEventsList.php     2009-09-14 18:40:45 UTC (rev 
56323)
+++ trunk/phase3/includes/LogEventsList.php     2009-09-14 18:58:25 UTC (rev 
56324)
@@ -575,10 +575,13 @@
         * @param $conds Array Extra conditions for the query
         * @param $showIfEmpty boolean Set to false if you don't want any 
output in case the loglist is empty
         *              if set to true (default), "No matching items in log" is 
displayed if loglist is empty
-        * @param $msgKey String if you want a nice box with a message, set 
this to the key of the message
+        * @param $msgKey Array If you want a nice box with a message, set this
+        *              to the key of the message. First element is the message
+        *              key, additional optional elements are parameters for the
+        *              key that are processed with wgMsgExt and option 'parse'
         * @return Integer Number of total log items (not limited by $lim)
         */
-       public static function showLogExtract( &$out, $types=array(), $page='', 
$user='', $lim=0, $conds=array(), $showIfEmpty = true, $msgKey = '' ) {
+       public static function showLogExtract( &$out, $types=array(), $page='', 
$user='', $lim=0, $conds=array(), $showIfEmpty = true, $msgKey = array() ) {
                global $wgUser, $wgOut;
                # Insert list of top 50 or so items
                $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
@@ -587,8 +590,17 @@
                $logBody = $pager->getBody();
                $s = '';
                if( $logBody ) {
-                       if ( $msgKey )
-                               $s = '<div class="mw-warning-with-logexcerpt">' 
. wfMsgExt( $msgKey, array('parse') ) ;
+                       if ( $msgKey ) {
+                               $s = '<div class="mw-warning-with-logexcerpt">';
+
+                               if ( sizeof( $msgKey ) == 1 ) {
+                                       $s .= wfMsgExt( $msgKey[0], 
array('parse') );
+                               } else { // Process additional arguments
+                                       $args = $msgKey;
+                                       unset( $args[0] );
+                                       $s .= wfMsgExt( $msgKey[0], 
array('parse'), $args );
+                               }
+                       }
                        $s .= $loglist->beginLogEventsList() .
                                 $logBody .
                                 $loglist->endLogEventsList();



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to