From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- includes/Pager.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 7 deletions(-) (limited to 'includes/Pager.php') diff --git a/includes/Pager.php b/includes/Pager.php index 0987cc06..a475dc16 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -2,6 +2,7 @@ /** * Basic pager interface. + * @addtogroup Pager */ interface Pager { function getNavigationBar(); @@ -46,6 +47,8 @@ interface Pager { * please see the examples in PageHistory.php and SpecialIpblocklist.php. You just need * to override formatRow(), getQueryInfo() and getIndexField(). Don't forget to call the * parent constructor if you override it. + * + * @addtogroup Pager */ abstract class IndexPager implements Pager { public $mRequest; @@ -69,17 +72,18 @@ abstract class IndexPager implements Pager { public $mResult; function __construct() { - global $wgRequest; + global $wgRequest, $wgUser; $this->mRequest = $wgRequest; - + # NB: the offset is quoted, not validated. It is treated as an arbitrary string # to support the widest variety of index types. Be careful outputting it into # HTML! $this->mOffset = $this->mRequest->getText( 'offset' ); - $this->mLimit = $this->mRequest->getInt( 'limit', $this->mDefaultLimit ); - if ( $this->mLimit <= 0 || $this->mLimit > 50000 ) { - $this->mLimit = $this->mDefaultLimit; - } + + # Use consistent behavior for the limit options + $this->mDefaultLimit = intval( $wgUser->getOption( 'rclimit' ) ); + list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset(); + $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' ); $this->mIndexField = $this->getIndexField(); $this->mDb = wfGetDB( DB_SLAVE ); @@ -386,8 +390,45 @@ abstract class IndexPager implements Pager { abstract function getIndexField(); } + +/** + * IndexPager with an alphabetic list and a formatted navigation bar + * @addtogroup Pager + */ +abstract class AlphabeticPager extends IndexPager { + public $mDefaultDirection = false; + + function __construct() { + parent::__construct(); + } + + /** + * Shamelessly stolen bits from ReverseChronologicalPager, d + * didn't want to do class magic as may be still revamped + */ + function getNavigationBar() { + global $wgLang; + + $linkTexts = array( + 'prev' => wfMsgHtml( "prevn", $this->mLimit ), + 'next' => wfMsgHtml( 'nextn', $this->mLimit ), + 'first' => wfMsgHtml('page_first'), /* Introduced the message */ + 'last' => wfMsgHtml( 'page_last' ) /* Introduced the message */ + ); + + $pagingLinks = $this->getPagingLinks( $linkTexts ); + $limitLinks = $this->getLimitLinks(); + $limits = implode( ' | ', $limitLinks ); + + $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " . wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits); + return $this->mNavigationBar; + + } +} + /** * IndexPager with a formatted navigation bar + * @addtogroup Pager */ abstract class ReverseChronologicalPager extends IndexPager { public $mDefaultDirection = true; @@ -413,13 +454,15 @@ abstract class ReverseChronologicalPager extends IndexPager { $limitLinks = $this->getLimitLinks(); $limits = implode( ' | ', $limitLinks ); - $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " . wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits); + $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " . + wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits); return $this->mNavigationBar; } } /** * Table-based display with a user-selectable sort order + * @addtogroup Pager */ abstract class TablePager extends IndexPager { var $mSort; -- cgit v1.2.2