X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCategoryViewer.php;h=66079c0179a9f4b71f81f990fd2b8166e966c0e3;hb=82ad18fbb49d79acb13dc13990da07dfe9f7f194;hp=1e0bf16c9fcc02f6edf061be3949c757e977a0b6;hpb=b3b50d729498435b8b9370ecddea73d082f9b9e6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 1e0bf16c9f..66079c0179 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -89,6 +89,9 @@ class CategoryViewer extends ContextSource { ) { $this->title = $title; $this->setContext( $context ); + $this->getOutput()->addModuleStyles( array( + 'mediawiki.action.view.categoryPage.styles' + ) ); $this->from = $from; $this->until = $until; $this->limit = $context->getConfig()->get( 'CategoryPagingLimit' ); @@ -528,8 +531,7 @@ class CategoryViewer extends ContextSource { * TODO: Take the headers into account when creating columns, so they're * more visually equal. * - * More distant TODO: Scrap this and use CSS columns, whenever IE finally - * supports those. + * TODO: shortList and columnList are similar, need merging * * @param array $articles * @param string[] $articles_start_char @@ -538,50 +540,34 @@ class CategoryViewer extends ContextSource { */ static function columnList( $articles, $articles_start_char ) { $columns = array_combine( $articles, $articles_start_char ); - # Split into three columns - $columns = array_chunk( $columns, ceil( count( $columns ) / 3 ), true /* preserve keys */ ); - $ret = ''; - $prevchar = null; + $ret = Html::openElement( 'div', array( 'class' => 'mw-category' ) ); - foreach ( $columns as $column ) { - $ret .= '\n"; } - $ret .= '
'; - $colContents = array(); + $colContents = array(); - # Kind of like array_flip() here, but we keep duplicates in an - # array instead of dropping them. - foreach ( $column as $article => $char ) { - if ( !isset( $colContents[$char] ) ) { - $colContents[$char] = array(); - } - $colContents[$char][] = $article; + # Kind of like array_flip() here, but we keep duplicates in an + # array instead of dropping them. + foreach ( $columns as $article => $char ) { + if ( !isset( $colContents[$char] ) ) { + $colContents[$char] = array(); } + $colContents[$char][] = $article; + } - $first = true; - foreach ( $colContents as $char => $articles ) { - # Change space to non-breaking space to keep headers aligned - $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char ); + foreach ( $colContents as $char => $articles ) { + # Change space to non-breaking space to keep headers aligned + $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char ); - $ret .= '

' . $h3char; - if ( $first && $char === $prevchar ) { - # We're continuing a previous chunk at the top of a new - # column, so add " cont." after the letter. - $ret .= ' ' . wfMessage( 'listingcontinuesabbrev' )->escaped(); - } - $ret .= "

\n"; + $ret .= '

' . $h3char; + $ret .= "

\n"; - $ret .= '
  • '; - $ret .= implode( "
  • \n
  • ", $articles ); - $ret .= '
'; - - $first = false; - $prevchar = $char; - } + $ret .= '
  • '; + $ret .= implode( "
  • \n
  • ", $articles ); + $ret .= '
'; - $ret .= "
'; + $ret .= Html::closeElement( 'div' ); return $ret; } @@ -617,7 +603,7 @@ class CategoryViewer extends ContextSource { * @return string HTML */ private function pagingLinks( $first, $last, $type = '' ) { - $prevLink = $this->msg( 'prevn' )->numParams( $this->limit )->escaped(); + $prevLink = $this->msg( 'prev-page' )->text(); if ( $first != '' ) { $prevQuery = $this->query; @@ -631,7 +617,7 @@ class CategoryViewer extends ContextSource { ); } - $nextLink = $this->msg( 'nextn' )->numParams( $this->limit )->escaped(); + $nextLink = $this->msg( 'next-page' )->text(); if ( $last != '' ) { $lastQuery = $this->query;