From da757e9712125c1c0d942990ce809932f85e0a6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 12 Jul 2005 18:28:13 +0000 Subject: [PATCH] * (bug 2802) Display more than one character of the sort key. --- RELEASE-NOTES | 1 + includes/CategoryPage.php | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2cd3631c76..29c980e60e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -561,6 +561,7 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new. * (bug 2780) Fix thumbnail generation with GD for new image schema * (bug 2791) Slovene numeric format * (bug 655) Provide empty search form when searching for nothing +* (bug 2802) Display more than one character of the sort key === Caveats === diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index bb6314f376..4d61eda632 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -140,9 +140,25 @@ class CategoryPage extends Article { } else { // Page in this category array_push( $articles, $sk->makeSizeLinkObj( $x->page_len, $title, $wgContLang->convert( $title->getPrefixedText() ) ) ) ; - array_push( $articles_start_char, $wgContLang->convert( $wgContLang->firstChar( $x->cl_sortkey ) ) ); + array_push( $articles_start_char,$wgContLang->convert( $x->cl_sortkey) ); } } + + $root_length = 0; + + for ($i = 0 ; $i < count($articles) - 1; ++$i){ + if ($articles_start_char[$i][$root_length] != $articles_start_char[$i + 1][$root_length] ) { + break; + } elseif (count($articles) - 2 == $i) { + $root_length = $root_length + 1; + $i = -1; + } + } + + for ($i = 0 ; $i < count($articles) ; ++$i) { + $articles_start_char[$i] = $wgContLang->truncate($articles_start_char[$i], $root_length + 1); + } + $dbr->freeResult( $res ); if( $flip ) { -- 2.20.1