Enable links in the dmoz-like category browser
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 6 Jun 2004 02:49:47 +0000 (02:49 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 6 Jun 2004 02:49:47 +0000 (02:49 +0000)
includes/Skin.php
includes/Title.php

index 81d1f2c..1d72b69 100644 (file)
@@ -360,7 +360,7 @@ class Skin {
        
        function getCategoryLinks () {
                global $wgOut, $wgTitle, $wgUser, $wgParser;
-               global $wgUseCategoryMagic;
+               global $wgUseCategoryMagic, $wgLang;
                if( !$wgUseCategoryMagic ) return "" ;
                if( count( $wgOut->mCategoryLinks ) == 0 ) return "";
                if( !$wgOut->isArticle() ) return "";
@@ -375,7 +375,7 @@ class Skin {
                $wgTitle->getAllParentCategories(&$catstack);
                foreach ($catstack as $key => $cat)
                {
-                       $s .= $key." &gt; ".$cat."<br/>\n";
+                       $s .= $this->makeLink($wgLang->getNSText( Namespace::getCategory() ).":".$key, $key )." &gt; ".$cat."<br/>\n";
                }
                
                return $s;
index 48ac5bf..cc5be06 100644 (file)
@@ -1197,6 +1197,9 @@ class Title {
        # will get the parents and grand-parents
        function getAllParentCategories(&$stack)
        {
+               global $wgUser;
+               $sk =& $wgUser->getSkin() ;
+
                # getting parents
                $parents = $this->getParentCategories( );
                                
@@ -1205,10 +1208,13 @@ class Title {
                        # create a title object for the parent
                        $tpar = Title::newFromID($parent->cur_id);
                        
-                       $stack[$tpar->getText()] = $this->getText();
                        if(isset($stack[$this->getText()]))
                        {
+                               $stack[$tpar->getText()] = $sk->makeLink( $this->getPrefixedDBkey(), $this->getText() );
                                $stack[$tpar->getText()] .= " &gt; ".$stack[$this->getText()];
+                       } else {
+                               # don't make a link for current page
+                               $stack[$tpar->getText()] = $this->getText();
                        }
                        
                        unset( $stack[$this->getText()] );