* 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
This commit is contained in:
parent
6a3dfb436a
commit
5bf4f28677
3 changed files with 22 additions and 5 deletions
|
|
@ -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 ==
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
|
|
|
|||
Loading…
Reference in a new issue