wrap links to redirects in <span class="redirect-in-category"></span> in categories...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Mon, 14 May 2007 03:23:02 +0000 (03:23 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Mon, 14 May 2007 03:23:02 +0000 (03:23 +0000)
RELEASE-NOTES
includes/CategoryPage.php

index e80ca37..67d0beb 100644 (file)
@@ -26,6 +26,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 8868) Separate "blocked" message for autoblocks
 * Adding expiry of block to block messages
 * Bulk mail options ($wgEnotifImpersonal, $wgEnotifUseJobQ) for large sites
+* Links to redirect pages in categories are wrapped in <span
+  class="redirect-in-category"></span>
 
 == Bugfixes since 1.10 ==
 
index 356f9ea..9b11d26 100644 (file)
@@ -147,7 +147,7 @@ class CategoryViewer {
        /**
         * Add a page in the image namespace
         */
-       function addImage( $title, $sortkey, $pageLength ) {
+       function addImage( $title, $sortkey, $pageLength, $isRedirect = false ) {
                if ( $this->showGallery ) {
                        $image = new Image( $title );
                        if( $this->flip ) {
@@ -156,18 +156,21 @@ class CategoryViewer {
                                $this->gallery->add( $image );
                        }
                } else {
-                       $this->addPage( $title, $sortkey, $pageLength );
+                       $this->addPage( $title, $sortkey, $pageLength, $isRedirect );
                }
        }
 
        /**
         * Add a miscellaneous page
         */
-       function addPage( $title, $sortkey, $pageLength ) {
+       function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
                global $wgContLang;
-               $this->articles[] = $this->getSkin()->makeSizeLinkObj( 
+               $link = $this->getSkin()->makeSizeLinkObj( 
                        $pageLength, $title, $wgContLang->convert( $title->getPrefixedText() ) 
                );
+               if ($isRedirect)
+                       $link = '<span class="redirect-in-category">'.$link.'</span>';
+               $this->articles[] = $link;
                $this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) );
        }
 
@@ -194,7 +197,7 @@ class CategoryViewer {
                }
                $res = $dbr->select(
                        array( 'page', 'categorylinks' ),
-                       array( 'page_title', 'page_namespace', 'page_len', 'cl_sortkey' ),
+                       array( 'page_title', 'page_namespace', 'page_len', 'page_is_redirect', 'cl_sortkey' ),
                        array( $pageCondition,
                               'cl_from          =  page_id',
                               'cl_to'           => $this->title->getDBKey()),
@@ -220,9 +223,9 @@ class CategoryViewer {
                        if( $title->getNamespace() == NS_CATEGORY ) {
                                $this->addSubcategory( $title, $x->cl_sortkey, $x->page_len );
                        } elseif( $title->getNamespace() == NS_IMAGE ) {
-                               $this->addImage( $title, $x->cl_sortkey, $x->page_len );
+                               $this->addImage( $title, $x->cl_sortkey, $x->page_len, !!$x->page_is_redirect );
                        } else {
-                               $this->addPage( $title, $x->cl_sortkey, $x->page_len );
+                               $this->addPage( $title, $x->cl_sortkey, $x->page_len, !!$x->page_is_redirect );
                        }
                }
                $dbr->freeResult( $res );