/**
* Language/charset variant links for classic-style skins
* @return string
- *
- * @fixed
*/
function variantLinks() {
$s = array();
return $this->getSkin()->getLanguage()->pipeList( $s );
}
- // @fixed
function otherLanguages() {
global $wgHideInterlanguageLinks;
if ( $wgHideInterlanguageLinks ) {
. $this->getSkin()->getLanguage()->pipeList( $s );
}
- // @fixed
function pageTitleLinks() {
$s = array();
$footlinks = $this->getFooterLinks();
* @param $message string Key of the message to use in place of standard text
*
* @return string
- * @fixed
*/
function processBottomLink( $key, $navlink, $message=null ) {
if ( !$navlink ) {
return $this->makeListItem( $key, $this->processNavlinkForDocument( $navlink ), array( 'tag' => 'span' ) );
}
- // @fixed
function bottomLinks() {
$toolbox = $this->getToolbox();
$content_nav = $this->data['content_navigation'];
return implode( array_filter( $lines ), "<br />\n" ) . "<br />\n";
}
- // @fixed
function talkLink() {
$title = $this->getSkin()->getTitle();
/**
* @return string
- *
- * @fixed
*/
function beforeContent() {
ob_start();
?>
<div id="content">
<div id="topbar">
- <p id="sitetitle">
+ <p id="sitetitle" role="banner">
<a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>">
<?php echo wfMessage( 'sitetitle' )->escaped() ?>
</a>
</p>
<p id="sitesub"><?php echo wfMessage( 'sitesubtitle' )->escaped() ?></p>
- <div id="toplinks">
- <p id="syslinks"><?php echo $this->sysLinks() ?></p>
- <p id="variantlinks"><?php echo $this->variantLinks() ?></p>
- </div>
- <div id="linkcollection">
+ <div id="linkcollection" role="navigation">
<div id="langlinks"><?php echo str_replace( '<br />', '', $this->otherLanguages() ) ?></div>
<?php echo $this->getSkin()->getCategories() ?>
<div id="titlelinks"><?php echo $this->pageTitleLinks() ?></div>
<?php } ?>
</div>
</div>
- <div id="article">
+ <div id="article" role="main">
<?php if ( $this->getSkin()->getSiteNotice() ) { ?>
<div id="siteNotice"><?php echo $this->getSkin()->getSiteNotice() ?></div>
<?php } ?>
- <h1 id="firstHeading"><span dir="auto"><?php echo $this->data['title'] ?></span></h1>
+ <h1 id="firstHeading" lang="<?php
+ $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageLanguage()->getCode();
+ $this->html( 'pageLanguage' );
+ ?>"><span dir="auto"><?php echo $this->data['title'] ?></span></h1>
<?php if ( $this->translator->translate( 'tagline' ) ) { ?>
<p class="tagline"><?php echo htmlspecialchars( $this->translator->translate( 'tagline' ) ) ?></p>
<?php } ?>
/**
* @return string
- *
- * @fixed
*/
function afterContent() {
ob_start();
?>
</div>
- <div id='footer'>
+ <div id="footer" role="contentinfo">
<?php
// Page-related links
echo $this->bottomLinks();
?>
</div>
</div>
-<?php echo $this->quickBar() ?>
+<div id="mw-navigation">
+ <h2><?php echo wfMessage( 'navigation-heading' )->escaped() ?></h2>
+ <div id="toplinks" role="navigation">
+ <p id="syslinks"><?php echo $this->sysLinks() ?></p>
+ <p id="variantlinks"><?php echo $this->variantLinks() ?></p>
+ </div>
+ <?php echo $this->quickBar() ?>
+</div>
<?php
$s = ob_get_contents();
ob_end_clean();
/**
* @return string
- *
- * @fixed
*/
function sysLinks() {
$s = array(
}
/**
- * @param $heading string
- * @return string
+ * Adds CologneBlue-specific items to the sidebar: qbedit, qbpageoptions and qbmyoptions menus.
*
- * @fixed
+ * @param $bar sidebar data
+ * @return array modified sidebar data
*/
- function menuHead( $heading ) {
- return "\n<h6>" . htmlspecialchars( $heading ) . "</h6>";
+ function sidebarAdditions( $bar ) {
+ // "This page" and "Edit" menus
+ // We need to do some massaging here... we reuse all of the items, except for $...['views']['view'],
+ // as $...['namespaces']['main'] and $...['namespaces']['talk'] together serve the same purpose.
+ // We also don't use $...['variants'], these are displayed in the top menu.
+ $content_navigation = $this->data['content_navigation'];
+ $qbpageoptions = array_merge(
+ $content_navigation['namespaces'],
+ array(
+ 'history' => $content_navigation['views']['history'],
+ 'watch' => $content_navigation['actions']['watch'],
+ 'unwatch' => $content_navigation['actions']['unwatch'],
+ )
+ );
+ $content_navigation['actions']['watch'] = null;
+ $content_navigation['actions']['unwatch'] = null;
+ $qbedit = array_merge(
+ array(
+ 'edit' => $content_navigation['views']['edit'],
+ 'addsection' => $content_navigation['views']['addsection'],
+ ),
+ $content_navigation['actions']
+ );
+
+ // Personal tools ("My pages")
+ $qbmyoptions = $this->getPersonalTools();
+ foreach ( array ( 'logout', 'createaccount', 'login', 'anonlogin' ) as $key ) {
+ $qbmyoptions[$key] = null;
+ }
+
+ // 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;
}
/**
* @access private
*
* @return string
- *
- * @fixed
*/
- function quickBar(){
- $s = "\n<div id='quickbar'>";
-
- $sep = "<br />\n";
-
- $plain_bar = $this->data['sidebar'];
+ function quickBar() {
+ // Massage the sidebar. We want to:
+ // * place SEARCH at the beginning
+ // * add new portlets before TOOLBOX (or at the end, if it's missing)
+ // * remove LANGUAGES (langlinks are displayed elsewhere)
+ $orig_bar = $this->data['sidebar'];
$bar = array();
-
- // Massage the sidebar
- // We want to place SEARCH at the beginning and a lot of stuff before TOOLBOX (or at the end, if it's missing)
- $additions_done = false;
- while ( !$additions_done ) {
- $bar = array(); // Empty it out
-
- // Always display search on top
- $bar['SEARCH'] = true;
-
- foreach ( $plain_bar as $heading => $links ) {
- if ( $heading == 'TOOLBOX' ) {
- if( $links !== NULL ) {
- // If this is not a toolbox prosthetic we inserted outselves, fill it out
- $plain_bar['TOOLBOX'] = $this->getToolbox();
- }
-
- // And insert the stuff
-
- // "This page" and "Edit" menus
- // We need to do some massaging here... we reuse all of the items, except for $...['views']['view'],
- // as $...['namespaces']['main'] and $...['namespaces']['talk'] together serve the same purpose.
- // We also don't use $...['variants'], these are displayed in the top menu.
- $content_navigation = $this->data['content_navigation'];
- $qbpageoptions = array_merge(
- $content_navigation['namespaces'],
- array(
- 'history' => $content_navigation['views']['history'],
- 'watch' => $content_navigation['actions']['watch'],
- 'unwatch' => $content_navigation['actions']['unwatch'],
- )
- );
- $content_navigation['actions']['watch'] = null;
- $content_navigation['actions']['unwatch'] = null;
- $qbedit = array_merge(
- array(
- 'edit' => $content_navigation['views']['edit'],
- 'addsection' => $content_navigation['views']['addsection'],
- ),
- $content_navigation['actions']
- );
- $bar['qbedit'] = $qbedit;
- $bar['qbpageoptions'] = $qbpageoptions;
-
- // Personal tools ("My pages")
- $bar['qbmyoptions'] = $this->getPersonalTools();
- foreach ( array ( 'logout', 'createaccount', 'login', 'anonlogin' ) as $key ) {
- $bar['qbmyoptions'][$key] = null;
- }
-
- $additions_done = true;
- }
-
- // Re-insert current heading, unless it's SEARCH
- if ( $heading != 'SEARCH' ) {
- $bar[$heading] = $plain_bar[$heading];
- }
+ $hasToolbox = false;
+
+ // Always display search first
+ $bar['SEARCH'] = true;
+ // Copy everything except for langlinks, inserting new items before toolbox
+ foreach ( $orig_bar as $heading => $data ) {
+ if ( $heading == 'TOOLBOX' ) {
+ // Insert the stuff
+ $bar = $this->sidebarAdditions( $bar );
+ $hasToolbox = true;
}
- // If TOOLBOX is missing, $additions_done is still false
- if ( !$additions_done ) {
- $plain_bar['TOOLBOX'] = false;
+ if ( $heading != 'LANGUAGES' ) {
+ $bar[$heading] = $data;
}
}
+ // If toolbox is missing, add our items at the end
+ if ( !$hasToolbox ) {
+ $bar = $this->sidebarAdditions( $bar );
+ }
+
- foreach ( $bar as $heading => $links ) {
+ // Fill out special sidebar items with content
+ $orig_bar = $bar;
+ $bar = array();
+ foreach ( $orig_bar as $heading => $data ) {
if ( $heading == 'SEARCH' ) {
- $s .= $this->menuHead( wfMessage( 'qbfind' )->text() );
- $s .= $this->searchForm( 'sidebar' );
- } elseif ( $heading == 'LANGUAGES' ) {
- // discard these; we display languages below page content
- } elseif ( $links ) {
- if ( is_array( $links ) ) {
- // Use the navigation heading from standard sidebar as the "browse" section
- if ( $heading == 'navigation' ) {
- $heading = 'qbbrowse';
- }
- if ( $heading == 'TOOLBOX' ) {
- $heading = 'toolbox';
- }
+ $bar['search'] = $this->searchForm( 'sidebar' );
+ } elseif ( $heading == 'TOOLBOX' ) {
+ $bar['tb'] = $this->getToolbox();
+ } else {
+ $bar[$heading] = $data;
+ }
+ }
- $headingMsg = wfMessage( $heading );
- $any_link = false;
- $t = $this->menuHead( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) );
- foreach ( $links as $key => $link ) {
- // Can be empty due to rampant sidebar massaging we're doing above
- if ( $link ) {
- $any_link = true;
- $t .= $this->makeListItem( $key, $link, array( 'tag' => 'span' ) ) . $sep;
- }
- }
+ // 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 = "<div id='quickbar'>\n";
+
+ foreach ( $bar as $heading => $data ) {
+ $portletId = Sanitizer::escapeId( "p-$heading" );
+ $headingMsg = wfMessage( $idToMessage[$heading] ? $idToMessage[$heading] : $heading );
+ $headingHTML = "<h3>" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "</h3>";
+ $listHTML = "";
- if ( $any_link ) {
- $s .= $t;
+ if ( is_array( $data ) ) {
+ // $data is an array of links
+ foreach ( $data as $key => $link ) {
+ // Can be empty due to how the sidebar additions are done
+ if ( $link ) {
+ $listHTML .= $this->makeListItem( $key, $link );
}
- } else {
- // $links can be a HTML string
- $s .= $links;
}
+ if ( $listHTML ) {
+ $listHTML = "<ul>$listHTML</ul>";
+ }
+ } else {
+ // $data is a HTML <ul>-list string
+ $listHTML = $data;
+ }
+
+ if ( $listHTML ) {
+ $role = ( $heading == 'search' ) ? 'search' : 'navigation';
+ $s .= "<div class=\"portlet\" id=\"$portletId\" role=\"$role\">\n$headingHTML\n$listHTML\n</div>\n";
}
}
- $s .= $sep . "\n</div>\n";
+ $s .= "</div>\n";
return $s;
}
/**
* @param $label string
* @return string
- *
- * @fixed
*/
function searchForm( $which ) {
global $wgUseTwoButtonsSearchForm;