Merge "Display "Printable version" links in toolbox on special pages"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 30 Jun 2013 17:14:13 +0000 (17:14 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 30 Jun 2013 17:14:13 +0000 (17:14 +0000)
1  2 
includes/SkinTemplate.php

@@@ -174,7 -174,7 +174,7 @@@ class SkinTemplate extends Skin 
                global $wgContLang;
                global $wgScript, $wgStylePath;
                global $wgMimeType, $wgJsMimeType;
 -              global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
 +              global $wgXhtmlNamespaces, $wgHtml5Version;
                global $wgDisableCounters, $wgSitename, $wgLogo;
                global $wgMaxCredits, $wgShowCreditsIfMax;
                global $wgPageShowWatchingUsers;
  
                        $tpl->set( 'jsvarurl', false );
  
 -                      $tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace );
 +                      $tpl->set( 'xhtmldefaultnamespace', 'http://www.w3.org/1999/xhtml' );
                        $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
                        $tpl->set( 'html5version', $wgHtml5Version );
                        $tpl->set( 'headlinks', $out->getHeadLinks() );
                                'href' => $href,
                                'active' => ( $href == $pageurl )
                        );
 -                      $href = self::makeSpecialUrl( 'Watchlist' );
 -                      $personal_urls['watchlist'] = array(
 -                              'text' => $this->msg( 'mywatchlist' )->text(),
 -                              'href' => $href,
 -                              'active' => ( $href == $pageurl )
 -                      );
 +
 +                      if ( $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
 +                              $href = self::makeSpecialUrl( 'Watchlist' );
 +                              $personal_urls['watchlist'] = array(
 +                                      'text' => $this->msg( 'mywatchlist' )->text(),
 +                                      '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
                                wfProfileOut( __METHOD__ . '-live' );
  
                                // Checks if the user is logged in
 -                              if ( $this->loggedin ) {
 +                              if ( $this->loggedin && $user->isAllowedAll( 'viewmywatchlist', 'editmywatchlist' ) ) {
                                        /**
                                         * The following actions use messages which, if made particular to
                                         * the any specific skins, would break the Ajax code which makes this
  
                // A print stylesheet is attached to all pages, but nobody ever
                // figures that out. :)  Add a link...
-               if ( $out->isArticle() ) {
-                       if ( !$out->isPrintable() ) {
-                               $nav_urls['print'] = array(
-                                       'text' => $this->msg( 'printableversion' )->text(),
-                                       'href' => $this->getTitle()->getLocalURL(
-                                               $request->appendQueryValue( 'printable', 'yes', true ) )
-                               );
-                       }
+               if ( !$out->isPrintable() && ( $out->isArticle() || $this->getTitle()->isSpecialPage() ) ) {
+                       $nav_urls['print'] = array(
+                               'text' => $this->msg( 'printableversion' )->text(),
+                               'href' => $this->getTitle()->getLocalURL(
+                                       $request->appendQueryValue( 'printable', 'yes', true ) )
+                       );
+               }
  
+               if ( $out->isArticle() ) {
                        // Also add a "permalink" while we're at it
                        $revid = $this->getRevisionId();
                        if ( $revid ) {
                        }
  
                        $sur = new UserrightsPage;
 +                      $sur->setContext( $this->getContext() );
                        if ( $sur->userCanExecute( $this->getUser() ) ) {
                                $nav_urls['userrights'] = array(
                                        'href' => self::makeSpecialUrlSubpage( 'Userrights', $rootUser )