$showGallery, $gallery,
$skin;
- function __construct( $title, $from, $until ) {
+ function __construct( $title, $from = '', $until = '' ) {
global $wgCategoryPagingLimit;
$this->title = $title;
$this->from = $from;
$this->children[] = $this->getSkin()->makeKnownLinkObj(
$title, $wgContLang->convertHtml( $title->getText() ) );
- // If there's a link from Category:A to Category:B, the sortkey of the resulting
- // entry in the categorylinks table is Category:A, not A, which it SHOULD be.
- // Workaround: If sortkey == "Category:".$title, than use $title for sorting,
- // else use sortkey...
- $sortkey = '';
+ $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
+ }
+
+ /**
+ * Get the character to be used for sorting subcategories.
+ * If there's a link from Category:A to Category:B, the sortkey of the resulting
+ * entry in the categorylinks table is Category:A, not A, which it SHOULD be.
+ * Workaround: If sortkey == "Category:".$title, than use $title for sorting,
+ * else use sortkey...
+ */
+ function getSubcategorySortChar( $title, $sortkey ) {
+ global $wgContLang;
+
if( $title->getPrefixedText() == $sortkey ) {
- $sortkey = $wgContLang->firstChar( $title->getDBkey() );
+ $firstChar = $wgContLang->firstChar( $title->getDBkey() );
} else {
- $sortkey = $wgContLang->firstChar( $sortkey );
+ $firstChar = $wgContLang->firstChar( $sortkey );
}
- $this->children_start_char[] = $wgContLang->convert( $sortkey );
+
+ return $wgContLang->convert( $firstChar );
}
/**
$r = '';
if( count( $this->children ) > 0 ) {
# Showing subcategories
+ $r .= "<div id=\"mw-subcategories\">\n";
$r .= '<h2>' . wfMsg( 'subcategories' ) . "</h2>\n";
$r .= wfMsgExt( 'subcategorycount', array( 'parse' ), count( $this->children) );
$r .= $this->formatList( $this->children, $this->children_start_char );
+ $r .= "\n</div>";
}
return $r;
}
function getPagesSection() {
$ti = htmlspecialchars( $this->title->getText() );
- $r = '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\n";
+ $r = "<div id=\"mw-pages\">\n";
+ $r .= '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\n";
$r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), count( $this->articles) );
$r .= $this->formatList( $this->articles, $this->articles_start_char );
+ $r .= "\n</div>";
return $r;
}
function getImageSection() {
if( $this->showGallery && ! $this->gallery->isEmpty() ) {
- return $this->gallery->toHTML();
+ return "<div id=\"mw-category-media\">\n" .
+ '<h2>' . wfMsg( 'category-media-header', htmlspecialchars($this->title->getText()) ) . "</h2>\n" .
+ wfMsgExt( 'category-media-count', array( 'parse' ), $this->gallery->count() ) .
+ $this->gallery->toHTML() . "\n</div>";
} else {
return '';
}