Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/71800


Change subject: Add getPersonalToolsList to SkinTemplate
......................................................................

Add getPersonalToolsList to SkinTemplate

This is for CentralAuth, so it can replace the p-personal list.

Change-Id: I7385bcb36e45310fb08da05f8df8925acd7d9890
---
M includes/SkinTemplate.php
1 file changed, 56 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/00/71800/1

diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php
index 8e41b5a..94978d4 100644
--- a/includes/SkinTemplate.php
+++ b/includes/SkinTemplate.php
@@ -165,6 +165,47 @@
                return $language_urls;
        }
 
+       protected function setupTemplateForOutput() {
+               wfProfileIn( __METHOD__ );
+
+               $request = $this->getRequest();
+               $user = $this->getUser();
+               $title = $this->getTitle();
+
+               wfProfileIn( __METHOD__ . '-init' );
+               $tpl = $this->setupTemplate( $this->template, 'skins' );
+               wfProfileOut( __METHOD__ . '-init' );
+
+               wfProfileIn( __METHOD__ . '-stuff' );
+               $this->thispage = $title->getPrefixedDBkey();
+               $this->titletxt = $title->getPrefixedText();
+               $this->userpage = $user->getUserPage()->getPrefixedText();
+               $query = array();
+               if ( !$request->wasPosted() ) {
+                       $query = $request->getValues();
+                       unset( $query['title'] );
+                       unset( $query['returnto'] );
+                       unset( $query['returntoquery'] );
+               }
+               $this->thisquery = wfArrayToCgi( $query );
+               $this->loggedin = $user->isLoggedIn();
+               $this->username = $user->getName();
+
+               if ( $this->loggedin || $this->showIPinHeader() ) {
+                       $this->userpageUrlDetails = self::makeUrlDetails( 
$this->userpage );
+               } else {
+                       # This won't be used in the standard skins, but we 
define it to preserve the interface
+                       # To save time, we check for existence
+                       $this->userpageUrlDetails = self::makeKnownUrlDetails( 
$this->userpage );
+               }
+
+               wfProfileOut( __METHOD__ . '-stuff' );
+
+               wfProfileOut( __METHOD__ );
+
+               return $tpl;
+       }
+
        /**
         * initialize various variables and generate the template
         *
@@ -197,34 +238,9 @@
 
                wfProfileIn( __METHOD__ . '-init' );
                $this->initPage( $out );
-
-               $tpl = $this->setupTemplate( $this->template, 'skins' );
                wfProfileOut( __METHOD__ . '-init' );
 
-               wfProfileIn( __METHOD__ . '-stuff' );
-               $this->thispage = $title->getPrefixedDBkey();
-               $this->titletxt = $title->getPrefixedText();
-               $this->userpage = $user->getUserPage()->getPrefixedText();
-               $query = array();
-               if ( !$request->wasPosted() ) {
-                       $query = $request->getValues();
-                       unset( $query['title'] );
-                       unset( $query['returnto'] );
-                       unset( $query['returntoquery'] );
-               }
-               $this->thisquery = wfArrayToCgi( $query );
-               $this->loggedin = $user->isLoggedIn();
-               $this->username = $user->getName();
-
-               if ( $this->loggedin || $this->showIPinHeader() ) {
-                       $this->userpageUrlDetails = self::makeUrlDetails( 
$this->userpage );
-               } else {
-                       # This won't be used in the standard skins, but we 
define it to preserve the interface
-                       # To save time, we check for existence
-                       $this->userpageUrlDetails = self::makeKnownUrlDetails( 
$this->userpage );
-               }
-
-               wfProfileOut( __METHOD__ . '-stuff' );
+               $tpl = $this->setupTemplateForOutput();
 
                wfProfileIn( __METHOD__ . '-stuff-head' );
                if ( !$this->useHeadElement ) {
@@ -516,6 +532,20 @@
        }
 
        /**
+        * Get the HTML for the p-personal list
+        * @return string
+        */
+       public function getPersonalToolsList() {
+               $tpl = $this->setupTemplateForOutput();
+               $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
+               $html = '';
+               foreach ( $tpl->getPersonalTools() as $key => $item ) {
+                       $html .= $tpl->makeListItem( $key, $item );
+               }
+               return $html;
+       }
+
+       /**
         * Format language name for use in sidebar interlanguage links list.
         * By default it is capitalized.
         *

-- 
To view, visit https://gerrit.wikimedia.org/r/71800
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7385bcb36e45310fb08da05f8df8925acd7d9890
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

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

Reply via email to