3 * Generate a list of changes using the good old system (no javascript).
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 class OldChangesList
extends ChangesList
{
25 * Format a line using the old system (aka without any javascript).
27 * @param RecentChange $rc Passed by reference
28 * @param bool $watched (default false)
29 * @param int $linenumber (default null)
33 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
34 global $wgRCShowChangedSize;
35 wfProfileIn( __METHOD__
);
37 # Should patrol-related stuff be shown?
38 $unpatrolled = $this->showAsUnpatrolled( $rc );
42 // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
44 if ( $linenumber & 1 ) {
45 $classes[] = 'mw-line-odd';
47 $classes[] = 'mw-line-even';
51 // Indicate watched status on the line to allow for more
52 // comprehensive styling.
53 $classes[] = $watched && $rc->mAttribs
['rc_timestamp'] >= $watched
54 ?
'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
56 if ( $rc->mAttribs
['rc_log_type'] ) {
57 $logtitle = SpecialPage
::getTitleFor( 'Log', $rc->mAttribs
['rc_log_type'] );
58 $this->insertLog( $s, $logtitle, $rc->mAttribs
['rc_log_type'] );
59 // Log entries (old format) or log targets, and special pages
60 } elseif ( $rc->mAttribs
['rc_namespace'] == NS_SPECIAL
) {
61 list( $name, $subpage ) = SpecialPageFactory
::resolveAlias( $rc->mAttribs
['rc_title'] );
62 if ( $name == 'Log' ) {
63 $this->insertLog( $s, $rc->getTitle(), $subpage );
67 $this->insertDiffHist( $s, $rc, $unpatrolled );
68 # M, N, b and ! (minor, new, bot and unpatrolled)
69 $s .= $this->recentChangesFlags(
71 'newpage' => $rc->mAttribs
['rc_type'] == RC_NEW
,
72 'minor' => $rc->mAttribs
['rc_minor'],
73 'unpatrolled' => $unpatrolled,
74 'bot' => $rc->mAttribs
['rc_bot']
78 $this->insertArticleLink( $s, $rc, $unpatrolled, $watched );
81 $this->insertTimestamp( $s, $rc );
82 # Bytes added or removed
83 if ( $wgRCShowChangedSize ) {
84 $cd = $this->formatCharacterDifference( $rc );
86 $s .= $cd . ' <span class="mw-changeslist-separator">. .</span> ';
90 if ( $rc->mAttribs
['rc_type'] == RC_LOG
) {
91 $s .= $this->insertLogEntry( $rc );
94 $this->insertUserRelatedLinks( $s, $rc );
95 # LTR/RTL direction mark
96 $s .= $this->getLanguage()->getDirMark();
97 $s .= $this->insertComment( $rc );
101 $this->insertTags( $s, $rc, $classes );
103 $this->insertRollback( $s, $rc );
105 $this->insertExtra( $s, $rc, $classes );
107 # How many users watch this page
108 if ( $rc->numberofWatchingusers
> 0 ) {
109 $s .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers
);
112 if ( $this->watchlist
) {
113 $classes[] = Sanitizer
::escapeClass( 'watchlist-' .
114 $rc->mAttribs
['rc_namespace'] . '-' . $rc->mAttribs
['rc_title'] );
117 if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$s, $rc, &$classes ) ) ) {
118 wfProfileOut( __METHOD__
);
123 wfProfileOut( __METHOD__
);
125 $dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience.
126 $this->insertDateHeader( $dateheader, $rc->mAttribs
['rc_timestamp'] );
128 return "$dateheader<li class=\"" . implode( ' ', $classes ) . "\">" . $s . "</li>\n";