}
/**
+ * TODO: Allow sorting by count. We need to have a unique index to do this
+ * properly.
+ *
* @addtogroup SpecialPage
* @addtogroup Pager
*/
class CategoryPager extends AlphabeticPager {
- private $mOrderType = 'abc';
-
- public function __construct() {
- parent::__construct();
- if( $this->mRequest->getText( 'order' ) == 'count' ) {
- $this->mOrderType = 'count';
- }
- if( $this->mRequest->getText( 'direction' ) == 'asc' ) {
- $this->mDefaultDirection = false;
- } elseif( $this->mRequest->getText( 'direction' ) == 'desc'
- || $this->mOrderType == 'count' ) {
- $this->mDefaultDirection = true;
- }
- }
-
function getQueryInfo() {
global $wgRequest;
return array(
}
function getIndexField() {
- # We can't use mOrderType here, since this is called from the parent
- # constructor. Hmm.
- if( $this->mRequest->getText( 'order' ) == 'count' ) {
- return 'cat_pages';
- } else {
- return "cat_title";
- }
+# return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
+ return 'cat_title';
+ }
+
+# protected function getOrderTypeMessages() {
+# return array( 'abc' => 'special-categories-sort-abc',
+# 'count' => 'special-categories-sort-count' );
+# }
+
+ protected function getDefaultDirections() {
+# return array( 'abc' => false, 'count' => true );
+ return false;
}
/* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
$wgLang->formatNum( $result->cat_pages ) );
return Xml::tags('li', null, "$titleText ($count)" ) . "\n";
}
-
- /** Override this to order by count */
- public function getNavigationBar() {
- $nav = parent::getNavigationBar() . ' (';
- if( $this->mOrderType == 'abc' ) {
- $nav .= $this->makeLink(
- wfMsgHTML( 'special-categories-sort-count' ),
- array( 'order' => 'count' )
- );
- } else {
- $nav .= $this->makeLink(
- wfMsgHTML( 'special-categories-sort-abc' ),
- array( 'order' => 'abc' )
- );
- }
- $nav .= ') (';
- # FIXME, these are stupid query names. "order" and "dir" are already
- # used.
- if( $this->mDefaultDirection ) {
- # Descending
- $nav .= $this->makeLink(
- wfMsgHTML( 'special-categories-sort-asc' ),
- array( 'direction' => 'asc' )
- );
- } else {
- $nav .= $this->makeLink(
- wfMsgHTML( 'special-categories-sort-desc' ),
- array( 'direction' => 'desc' )
- );
- }
- $nav .= ')';
- return $nav;
- }
}