r17863 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17862‎ | r17863 | r17864 >
Date:21:48, 22 November 2006
Author:daniel
Status:old
Tags:
Comment:
added option (Bug 8011)
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTree.php (modified) (history)
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)
  • /trunk/extensions/CategoryTree/README (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTree/CategoryTree.php
@@ -34,6 +34,7 @@
3535 * $wgCategoryTreeDisableCache - disabled the parser cache for pages with a <categorytree> tag. Default is true.
3636 * $wgCategoryTreeUseCache - enable HTTP cache for anon users. Default is false.
3737 * $wgCategoryTreeUnifiedView - use unified view on category pages, instead of "tree" or "traditional list". Default is true.
 38+ * $wgCategoryTreeOmitNamespace - never show namespace prefix. Default is false
3839 */
3940 $wgCategoryTreeMaxChildren = 200;
4041 $wgCategoryTreeAllowTag = true;
@@ -41,6 +42,7 @@
4243 $wgCategoryTreeDynamicTag = false;
4344 $wgCategoryTreeHTTPCache = false;
4445 $wgCategoryTreeUnifiedView = true;
 46+$wgCategoryTreeOmitNamespace = false;
4547
4648 /**
4749 * Register extension setup hook and credits
Index: trunk/extensions/CategoryTree/README
@@ -87,5 +87,9 @@
8888 $wgCategoryTreeHTTPCache - enable HTTP cache for anon users. Default is
8989 false.
9090
 91+$wgCategoryTreeOmitNamespace - never show namespace prefix. Default is
 92+ false. Patch contributed by Manuel Schneider
 93+ <manuel.schneider@wikimedia.ch>, Bug 8011
 94+
9195 --------------------------------------------------------------------------
9296 EOF
\ No newline at end of file
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -269,6 +269,7 @@
270270 * $title must be a Title object
271271 */
272272 function renderNode( &$title, $mode = CT_MODE_CATEGORIES, $children = false, $loadchildren = false ) {
 273+ global $wgCategoryTreeOmitNamespace;
273274 static $uniq = 0;
274275
275276 $load = false;
@@ -286,8 +287,9 @@
287288 #$trans = $title->getLocalizedText();
288289 $trans = ''; #place holder for when translated titles are available
289290
290 - #when showing only categories, omit namespace in label
291 - if ( $mode == CT_MODE_CATEGORIES ) $label = htmlspecialchars( $title->getText() );
 291+ #when showing only categories, omit namespace in label unless we explicitely defined the configuration setting
 292+ #patch contributed by Manuel Schneider <manuel.schneider@wikimedia.ch>, Bug 8011
 293+ if ( $wgCategoryTreeOmitNamespace || $mode == CT_MODE_CATEGORIES ) $label = htmlspecialchars( $title->getText() );
292294 else $label = htmlspecialchars( $title->getPrefixedText() );
293295
294296 if ( $trans && $trans!=$label ) $label.= ' ' . wfElement( 'i', array( 'class' => 'translation'), $trans );