# Anons don't get a watchlist
if( $wgUser->isAnon() ) {
$wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
- $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ),
- wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() );
+ $llink = $skin->linkKnown(
+ SpecialPage::getTitleFor( 'Userlogin' ),
+ wfMsgHtml( 'loginreqlink' ),
+ array(),
+ array( 'returnto' => $specialTitle->getPrefixedText() )
+ );
$wgOut->addHTML( wfMsgWikiHtml( 'watchlistanontext', $llink ) );
return;
}
if( $andHidePatrolled ) $conds[] = $andHidePatrolled;
if( $nameSpaceClause ) $conds[] = $nameSpaceClause;
- if ( $usePage ) {
+ $rollbacker = $wgUser->isAllowed('rollback');
+ if ( $usePage || $rollbacker ) {
$tables[] = 'page';
$join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id');
+ if ($rollbacker)
+ $fields[] = 'page_latest';
}
- ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, '' );
+ ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
wfRunHooks('SpecialWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) );
$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
$cutofflinks = "\n" . wlCutoffLinks( $days, 'Watchlist', $nondefaults ) . "<br />\n";
- # Spit out some control panel links
$thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
- $skin = $wgUser->getSkin();
- $showLinktext = wfMsgHtml( 'show' );
- $hideLinktext = wfMsgHtml( 'hide' );
- # Hide/show minor edits
- $label = $hideMinor ? $showLinktext : $hideLinktext;
- $linkBits = wfArrayToCGI( array( 'hideMinor' => 1 - (int)$hideMinor ), $nondefaults );
- $links[] = wfMsgHtml( 'rcshowhideminor', $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ) );
-
- # Hide/show bot edits
- $label = $hideBots ? $showLinktext : $hideLinktext;
- $linkBits = wfArrayToCGI( array( 'hideBots' => 1 - (int)$hideBots ), $nondefaults );
- $links[] = wfMsgHtml( 'rcshowhidebots', $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ) );
-
- # Hide/show anonymous edits
- $label = $hideAnons ? $showLinktext : $hideLinktext;
- $linkBits = wfArrayToCGI( array( 'hideAnons' => 1 - (int)$hideAnons ), $nondefaults );
- $links[] = wfMsgHtml( 'rcshowhideanons', $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ) );
-
- # Hide/show logged in edits
- $label = $hideLiu ? $showLinktext : $hideLinktext;
- $linkBits = wfArrayToCGI( array( 'hideLiu' => 1 - (int)$hideLiu ), $nondefaults );
- $links[] = wfMsgHtml( 'rcshowhideliu', $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ) );
-
- # Hide/show own edits
- $label = $hideOwn ? $showLinktext : $hideLinktext;
- $linkBits = wfArrayToCGI( array( 'hideOwn' => 1 - (int)$hideOwn ), $nondefaults );
- $links[] = wfMsgHtml( 'rcshowhidemine', $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ) );
-
- # Hide/show patrolled edits
+ # Spit out some control panel links
+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhideminor', 'hideMinor', $hideMinor );
+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhidebots', 'hideBots', $hideBots );
+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhideanons', 'hideAnons', $hideAnons );
+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhideliu', 'hideLiu', $hideLiu );
+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhidemine', 'hideOwn', $hideOwn );
+
if( $wgUser->useRCPatrol() ) {
- $label = $hidePatrolled ? $showLinktext : $hideLinktext;
- $linkBits = wfArrayToCGI( array( 'hidePatrolled' => 1 - (int)$hidePatrolled ), $nondefaults );
- $links[] = wfMsgHtml( 'rcshowhidepatr', $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ) );
+ $links[] = wlShowHideLink( $nondefaults, 'rcshowhidepatr', 'hidePatrolled', $hidePatrolled );
}
# Namespace filter and put the whole form together.
$form .= Xml::closeElement( 'fieldset' );
$wgOut->addHTML( $form );
+ $wgOut->addHTML( ChangesList::flagLegend() );
+
# If there's nothing to show, stop here
if( $numRows == 0 ) {
$wgOut->addWikiMsg( 'watchnochange' );
$dbr->dataSeek( $res, 0 );
$list = ChangesList::newFromUser( $wgUser );
-
+ $list->setWatchlistDivs();
+
$s = $list->beginRecentChangesList();
$counter = 1;
while ( $obj = $dbr->fetchObject( $res ) ) {
$wgOut->addHTML( $s );
}
+function wlShowHideLink( $options, $message, $name, $value ) {
+ global $wgUser;
+
+ $showLinktext = wfMsgHtml( 'show' );
+ $hideLinktext = wfMsgHtml( 'hide' );
+ $title = SpecialPage::getTitleFor( 'Watchlist' );
+ $skin = $wgUser->getSkin();
+
+ $label = $value ? $showLinktext : $hideLinktext;
+ $options[$name] = 1 - (int) $value;
+
+ return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) );
+}
+
+
function wlHoursLink( $h, $page, $options = array() ) {
global $wgUser, $wgLang, $wgContLang;
+
$sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink(
- $wgContLang->specialPage( $page ),
- $wgLang->formatNum( $h ),
- wfArrayToCGI( array('days' => ($h / 24.0)), $options ) );
+ $title = Title::newFromText( $wgContLang->specialPage( $page ) );
+ $options['days'] = ($h / 24.0);
+
+ $s = $sk->linkKnown(
+ $title,
+ $wgLang->formatNum( $h ),
+ array(),
+ $options
+ );
+
return $s;
}
function wlDaysLink( $d, $page, $options = array() ) {
global $wgUser, $wgLang, $wgContLang;
+
$sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink(
- $wgContLang->specialPage( $page ),
- ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) ),
- wfArrayToCGI( array('days' => $d), $options ) );
+ $title = Title::newFromText( $wgContLang->specialPage( $page ) );
+ $options['days'] = $d;
+ $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
+
+ $s = $sk->linkKnown(
+ $title,
+ $message,
+ array(),
+ $options
+ );
+
return $s;
}