Njw has uploaded a new change for review. https://gerrit.wikimedia.org/r/57041
Change subject: Allow depth in category pages and javascript disabling ...................................................................... Allow depth in category pages and javascript disabling See https://bugzilla.wikimedia.org/show_bug.cgi?id=46775#c0 for a full rationale for this change. Basically it allows the depth option to be used for Category Pages, which makes the extension useful without javascript for some usecases. Change-Id: I65bebc388b65d2300a1fe63054619fbc1b2abd5c --- M CategoryPageSubclass.php M CategoryTree.php M CategoryTreeFunctions.php 3 files changed, 10 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryTree refs/changes/41/57041/1 diff --git a/CategoryPageSubclass.php b/CategoryPageSubclass.php index bb374f0..b87d2bb 100644 --- a/CategoryPageSubclass.php +++ b/CategoryPageSubclass.php @@ -47,7 +47,7 @@ $tree = $this->getCategoryTree(); - $this->children[] = $tree->renderNodeInfo( $title, $cat ); + $this->children[] = $tree->renderNodeInfo( $title, $cat, $tree->getOption( 'depth' ) ); $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey ); } diff --git a/CategoryTree.php b/CategoryTree.php index 5d0bbdf..1f3b7cc 100644 --- a/CategoryTree.php +++ b/CategoryTree.php @@ -49,6 +49,8 @@ * $wgCategoryTreeDefaultOptions - default options for the <categorytree> tag. * $wgCategoryTreeCategoryPageOptions - options to apply on category pages. * $wgCategoryTreeSpecialPageOptions - options to apply on Special:CategoryTree. + * $wgCategoryTreeDisableScript - disable all javascript in this extension. Use this in + * combination with a >1 $depth value for static category trees. */ $wgCategoryTreeMaxChildren = 200; @@ -65,6 +67,7 @@ $wgCategoryTreeSidebarRoot = null; $wgCategoryTreeHijackPageCategories = false; # EXPERIMENTAL! NOT YET FOR PRODUCTION USE! Main problem is general HTML/CSS layout cruftiness. $wgCategoryTreeUseCategoryTable = true; +$wgCategoryTreeDisableScript = false; $wgCategoryTreeOmitNamespace = CT_HIDEPREFIX_CATEGORIES; $wgCategoryTreeDefaultMode = CT_MODE_CATEGORIES; @@ -73,6 +76,7 @@ $wgCategoryTreeDefaultOptions['hideprefix'] = null; # will be set to $wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk $wgCategoryTreeDefaultOptions['showcount'] = false; $wgCategoryTreeDefaultOptions['namespaces'] = false; # false means "no filter" +$wgCategoryTreeDefaultOptions['depth'] = 1; $wgCategoryTreeCategoryPageMode = CT_MODE_CATEGORIES; $wgCategoryTreeCategoryPageOptions = array(); # Options to be used for category pages @@ -177,7 +181,7 @@ global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders, $wgCategoryTreeHijackPageCategories; # Abort if AJAX is not enabled - if ( !$wgUseAjax ) { + if ( !$wgUseAjax && !$wgCategoryTreeDisableScript ) { wfDebug( 'efCategoryTree: $wgUseAjax is not enabled, aborting extension setup.' ); return; } diff --git a/CategoryTreeFunctions.php b/CategoryTreeFunctions.php index f26c91a..7aa98f7 100644 --- a/CategoryTreeFunctions.php +++ b/CategoryTreeFunctions.php @@ -233,9 +233,12 @@ * @param OutputPage $outputPage */ static function setHeaders( $outputPage ) { + global $wgCategoryTreeDisableScript; # Add the modules $outputPage->addModuleStyles( 'ext.categoryTree.css' ); - $outputPage->addModules( 'ext.categoryTree' ); + if( !$wgCategoryTreeDisableScript ) { + $outputPage->addModules( 'ext.categoryTree' ); + } } /** -- To view, visit https://gerrit.wikimedia.org/r/57041 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I65bebc388b65d2300a1fe63054619fbc1b2abd5c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CategoryTree Gerrit-Branch: master Gerrit-Owner: Njw <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
