From: Ævar Arnfjörð Bjarmason Date: Thu, 7 Apr 2005 21:57:51 +0000 (+0000) Subject: * Implemented the 'invert' feature (akin to Special:Allpages) X-Git-Tag: 1.5.0alpha1~352 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=6c9dd1590ae498dd21605cd64b396b0379f570e3;p=lhc%2Fweb%2Fwiklou.git * Implemented the 'invert' feature (akin to Special:Allpages) --- diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 25e444d491..5c98e1c6bd 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -1,6 +1,5 @@ getVal( 'target' ); - + // GET values + $target = $par ? $par : $wgRequest->getVal( 'target' ); + $namespace = $wgRequest->getInt( 'namespace', '' ); + $namespace = ($namespace == '') ? NULL : $namespace; + $invert = $wgRequest->getBool( 'invert' ); + $hideminor = ($wgRequest->getBool( 'hideminor' ) ? true : false); + if ( '' == $target ) { $wgOut->errorpage( 'notargettitle', 'notargettext' ); return; @@ -30,16 +31,9 @@ function wfSpecialContributions( $par = '' ) { list( $limit, $offset ) = wfCheckLimits( 50, '' ); $offlimit = $limit + $offset; $querylimit = $offlimit + 1; - $hideminor = ($wgRequest->getVal( 'hideminor' ) ? 1 : 0); $sk = $wgUser->getSkin(); $dbr =& wfGetDB( DB_SLAVE ); $userCond = ""; - $namespace = $wgRequest->getVal( 'namespace', '' ); - if( $namespace != '' ) { - $namespace = IntVal( $namespace ); - } else { - $namespace = NULL; - } $nt = Title::newFromURL( $target ); if ( !$nt ) { @@ -85,7 +79,7 @@ function wfSpecialContributions( $par = '' ) { } if( !is_null($namespace) ) { - $minorQuery .= " AND page_namespace = {$namespace}"; + $minorQuery .= ' AND page_namespace ' . ($invert ? '!' : '') . "= {$namespace}"; } extract( $dbr->tableNames( 'page', 'revision' ) ); @@ -109,7 +103,7 @@ function wfSpecialContributions( $par = '' ) { $res = $dbr->query( $sql, $fname ); $numRows = $dbr->numRows( $res ); - $wgOut->addHTML( namespaceForm( $target, $hideminor, $namespace ) ); + $wgOut->addHTML( namespaceForm( $target, $hideminor, $namespace, $invert ) ); $top = wfShowingResults( $offset, $limit ); $wgOut->addHTML( "

{$top}\n" ); @@ -220,8 +214,9 @@ function ucListEdit( $sk, $row ) { * @param string $target target user to show contributions for * @param string $hideminor whether minor contributions are hidden * @param string $namespace currently selected namespace, NULL for show all + * @param bool $invert inverts the namespace selection on true (default null) */ -function namespaceForm ( $target, $hideminor, $namespace ) { +function namespaceForm ( $target, $hideminor, $namespace, $invert ) { global $wgContLang, $wgScript; $namespaceselect = ''; $submitbutton = ''; + $invertbox = "'; $out = "

"; $out .= ''; $out .= ''; $out .= ''; - $out .= wfMsg ( 'contributionsformtext', $namespaceselect, $submitbutton ); + $out .= wfMsg ( 'contributionsformtext', $namespaceselect, $submitbutton, $invertbox ); $out .= '
'; return $out; }