Merge "Simplify SpecialVersion:listToText()"
[lhc/web/wiklou.git] / skins / CologneBlue.php
index 0370e05..3b53468 100644 (file)
@@ -36,7 +36,7 @@ class SkinCologneBlue extends SkinTemplate {
        var $useHeadElement = true;
 
        /**
-        * @param $out OutputPage
+        * @param OutputPage $out
         */
        function setupSkinUserCss( OutputPage $out ) {
                parent::setupSkinUserCss( $out );
@@ -47,6 +47,8 @@ class SkinCologneBlue extends SkinTemplate {
        /**
         * Override langlink formatting behavior not to uppercase the language names.
         * See otherLanguages() in CologneBlueTemplate.
+        * @param string $name
+        * @return string
         */
        function formatLanguageName( $name ) {
                return $name;
@@ -90,21 +92,37 @@ class CologneBlueTemplate extends BaseTemplate {
                        return "";
                }
 
+               $html = '';
+
                // We override SkinTemplate->formatLanguageName() in SkinCologneBlue
                // not to capitalize the language names.
                $language_urls = $this->data['language_urls'];
-               if ( empty( $language_urls ) ) {
-                       return "";
-               }
+               if ( !empty( $language_urls ) ) {
+                       $s = array();
+                       foreach ( $language_urls as $key => $data ) {
+                               $s[] = $this->makeListItem( $key, $data, array( 'tag' => 'span' ) );
+                       }
 
-               $s = array();
-               foreach ( $language_urls as $key => $data ) {
-                       $s[] = $this->makeListItem( $key, $data, array( 'tag' => 'span' ) );
+                       $html = wfMessage( 'otherlanguages' )->text()
+                               . wfMessage( 'colon-separator' )->text()
+                               . $this->getSkin()->getLanguage()->pipeList( $s );
                }
 
-               return wfMessage( 'otherlanguages' )->text()
-                       . wfMessage( 'colon-separator' )->text()
-                       . $this->getSkin()->getLanguage()->pipeList( $s );
+               $html .= $this->renderAfterPortlet( 'lang' );
+
+               return $html;
+       }
+
+       /**
+        * @param string $name
+        */
+       protected function renderAfterPortlet( $name ) {
+               $content = '';
+               wfRunHooks( 'BaseTemplateAfterPortlet', array( $this, $name, &$content ) );
+
+               $html = $content !== '' ? "<div class='after-portlet after-portlet-$name'>$content</div>" : '';
+
+               return $html;
        }
 
        function pageTitleLinks() {
@@ -121,9 +139,9 @@ class CologneBlueTemplate extends BaseTemplate {
        /**
         * Used in bottomLinks() to eliminate repetitive code.
         *
-        * @param $key string Key to be passed to makeListItem()
-        * @param $navlink array Navlink suitable for processNavlinkForDocument()
-        * @param $message string Key of the message to use in place of standard text
+        * @param string $key Key to be passed to makeListItem()
+        * @param array $navlink Navlink suitable for processNavlinkForDocument()
+        * @param string $message Key of the message to use in place of standard text
         *
         * @return string
         */
@@ -169,7 +187,6 @@ class CologneBlueTemplate extends BaseTemplate {
 
                        $lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) );
 
-
                        // Second row. Privileged actions.
                        $element = array();
 
@@ -183,7 +200,6 @@ class CologneBlueTemplate extends BaseTemplate {
 
                        $lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) );
 
-
                        // Third row. Language links.
                        $lines[] = $this->otherLanguages();
                }
@@ -243,8 +259,8 @@ class CologneBlueTemplate extends BaseTemplate {
         * and removes the accesskeys. This is necessary to be able to use the same navlink twice,
         * e.g. in sidebar and in footer.
         *
-        * @param $navlink array Navigational link generated by SkinTemplate
-        * @param $idPrefix mixed Prefix to add to id of this navlink. If false, id is removed entirely. Default is 'cb-'.
+        * @param array $navlink Navigational link generated by SkinTemplate
+        * @param mixed $idPrefix Prefix to add to id of this navlink. If false, id is removed entirely. Default is 'cb-'.
         */
        function processNavlinkForDocument( $navlink, $idPrefix = 'cb-' ) {
                if ( $navlink['id'] ) {
@@ -285,7 +301,7 @@ class CologneBlueTemplate extends BaseTemplate {
                        <?php } ?>
                </div>
        </div>
-       <div id="article" role="main">
+       <div id="article" class="mw-body" role="main">
                <?php if ( $this->getSkin()->getSiteNotice() ) { ?>
                <div id="siteNotice"><?php echo $this->getSkin()->getSiteNotice() ?></div>
                <?php } ?>
@@ -369,9 +385,10 @@ class CologneBlueTemplate extends BaseTemplate {
                                Title::newFromText( wfMessage( 'aboutpage' )->inContentLanguage()->text() ),
                                wfMessage( 'about' )->text()
                        ),
-                       Linker::linkKnown(
-                               Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ),
-                               wfMessage( 'help' )->text()
+                       Linker::makeExternalLink(
+                               Skin::makeInternalOrExternalUrl( wfMessage( 'helppage' )->inContentLanguage()->text() ),
+                               wfMessage( 'help' )->text(),
+                               false
                        ),
                        Linker::linkKnown(
                                Title::newFromText( wfMessage( 'faqpage' )->inContentLanguage()->text() ),
@@ -380,7 +397,7 @@ class CologneBlueTemplate extends BaseTemplate {
                );
 
                $personalUrls = $this->getPersonalTools();
-               foreach ( array( 'logout', 'createaccount', 'login', 'anonlogin' ) as $key ) {
+               foreach ( array( 'logout', 'createaccount', 'login' ) as $key ) {
                        if ( $personalUrls[$key] ) {
                                $s[] = $this->makeListItem( $key, $personalUrls[$key], array( 'tag' => 'span' ) );
                        }
@@ -392,8 +409,8 @@ class CologneBlueTemplate extends BaseTemplate {
        /**
         * Adds CologneBlue-specific items to the sidebar: qbedit, qbpageoptions and qbmyoptions menus.
         *
-        * @param $bar sidebar data
-        * @return array modified sidebar data
+        * @param array $bar Sidebar data
+        * @return array Modified sidebar data
         */
        function sidebarAdditions( $bar ) {
                // "This page" and "Edit" menus
@@ -421,7 +438,7 @@ class CologneBlueTemplate extends BaseTemplate {
 
                // Personal tools ("My pages")
                $qbmyoptions = $this->getPersonalTools();
-               foreach ( array( 'logout', 'createaccount', 'login', 'anonlogin' ) as $key ) {
+               foreach ( array( 'logout', 'createaccount', 'login', ) as $key ) {
                        $qbmyoptions[$key] = null;
                }
 
@@ -467,7 +484,6 @@ class CologneBlueTemplate extends BaseTemplate {
                        $bar = $this->sidebarAdditions( $bar );
                }
 
-
                // Fill out special sidebar items with content
                $orig_bar = $bar;
                $bar = array();
@@ -481,7 +497,6 @@ class CologneBlueTemplate extends BaseTemplate {
                        }
                }
 
-
                // Output the sidebar
                // CologneBlue uses custom messages for some portlets, but we should keep the ids for consistency
                $idToMessage = array(
@@ -521,6 +536,8 @@ class CologneBlueTemplate extends BaseTemplate {
                                $role = ( $heading == 'search' ) ? 'search' : 'navigation';
                                $s .= "<div class=\"portlet\" id=\"$portletId\" role=\"$role\">\n$headingHTML\n$listHTML\n</div>\n";
                        }
+
+                       $s .= $this->renderAfterPortlet( $heading );
                }
 
                $s .= "</div>\n";
@@ -528,7 +545,7 @@ class CologneBlueTemplate extends BaseTemplate {
        }
 
        /**
-        * @param $label string
+        * @param string $label
         * @return string
         */
        function searchForm( $which ) {