(bug 4764) "My contributions" not bold when viewing own contributions
authorRob Church <robchurch@users.mediawiki.org>
Mon, 2 Apr 2007 06:27:55 +0000 (06:27 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 2 Apr 2007 06:27:55 +0000 (06:27 +0000)
RELEASE-NOTES
includes/SkinTemplate.php

index ab8df38..76ae6be 100644 (file)
@@ -297,6 +297,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9466) "Rollback failed" page doesn't format edit comment
 * (bug 9472) Invalid XHTML on cached special pages
 * (bug 9472) Invalid XHTML on Special:Newpages
+* (bug 4764) "My contributions" not bold when viewing own contributions
  
 == Maintenance ==
 * New script maintenance/language/checkExtensioni18n.php used to check i18n
index 9643b17..8f34935 100644 (file)
@@ -488,7 +488,7 @@ class SkinTemplate extends Skin {
         * @private
         */
        function buildPersonalUrls() {
-               global $wgTitle;
+               global $wgTitle, $wgRequest;
 
                $fname = 'SkinTemplate::buildPersonalUrls';
                $pageurl = $wgTitle->getLocalURL();
@@ -522,13 +522,28 @@ class SkinTemplate extends Skin {
                                'href' => $href,
                                'active' => ( $href == $pageurl )
                        );
+                       
+                       # We need to do an explicit check for Special:Contributions, as we
+                       # have to match both the title, and the target (which could come
+                       # from request values or be specified in "sub page" form. The plot
+                       # thickens, because $wgTitle is altered for special pages, so doesn't
+                       # contain the original alias-with-subpage.
+                       $title = Title::newFromText( $wgRequest->getText( 'title' ) );
+                       if( $title instanceof Title && $title->getNamespace() == NS_SPECIAL ) {                 
+                               list( $spName, $spPar ) =
+                                       SpecialPage::resolveAliasWithSubpage( $title->getText() );
+                               $active = $spName == 'Contributions'
+                                       && ( ( $spPar && $spPar == $this->username )
+                                               || $wgRequest->getText( 'target' ) == $this->username );
+                       } else {
+                               $active = false;
+                       }
+                       
                        $href = self::makeSpecialUrlSubpage( 'Contributions', $this->username );
                        $personal_urls['mycontris'] = array(
                                'text' => wfMsg( 'mycontris' ),
                                'href' => $href,
-                               // FIXME #  'active' was disabled in r11346 with message: "disable bold link to my contributions; link was bold on all
-                               // Special:Contributions, not just current user's (fix me please!)". Until resolved (bug 4764), explicitly setting active to false.
-                               'active' => false # ( ( $href == $pageurl . '/' . $this->username )
+                               'active' => $active
                        );
                        $personal_urls['logout'] = array(
                                'text' => wfMsg( 'userlogout' ),