addModuleStyles( 'mediawiki.legacy.shared' ); $out->addModuleStyles( 'mediawiki.legacy.oldshared' ); $out->addModuleStyles( 'skins.cologneblue' ); } } class CologneBlueTemplate extends BaseTemplate { function execute() { $this->html( 'headelement' ); echo $this->beforeContent(); $this->html( 'bodytext' ); echo "\n"; echo $this->afterContent(); $this->html( 'dataAfterContent' ); $this->printTrail(); echo "\n"; } /** * Language/charset variant links for classic-style skins * @return string */ function variantLinks() { $s = ''; /* show links to different language variants */ global $wgDisableLangConversion, $wgLang; $title = $this->getSkin()->getTitle(); $lang = $title->getPageLanguage(); $variants = $lang->getVariants(); if ( !$wgDisableLangConversion && sizeof( $variants ) > 1 && !$title->isSpecialPage() ) { foreach ( $variants as $code ) { $varname = $lang->getVariantname( $code ); if ( $varname == 'disable' ) { continue; } $s = $wgLang->pipeList( array( $s, '' . htmlspecialchars( $varname ) . '' ) ); } } return $s; } /** * Compatibility for extensions adding functionality through tabs. * Eventually these old skins should be replaced with SkinTemplate-based * versions, sigh... * @return string * @todo Exterminate! ...that, and replace it with normal SkinTemplate stuff */ function extensionTabLinks() { $tabs = array(); $out = ''; $s = array(); wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) ); foreach ( $tabs as $tab ) { $s[] = Xml::element( 'a', array( 'href' => $tab['href'] ), $tab['text'] ); } if ( count( $s ) ) { global $wgLang; $out = wfMessage( 'pipe-separator' )->escaped(); $out .= $wgLang->pipeList( $s ); } return $out; } function otherLanguages() { global $wgOut, $wgLang, $wgHideInterlanguageLinks; if ( $wgHideInterlanguageLinks ) { return ''; } $a = $wgOut->getLanguageLinks(); if ( 0 == count( $a ) ) { return ''; } $s = wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text(); $first = true; if ( $wgLang->isRTL() ) { $s .= ''; } foreach ( $a as $l ) { if ( !$first ) { $s .= wfMessage( 'pipe-separator' )->escaped(); } $first = false; $nt = Title::newFromText( $l ); $text = Language::fetchLanguageName( $nt->getInterwiki() ); $s .= Html::element( 'a', array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ), $text == '' ? $l : $text ); } if ( $wgLang->isRTL() ) { $s .= ''; } return $s; } // @fixed function pageTitleLinks() { global $wgLang; $s = array(); $footlinks = $this->getFooterLinks(); foreach ( $footlinks['places'] as $item ) { $s[] = $this->data[$item]; } return $wgLang->pipeList( $s ); } function bottomLinks() { global $wgOut, $wgUser; $sep = wfMessage( 'pipe-separator' )->escaped() . "\n"; $s = ''; if ( $wgOut->isArticleRelated() ) { $element[] = '' . $this->editThisPage() . ''; if ( $wgUser->isLoggedIn() ) { $element[] = $this->watchThisPage(); } $element[] = $this->talkLink(); $element[] = $this->historyLink(); $element[] = $this->whatLinksHere(); $element[] = $this->watchPageLinksLink(); $title = $this->getSkin()->getTitle(); if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) { $id = User::idFromName( $title->getText() ); $ip = User::isIP( $title->getText() ); # Both anons and non-anons have contributions list if ( $id || $ip ) { $element[] = $this->userContribsLink(); } if ( $this->getSkin()->showEmailUser( $id ) ) { $element[] = $this->emailUserLink(); } } $s = implode( $element, $sep ); if ( $title->getArticleID() ) { $s .= "\n
"; // Delete/protect/move links for privileged users if ( $wgUser->isAllowed( 'delete' ) ) { $s .= $this->deleteThisPage(); } if ( $wgUser->isAllowed( 'protect' ) ) { $s .= $sep . $this->protectThisPage(); } if ( $wgUser->isAllowed( 'move' ) ) { $s .= $sep . $this->moveThisPage(); } } $s .= "
\n" . $this->otherLanguages(); } return $s; } function editThisPage() { global $wgOut; if ( !$wgOut->isArticleRelated() ) { $s = wfMessage( 'protectedpage' )->text(); } else { $title = $this->getSkin()->getTitle(); if ( $title->quickUserCan( 'edit' ) && $title->exists() ) { $t = wfMessage( 'editthispage' )->text(); } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) { $t = wfMessage( 'create-this-page' )->text(); } else { $t = wfMessage( 'viewsource' )->text(); } $s = Linker::linkKnown( $title, $t, array(), $this->getSkin()->editUrlOptions() ); } return $s; } function deleteThisPage() { global $wgUser, $wgRequest; $diff = $wgRequest->getVal( 'diff' ); $title = $this->getSkin()->getTitle(); if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) { $t = wfMessage( 'deletethispage' )->text(); $s = Linker::linkKnown( $title, $t, array(), array( 'action' => 'delete' ) ); } else { $s = ''; } return $s; } function protectThisPage() { global $wgUser, $wgRequest; $diff = $wgRequest->getVal( 'diff' ); $title = $this->getSkin()->getTitle(); if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) { if ( $title->isProtected() ) { $text = wfMessage( 'unprotectthispage' )->text(); $query = array( 'action' => 'unprotect' ); } else { $text = wfMessage( 'protectthispage' )->text(); $query = array( 'action' => 'protect' ); } $s = Linker::linkKnown( $title, $text, array(), $query ); } else { $s = ''; } return $s; } function watchThisPage() { global $wgOut, $wgUser; // Cache $title = $this->getSkin()->getTitle(); if ( $wgOut->isArticleRelated() ) { if ( $wgUser->isWatched( $title ) ) { $text = wfMessage( 'unwatchthispage' )->text(); $query = array( 'action' => 'unwatch', 'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ), ); $id = 'mw-unwatch-link'; } else { $text = wfMessage( 'watchthispage' )->text(); $query = array( 'action' => 'watch', 'token' => WatchAction::getWatchToken( $title, $wgUser ), ); $id = 'mw-watch-link'; } $s = Linker::linkKnown( $title, $text, array( 'id' => $id ), $query ); } else { $s = wfMessage( 'notanarticle' )->text(); } return $s; } function moveThisPage() { if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) { return Linker::linkKnown( SpecialPage::getTitleFor( 'Movepage' ), wfMessage( 'movethispage' )->text(), array(), array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() ) ); } else { // no message if page is protected - would be redundant return ''; } } function historyLink() { return Linker::link( $this->getSkin()->getTitle(), wfMessage( 'history' )->escaped(), array( 'rel' => 'archives' ), array( 'action' => 'history' ) ); } function whatLinksHere() { return Linker::linkKnown( SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ), wfMessage( 'whatlinkshere' )->escaped() ); } function userContribsLink() { return Linker::linkKnown( SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ), wfMessage( 'contributions' )->escaped() ); } function emailUserLink() { return Linker::linkKnown( SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ), wfMessage( 'emailuser' )->escaped() ); } function watchPageLinksLink() { global $wgOut; if ( !$wgOut->isArticleRelated() ) { return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped(); } else { return Linker::linkKnown( SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ), wfMessage( 'recentchangeslinked-toolbox' )->escaped() ); } } function talkLink() { $title = $this->getSkin()->getTitle(); if ( NS_SPECIAL == $title->getNamespace() ) { # No discussion links for special pages return ''; } $linkOptions = array(); if ( $title->isTalkPage() ) { $link = $title->getSubjectPage(); switch( $link->getNamespace() ) { case NS_MAIN: $text = wfMessage( 'articlepage' ); break; case NS_USER: $text = wfMessage( 'userpage' ); break; case NS_PROJECT: $text = wfMessage( 'projectpage' ); break; case NS_FILE: $text = wfMessage( 'imagepage' ); # Make link known if image exists, even if the desc. page doesn't. if ( wfFindFile( $link ) ) $linkOptions[] = 'known'; break; case NS_MEDIAWIKI: $text = wfMessage( 'mediawikipage' ); break; case NS_TEMPLATE: $text = wfMessage( 'templatepage' ); break; case NS_HELP: $text = wfMessage( 'viewhelppage' ); break; case NS_CATEGORY: $text = wfMessage( 'categorypage' ); break; default: $text = wfMessage( 'articlepage' ); } } else { $link = $title->getTalkPage(); $text = wfMessage( 'talkpage' ); } $s = Linker::link( $link, $text->text(), array(), array(), $linkOptions ); return $s; } /** * @return string */ function beforeContent() { $mainPageObj = Title::newMainPage(); $s = "\n
\n"; ob_start(); ?>

escaped() ?>

escaped() ?>

getSkin()->getCategories() ?> data['newtalk'] ) { ?>
data['newtalk'] ?>
"; $notice = $this->getSkin()->getSiteNotice(); if( $notice ) { $s .= "\n
$notice
\n"; } $s .= '

' . $this->data['title'] . '

'; if ( $this->translator->translate( 'tagline' ) ) { $s .= "

" . htmlspecialchars( $this->translator->translate( 'tagline' ) ) . "

"; } if ( $this->getSkin()->getOutput()->getSubtitle() ) { $s .= "

" . $this->getSkin()->getOutput()->getSubtitle() . "

"; } if ( $this->getSkin()->subPageSubtitle() ) { $s .= "

" . $this->getSkin()->subPageSubtitle() . "

"; } return $s; } /** * @return string */ function afterContent(){ $s = "\n
\n"; $s .= "\n\n\n"; $s .= $this->quickBar(); return $s; } /** * @return string */ function sysLinks() { $personalUrls = $this->data['personal_urls']; $s = array( $this->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() ), Linker::specialLink( 'Specialpages' ) ); /* show links to different language variants */ if( $this->variantLinks() ) { $s[] = $this->variantLinks(); } if( $this->extensionTabLinks() ) { $s[] = $this->extensionTabLinks(); } if ( $this->data['loggedin'] ) { $s[] = $this->makeLink( 'logout', $personalUrls['logout'] ); } else { if ( $personalUrls['createaccount'] ) { // Controlled by $wgUseCombinedLoginLink $s[] = $this->makeLink( 'createaccount', $personalUrls['createaccount'] ); } if ( $personalUrls['login'] ) { $s[] = $this->makeLink( 'login', $personalUrls['login'] ); } if ( $personalUrls['anonlogin'] ) { $s[] = $this->makeLink( 'anonlogin', $personalUrls['anonlogin'] ); } } return $this->getSkin()->getLanguage()->pipeList( $s ); } /** * @param $heading string * @return string * * @fixed */ function menuHead( $heading ) { return "\n
" . htmlspecialchars( $heading ) . "
"; } /** * Compute the sidebar * @access private * * @return string * * @fixed */ function quickBar(){ $s = "\n
"; $sep = "
\n"; $plain_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(); $bar['qbmyoptions']['login'] = false; $bar['qbmyoptions']['anonlogin'] = false; $bar['qbmyoptions']['logout'] = false; $bar['qbmyoptions']['createaccount'] = false; $additions_done = true; } // Re-insert current heading, unless it's SEARCH if ( $heading != 'SEARCH' ) { $bar[$heading] = $plain_bar[$heading]; } } // If TOOLBOX is missing, $additions_done is still false if ( !$additions_done ) { $plain_bar['TOOLBOX'] = false; } } foreach ( $bar as $heading => $links ) { if ( $heading == 'SEARCH' ) { $s .= $this->menuHead( wfMessage( 'qbfind' )->text() ); $s .= $this->searchForm( 'sidebar' ); } elseif ( $heading == 'LANGUAGES' ) { // discard these; we display languages below page content } else { if ( $links ) { // Use the navigation heading from standard sidebar as the "browse" section if ( $heading == 'navigation' ) { $heading = 'qbbrowse'; } if ( $heading == 'TOOLBOX' ) { $heading = 'toolbox'; } $headingMsg = wfMessage( $heading ); $any_link = false; $t = $this->menuHead( $headingMsg->exists() ? $headingMsg->text() : $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; } } if ( $any_link ) { $s .= $t; } } } } $s .= $sep . "\n
\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 == 'afterContent' ) { $s .= wfMessage( 'qbfind' )->text() . ": "; } $s .= "" . ($which == 'afterContent' ? " " : "
") . "escaped() . "\" />"; if( $wgUseTwoButtonsSearchForm ) { $s .= " escaped() . "\" />\n"; } else { $s .= '
\n"; } $s .= '
'; return $s; } }