X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FChangesList.php;h=6524d087e9be593ebee401e43961849ec8c128a1;hb=e56ab3154a52842eb8e4b235aa2aa5dfa5599c99;hp=5f6425d5d407663f01be6c3e96e0a80a58d2e042;hpb=ef985d1362532a5d9a730d002c56d2b5175c302d;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/ChangesList.php b/includes/ChangesList.php
index 5f6425d5d4..6524d087e9 100644
--- a/includes/ChangesList.php
+++ b/includes/ChangesList.php
@@ -1,14 +1,36 @@
skin =& $skin;
}
- # Returns text for the start of the tabular part of RC
+ /**
+ * Returns the appropiate flags for new page, minor change and patrolling
+ */
+ function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ' ) {
+ $f = $new ? '' . htmlspecialchars( wfMsg( 'newpageletter' ) ) . ''
+ : $nothing;
+ $f .= $minor ? '' . htmlspecialchars( wfMsg( 'minoreditletter' ) ) . ''
+ : $nothing;
+ $f .= $patrolled ? '!' : $nothing;
+ return $f;
+
+ }
+
+ /**
+ * Returns text for the start of the tabular part of RC
+ */
function beginRecentChangesList() {
$this->rc_cache = array() ;
$this->rcMoveIndex = 0;
@@ -47,27 +69,9 @@ class ChangesList {
$r .= '' ;
if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
- $r .= ' ';
+ $r .= ' ';
} else {
- # M, N and !
- $M = wfMsg( 'minoreditletter' );
- $N = wfMsg( 'newpageletter' );
-
- if ( $rc_type == RC_NEW ) {
- $r .= $N ;
- } else {
- $r .= ' ' ;
- }
- if ( $rc_minor ) {
- $r .= $M ;
- } else {
- $r .= ' ' ;
- }
- if ( $rcObj->unpatrolled ) {
- $r .= '!';
- } else {
- $r .= ' ';
- }
+ $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled );
}
# Timestamp
@@ -92,9 +96,12 @@ class ChangesList {
$r .= $rcObj->usertalklink ;
# Comment
- if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
- $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
- $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' );
+ if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
+ }
+
+ if ($rcObj->numberofWatchingusers > 0) {
+ $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers));
}
$r .= "
\n" ;
@@ -107,9 +114,7 @@ class ChangesList {
function recentChangesBlockGroup ( $block ) {
global $wgStylePath, $wgContLang ;
- $r = '' ;
- $M = wfMsg( 'minoreditletter' );
- $N = wfMsg( 'newpageletter' );
+ $r = '';
# Collate list of users
$isnew = false ;
@@ -139,7 +144,7 @@ class ChangesList {
if ( $count > 1 ) $text .= " ({$count}×)" ;
array_push ( $users , $text ) ;
}
- $users = ' ['.implode('; ',$users).']' ;
+ $users = ' ['.implode('; ',$users).']';
# Arrow
$rci = 'RCI'.$this->rcCacheIndex ;
@@ -152,16 +157,9 @@ class ChangesList {
$r .= $tl ;
# Main line
- # M/N
+
$r .= '' ;
- if ( $isnew ) $r .= $N ;
- else $r .= ' ' ;
- $r .= ' ' ; # Minor
- if ( $unpatrolled ) {
- $r .= "!";
- } else {
- $r .= " ";
- }
+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled );
# Timestamp
$r .= ' '.$block[0]->timestamp.' ' ;
@@ -187,6 +185,10 @@ class ChangesList {
}
$r .= $users ;
+
+ if ($block[0]->numberofWatchingusers > 0) {
+ $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers));
+ }
$r .= "
\n" ;
# Sub-entries
@@ -197,24 +199,7 @@ class ChangesList {
$r .= '
';
$r .= ' ' ;
- if ( $rc_new ) {
- $r .= $N ;
- } else {
- $r .= ' ' ;
- }
-
- if ( $rc_minor ) {
- $r .= $M ;
- } else {
- $r .= ' ' ;
- }
-
- if ( $rcObj->unpatrolled ) {
- $r .= "!";
- } else {
- $r .= " ";
- }
-
+ $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled );
$r .= ' ' ;
$o = '' ;
@@ -235,10 +220,7 @@ class ChangesList {
$r .= $rcObj->lastlink ;
$r .= ') . . '.$rcObj->userlink ;
$r .= $rcObj->usertalklink ;
- if ( $rc_comment != '' ) {
- $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
- $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' ) ;
- }
+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= "
\n" ;
}
$r .= "\n" ;
@@ -271,7 +253,7 @@ class ChangesList {
* Either returns the line, or caches it for later use
*/
function recentChangesLine( &$rc, $watched = false ) {
- global $wgUser ;
+ global $wgUser;
$usenew = $wgUser->getOption( 'usenewrc' );
if ( $usenew )
$line = $this->recentChangesLineNew ( $rc, $watched ) ;
@@ -280,11 +262,13 @@ class ChangesList {
return $line ;
}
+
function recentChangesLineOld( &$rc, $watched = false ) {
+ global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol,
+ $wgOnlySysopsCanPatrol, $wgSysopUserBans;
+
$fname = 'Skin::recentChangesLineOld';
wfProfileIn( $fname );
-
- global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
static $message;
if( !isset( $message ) ) {
@@ -298,11 +282,11 @@ class ChangesList {
$curIdEq = 'curid=' . $rc_cur_id;
# Should patrol-related stuff be shown?
- $unpatrolled = $wgUseRCPatrol && $wgUser->getID() != 0 &&
+ $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() &&
( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0;
# Make date header if necessary
- $date = $wgLang->date( $rc_timestamp, true);
+ $date = $wgLang->date( $rc_timestamp, true, true );
$s = '';
if ( $date != $this->lastdate ) {
if ( '' != $this->lastdate ) { $s .= "\n"; }
@@ -350,9 +334,7 @@ class ChangesList {
$s .= ') . . ';
# M, N and ! (minor, new and unpatrolled)
- if ( $rc_minor ) { $s .= ' '.$message["minoreditletter"].''; }
- if ( $rc_type == RC_NEW ) { $s .= ''.$message["newpageletter"].''; }
- if ( !$rc_patrolled ) { $s .= ' !'; }
+ $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '' );
# Article link
# If it's a new article, there is no diff link, but if it hasn't been
@@ -365,13 +347,14 @@ class ChangesList {
if ( $watched ) {
$articleLink = ''.$articleLink.'';
}
+
$s .= ' '.$articleLink;
wfProfileOut("$fname-page");
}
wfProfileIn( "$fname-rest" );
# Timestamp
- $s .= '; ' . $wgLang->time( $rc_timestamp, true, $wgRCSeconds ) . ' . . ';
+ $s .= '; ' . $wgLang->time( $rc_timestamp, true, true ) . ' . . ';
# User link (or contributions for unregistered users)
if ( 0 == $rc_user ) {
@@ -395,9 +378,9 @@ class ChangesList {
}
# Block link
$blockLink='';
- if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
+ if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
$blockLinkPage = Title::makeTitle( NS_SPECIAL, 'Blockip' );
- $blockLink = $this->skin->makeKnownLink( $blockLinkPage,
+ $blockLink = $this->skin->makeKnownLinkObj( $blockLinkPage,
$message['blocklink'], 'ip='.$rc_user_text );
}
@@ -408,10 +391,14 @@ class ChangesList {
if($userTalkLink) $s.=' ('.$userTalkLink.')';
# Add comment
- if ( '' != $rc_comment && '*' != $rc_comment && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
- $rc_comment = $this->skin->formatComment($rc_comment,$rc->getTitle());
- $s .= $wgContLang->emphasize(' (' . $rc_comment . ')');
+ if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+ $s .= $this->skin->commentBlock( $rc_comment, $rc->getTitle() );
}
+
+ if ($rc->numberofWatchingusers > 0) {
+ $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
+ }
+
$s .= "\n";
wfProfileOut( "$fname-rest" );
@@ -420,8 +407,8 @@ class ChangesList {
}
function recentChangesLineNew( &$baseRC, $watched = false ) {
- global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds;
- global $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
+ global $wgTitle, $wgLang, $wgContLang, $wgUser,
+ $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans;
static $message;
if( !isset( $message ) ) {
@@ -449,7 +436,7 @@ class ChangesList {
}
# Should patrol-related stuff be shown?
- if ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
+ if ( $wgUseRCPatrol && $wgUser->isLoggedIn() &&
( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') )) {
$rc->unpatrolled = !$rc_patrolled;
} else {
@@ -473,12 +460,19 @@ class ChangesList {
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ) ;
}
- $time = $wgContLang->time( $rc_timestamp, true, $wgRCSeconds );
+ $time = $wgContLang->time( $rc_timestamp, true, true );
$rc->watched = $watched ;
$rc->link = $clink ;
$rc->timestamp = $time;
+ $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
# Make "cur" and "diff" links
+ $titleObj = $rc->getTitle();
+ if ( $rc->unpatrolled ) {
+ $rcIdQuery = "&rcid={$rc_id}";
+ } else {
+ $rcIdQuery = '';
+ }
if ( ( $rc_type == RC_NEW && $rc_this_oldid == 0 ) || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$curLink = $message['cur'];
$diffLink = $message['diff'];
@@ -486,16 +480,10 @@ class ChangesList {
$query = $curIdEq.'&diff=0&oldid='.$rc_this_oldid;
$aprops = ' tabindex="'.$baseRC->counter.'"';
$curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $message['cur'], $query, '' ,'' , $aprops );
- $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $message['diff'], $query, '' ,'' , $aprops );
+ $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $message['diff'], $query . $rcIdQuery, '' ,'' , $aprops );
}
# Make "last" link
- $titleObj = $rc->getTitle();
- if ( $rc->unpatrolled ) {
- $rcIdQuery = "&rcid={$rc_id}";
- } else {
- $rcIdQuery = '';
- }
if ( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$lastLink = $message['last'];
} else {
@@ -524,7 +512,7 @@ class ChangesList {
$userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
global $wgDisableAnonTalk;
- if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
+ if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
$blockPage =& Title::makeTitle( NS_SPECIAL, 'Blockip' );
$blockLink = $this->skin->makeKnownLinkObj( $blockPage,
$message['blocklink'], 'ip='.$rc_user_text );
@@ -554,6 +542,4 @@ class ChangesList {
}
}
-
-
-?>
\ No newline at end of file
+?>