From 1bbc1bac91377b4eaf19d2d9b72066a91f8b30cb Mon Sep 17 00:00:00 2001 From: Rob Church Date: Mon, 9 Jul 2007 12:04:58 +0000 Subject: [PATCH] Add some navigation between watchlist modes --- includes/SpecialWatchlist.php | 11 +++++++---- includes/WatchlistEditor.php | 18 ++++++++++++++++++ languages/messages/MessagesEn.php | 6 ++++++ maintenance/language/messages.inc | 9 ++++++++- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index a921e982a3..ec36663e74 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -30,17 +30,20 @@ function wfSpecialWatchlist( $par ) { $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() ); $wgOut->addHtml( wfMsgWikiHtml( 'watchlistanontext', $llink ) ); return; - } else { - $wgOut->setPageTitle( wfMsg( 'watchlist' ) ); - $wgOut->setSubtitle( wfMsgWikiHtml( 'watchlistfor', htmlspecialchars( $wgUser->getName() ) ) ); } + + $wgOut->setPageTitle( wfMsg( 'watchlist' ) ); + + $sub = wfMsgExt( 'watchlistfor', 'parseinline', $wgUser->getName() ); + $sub .= '
' . WatchlistEditor::buildTools( $wgUser->getSkin() ); + $wgOut->setSubtitle( $sub ); if( ( $mode = WatchlistEditor::getMode( $wgRequest, $par ) ) !== false ) { $editor = new WatchlistEditor(); $editor->execute( $wgUser, $wgOut, $wgRequest, $mode ); return; } - + $uid = $wgUser->getId(); if( $wgEnotifWatchlist && $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) { $wgUser->clearAllNotifications( $uid ); diff --git a/includes/WatchlistEditor.php b/includes/WatchlistEditor.php index fe20f364f9..abd79248a5 100644 --- a/includes/WatchlistEditor.php +++ b/includes/WatchlistEditor.php @@ -467,5 +467,23 @@ class WatchlistEditor { return false; } } + + /** + * Build a set of links for convenient navigation + * between watchlist viewing and editing modes + * + * @param Skin $skin Skin to use + * @return string + */ + public static function buildTools( $skin ) { + $tools = array(); + $self = SpecialPage::getTitleFor( 'Watchlist' ); + $modes = array( 'view' => '', 'edit' => 'edit', 'raw' => 'raw', 'clear' => 'clear' ); + foreach( $modes as $mode => $action ) { + $action = $action ? "action={$action}" : ''; + $tools[] = $skin->makeKnownLinkObj( $self, wfMsgHtml( "watchlisttools-{$mode}" ), $action ); + } + return implode( ' | ', $tools ); + } } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 1a143b74aa..20ffe6f2e1 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2914,4 +2914,10 @@ $1', 'watchlistedit-raw-added' => '{{PLURAL:$1|1 title was|$1 titles were}} added:', 'watchlistedit-raw-removed' => '{{PLURAL:$1|1 title was|$1 titles were}} removed:', +# Watchlist editing tools +'watchlisttools-view' => 'View watchlist', +'watchlisttools-edit' => 'Edit watchlist', +'watchlisttools-raw' => 'Edit raw watchlist', +'watchlisttools-clear' => 'Clear watchlist', + ); diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index ee04e5e59b..fd145952b9 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2145,7 +2145,13 @@ $wgMessageStructure = array( 'watchlistedit-raw-done', 'watchlistedit-raw-added', 'watchlistedit-raw-removed', - ), + ), + 'watchlisttools' => array( + 'watchlisttools-view', + 'watchlisttools-edit', + 'watchlisttools-raw', + 'watchlisttools-clear', + ), ); /** Comments for each block */ $wgBlockComments = array( @@ -2313,6 +2319,7 @@ Variants for Chinese language", 'livepreview' => 'Live preview', 'lagwarning' => 'Friendlier slave lag warnings', 'watchlisteditor' => 'Watchlist editor', + 'watchlisttools' => 'Watchlist editing tools', ); /** Short comments for standalone messages */ -- 2.20.1