r48568 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48567‎ | r48568 | r48569 >
Date:03:21, 19 March 2009
Author:aaron
Status:ok
Tags:
Comment:
* Add redirect filter
* Force page index
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
@@ -23,6 +23,7 @@
2424 $this->namespace = $wgRequest->getInt( 'namespace' );
2525 $this->type = $wgRequest->getInt( 'level', -1 );
2626 $this->type = min($this->type,$maxType);
 27+ $this->hideRedirs = $wgRequest->getBool( 'hideredirs', true );
2728
2829 $this->showForm();
2930 $this->showPageList();
@@ -34,11 +35,20 @@
3536 $form = Xml::openElement( 'form',
3637 array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) );
3738 $form .= "<fieldset><legend>".wfMsg('reviewedpages-leg')."</legend>\n";
38 -
 39+
 40+ // show/hide links
 41+ $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
 42+ $onoff = 1 - $this->hideRedirs;
 43+ $link = $this->skin->link( $this->getTitle(), $showhide[$onoff], array(),
 44+ array( 'hideredirs' => $onoff, 'namespace' => $this->namespace )
 45+ );
 46+ $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link );
 47+
3948 if( count($wgFlaggedRevsNamespaces) > 1 ) {
40 - $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
 49+ $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' ';
4150 }
42 - $form .= FlaggedRevsXML::getLevelMenu( $this->type );
 51+ $form .= FlaggedRevsXML::getLevelMenu( $this->type ) . ' ';
 52+ $form .= $showhideredirs . ' ';
4353
4454 $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
4555 $form .= Xml::hidden( 'title', $wgTitle->getPrefixedDBKey() );
@@ -50,7 +60,7 @@
5161 protected function showPageList() {
5262 global $wgOut, $wgUser, $wgLang;
5363
54 - $pager = new ReviewedPagesPager( $this, array(), $this->type, $this->namespace );
 64+ $pager = new ReviewedPagesPager( $this, array(), $this->type, $this->namespace, $this->hideRedirs );
5565 if( $pager->getNumRows() ) {
5666 $wgOut->addHTML( wfMsgExt('reviewedpages-list', array('parse') ) );
5767 $wgOut->addHTML( $pager->getNavigationBar() );
@@ -92,7 +102,7 @@
93103 class ReviewedPagesPager extends AlphabeticPager {
94104 public $mForm, $mConds, $namespace, $type;
95105
96 - function __construct( $form, $conds = array(), $type=0, $namespace=0 ) {
 106+ function __construct( $form, $conds = array(), $type=0, $namespace=0, $hideRedirs=1 ) {
97107 $this->mForm = $form;
98108 $this->mConds = $conds;
99109 $this->type = $type;
@@ -105,6 +115,7 @@
106116 $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
107117 }
108118 $this->namespace = $namespace;
 119+ $this->hideRedirs = $hideRedirs;
109120
110121 parent::__construct();
111122 }
@@ -121,12 +132,15 @@
122133 $conds['fp_quality'] = $this->type;
123134 $index = 'fp_quality_page';
124135 }
 136+ if( $this->hideRedirs ) {
 137+ $conds['page_is_redirect'] = 0;
 138+ }
125139 $conds['page_namespace'] = $this->namespace; // Sanity check NS
126140 return array(
127141 'tables' => array('flaggedpages','page'),
128142 'fields' => 'page_namespace,page_title,page_len,fp_page_id',
129143 'conds' => $conds,
130 - 'options' => array( 'USE INDEX' => array('flaggedpages' => $index) )
 144+ 'options' => array( 'USE INDEX' => array('flaggedpages' => $index,'page' => 'PRIMARY') )
131145 );
132146 }
133147

Status & tagging log