From 8f416baead93a48e5799e44b8bd2e2c4859f4e04 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 14 Sep 2007 13:18:58 +0200 Subject: auf Version 1.11 aktualisiert; Login-Bug behoben --- includes/CategoryPage.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'includes/CategoryPage.php') diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 356f9ea2..76a388a6 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -90,6 +90,11 @@ class CategoryViewer { $this->getImageSection() . $this->getCategoryBottom(); + // Give a proper message if category is empty + if ( $r == '' ) { + $r = wfMsgExt( 'category-empty', array( 'parse' ) ); + } + wfProfileOut( __METHOD__ ); return $r; } @@ -101,7 +106,7 @@ class CategoryViewer { $this->children_start_char = array(); if( $this->showGallery ) { $this->gallery = new ImageGallery(); - $this->gallery->setParsing(); + $this->gallery->setHideBadImages(); } } @@ -147,7 +152,7 @@ class CategoryViewer { /** * Add a page in the image namespace */ - function addImage( $title, $sortkey, $pageLength ) { + function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) { if ( $this->showGallery ) { $image = new Image( $title ); if( $this->flip ) { @@ -156,18 +161,18 @@ class CategoryViewer { $this->gallery->add( $image ); } } else { - $this->addPage( $title, $sortkey, $pageLength ); + $this->addPage( $title, $sortkey, $pageLength, $isRedirect ); } } /** * Add a miscellaneous page */ - function addPage( $title, $sortkey, $pageLength ) { + function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) { global $wgContLang; - $this->articles[] = $this->getSkin()->makeSizeLinkObj( - $pageLength, $title, $wgContLang->convert( $title->getPrefixedText() ) - ); + $this->articles[] = $isRedirect + ? '' . $this->getSkin()->makeKnownLinkObj( $title ) . '' + : $this->getSkin()->makeSizeLinkObj( $pageLength, $title ); $this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); } @@ -194,7 +199,7 @@ class CategoryViewer { } $res = $dbr->select( array( 'page', 'categorylinks' ), - array( 'page_title', 'page_namespace', 'page_len', 'cl_sortkey' ), + array( 'page_title', 'page_namespace', 'page_len', 'page_is_redirect', 'cl_sortkey' ), array( $pageCondition, 'cl_from = page_id', 'cl_to' => $this->title->getDBKey()), @@ -219,23 +224,25 @@ class CategoryViewer { if( $title->getNamespace() == NS_CATEGORY ) { $this->addSubcategory( $title, $x->cl_sortkey, $x->page_len ); - } elseif( $title->getNamespace() == NS_IMAGE ) { - $this->addImage( $title, $x->cl_sortkey, $x->page_len ); + } elseif( $this->showGallery && $title->getNamespace() == NS_IMAGE ) { + $this->addImage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect ); } else { - $this->addPage( $title, $x->cl_sortkey, $x->page_len ); + $this->addPage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect ); } } $dbr->freeResult( $res ); } function getCategoryTop() { - $r = "
\n"; + $r = ''; if( $this->until != '' ) { $r .= $this->pagingLinks( $this->title, $this->nextPage, $this->until, $this->limit ); } elseif( $this->nextPage != '' || $this->from != '' ) { $r .= $this->pagingLinks( $this->title, $this->from, $this->nextPage, $this->limit ); } - return $r; + return $r == '' + ? $r + : "
\n" . $r; } function getSubcategorySection() { @@ -352,7 +359,7 @@ class CategoryViewer { } $cont_msg = ""; if ( $articles_start_char[$index] == $prev_start_char ) - $cont_msg = wfMsgHtml('listingcontinuesabbrev'); + $cont_msg = ' ' . wfMsgHtml( 'listingcontinuesabbrev' ); $r .= "

" . htmlspecialchars( $articles_start_char[$index] ) . "$cont_msg

\n