r90815 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90814‎ | r90815 | r90816 >
Date:03:00, 26 June 2011
Author:bawolff
Status:ok
Tags:
Comment:
(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 (modified) (history)
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -60,6 +60,8 @@
6161 SHOW SLAVE STATUS instead of SHOW PROCESSLIST.
6262 * Language codes in $wgDummyLanguageCodes are now excluded on localization
6363 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.
6466
6567 === Bug fixes in 1.19 ===
6668 * (bug 28868) Show total pages in the subtitle of an image on the
Index: trunk/phase3/includes/CategoryPage.php
@@ -629,7 +629,7 @@
630630 $prevQuery["{$type}until"] = $first;
631631 unset( $prevQuery["{$type}from"] );
632632 $prevLink = $sk->linkKnown(
633 - $this->title,
 633+ $this->addFragmentToTitle( $this->title, $type ),
634634 $prevLink,
635635 array(),
636636 $prevQuery
@@ -643,7 +643,7 @@
644644 $lastQuery["{$type}from"] = $last;
645645 unset( $lastQuery["{$type}until"] );
646646 $nextLink = $sk->linkKnown(
647 - $this->title,
 647+ $this->addFragmentToTitle( $this->title, $type ),
648648 $nextLink,
649649 array(),
650650 $lastQuery
@@ -654,6 +654,32 @@
655655 }
656656
657657 /**
 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+ /**
658684 * What to do if the category table conflicts with the number of results
659685 * returned? This function says what. Each type is considered independently
660686 * of the other types.

Status & tagging log