From 103e520974ea58c4f959385911ccb396efb8eebe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sun, 5 Jul 2009 09:11:09 +0000 Subject: [PATCH] * (bug 19442) Show/hide options on watchlist only work once * Regression is probably since r51572 --- RELEASE-NOTES | 1 + includes/specials/SpecialWatchlist.php | 120 +++++-------------------- 2 files changed, 23 insertions(+), 98 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index dc66781bb9..18088da09e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -228,6 +228,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN and attempted to upload with the source name. Now warns about not having an extension (since 0.ext is perfectly valid) * (bug 19468) Enotif preferences are now only displayed when they are turned on +* (bug 19442) Show/hide options on watchlist only work once == API changes in 1.16 == diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 8703d1b2ad..4d159f5fbf 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -252,108 +252,17 @@ function wfSpecialWatchlist( $par ) { $cutofflinks = "\n" . wlCutoffLinks( $days, 'Watchlist', $nondefaults ) . "
\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 = array_merge( - array( 'hideMinor' => 1 - (int)$hideMinor ), - $nondefaults - ); - $links[] = wfMsgHtml( - 'rcshowhideminor', - $skin->linkKnown( - $thisTitle, - $label, - array(), - $linkBits - ) - ); - - # Hide/show bot edits - $label = $hideBots ? $showLinktext : $hideLinktext; - $linkBits = array_merge( - array( 'hideBots' => 1 - (int)$hideBots ), - $nondefaults - ); - $links[] = wfMsgHtml( - 'rcshowhidebots', - $skin->linkKnown( - $thisTitle, - $label, - array(), - $linkBits - ) - ); - # Hide/show anonymous edits - $label = $hideAnons ? $showLinktext : $hideLinktext; - $linkBits = array_merge( - array( 'hideAnons' => 1 - (int)$hideAnons ), - $nondefaults - ); - $links[] = wfMsgHtml( - 'rcshowhideanons', - $skin->linkKnown( - $thisTitle, - $label, - array(), - $linkBits - ) - ); - - # Hide/show logged in edits - $label = $hideLiu ? $showLinktext : $hideLinktext; - $linkBits = array_merge( - array( 'hideLiu' => 1 - (int)$hideLiu ), - $nondefaults - ); - $links[] = wfMsgHtml( - 'rcshowhideliu', - $skin->linkKnown( - $thisTitle, - $label, - array(), - $linkBits - ) - ); - - # Hide/show own edits - $label = $hideOwn ? $showLinktext : $hideLinktext; - $linkBits = array_merge( - array( 'hideOwn' => 1 - (int)$hideOwn ), - $nondefaults - ); - $links[] = wfMsgHtml( - 'rcshowhidemine', - $skin->linkKnown( - $thisTitle, - $label, - array(), - $linkBits - ) - ); + # 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 ); - # Hide/show patrolled edits if( $wgUser->useRCPatrol() ) { - $label = $hidePatrolled ? $showLinktext : $hideLinktext; - $linkBits = array_merge( - array( 'hidePatrolled' => 1 - (int)$hidePatrolled ), - $nondefaults - ); - $links[] = wfMsgHtml( - 'rcshowhidepatr', - $skin->linkKnown( - $thisTitle, - $label, - array(), - $linkBits - ) - ); + $links[] = wlShowHideLink( $nondefaults, 'rcshowhidepatr', 'hidePatrolled', $hidePatrolled ); } # Namespace filter and put the whole form together. @@ -439,6 +348,21 @@ function wfSpecialWatchlist( $par ) { $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; -- 2.20.1