addModuleStyles( 'mediawiki.legacy.shared' ); $out->addModuleStyles( 'mediawiki.legacy.oldshared' ); $out->addModuleStyles( 'skins.cologneblue' ); } /** * Override langlink formatting behavior not to uppercase the language names. * See otherLanguages() in CologneBlueTemplate. */ function formatLanguageName( $name ) { return $name; } } class CologneBlueTemplate extends BaseTemplate { function execute() { // Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings(); $this->html( 'headelement' ); echo $this->beforeContent(); $this->html( 'bodytext' ); echo "\n"; echo $this->afterContent(); $this->html( 'dataAfterContent' ); $this->printTrail(); echo "\n"; wfRestoreWarnings(); } /** * Language/charset variant links for classic-style skins * @return string * * @fixed */ function variantLinks() { $s = array(); $variants = $this->data['content_navigation']['variants']; foreach ( $variants as $key => $link ) { $s[] = $this->makeListItem( $key, $link, array( 'tag' => 'span' ) ); } return $this->getSkin()->getLanguage()->pipeList( $s ); } // @fixed function otherLanguages() { global $wgHideInterlanguageLinks; if ( $wgHideInterlanguageLinks ) { return ""; } // We override SkinTemplate->formatLanguageName() in SkinCologneBlue // not to capitalize the language names. $language_urls = $this->data['language_urls']; if ( empty( $language_urls ) ) { return ""; } $s = array(); foreach ( $language_urls as $key => $data ) { $s[] = $this->makeListItem( $key, $data, array( 'tag' => 'span' ) ); } return wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text() . $this->getSkin()->getLanguage()->pipeList( $s ); } // @fixed function pageTitleLinks() { $s = array(); $footlinks = $this->getFooterLinks(); foreach ( $footlinks['places'] as $item ) { $s[] = $this->data[$item]; } return $this->getSkin()->getLanguage()->pipeList( $s ); } /** * 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 * * @return string * @fixed */ function processBottomLink( $key, $navlink, $message=null ) { if ( !$navlink ) { // Empty navlinks might be passed. return null; } if ( $message ) { $navlink['text'] = wfMessage( $message )->escaped(); } return $this->makeListItem( $key, $this->processNavlinkForDocument( $navlink ), array( 'tag' => 'span' ) ); } // @fixed function bottomLinks() { $toolbox = $this->getToolbox(); $content_nav = $this->data['content_navigation']; $lines = array(); if ( $this->getSkin()->getOutput()->isArticleRelated() ) { // First row. Regular actions. $element = array(); $editLinkMessage = $this->getSkin()->getTitle()->exists() ? 'editthispage' : 'create-this-page'; $element[] = $this->processBottomLink( 'edit', $content_nav['views']['edit'], $editLinkMessage ); $element[] = $this->processBottomLink( 'viewsource', $content_nav['views']['viewsource'], 'viewsource' ); $element[] = $this->processBottomLink( 'watch', $content_nav['actions']['watch'], 'watchthispage' ); $element[] = $this->processBottomLink( 'unwatch', $content_nav['actions']['unwatch'], 'unwatchthispage' ); $element[] = $this->talkLink(); $element[] = $this->processBottomLink( 'history', $content_nav['views']['history'], 'history' ); $element[] = $this->processBottomLink( 'info', $toolbox['info'] ); $element[] = $this->processBottomLink( 'whatlinkshere', $toolbox['whatlinkshere'] ); $element[] = $this->processBottomLink( 'recentchangeslinked', $toolbox['recentchangeslinked'] ); $element[] = $this->processBottomLink( 'contributions', $toolbox['contributions'] ); $element[] = $this->processBottomLink( 'emailuser', $toolbox['emailuser'] ); $lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) ); // Second row. Privileged actions. $element = array(); $element[] = $this->processBottomLink( 'delete', $content_nav['actions']['delete'], 'deletethispage' ); $element[] = $this->processBottomLink( 'undelete', $content_nav['actions']['undelete'], 'undeletethispage' ); $element[] = $this->processBottomLink( 'protect', $content_nav['actions']['protect'], 'protectthispage' ); $element[] = $this->processBottomLink( 'unprotect', $content_nav['actions']['unprotect'], 'unprotectthispage' ); $element[] = $this->processBottomLink( 'move', $content_nav['actions']['move'], 'movethispage' ); $lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) ); // Third row. Language links. $lines[] = $this->otherLanguages(); } return implode( array_filter( $lines ), "
\n" ) . "
\n"; } // @fixed function talkLink() { $title = $this->getSkin()->getTitle(); if ( $title->getNamespace() == NS_SPECIAL ) { // No discussion links for special pages return ""; } $companionTitle = $title->isTalkPage() ? $title->getSubjectPage() : $title->getTalkPage(); $companionNamespace = $companionTitle->getNamespace(); // TODO these messages appear to only be used by CologneBlue and legacy skins, // kill and replace with something more sensibly named? $nsToMessage = array( NS_MAIN => 'articlepage', NS_USER => 'userpage', NS_PROJECT => 'projectpage', NS_FILE => 'imagepage', NS_MEDIAWIKI => 'mediawikipage', NS_TEMPLATE => 'templatepage', NS_HELP => 'viewhelppage', NS_CATEGORY => 'categorypage', NS_FILE => 'imagepage', ); // Find out the message to use for link text. Use either the array above or, // for non-talk pages, a generic "discuss this" message. // Default is the same as for main namespace. if ( isset( $nsToMessage[$companionNamespace] ) ) { $message = $nsToMessage[$companionNamespace]; } else { $message = $companionTitle->isTalkPage() ? 'talkpage' : 'articlepage'; } // Obviously this can't be reasonable and just return the key for talk namespace, only for content ones. // Thus we have to mangle it in exactly the same way SkinTemplate does. (bug 40805) $key = $companionTitle->getNamespaceKey( '' ); if ( $companionTitle->isTalkPage() ) { $key = ( $key == 'main' ? 'talk' : $key . "_talk" ); } // Use the regular navigational link, but replace its text. Everything else stays unmodified. $namespacesLinks = $this->data['content_navigation']['namespaces']; return $this->processBottomLink( $message, $namespacesLinks[$key], $message ); } /** * Takes a navigational link generated by SkinTemplate in whichever way * and mangles attributes unsuitable for repeated use. In particular, this modifies the ids * 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-'. */ function processNavlinkForDocument( $navlink, $idPrefix='cb-' ) { if ( $navlink['id'] ) { $navlink['single-id'] = $navlink['id']; // to allow for tooltip generation $navlink['tooltiponly'] = true; // but no accesskeys // mangle or remove the id if ( $idPrefix === false ) { unset( $navlink['id'] ); } else { $navlink['id'] = $idPrefix . $navlink['id']; } } return $navlink; } /** * @return string * * @fixed */ function beforeContent() { ob_start(); ?>

escaped() ?>

escaped() ?>

getSkin()->getCategories() ?> data['newtalk'] ) { ?>
data['newtalk'] ?>
getSkin()->getSiteNotice() ) { ?>
getSkin()->getSiteNotice() ?>

data['title'] ?>

translator->translate( 'tagline' ) ) { ?>

translator->translate( 'tagline' ) ) ?>

getSkin()->getOutput()->getSubtitle() ) { ?>

getSkin()->getOutput()->getSubtitle() ?>

getSkin()->subPageSubtitle() ) { ?>

getSkin()->subPageSubtitle() ?>

quickBar() ?> getSkin()->mainPageLink(), Linker::linkKnown( Title::newFromText( wfMessage( 'aboutpage' )->inContentLanguage()->text() ), wfMessage( 'about' )->text() ), Linker::linkKnown( Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ), wfMessage( 'help' )->text() ), Linker::linkKnown( Title::newFromText( wfMessage( 'faqpage' )->inContentLanguage()->text() ), wfMessage( 'faq' )->text() ), ); $personalUrls = $this->getPersonalTools(); foreach ( array ( 'logout', 'createaccount', 'login', 'anonlogin' ) as $key ) { if ( $personalUrls[$key] ) { $s[] = $this->makeListItem( $key, $personalUrls[$key], array( 'tag' => 'span' ) ); } } return $this->getSkin()->getLanguage()->pipeList( $s ); } /** * Adds CologneBlue-specific items to the sidebar: qbedit, qbpageoptions and qbmyoptions menus. * * @param $bar sidebar data * @return array modified sidebar data * * @fixed */ 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; } $bar['qbedit'] = $qbedit; $bar['qbpageoptions'] = $qbpageoptions; $bar['qbmyoptions'] = $qbmyoptions; return $bar; } /** * Compute the sidebar * @access private * * @return string * * @fixed */ 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(); $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 ( $heading != 'LANGUAGES' ) { $bar[$heading] = $data; } } // If toolbox is missing, add our items at the end if ( !$hasToolbox ) { $bar = $this->sidebarAdditions( $bar ); } // Fill out special sidebar items with content $orig_bar = $bar; $bar = array(); foreach ( $orig_bar as $heading => $data ) { if ( $heading == 'SEARCH' ) { $bar['qbfind'] = $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; } else { $bar[$heading] = $data; } } // Output the sidebar $s = "
\n"; foreach ( $bar as $heading => $data ) { $headingMsg = wfMessage( $heading ); $headingHTML = "
" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "
"; $portletId = Sanitizer::escapeId( "p-$heading" ); $listHTML = ""; 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 ); } } if ( $listHTML ) { $listHTML = ""; } } else { // $data is a HTML
\n"; return $s; } /** * @param $label string * @return string * * @fixed */ function searchForm( $which ) { global $wgUseTwoButtonsSearchForm; $search = $this->getSkin()->getRequest()->getText( 'search' ); $action = $this->data['searchaction']; $s = "
"; if( $which == 'footer' ) { $s .= wfMessage( 'qbfind' )->text() . ": "; } $s .= "" . ($which == 'footer' ? " " : "
") . "escaped() . "\" />"; if( $wgUseTwoButtonsSearchForm ) { $s .= " escaped() . "\" />\n"; } else { $s .= '
\n"; } $s .= '
'; return $s; } }