Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -60,6 +60,8 @@ |
61 | 61 | SHOW SLAVE STATUS instead of SHOW PROCESSLIST. |
62 | 62 | * Language codes in $wgDummyLanguageCodes are now excluded on localization |
63 | 63 | statistics (maintenance/language/transstat.php) |
| 64 | +* (bug 29586) Make the (next 200) links on categories link directly to |
| 65 | + the relevant section of the category. |
64 | 66 | |
65 | 67 | === Bug fixes in 1.19 === |
66 | 68 | * (bug 28868) Show total pages in the subtitle of an image on the |
Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -629,7 +629,7 @@ |
630 | 630 | $prevQuery["{$type}until"] = $first; |
631 | 631 | unset( $prevQuery["{$type}from"] ); |
632 | 632 | $prevLink = $sk->linkKnown( |
633 | | - $this->title, |
| 633 | + $this->addFragmentToTitle( $this->title, $type ), |
634 | 634 | $prevLink, |
635 | 635 | array(), |
636 | 636 | $prevQuery |
— | — | @@ -643,7 +643,7 @@ |
644 | 644 | $lastQuery["{$type}from"] = $last; |
645 | 645 | unset( $lastQuery["{$type}until"] ); |
646 | 646 | $nextLink = $sk->linkKnown( |
647 | | - $this->title, |
| 647 | + $this->addFragmentToTitle( $this->title, $type ), |
648 | 648 | $nextLink, |
649 | 649 | array(), |
650 | 650 | $lastQuery |
— | — | @@ -654,6 +654,32 @@ |
655 | 655 | } |
656 | 656 | |
657 | 657 | /** |
| 658 | + * Takes a title, and adds the fragment identifier that |
| 659 | + * corresponds to the correct segment of the category. |
| 660 | + * |
| 661 | + * @param Title $title: The title (usually $this->title) |
| 662 | + * @param String $section: Which section |
| 663 | + */ |
| 664 | + private function addFragmentToTitle( $title, $section ) { |
| 665 | + switch ( $section ) { |
| 666 | + case 'page': |
| 667 | + $fragment = 'mw-pages'; |
| 668 | + break; |
| 669 | + case 'subcat': |
| 670 | + $fragment = 'mw-subcategories'; |
| 671 | + break; |
| 672 | + case 'file': |
| 673 | + $fragment = 'mw-category-media'; |
| 674 | + break; |
| 675 | + default: |
| 676 | + throw new MWException( __METHOD__ . |
| 677 | + " Invalid section $section." ); |
| 678 | + } |
| 679 | + |
| 680 | + return Title::makeTitle( $title->getNamespace(), |
| 681 | + $title->getDBkey(), $fragment ); |
| 682 | + } |
| 683 | + /** |
658 | 684 | * What to do if the category table conflicts with the number of results |
659 | 685 | * returned? This function says what. Each type is considered independently |
660 | 686 | * of the other types. |