From 5bf4f2867748adba3a7d1678822a0ff78fba9ee8 Mon Sep 17 00:00:00 2001 From: Leon Weber Date: Tue, 23 Jan 2007 19:56:01 +0000 Subject: [PATCH] * 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. -- Diese und -- M includes/Linker.php M includes/SpecialLog.php M RELEASE-NOTES --- RELEASE-NOTES | 3 +++ includes/Linker.php | 22 ++++++++++++++++++---- includes/SpecialLog.php | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 46a4368f70..5b90c4f41c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Linker.php b/includes/Linker.php index 8dcb44e244..e562fa76e0 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -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. diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index d84b19469f..409ca23bea 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -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 = ''; -- 2.20.1