Add some navigation between watchlist modes
authorRob Church <robchurch@users.mediawiki.org>
Mon, 9 Jul 2007 12:04:58 +0000 (12:04 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 9 Jul 2007 12:04:58 +0000 (12:04 +0000)
includes/SpecialWatchlist.php
includes/WatchlistEditor.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index a921e98..ec36663 100644 (file)
@@ -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 .= '<br />' . 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 );
index fe20f36..abd7924 100644 (file)
@@ -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 );
+       }
 
 }
index 1a143b7..20ffe6f 100644 (file)
@@ -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',
+
 );
index ee04e5e..fd14595 100644 (file)
@@ -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 */