Revision: 48568
Author:   aaron
Date:     2009-03-19 03:21:25 +0000 (Thu, 19 Mar 2009)

Log Message:
-----------
* Add redirect filter
* Force page index

Modified Paths:
--------------
    trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php

Modified: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
===================================================================
--- trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php    
2009-03-19 03:10:18 UTC (rev 48567)
+++ trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php    
2009-03-19 03:21:25 UTC (rev 48568)
@@ -23,6 +23,7 @@
                $this->namespace = $wgRequest->getInt( 'namespace' );
                $this->type = $wgRequest->getInt( 'level', -1 );
                $this->type = min($this->type,$maxType);
+               $this->hideRedirs = $wgRequest->getBool( 'hideredirs', true );
                
                $this->showForm();
                $this->showPageList();
@@ -34,11 +35,20 @@
                $form = Xml::openElement( 'form',
                        array( 'name' => 'reviewedpages', 'action' => 
$wgScript, 'method' => 'get' ) );
                $form .= 
"<fieldset><legend>".wfMsg('reviewedpages-leg')."</legend>\n";
-               
+
+               // show/hide links
+               $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
+               $onoff = 1 - $this->hideRedirs;
+               $link = $this->skin->link( $this->getTitle(), 
$showhide[$onoff], array(),
+                        array( 'hideredirs' => $onoff, 'namespace' => 
$this->namespace )
+               );
+               $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link 
);
+
                if( count($wgFlaggedRevsNamespaces) > 1 ) {
-                       $form .= FlaggedRevsXML::getNamespaceMenu( 
$this->namespace ) . '&nbsp;';
+                       $form .= FlaggedRevsXML::getNamespaceMenu( 
$this->namespace ) . ' ';
                }
-               $form .= FlaggedRevsXML::getLevelMenu( $this->type );
+               $form .= FlaggedRevsXML::getLevelMenu( $this->type ) . ' ';
+               $form .= $showhideredirs . ' ';
 
                $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
                $form .= Xml::hidden( 'title', $wgTitle->getPrefixedDBKey() );
@@ -50,7 +60,7 @@
        protected function showPageList() {
                global $wgOut, $wgUser, $wgLang;
 
-               $pager = new ReviewedPagesPager( $this, array(), $this->type, 
$this->namespace );
+               $pager = new ReviewedPagesPager( $this, array(), $this->type, 
$this->namespace, $this->hideRedirs );
                if( $pager->getNumRows() ) {
                        $wgOut->addHTML( wfMsgExt('reviewedpages-list', 
array('parse') ) );
                        $wgOut->addHTML( $pager->getNavigationBar() );
@@ -92,7 +102,7 @@
 class ReviewedPagesPager extends AlphabeticPager {
        public $mForm, $mConds, $namespace, $type;
 
-       function __construct( $form, $conds = array(), $type=0, $namespace=0 ) {
+       function __construct( $form, $conds = array(), $type=0, $namespace=0, 
$hideRedirs=1 ) {
                $this->mForm = $form;
                $this->mConds = $conds;
                $this->type = $type;
@@ -105,6 +115,7 @@
                        $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : 
$wgFlaggedRevsNamespaces[0];         
                }
                $this->namespace = $namespace;
+               $this->hideRedirs = $hideRedirs;
 
                parent::__construct();
        }
@@ -121,12 +132,15 @@
                        $conds['fp_quality'] = $this->type;
                        $index = 'fp_quality_page';
                }
+               if( $this->hideRedirs ) {
+                       $conds['page_is_redirect'] = 0;
+               }
                $conds['page_namespace'] = $this->namespace; // Sanity check NS
                return array(
                        'tables' => array('flaggedpages','page'),
                        'fields' => 
'page_namespace,page_title,page_len,fp_page_id',
                        'conds'  => $conds,
-                       'options' => array( 'USE INDEX' => array('flaggedpages' 
=> $index) )
+                       'options' => array( 'USE INDEX' => array('flaggedpages' 
=> $index,'page' => 'PRIMARY') )
                );
        }
 



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to