From: Brion Vibber Date: Mon, 9 Jun 2008 23:04:06 +0000 (+0000) Subject: Clean up rr35065 -- normalize initial caps and _ input on Special:Categories form... X-Git-Tag: 1.31.0-rc.0~47088 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=dd01af78a288df739affbdec5d04e1a0e2b38369;p=lhc%2Fweb%2Fwiklou.git Clean up rr35065 -- normalize initial caps and _ input on Special:Categories form and accept /suffix on page name --- diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php index d5b79a9d41..68aeb1f139 100644 --- a/includes/SpecialCategories.php +++ b/includes/SpecialCategories.php @@ -4,13 +4,18 @@ * @ingroup SpecialPage */ -function wfSpecialCategories() { +function wfSpecialCategories( $par=null ) { global $wgOut, $wgRequest; - $cap = new CategoryPager(); + if( $par == '' ) { + $from = $wgRequest->getText( 'from' ); + } else { + $from = $par; + } + $cap = new CategoryPager( $from ); $wgOut->addHTML( wfMsgExt( 'categoriespagetext', array( 'parse' ) ) . - $cap->getStartForm( str_replace( '_', ' ', $wgRequest->getVal( 'offset' ) ) ) . + $cap->getStartForm( $from ) . $cap->getNavigationBar() . '' . $cap->getNavigationBar() @@ -24,6 +29,18 @@ function wfSpecialCategories() { * @ingroup SpecialPage Pager */ class CategoryPager extends AlphabeticPager { + function __construct( $from ) { + parent::__construct(); + $from = str_replace( ' ', '_', $from ); + if( $from != '' ) { + global $wgCapitalLinks, $wgContLang; + if( $wgCapitalLinks ) { + $from = $wgContLang->ucfirst( $from ); + } + $this->mOffset = $from; + } + } + function getQueryInfo() { global $wgRequest; return array( @@ -39,6 +56,10 @@ class CategoryPager extends AlphabeticPager { return 'cat_title'; } + function getDefaultQuery() { + parent::getDefaultQuery(); + unset( $this->mDefaultQuery['from'] ); + } # protected function getOrderTypeMessages() { # return array( 'abc' => 'special-categories-sort-abc', # 'count' => 'special-categories-sort-count' ); @@ -75,7 +96,7 @@ class CategoryPager extends AlphabeticPager { return Xml::tags('li', null, "$titleText ($count)" ) . "\n"; } - public function getStartForm( $from='' ) { + public function getStartForm( $from ) { global $wgScript; $t = SpecialPage::getTitleFor( 'Categories' ); @@ -84,7 +105,7 @@ class CategoryPager extends AlphabeticPager { Xml::hidden( 'title', $t->getPrefixedText() ) . Xml::fieldset( wfMsg( 'categories' ), Xml::inputLabel( wfMsg( 'categoriesfrom' ), - 'offset', 'offset', 20, $from ) . + 'from', 'from', 20, $from ) . ' ' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) ) ); }