http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90815

Revision: 90815
Author:   bawolff
Date:     2011-06-26 03:00:37 +0000 (Sun, 26 Jun 2011)
Log Message:
-----------
(sort of bug 29586) Make the (next 200) links on categories link directly to
the relevant section of the category.

The bug in question actually want to remove all the other sections of the 
category
when you hit (next 200), I personally think that'd be confusing, but would be 
good
to have other people's thoughts.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES-1.19
    trunk/phase3/includes/CategoryPage.php

Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19     2011-06-26 02:40:00 UTC (rev 90814)
+++ trunk/phase3/RELEASE-NOTES-1.19     2011-06-26 03:00:37 UTC (rev 90815)
@@ -60,6 +60,8 @@
   SHOW SLAVE STATUS instead of SHOW PROCESSLIST.
 * Language codes in $wgDummyLanguageCodes are now excluded on localization
   statistics (maintenance/language/transstat.php)
+* (bug 29586) Make the (next 200) links on categories link directly to
+  the relevant section of the category.
 
 === Bug fixes in 1.19 ===
 * (bug 28868) Show total pages in the subtitle of an image on the

Modified: trunk/phase3/includes/CategoryPage.php
===================================================================
--- trunk/phase3/includes/CategoryPage.php      2011-06-26 02:40:00 UTC (rev 
90814)
+++ trunk/phase3/includes/CategoryPage.php      2011-06-26 03:00:37 UTC (rev 
90815)
@@ -629,7 +629,7 @@
                        $prevQuery["{$type}until"] = $first;
                        unset( $prevQuery["{$type}from"] );
                        $prevLink = $sk->linkKnown(
-                               $this->title,
+                               $this->addFragmentToTitle( $this->title, $type 
),
                                $prevLink,
                                array(),
                                $prevQuery
@@ -643,7 +643,7 @@
                        $lastQuery["{$type}from"] = $last;
                        unset( $lastQuery["{$type}until"] );
                        $nextLink = $sk->linkKnown(
-                               $this->title,
+                               $this->addFragmentToTitle( $this->title, $type 
),
                                $nextLink,
                                array(),
                                $lastQuery
@@ -654,6 +654,32 @@
        }
 
        /**
+        * Takes a title, and adds the fragment identifier that
+        * corresponds to the correct segment of the category.
+        *
+        * @param Title $title: The title (usually $this->title)
+        * @param String $section: Which section
+        */
+       private function addFragmentToTitle( $title, $section ) {
+               switch ( $section ) {
+                       case 'page':
+                               $fragment = 'mw-pages';
+                               break;
+                       case 'subcat':
+                               $fragment = 'mw-subcategories';
+                               break;
+                       case 'file':
+                               $fragment = 'mw-category-media';
+                               break;
+                       default:
+                               throw new MWException( __METHOD__ .
+                                       " Invalid section $section." );
+               }
+
+               return Title::makeTitle( $title->getNamespace(),
+                       $title->getDBkey(), $fragment );
+       }
+       /**
         * What to do if the category table conflicts with the number of results
         * returned?  This function says what. Each type is considered 
independently
         * of the other types.


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to