From 6f8a8d98d28205d0db4be2c34671d86e4a7b6e89 Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Wed, 31 Oct 2012 22:52:40 +0100 Subject: [PATCH] make addPortletLink work with CologneBlue To achieve this: * remove the special-casing in mw.util * use standard portlet ids to make existing scripts work Change-Id: I4ac3bc143fc235f700144244b0ad5b1f681ae5b5 --- resources/mediawiki/mediawiki.util.js | 1 - skins/CologneBlue.php | 30 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/resources/mediawiki/mediawiki.util.js b/resources/mediawiki/mediawiki.util.js index 4e515bc518..0174325fb0 100644 --- a/resources/mediawiki/mediawiki.util.js +++ b/resources/mediawiki/mediawiki.util.js @@ -372,7 +372,6 @@ // just add it to the bottom of their 'sidebar' element as a fallback switch ( mw.config.get( 'skin' ) ) { case 'standard': - case 'cologneblue': $( '#quickbar' ).append( $link.after( '
' ) ); return $link[0]; case 'nostalgia': diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index c140e33fc8..b81b1aa918 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -430,9 +430,10 @@ class CologneBlueTemplate extends BaseTemplate { $qbmyoptions[$key] = null; } - $bar['qbedit'] = $qbedit; - $bar['qbpageoptions'] = $qbpageoptions; - $bar['qbmyoptions'] = $qbmyoptions; + // Use the closest reasonable name + $bar['cactions'] = $qbedit; + $bar['pageoptions'] = $qbpageoptions; // this is a non-standard portlet name, but nothing fits + $bar['personal'] = $qbmyoptions; return $bar; } @@ -479,12 +480,9 @@ class CologneBlueTemplate extends BaseTemplate { $bar = array(); foreach ( $orig_bar as $heading => $data ) { if ( $heading == 'SEARCH' ) { - $bar['qbfind'] = $this->searchForm( 'sidebar' ); + $bar['search'] = $this->searchForm( 'sidebar' ); } elseif ( $heading == 'TOOLBOX' ) { - $bar['toolbox'] = $this->getToolbox(); - } elseif ( $heading == 'navigation' ) { - // Use the navigation heading from standard sidebar as the "browse" section - $bar['qbbrowse'] = $data; + $bar['tb'] = $this->getToolbox(); } else { $bar[$heading] = $data; } @@ -492,12 +490,22 @@ class CologneBlueTemplate extends BaseTemplate { // Output the sidebar + // CologneBlue uses custom messages for some portlets, but we should keep the ids for consistency + $idToMessage = array( + 'search' => 'qbfind', + 'navigation' => 'qbbrowse', + 'tb' => 'toolbox', + 'cactions' => 'qbedit', + 'personal' => 'qbmyoptions', + 'pageoptions' => 'qbpageoptions', + ); + $s = "
\n"; foreach ( $bar as $heading => $data ) { - $headingMsg = wfMessage( $heading ); - $headingHTML = "
" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "
"; $portletId = Sanitizer::escapeId( "p-$heading" ); + $headingMsg = wfMessage( $idToMessage[$heading] ? $idToMessage[$heading] : $heading ); + $headingHTML = "
" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "
"; $listHTML = ""; if ( is_array( $data ) ) { @@ -517,7 +525,7 @@ class CologneBlueTemplate extends BaseTemplate { } if ( $listHTML ) { - $role = ( $heading == 'qbfind' ) ? 'search' : 'navigation'; + $role = ( $heading == 'search' ) ? 'search' : 'navigation'; $s .= "
\n$headingHTML\n$listHTML\n
\n"; } } -- 2.20.1