* Added an option to make Linker::userToolLinks() show the contribs link
authorLeon Weber <leon@users.mediawiki.org>
Tue, 23 Jan 2007 19:56:01 +0000 (19:56 +0000)
committerLeon Weber <leon@users.mediawiki.org>
Tue, 23 Jan 2007 19:56:01 +0000 (19:56 +0000)
  red when the user has no edits. Linker::userToolLinksRedContribs() is an
  alias to that which should be used to make it more self documentating.
-- Diese und --
M    includes/Linker.php
M    includes/SpecialLog.php
M    RELEASE-NOTES

RELEASE-NOTES
includes/Linker.php
includes/SpecialLog.php

index 46a4368..5b90c4f 100644 (file)
@@ -141,6 +141,9 @@ lighter making things easier to read.
 * (bug 3717) Update user count for AuthPlugin account autocreation
 * (bug 8719) Firefox release notes lie! Fix tooltips for Firefox 2 on x11;
   accesskeys default settings appear to be same as Windows.
+* Added an option to make Linker::userToolLinks() show the contribs link
+  red when the user has no edits. Linker::userToolLinksRedContribs() is an
+  alias to that which should be used to make it more self documentating.
 
 
 == Languages updated ==
index 8dcb44e..e562fa7 100644 (file)
@@ -754,10 +754,10 @@ class Linker {
        /**
         * @param $userId Integer: user id in database.
         * @param $userText String: user name in database.
+        * @param $redContribsWhenNoEdits Bool: return a red contribs link when the user had no edits and this is true.
         * @return string HTML fragment with talk and/or block links
-        * @private
         */
-       function userToolLinks( $userId, $userText ) {
+       public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false ) {
                global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
                $talkable = !( $wgDisableAnonTalk && 0 == $userId );
                $blockable = ( $wgSysopUserBans || 0 == $userId );
@@ -767,9 +767,15 @@ class Linker {
                        $items[] = $this->userTalkLink( $userId, $userText );
                }
                if( $userId ) {
+                       // check if the user has an edit
+                       if( $redContribsWhenNoEdits && User::edits( $userId ) == 0 ) {
+                               $style = "class='new'";
+                       } else {
+                               $style = '';
+                       }
                        $contribsPage = SpecialPage::getTitleFor( 'Contributions', $userText );
-                       $items[] = $this->makeKnownLinkObj( $contribsPage ,
-                               wfMsgHtml( 'contribslink' ) );
+
+                       $items[] = $this->makeKnownLinkObj( $contribsPage, wfMsgHtml( 'contribslink' ), '', '', '', '', $style );
                }
                if( $blockable && $wgUser->isAllowed( 'block' ) ) {
                        $items[] = $this->blockLink( $userId, $userText );
@@ -782,6 +788,14 @@ class Linker {
                }
        }
 
+       /**
+        * Alias for userToolLinks( $userId, $userText, true );
+        */
+       public function userToolLinksRedContribs( $userId, $userText ) {
+               return $this->userToolLinks( $userId, $userText, true );
+       }
+
+
        /**
         * @param $userId Integer: user id in database.
         * @param $userText String: user name in database.
index d84b194..409ca23 100644 (file)
@@ -311,7 +311,7 @@ class LogViewer {
                        $linkCache->addBadLinkObj( $title );
                }
 
-               $userLink = $this->skin->userLink( $s->log_user, $s->user_name ) . $this->skin->userToolLinks( $s->log_user, $s->user_name );
+               $userLink = $this->skin->userLink( $s->log_user, $s->user_name ) . $this->skin->userToolLinksRedContribs( $s->log_user, $s->user_name );
                $comment = $this->skin->commentBlock( $s->log_comment );
                $paramArray = LogPage::extractParams( $s->log_params );
                $revert = '';