From: umherirrender Date: Sat, 28 Apr 2012 09:06:08 +0000 (+0200) Subject: (bug 31704) Allow selection of associated namespace on the watchlist X-Git-Tag: 1.31.0-rc.0~23764^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/supprimer.php?a=commitdiff_plain;h=6178f88f57dbf9ec0a504aa2e829715a3a178575;p=lhc%2Fweb%2Fwiklou.git (bug 31704) Allow selection of associated namespace on the watchlist This patch does not contain javascript part for the checkboxes, see bug 36317 Change-Id: If012d70b57a925d86d56503735a3bed9ef32dd3f --- diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index bd8f775511..8ee49fc939 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -46,6 +46,7 @@ production. Special:Version * Edit notices can now be translated. * (bug 22887) Add warning and tracking category for preprocessor errors +* (bug 31704) Allow selection of associated namespace on the watchlist === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 0c5f11cd7c..4314424c42 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -116,6 +116,7 @@ class SpecialWatchlist extends SpecialPage { /* bool */ 'hideOwn' => (int)$user->getBoolOption( 'watchlisthideown' ), /* ? */ 'namespace' => 'all', /* ? */ 'invert' => false, + /* bool */ 'associated' => false, ); $this->customFilters = array(); wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) ); @@ -148,13 +149,20 @@ class SpecialWatchlist extends SpecialPage { # 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 ? '!=' : '='; + $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 ); + $nameSpaceClause = + "rc_namespace $eq_op $nameSpace " . + $bool_op . + " rc_namespace $eq_op $associatedNS"; } } else { $nameSpace = ''; @@ -162,6 +170,7 @@ class SpecialWatchlist extends SpecialPage { } $values['namespace'] = $nameSpace; $values['invert'] = $invert; + $values['associated'] = $associated; if( is_null( $values['days'] ) || !is_numeric( $values['days'] ) ) { $big = 1000; /* The magical big */ @@ -338,7 +347,20 @@ class SpecialWatchlist extends SpecialPage { '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() ) . '

'; $form .= Html::hidden( 'days', $values['days'] ); foreach ( $filters as $key => $msg ) {