Watchlist cleanup #1
authorRob Church <robchurch@users.mediawiki.org>
Tue, 18 Apr 2006 00:37:40 +0000 (00:37 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Tue, 18 Apr 2006 00:37:40 +0000 (00:37 +0000)
* Hiding bots should now work
* Cleaned up "panel" generation code to facilitate easier adding of items in the future
* Set less restrictive range on default days setting in user preferences
* Tweak messages to look a bit nicer
* Add the show/hide bots thing to the user preferences

RELEASE-NOTES
includes/DefaultSettings.php
includes/SpecialPreferences.php
includes/SpecialWatchlist.php
languages/Language.php
languages/Messages.php

index 3523d37..b914301 100644 (file)
@@ -93,6 +93,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 5628) More translations for MessagesHr.php
 * (bug 5595) Localisation for Bosnian language (bs)
 * (bug 2910) Default view preferences for watchlists
+* Add "hide bot edits from the watchlist" user preference
 
 == Compatibility ==
 
index f3b8e0b..20bdeda 100644 (file)
@@ -1897,12 +1897,6 @@ $wgTranscludeCacheExpiry = 3600;
  */
 $wgUseTrackbacks = false;
 
-/**
- * Enable filtering of robots in Special:Watchlist
- */
-
-$wgFilterRobotsWL = false;
-
 /**
  * Enable filtering of categories in Recentchanges
  */
index 6af8662..8327762 100644 (file)
@@ -265,7 +265,7 @@ class PreferencesForm {
                $wgUser->setOption( 'imagesize', $this->mImageSize );
                $wgUser->setOption( 'thumbsize', $this->mThumbSize );
                $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
-               $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0.5, 5 ) );
+               $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
 
                # Set search namespace options
                foreach( $this->mSearchNs as $i => $value ) {
@@ -853,7 +853,7 @@ class PreferencesForm {
                $wgOut->addHTML( '<label for="wpWatchlistDays">' . wfMsgHtml( 'prefs-watchlist-days' ) . '</label> ' );
                $wgOut->addHTML( '<input type="text" name="wpWatchlistDays" id="wpWatchlistDays" value="' . $this->mWatchlistDays . '" size="3" />' );
                $wgOut->addHTML( '<p></p>' ); # Spacing
-               $wgOut->addHTML( $this->getToggles( array( 'watchlisthideown' ) ) );
+               $wgOut->addHTML( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots' ) ) );
 
                $wgOut->addHTML( '</fieldset>' );
 
index 890761d..5c89a33 100644 (file)
@@ -248,13 +248,9 @@ function wfSpecialWatchlist( $par ) {
 
        # Up estimate of watched items by 15% to compensate for talk pages...
 
+       # Toggles
        $andHideOwn = $hideOwn ? "AND (rc_user <> $uid)" : '';
-       if( $wgFilterRobotsWL ) {
-               $andHideBotsOptional = $hideBots ? "AND (rc_bot = 0)" : '';
-       } else {
-               $andHideBotsOptional = "AND rc_this_oldid=page_latest";
-       }
-
+       $andHideBots = $hideBots ? "AND (rc_bot = 0)" : '';
 
        # Show watchlist header
        $header = '';
@@ -295,7 +291,7 @@ function wfSpecialWatchlist( $par ) {
          AND rc_timestamp > '$cutoff'
          AND rc_cur_id=page_id
          $andHideOwn
-         $andHideBotsOptional
+         $andHideBots
          $nameSpaceClause
          ORDER BY rc_timestamp DESC";
 
@@ -314,23 +310,20 @@ function wfSpecialWatchlist( $par ) {
 
        $wgOut->addHTML( "\n" . wlCutoffLinks( $days, 'Watchlist', $nondefaults ) . "<br />\n" );
 
-       $sk = $wgUser->getSkin();
-       $s = $sk->makeKnownLink(
-               $wgContLang->specialPage( 'Watchlist' ),
-               (0 == $hideOwn) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ),
-               wfArrayToCGI( array('hideOwn' => 1-$hideOwn ), $nondefaults ) );
-       $wgOut->addHTML( wfMsgHtml( "wlhideshowown", $s ) );
-
-       if( $wgFilterRobotsWL ) {
-               $s = $sk->makeKnownLink(
-      $wgContLang->specialPage( 'Watchlist' ),
-                 (0 == $hideBots) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ),
-                 wfArrayToCGI( array('hideBots' => 1-$hideBots ), $nondefaults ) );
-         $wgOut->addHTML( wfMsgHtml( "wlhideshowbots", "  $s" ) );
+       # Spit out some control panel links
+       $thisTitle = Title::makeTitle( NS_SPECIAL, 'Watchlist' );
+       $skin = $wgUser->getSkin();
+       $linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' );
+       
+       foreach( $linkElements as $var => $msg ) {
+               $label = $$var == 0 ? wfMsgHtml( 'hide' ) : wfMsgHtml( 'show' );        
+               $linkBits = wfArrayToCGI( array( $var => 1 - $$var ), $nondefaults );
+               $link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
+               $links[] = wfMsgHtml( $msg, $link );
        }
+       $wgOut->addHTML( implode( ' | ', $links ) );
 
        # Form for namespace filtering
-       $thisTitle = Title::makeTitle( NS_SPECIAL, 'Watchlist' );
        $thisAction = $thisTitle->escapeLocalUrl();
        $nsForm  = "<form method=\"post\" action=\"{$thisAction}\">\n";
        $nsForm .= "<label for=\"namespace\">" . wfMsg( 'namespace' ) . "</label> ";
index 067c8b3..6a2d200 100644 (file)
@@ -163,6 +163,7 @@ $wgDateFormatsEn = array(
        'autopatrol',
        'forceeditsummary',
        'watchlisthideown',
+       'watchlisthidebots',
 );
 
 /* private */ $wgBookstoreListEn = array(
index bb6d94e..3404f6a 100644 (file)
@@ -64,6 +64,7 @@ parent class in order maintain consistency across languages.
 'tog-autopatrol' => 'Mark edits I make as patrolled',
 'tog-forceeditsummary' => 'Prompt me when entering a blank edit summary',
 'tog-watchlisthideown' => 'Hide my edits from the watchlist',
+'tog-watchlisthidebots' => 'Hide bot edits from the watchlist',
 
 'underline-always' => 'Always',
 'underline-never' => 'Never',
@@ -1096,10 +1097,8 @@ at the bottom of the screen (deleting a content page also deletes the accompanyi
 'wlnote'               => 'Below are the last $1 changes in the last <b>$2</b> hours.',
 'wlshowlast'           => 'Show last $1 hours $2 days $3',
 'wlsaved'              => 'This is a saved version of your watchlist.',
-'wlhideshowown'        => '$1 my edits.',
-'wlhideshowbots'       => '$1 bot edits.',
-'wlshow'               => 'Show',
-'wlhide'               => 'Hide',
+'wlhideshowown'        => '$1 my edits',
+'wlhideshowbots'       => '$1 bot edits',
 
 'enotif_mailer'                => '{{SITENAME}} Notification Mailer',
 'enotif_reset'                 => 'Mark all pages visited',