Index: trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | /** |
27 | 27 | * Constructor |
28 | 28 | */ |
29 | | - public function __construct(){ |
| 29 | + public function __construct() { |
30 | 30 | //XXX That's nasty, SpecialWatchlist should have a corresponding constructor, |
31 | 31 | // or expose the methods we need publicly |
32 | 32 | SpecialPage::__construct( 'CollabWatchlist' ); |
— | — | @@ -149,7 +149,6 @@ |
150 | 150 | |
151 | 151 | # Get collabwatchlist value, if supplied, and prepare a WHERE fragment |
152 | 152 | $collabWatchlist = $wgRequest->getIntOrNull( 'collabwatchlist' ); |
153 | | - $invert = $wgRequest->getBool( 'invert' ); |
154 | 153 | if ( !is_null( $collabWatchlist ) && $collabWatchlist !== 'all' ) { |
155 | 154 | $collabWatchlist = intval( $collabWatchlist ); |
156 | 155 | } |
— | — | @@ -190,7 +189,6 @@ |
191 | 190 | wfAppendToArrayIfNotDefault( 'hidePatrolled', (int)$hidePatrolled, $defaults, $nondefaults ); |
192 | 191 | wfAppendToArrayIfNotDefault( 'filterTags', $filterTags , $defaults, $nondefaults ); |
193 | 192 | wfAppendToArrayIfNotDefault( 'invertTags', $invertTags , $defaults, $nondefaults ); |
194 | | - wfAppendToArrayIfNotDefault( 'invert', $invert , $defaults, $nondefaults ); |
195 | 193 | |
196 | 194 | if ( $days <= 0 ) { |
197 | 195 | $andcutoff = ''; |
— | — | @@ -361,7 +359,6 @@ |
362 | 360 | } |
363 | 361 | $form .= Xml::checkLabel( wfMsg( 'collabwatchlistinverttags' ), 'invertTags', 'nsinvertTags', $invertTags ) . '<br />'; |
364 | 362 | $form .= CollabWatchlistChangesList::collabWatchlistSelector( $listIdsAndNames, $collabWatchlist, '', 'collabwatchlist', wfMsg( 'collabwatchlist' ) ) . ' '; |
365 | | - $form .= Xml::checkLabel( wfMsg( 'invert' ), 'invert', 'nsinvert', $invert ) . ' '; |
366 | 363 | $form .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</p>'; |
367 | 364 | $form .= Html::hidden( 'days', $days ); |
368 | 365 | if ( $hideMinor ) |
— | — | @@ -427,7 +424,7 @@ |
428 | 425 | $rc->numberofWatchingusers = 0; |
429 | 426 | } |
430 | 427 | |
431 | | - $tags = $this->wlTagsForRevision( $obj->rc_this_oldid, array( $collabWatchlist ), $invert ); |
| 428 | + $tags = $this->wlTagsForRevision( $obj->rc_this_oldid, array( $collabWatchlist ) ); |
432 | 429 | // if( isset($tags) ) { |
433 | 430 | // // Filter recentchanges which contain unwanted tags |
434 | 431 | // $tagNames = array(); |
— | — | @@ -468,19 +465,14 @@ |
469 | 466 | * - rrt_comment Collabwatchlist tag comment |
470 | 467 | * @param $rev_id |
471 | 468 | * @param $rl_ids |
472 | | - * @param $invert |
473 | 469 | * @return unknown_type |
474 | 470 | */ |
475 | | - function wlTagsForRevision( $rev_id, $rl_ids = array(), $invert = false, $filterTags = array() ) { |
| 471 | + function wlTagsForRevision( $rev_id, $rl_ids = array(), $filterTags = array() ) { |
476 | 472 | // Some DB stuff |
477 | 473 | $dbr = wfGetDB( DB_SLAVE ); |
478 | 474 | $cond = array(); |
479 | 475 | if ( isset( $rl_ids ) && !( count( $rl_ids ) == 1 && $rl_ids[0] == 0 ) ) { |
480 | | - if ( $invert ) { |
481 | | - $cond[] = "rl_id NOT IN (" . $dbr->makeList( $rl_ids ) . ")"; |
482 | | - } else { |
483 | | - $cond = array( "rl_id" => $rl_ids ); |
484 | | - } |
| 476 | + $cond = array( "rl_id" => $rl_ids ); |
485 | 477 | } |
486 | 478 | if ( isset( $filterTags ) && count( $filterTags ) > 0 ) { |
487 | 479 | $cond[] = "ct_tag not in (" . $dbr->makeList( $filterTags ) . ")"; |
— | — | @@ -580,7 +572,22 @@ |
581 | 573 | } |
582 | 574 | return $clause; |
583 | 575 | } |
| 576 | + |
| 577 | + //XXX SpecialWatchlist should let us pass the page title |
| 578 | + public static function showHideLink( $options, $message, $name, $value ) { |
| 579 | + global $wgUser; |
584 | 580 | |
| 581 | + $showLinktext = wfMsgHtml( 'show' ); |
| 582 | + $hideLinktext = wfMsgHtml( 'hide' ); |
| 583 | + $title = SpecialPage::getTitleFor( 'CollabWatchlist' ); |
| 584 | + $skin = $wgUser->getSkin(); |
| 585 | + |
| 586 | + $label = $value ? $showLinktext : $hideLinktext; |
| 587 | + $options[$name] = 1 - (int) $value; |
| 588 | + |
| 589 | + return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) ); |
| 590 | + } |
| 591 | + |
585 | 592 | /** |
586 | 593 | * Runs $db->addQuotes() for each of the strings |
587 | 594 | * @param $db Database: The db object to use |