From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- skins/CologneBlue.php | 173 ++++++++++++++++++++++++++------------------------ 1 file changed, 90 insertions(+), 83 deletions(-) (limited to 'skins/CologneBlue.php') diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 1ff2ccab..58b00fc6 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -15,37 +15,67 @@ if( !defined( 'MEDIAWIKI' ) ) { * @todo document * @ingroup Skins */ -class SkinCologneBlue extends Skin { +class SkinCologneBlue extends SkinLegacy { + var $skinname = 'cologneblue', $stylename = 'cologneblue', + $template = 'CologneBlueTemplate'; - function getStylesheet() { - return 'common/cologneblue.css'; - } + function setupSkinUserCss( OutputPage $out ){ + parent::setupSkinUserCss( $out ); + $out->addModuleStyles( 'skins.cologneblue' ); + + $qb = $this->qbSetting(); + $rules = array(); - function getSkinName() { - return 'cologneblue'; + if ( 2 == $qb ) { # Right + $rules[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }"; + $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }"; + $rules[] = "/* @noflip */#footer { margin-right: 152px; }"; + } elseif ( 1 == $qb ) { + $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }"; + $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }"; + $rules[] = "/* @noflip */#footer { margin-left: 152px; }"; + } elseif ( 3 == $qb ) { # Floating left + $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }"; + $rules[] = "/* @noflip */#topbar { margin-left: 148px }"; + $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }"; + $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE + $rules[] = "/* @noflip */#footer { margin-left: 152px; }"; + } elseif ( 4 == $qb ) { # Floating right + $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }"; + $rules[] = "/* @noflip */#topbar { margin-right: 148px }"; + $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }"; + $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE + $rules[] = "/* @noflip */#footer { margin-right: 152px; }"; + } + $style = implode( "\n", $rules ); + $out->addInlineStyle( $style, 'flip' ); } +} + +class CologneBlueTemplate extends LegacyTemplate { + function doBeforeContent() { $mainPageObj = Title::newMainPage(); $s = "\n
\n
" . ''; - $s .= '
'; + $s .= ''; $s .= ''; $s .= '' . wfMsg( 'sitetitle' ) . ''; - $s .= ''; + $s .= '
'; + $s .= '
'; $s .= ''; $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . ''; - $s .= ''; + $s .= ''; $s .= ''; $s .= str_replace( '
', '', $this->otherLanguages() ); - $cat = $this->getCategoryLinks(); + $cat = ''; if( $cat ) { $s .= "
$cat\n"; } @@ -56,7 +86,7 @@ class SkinCologneBlue extends Skin { $s .= "\n\n
"; - $notice = wfGetSiteNotice(); + $notice = $this->getSkin()->getSiteNotice(); if( $notice ) { $s .= "\n
$notice
\n"; } @@ -73,75 +103,38 @@ class SkinCologneBlue extends Skin { $s .= "\n\n
\n"; - if ( 0 != $qb ) { + if ( $this->getSkin()->qbSetting() != 0 ) { $s .= $this->quickBar(); } return $s; } - function setupSkinUserCss( OutputPage $out ){ - global $wgContLang; - $qb = $this->qbSetting(); - $rules = array(); - - if ( 2 == $qb ) { # Right - $rules[] = "#quickbar { position: absolute; right: 4px; }"; - $rules[] = "#article { margin-left: 4px; margin-right: 148px; }"; - } elseif ( 1 == $qb ) { - $rules[] = "#quickbar { position: absolute; left: 4px; }"; - $rules[] = "#article { margin-left: 148px; margin-right: 4px; }"; - } elseif ( 3 == $qb ) { # Floating left - $rules[] = "#quickbar { position:absolute; left:4px }"; - $rules[] = "#topbar { margin-left: 148px }"; - $rules[] = "#article { margin-left:148px; margin-right: 4px; }"; - $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE - } elseif ( 4 == $qb ) { # Floating right - $rules[] = "#quickbar { position: fixed; right: 4px; }"; - $rules[] = "#topbar { margin-right: 148px }"; - $rules[] = "#article { margin-right: 148px; margin-left: 4px; }"; - $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE - } - $style = implode( "\n", $rules ); - if ( $wgContLang->getDir() === 'rtl' ) { - $style = CSSJanus::transform( $style, true, false ); - } - $out->addInlineStyle( $style ); - parent::setupSkinUserCss( $out ); - } - function sysLinks() { global $wgUser, $wgLang; $li = SpecialPage::getTitleFor( 'Userlogin' ); $lo = SpecialPage::getTitleFor( 'Userlogout' ); - $rt = $this->mTitle->getPrefixedURL(); + $rt = $this->getSkin()->getTitle()->getPrefixedURL(); if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) { $q = array(); } else { @@ -149,20 +142,20 @@ class SkinCologneBlue extends Skin { } $s = array( - $this->mainPageLink(), - $this->linkKnown( + $this->getSkin()->mainPageLink(), + Linker::linkKnown( Title::newFromText( wfMsgForContent( 'aboutpage' ) ), wfMsg( 'about' ) ), - $this->linkKnown( + Linker::linkKnown( Title::newFromText( wfMsgForContent( 'helppage' ) ), wfMsg( 'help' ) ), - $this->linkKnown( + Linker::linkKnown( Title::newFromText( wfMsgForContent( 'faqpage' ) ), wfMsg( 'faq' ) ), - $this->specialLink( 'Specialpages' ) + Linker::specialLink( 'Specialpages' ) ); /* show links to different language variants */ @@ -173,14 +166,14 @@ class SkinCologneBlue extends Skin { $s[] = $this->extensionTabLinks(); } if ( $wgUser->isLoggedIn() ) { - $s[] = $this->linkKnown( + $s[] = Linker::linkKnown( $lo, wfMsg( 'logout' ), array(), $q ); } else { - $s[] = $this->linkKnown( + $s[] = Linker::linkKnown( $li, wfMsg( 'login' ), array(), @@ -198,7 +191,7 @@ class SkinCologneBlue extends Skin { function quickBar(){ global $wgOut, $wgUser; - $tns = $this->mTitle->getNamespace(); + $tns = $this->getSkin()->getTitle()->getNamespace(); $s = "\n
"; @@ -209,24 +202,38 @@ class SkinCologneBlue extends Skin { $s .= $this->menuHead( 'qbbrowse' ); # Use the first heading from the Monobook sidebar as the "browse" section - $bar = $this->buildSidebar(); + $bar = $this->getSkin()->buildSidebar(); unset( $bar['SEARCH'] ); unset( $bar['LANGUAGES'] ); unset( $bar['TOOLBOX'] ); - $browseLinks = reset( $bar ); - foreach ( $browseLinks as $link ) { - if ( $link['text'] != '-' ) { - $s .= "" . - htmlspecialchars( $link['text'] ) . '' . $sep; + $barnumber = 1; + foreach ( $bar as $heading => $browseLinks ) { + if ( $barnumber > 1 ) { + $headingMsg = wfMessage( $heading ); + if ( $headingMsg->exists() ) { + $h = $headingMsg->text(); + } else { + $h = $heading; + } + $s .= "\n
" . htmlspecialchars( $h ) . "
"; + } + if( is_array( $browseLinks ) ) { + foreach ( $browseLinks as $link ) { + if ( $link['text'] != '-' ) { + $s .= "" . + htmlspecialchars( $link['text'] ) . '' . $sep; + } + } } + $barnumber++; } if ( $wgOut->isArticle() ) { $s .= $this->menuHead( 'qbedit' ); $s .= '' . $this->editThisPage() . ''; - $s .= $sep . $this->linkKnown( + $s .= $sep . Linker::linkKnown( Title::newFromText( wfMsgForContent( 'edithelppage' ) ), wfMsg( 'edithelp' ) ); @@ -264,10 +271,10 @@ class SkinCologneBlue extends Skin { . $sep . $this->watchPageLinksLink(); if( $tns == NS_USER || $tns == NS_USER_TALK ) { - $id = User::idFromName( $this->mTitle->getText() ); + $id = User::idFromName( $this->getSkin()->getTitle()->getText() ); if( $id != 0 ) { $s .= $sep . $this->userContribsLink(); - if( $this->showEmailUser( $id ) ) { + if( $this->getSkin()->showEmailUser( $id ) ) { $s .= $sep . $this->emailUserLink(); } } @@ -277,7 +284,7 @@ class SkinCologneBlue extends Skin { $s .= $this->menuHead( 'qbmyoptions' ); if ( $wgUser->isLoggedIn() ) { - $tl = $this->link( + $tl = Linker::link( $wgUser->getTalkPage(), wfMsg( 'mytalk' ), array(), @@ -288,30 +295,30 @@ class SkinCologneBlue extends Skin { $tl .= ' *'; } - $s .= $this->link( + $s .= Linker::link( $wgUser->getUserPage(), wfMsg( 'mypage' ), array(), array(), array( 'known', 'noclasses' ) - ) . $sep . $tl . $sep . $this->specialLink( 'Watchlist' ) + ) . $sep . $tl . $sep . Linker::specialLink( 'Watchlist' ) . $sep . - $this->link( + Linker::link( SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ), wfMsg( 'mycontris' ), array(), array(), array( 'known', 'noclasses' ) - ) . $sep . $this->specialLink( 'Preferences' ) - . $sep . $this->specialLink( 'Userlogout' ); + ) . $sep . Linker::specialLink( 'Preferences' ) + . $sep . Linker::specialLink( 'Userlogout' ); } else { - $s .= $this->specialLink( 'Userlogin' ); + $s .= Linker::specialLink( 'Userlogin' ); } $s .= $this->menuHead( 'qbspecialpages' ) - . $this->specialLink( 'Newpages' ) - . $sep . $this->specialLink( 'Listfiles' ) - . $sep . $this->specialLink( 'Statistics' ); + . Linker::specialLink( 'Newpages' ) + . $sep . Linker::specialLink( 'Listfiles' ) + . $sep . Linker::specialLink( 'Statistics' ); if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) { $s .= $sep . $this->getUploadLink(); } @@ -323,7 +330,7 @@ class SkinCologneBlue extends Skin { . wfMsg( 'sitesupport' ) . ''; } - $s .= $sep . $this->link( + $s .= $sep . Linker::link( SpecialPage::getTitleFor( 'Specialpages' ), wfMsg( 'moredotdotdot' ), array(), @@ -344,7 +351,7 @@ class SkinCologneBlue extends Skin { global $wgRequest, $wgUseTwoButtonsSearchForm; $search = $wgRequest->getText( 'search' ); - $action = $this->escapeSearchLink(); + $action = $this->data['searchaction']; $s = "
searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">"; if( $label != '' ) { $s .= "{$label}: "; -- cgit v1.2.2