/* bool */ 'hideOwn' => (int)$user->getBoolOption( 'watchlisthideown' ),
/* ? */ 'namespace' => 'all',
/* ? */ 'invert' => false,
+ /* bool */ 'associated' => false,
);
$this->customFilters = array();
wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
# Get namespace value, if supplied, and prepare a WHERE fragment
$nameSpace = $request->getIntOrNull( 'namespace' );
- $invert = $request->getIntOrNull( 'invert' );
+ $invert = $request->getBool( 'invert' );
+ $associated = $request->getBool( 'associated' );
if ( !is_null( $nameSpace ) ) {
+ $eq_op = $invert ? '!=' : '=';\r
+ $bool_op = $invert ? 'AND' : 'OR';
$nameSpace = intval( $nameSpace ); // paranioa
- if ( $invert ) {
- $nameSpaceClause = "rc_namespace != $nameSpace";
+ if ( !$associated ) {
+ $nameSpaceClause = "rc_namespace $eq_op $nameSpace";
} else {
- $nameSpaceClause = "rc_namespace = $nameSpace";
+ $associatedNS = MWNamespace::getAssociated( $nameSpace );\r
+ $nameSpaceClause =
+ "rc_namespace $eq_op $nameSpace " .\r
+ $bool_op .\r
+ " rc_namespace $eq_op $associatedNS";
}
} else {
$nameSpace = '';
}
$values['namespace'] = $nameSpace;
$values['invert'] = $invert;
+ $values['associated'] = $associated;
if( is_null( $values['days'] ) || !is_numeric( $values['days'] ) ) {
$big = 1000; /* The magical big */
'class' => 'namespaceselector',
)
) . ' ';
- $form .= Xml::checkLabel( $this->msg( 'invert' )->text(), 'invert', 'nsinvert', $invert ) . ' ';
+ $form .= Xml::checkLabel(
+ $this->msg( 'invert' )->text(),
+ 'invert',
+ 'nsinvert',
+ $invert,
+ array( 'title' => $this->msg( 'tooltip-invert' )->text() )
+ ) . ' ';
+ $form .= Xml::checkLabel(
+ $this->msg( 'namespace_association' )->text(),
+ 'associated',
+ 'associated',
+ $associated,
+ array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
+ ) . ' ';
$form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . '</p>';
$form .= Html::hidden( 'days', $values['days'] );
foreach ( $filters as $key => $msg ) {