From 63c2fa2745bf17f740fa4908075bd0b8f250ef62 Mon Sep 17 00:00:00 2001 From: Daniel Kinzler Date: Sat, 2 Sep 2006 12:14:12 +0000 Subject: [PATCH] Added experimental "unified" category page mode --- CategoryPageSubclass.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/CategoryPageSubclass.php b/CategoryPageSubclass.php index c92c49e0..2a46fe1b 100644 --- a/CategoryPageSubclass.php +++ b/CategoryPageSubclass.php @@ -14,9 +14,34 @@ class CategoryTreeCategoryPage extends CategoryPage { class CategoryTreeCategoryViewer extends CategoryViewer { var $child_titles; + /** + * Add a subcategory to the internal lists + */ + function addSubcategory( $title, $sortkey, $pageLength ) { + global $wgContLang, $wgOut; + + if ( ! @$GLOBALS['wgCategoryTreeUnifiedView'] ) { + $this->child_titles[] = $title; + return parent::addSubcategory( $title, $sortkey, $pageLength ); + } + + if ( ! isset($this->categorytree) ) { + CategoryTree::setHeaders( $wgOut ); + $this->categorytree = new CategoryTree; + } + + $this->children[] = $this->categorytree->renderNode( $title ); + + $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey ); + } + function getSubcategorySection() { global $wgOut, $wgRequest, $wgCookiePrefix; + if ( @$GLOBALS['wgCategoryTreeUnifiedView'] ) { + return parent::getSubcategorySection(); + } + if( count( $this->children ) == 0 ) { return ''; } @@ -90,11 +115,6 @@ class CategoryTreeCategoryViewer extends CategoryViewer { parent::clearCategoryState(); } - function addSubcategory( $title, $sortKey, $pageLength ) { - $this->child_titles[] = $title; - parent::addSubcategory( $title, $sortKey, $pageLength ); - } - function finaliseCategoryState() { if( $this->flip ) { $this->child_titles = array_reverse( $this->child_titles );