r36111 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36110‎ | r36111 | r36112 >
Date:23:04, 9 June 2008
Author:brion
Status:old
Tags:
Comment:
Clean up rr35065 -- normalize initial caps and _ input on Special:Categories form and accept /suffix on page name
Modified paths:
  • /trunk/phase3/includes/SpecialCategories.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialCategories.php
@@ -4,13 +4,18 @@
55 * @ingroup SpecialPage
66 */
77
8 -function wfSpecialCategories() {
 8+function wfSpecialCategories( $par=null ) {
99 global $wgOut, $wgRequest;
1010
11 - $cap = new CategoryPager();
 11+ if( $par == '' ) {
 12+ $from = $wgRequest->getText( 'from' );
 13+ } else {
 14+ $from = $par;
 15+ }
 16+ $cap = new CategoryPager( $from );
1217 $wgOut->addHTML(
1318 wfMsgExt( 'categoriespagetext', array( 'parse' ) ) .
14 - $cap->getStartForm( str_replace( '_', ' ', $wgRequest->getVal( 'offset' ) ) ) .
 19+ $cap->getStartForm( $from ) .
1520 $cap->getNavigationBar() .
1621 '<ul>' . $cap->getBody() . '</ul>' .
1722 $cap->getNavigationBar()
@@ -24,6 +29,18 @@
2530 * @ingroup SpecialPage Pager
2631 */
2732 class CategoryPager extends AlphabeticPager {
 33+ function __construct( $from ) {
 34+ parent::__construct();
 35+ $from = str_replace( ' ', '_', $from );
 36+ if( $from != '' ) {
 37+ global $wgCapitalLinks, $wgContLang;
 38+ if( $wgCapitalLinks ) {
 39+ $from = $wgContLang->ucfirst( $from );
 40+ }
 41+ $this->mOffset = $from;
 42+ }
 43+ }
 44+
2845 function getQueryInfo() {
2946 global $wgRequest;
3047 return array(
@@ -39,6 +56,10 @@
4057 return 'cat_title';
4158 }
4259
 60+ function getDefaultQuery() {
 61+ parent::getDefaultQuery();
 62+ unset( $this->mDefaultQuery['from'] );
 63+ }
4364 # protected function getOrderTypeMessages() {
4465 # return array( 'abc' => 'special-categories-sort-abc',
4566 # 'count' => 'special-categories-sort-count' );
@@ -75,7 +96,7 @@
7697 return Xml::tags('li', null, "$titleText ($count)" ) . "\n";
7798 }
7899
79 - public function getStartForm( $from='' ) {
 100+ public function getStartForm( $from ) {
80101 global $wgScript;
81102 $t = SpecialPage::getTitleFor( 'Categories' );
82103
@@ -84,7 +105,7 @@
85106 Xml::hidden( 'title', $t->getPrefixedText() ) .
86107 Xml::fieldset( wfMsg( 'categories' ),
87108 Xml::inputLabel( wfMsg( 'categoriesfrom' ),
88 - 'offset', 'offset', 20, $from ) .
 109+ 'from', 'from', 20, $from ) .
89110 ' ' .
90111 Xml::submitButton( wfMsg( 'allpagessubmit' ) ) ) );
91112 }

Status & tagging log