(bug 15157) Special:Watchlist now has the same options as Special:Watchlist:
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Wed, 13 Aug 2008 23:08:22 +0000 (23:08 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Wed, 13 Aug 2008 23:08:22 +0000 (23:08 +0000)
* Show/Hide logged in users
* Show/Hide anonymous
* Invert namespace selection
* Same ordering of options

Code comments: Toggles added in Preferences, messages added, code ordered as presented in special page

RELEASE-NOTES
includes/specials/SpecialPreferences.php
includes/specials/SpecialWatchlist.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 5344cc0..f5f53fb 100644 (file)
@@ -78,6 +78,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   so-called GIFAR vulnerability.
 * (bug 15141) Give ability to only list protected pages with the cascading
   option enabled on Special:ProtectedPages
+* (bug 15157) Special:Watchlist has the same options as Special:Watchlist:
+  Show/Hide logged in users, Show/Hide anonymous, Invert namespace selection
 
 === Bug fixes in 1.14 ===
 
index 3c7416e..de0c0d6 100644 (file)
@@ -1023,7 +1023,7 @@ class PreferencesForm {
                $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
                $wgOut->addHtml( '<br /><br />' );
 
-               $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
+               $wgOut->addHtml( $this->getToggles( array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown', 'watchlisthideanons', 'watchlisthideliu' ) ) );
 
                if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) )
                        $wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
index db7cd42..3e729f2 100644 (file)
@@ -47,33 +47,44 @@ function wfSpecialWatchlist( $par ) {
        }
 
        $defaults = array(
-       /* float */ 'days' => floatval( $wgUser->getOption( 'watchlistdays' ) ), /* 3.0 or 0.5, watch further below */
-       /* bool  */ 'hideOwn' => (int)$wgUser->getBoolOption( 'watchlisthideown' ),
-       /* bool  */ 'hideBots' => (int)$wgUser->getBoolOption( 'watchlisthidebots' ),
-       /* bool */ 'hideMinor' => (int)$wgUser->getBoolOption( 'watchlisthideminor' ),
+       /* float */ 'days'      => floatval( $wgUser->getOption( 'watchlistdays' ) ), /* 3.0 or 0.5, watch further below */
+       /* bool  */ 'hideMinor' => (int)$wgUser->getBoolOption( 'watchlisthideminor' ),
+       /* bool  */ 'hideBots'  => (int)$wgUser->getBoolOption( 'watchlisthidebots' ),
+       /* bool  */ 'hideAnons' => (int)$wgUser->getBoolOption( 'watchlisthideanons' ),
+       /* bool  */ 'hideLiu'   => (int)$wgUser->getBoolOption( 'watchlisthideliu' ),
+       /* bool  */ 'hideOwn'   => (int)$wgUser->getBoolOption( 'watchlisthideown' ),
        /* ?     */ 'namespace' => 'all',
+       /* ?     */ 'invert'    => false,
        );
 
        extract($defaults);
 
        # Extract variables from the request, falling back to user preferences or
        # other default values if these don't exist
-       $prefs['days'    ] = floatval( $wgUser->getOption( 'watchlistdays' ) );
-       $prefs['hideown' ] = $wgUser->getBoolOption( 'watchlisthideown' );
-       $prefs['hidebots'] = $wgUser->getBoolOption( 'watchlisthidebots' );
+       $prefs['days']      = floatval( $wgUser->getOption( 'watchlistdays' ) );
        $prefs['hideminor'] = $wgUser->getBoolOption( 'watchlisthideminor' );
+       $prefs['hidebots']  = $wgUser->getBoolOption( 'watchlisthidebots' );
+       $prefs['hideanons'] = $wgUser->getBoolOption( 'watchlisthideanon' );
+       $prefs['hideliu']   = $wgUser->getBoolOption( 'watchlisthideliu' );
+       $prefs['hideown' ]  = $wgUser->getBoolOption( 'watchlisthideown' );
 
        # Get query variables
-       $days     = $wgRequest->getVal(  'days', $prefs['days'] );
-       $hideOwn  = $wgRequest->getBool( 'hideOwn', $prefs['hideown'] );
-       $hideBots = $wgRequest->getBool( 'hideBots', $prefs['hidebots'] );
+       $days      = $wgRequest->getVal(  'days'     , $prefs['days'] );
        $hideMinor = $wgRequest->getBool( 'hideMinor', $prefs['hideminor'] );
+       $hideBots  = $wgRequest->getBool( 'hideBots' , $prefs['hidebots'] );
+       $hideAnons = $wgRequest->getBool( 'hideAnons', $prefs['hideanons'] );
+       $hideLiu   = $wgRequest->getBool( 'hideLiu'  , $prefs['hideliu'] );
+       $hideOwn   = $wgRequest->getBool( 'hideOwn'  , $prefs['hideown'] );
 
        # Get namespace value, if supplied, and prepare a WHERE fragment
        $nameSpace = $wgRequest->getIntOrNull( 'namespace' );
+       $invert = $wgRequest->getIntOrNull( 'invert' );
        if( !is_null( $nameSpace ) ) {
                $nameSpace = intval( $nameSpace );
-               $nameSpaceClause = " AND rc_namespace = $nameSpace";
+               if( $invert && $nameSpace != 'all' )
+                       $nameSpaceClause = " AND rc_namespace != $nameSpace";
+               else
+                       $nameSpaceClause = " AND rc_namespace = $nameSpace";
        } else {
                $nameSpace = '';
                $nameSpaceClause = '';
@@ -103,11 +114,13 @@ function wfSpecialWatchlist( $par ) {
        // Dump everything here
        $nondefaults = array();
 
-       wfAppendToArrayIfNotDefault('days'     , $days         , $defaults, $nondefaults);
-       wfAppendToArrayIfNotDefault('hideOwn'  , (int)$hideOwn , $defaults, $nondefaults);
-       wfAppendToArrayIfNotDefault('hideBots' , (int)$hideBots, $defaults, $nondefaults);
+       wfAppendToArrayIfNotDefault( 'days'     , $days          , $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault( 'hideMinor', (int)$hideMinor, $defaults, $nondefaults );
-       wfAppendToArrayIfNotDefault('namespace', $nameSpace    , $defaults, $nondefaults);
+       wfAppendToArrayIfNotDefault( 'hideBots' , (int)$hideBots , $defaults, $nondefaults);
+       wfAppendToArrayIfNotDefault( 'hideAnons', (int)$hideAnons, $defaults, $nondefaults );
+       wfAppendToArrayIfNotDefault( 'hideLiu'  , (int)$hideLiu  , $defaults, $nondefaults );
+       wfAppendToArrayIfNotDefault( 'hideOwn'  , (int)$hideOwn  , $defaults, $nondefaults);
+       wfAppendToArrayIfNotDefault( 'namespace', $nameSpace     , $defaults, $nondefaults);
 
        $hookSql = "";
        if( ! wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql)) ) {
@@ -140,9 +153,11 @@ function wfSpecialWatchlist( $par ) {
        # Up estimate of watched items by 15% to compensate for talk pages...
 
        # Toggles
-       $andHideOwn = $hideOwn ? "AND (rc_user <> $uid)" : '';
-       $andHideBots = $hideBots ? "AND (rc_bot = 0)" : '';
-       $andHideMinor = $hideMinor ? 'AND rc_minor = 0' : '';
+       $andHideOwn   = $hideOwn   ? "AND (rc_user <> $uid)" : '';
+       $andHideBots  = $hideBots  ? "AND (rc_bot = 0)" : '';
+       $andHideMinor = $hideMinor ? "AND (rc_minor = 0)" : '';
+       $andHideLiu   = $hideLiu   ? "AND (rc_user = 0)" : '';
+       $andHideAnons = $hideAnons ? "AND (rc_user != 0)" : '';
 
        # Show watchlist header
        $header = '';
@@ -194,6 +209,8 @@ function wfSpecialWatchlist( $par ) {
          $andHideOwn
          $andHideBots
          $andHideMinor
+         $andHideLiu
+         $andHideAnons
          $nameSpaceClause
          $hookSql
          ORDER BY rc_timestamp DESC
@@ -230,21 +247,31 @@ function wfSpecialWatchlist( $par ) {
        $thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
        $skin = $wgUser->getSkin();
 
+       # Hide/show minor edits
+       $label = $hideMinor ? wfMsgHtml( 'watchlist-show-minor' ) : wfMsgHtml( 'watchlist-hide-minor' );
+       $linkBits = wfArrayToCGI( array( 'hideMinor' => 1 - (int)$hideMinor ), $nondefaults );
+       $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
+
        # Hide/show bot edits
        $label = $hideBots ? wfMsgHtml( 'watchlist-show-bots' ) : wfMsgHtml( 'watchlist-hide-bots' );
        $linkBits = wfArrayToCGI( array( 'hideBots' => 1 - (int)$hideBots ), $nondefaults );
        $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
 
+       # Hide/show anonymous edits
+       $label = $hideAnons ? wfMsgHtml( 'watchlist-show-anons' ) : wfMsgHtml( 'watchlist-hide-anons' );
+       $linkBits = wfArrayToCGI( array( 'hideAnons' => 1 - (int)$hideAnons ), $nondefaults );
+       $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
+
+       # Hide/show logged in edits
+       $label = $hideLiu ? wfMsgHtml( 'watchlist-show-liu' ) : wfMsgHtml( 'watchlist-hide-liu' );
+       $linkBits = wfArrayToCGI( array( 'hideLiu' => 1 - (int)$hideLiu ), $nondefaults );
+       $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
+
        # Hide/show own edits
        $label = $hideOwn ? wfMsgHtml( 'watchlist-show-own' ) : wfMsgHtml( 'watchlist-hide-own' );
        $linkBits = wfArrayToCGI( array( 'hideOwn' => 1 - (int)$hideOwn ), $nondefaults );
        $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
 
-       # Hide/show minor edits
-       $label = $hideMinor ? wfMsgHtml( 'watchlist-show-minor' ) : wfMsgHtml( 'watchlist-hide-minor' );
-       $linkBits = wfArrayToCGI( array( 'hideMinor' => 1 - (int)$hideMinor ), $nondefaults );
-       $links[] = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
-
        $wgOut->addHTML( implode( ' | ', $links ) );
 
        # Form for namespace filtering
@@ -252,14 +279,19 @@ function wfSpecialWatchlist( $par ) {
        $form .= '<p>';
        $form .= Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '&nbsp;';
        $form .= Xml::namespaceSelector( $nameSpace, '' ) . '&nbsp;';
+       $form .= Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $invert ) . "<br />";
        $form .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</p>';
        $form .= Xml::hidden( 'days', $days );
-       if( $hideOwn )
-               $form .= Xml::hidden( 'hideOwn', 1 );
-       if( $hideBots )
-               $form .= Xml::hidden( 'hideBots', 1 );
        if( $hideMinor )
                $form .= Xml::hidden( 'hideMinor', 1 );
+       if( $hideBots )
+               $form .= Xml::hidden( 'hideBots', 1 );
+       if( $hideAnons )
+               $form .= Xml::hidden( 'hideAnons', 1 );
+       if( $hideLiu )
+               $form .= Xml::hidden( 'hideLiu', 1 );
+       if( $hideOwn )
+               $form .= Xml::hidden( 'hideOwn', 1 );
        $form .= Xml::closeElement( 'form' );
        $wgOut->addHtml( $form );
 
@@ -316,7 +348,6 @@ function wfSpecialWatchlist( $par ) {
 
        $dbr->freeResult( $res );
        $wgOut->addHTML( $s );
-
 }
 
 function wlHoursLink( $h, $page, $options = array() ) {
index 3a1d1ce..da55356 100644 (file)
@@ -528,6 +528,8 @@ XHTML id names.
 'tog-watchlisthideown'        => 'Hide my edits from the watchlist',
 'tog-watchlisthidebots'       => 'Hide bot edits from the watchlist',
 'tog-watchlisthideminor'      => 'Hide minor edits from the watchlist',
+'tog-watchlisthideliu'        => 'Hide edits by logged in users from the watchlist',
+'tog-watchlisthideanons'      => 'Hide edits by anonymous users from the watchlist',
 'tog-nolangconversion'        => 'Disable variants conversion', # only translate this message to other languages if you have to change it
 'tog-ccmeonemails'            => 'Send me copies of e-mails I send to other users',
 'tog-diffonly'                => 'Do not show page content below diffs',
@@ -2097,6 +2099,10 @@ Future changes to this page and its associated talk page will be listed there, a
 'watchlist-hide-own'   => 'Hide my edits',
 'watchlist-show-minor' => 'Show minor edits',
 'watchlist-hide-minor' => 'Hide minor edits',
+'watchlist-show-anons' => 'Show anonymous edits',
+'watchlist-hide-anons' => 'Hide anonymous edits',
+'watchlist-show-liu'   => 'Show logged-in user edits',
+'watchlist-hide-liu'   => 'Hide logged-in user edits',
 
 # Displayed when you click the "watch" button and it is in the process of watching
 'watching'   => 'Watching...',
index 9a7ac6d..1597e7d 100644 (file)
@@ -48,6 +48,8 @@ $wgMessageStructure = array(
                'tog-watchlisthideown',
                'tog-watchlisthidebots',
                'tog-watchlisthideminor',
+               'tog-watchlisthideliu',
+               'tog-watchlisthideanons',
                'tog-nolangconversion',
                'tog-ccmeonemails',
                'tog-diffonly',
@@ -1374,6 +1376,10 @@ $wgMessageStructure = array(
                'watchlist-hide-own',
                'watchlist-show-minor',
                'watchlist-hide-minor',
+               'watchlist-show-anons',
+               'watchlist-hide-anons',
+               'watchlist-show-liu',
+               'watchlist-hide-liu',
        ),
        'watching' => array(
                'watching',