X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=skins%2FCologneBlue.php;h=e157ed44a5e7b24c3bbaf23dbe4024df2e1ecdb3;hb=58e8c56edaa28d1b1ea26df4c2838ae4708abb68;hp=f304e37eb207940bdba60471c89febf57ab296d5;hpb=c38ef1d65bc2efa366bce721e26e098573b8a68c;p=lhc%2Fweb%2Fwiklou.git diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index f304e37eb2..e157ed44a5 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -1,62 +1,92 @@ addModuleStyles( 'skins.cologneblue' ); + + 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 ); } - function doBeforeContent() { +} - $s = ""; - $qb = $this->qbSetting(); +class CologneBlueTemplate extends LegacyTemplate { + + function doBeforeContent() { $mainPageObj = Title::newMainPage(); - $s .= "\n
\n
" . - ""; + $s = "\n
\n
" . + '
'; - $s .= "
"; - $s .= "escapeLocalURL() . "\">"; - $s .= "" . wfMsg( "sitetitle" ) . ""; + $s .= ''; + $s .= ''; + $s .= '' . wfMsg( 'sitetitle' ) . ''; - $s .= ""; + $s .= '
"; + $s .= '
'; - $s .= ""; - $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . ""; - $s .= "" ; + $s .= ''; + $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . ''; + $s .= ''; - $s .= "" ; - $s .= str_replace ( "
" , "" , $this->otherLanguages() ); - $cat = $this->getCategoryLinks(); - if( $cat ) $s .= "
$cat\n"; - $s .= "
" . $this->pageTitleLinks(); - $s .= "
"; + $s .= ''; + $s .= str_replace( '
', '', $this->otherLanguages() ); + $cat = $this->getSkin()->getCategoryLinks(); + if( $cat ) { + $s .= "
$cat\n"; + } + $s .= '
' . $this->pageTitleLinks(); + $s .= '
'; $s .= "
\n"; $s .= "\n
\n
"; - $notice = wfGetSiteNotice(); + $notice = $this->getSkin()->getSiteNotice(); if( $notice ) { $s .= "\n
$notice
\n"; } @@ -65,128 +95,124 @@ class SkinCologneBlue extends Skin { return $s; } - function doAfterContent() - { - global $wgOut; + function doAfterContent(){ + global $wgLang; $s = "\n

\n"; $s .= "\n\n
\n"; - if ( 0 != $qb ) { $s .= $this->quickBar(); } - return $s; - } - - function doGetUserStyles() { - global $wgOut; - $s = parent::doGetUserStyles(); - $qb = $this->qbSetting(); - - if ( 2 == $qb ) { # Right - $s .= "#quickbar { position: absolute; right: 4px; }\n" . - "#article { margin-left: 4px; margin-right: 148px; }\n"; - } else if ( 1 == $qb ) { - $s .= "#quickbar { position: absolute; left: 4px; }\n" . - "#article { margin-left: 148px; margin-right: 4px; }\n"; - } else if ( 3 == $qb ) { # Floating left - $s .= "#quickbar { position:absolute; left:4px } \n" . - "#topbar { margin-left: 148px }\n" . - "#article { margin-left:148px; margin-right: 4px; } \n" . - "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE - } else if ( 4 == $qb ) { # Floating right - $s .= "#quickbar { position: fixed; right: 4px; } \n" . - "#topbar { margin-right: 148px }\n" . - "#article { margin-right: 148px; margin-left: 4px; } \n" . - "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE + if ( 0 != $qb ) { + $s .= $this->quickBar(); } return $s; } function sysLinks() { - global $wgUser, $wgContLang, $wgTitle; - $li = $wgContLang->specialPage("Userlogin"); - $lo = $wgContLang->specialPage("Userlogout"); + global $wgUser, $wgLang; + $li = SpecialPage::getTitleFor( 'Userlogin' ); + $lo = SpecialPage::getTitleFor( 'Userlogout' ); - $rt = $wgTitle->getPrefixedURL(); + $rt = $this->getSkin()->getTitle()->getPrefixedURL(); if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) { - $q = ""; + $q = array(); } else { - $q = "returnto={$rt}"; + $q = array( 'returnto' => $rt ); } - $s = "" . - $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) ) - . " | " . - $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) ) - . " | " . - $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) ) - . " | " . - $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") ) - . " | " . - $this->specialLink( "specialpages" ) . " | "; + $s = array( + $this->getSkin()->mainPageLink(), + $this->getSkin()->linkKnown( + Title::newFromText( wfMsgForContent( 'aboutpage' ) ), + wfMsg( 'about' ) + ), + $this->getSkin()->linkKnown( + Title::newFromText( wfMsgForContent( 'helppage' ) ), + wfMsg( 'help' ) + ), + $this->getSkin()->linkKnown( + Title::newFromText( wfMsgForContent( 'faqpage' ) ), + wfMsg( 'faq' ) + ), + $this->getSkin()->specialLink( 'Specialpages' ) + ); + /* show links to different language variants */ + if( $this->variantLinks() ) { + $s[] = $this->variantLinks(); + } + if( $this->extensionTabLinks() ) { + $s[] = $this->extensionTabLinks(); + } if ( $wgUser->isLoggedIn() ) { - $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q ); + $s[] = $this->getSkin()->linkKnown( + $lo, + wfMsg( 'logout' ), + array(), + $q + ); } else { - $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q ); + $s[] = $this->getSkin()->linkKnown( + $li, + wfMsg( 'login' ), + array(), + $q + ); } - /* show links to different language variants */ - global $wgDisableLangConversion; - $variants = $wgContLang->getVariants(); - if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) { - $actstr = ''; - foreach( $variants as $code ) { - $varname = $wgContLang->getVariantname( $code ); - if( $varname == 'disable' ) - continue; - $s .= ' | ' . $varname . ''; - } - } - - return $s; + return $wgLang->pipeList( $s ); } /** * Compute the sidebar * @access private */ - function quickBar() - { - global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads; + function quickBar(){ + global $wgOut, $wgUser; - $tns=$wgTitle->getNamespace(); + $tns = $this->getSkin()->getTitle()->getNamespace(); $s = "\n
"; - $sep = "
"; - $s .= $this->menuHead( "qbfind" ); + $sep = '
'; + $s .= $this->menuHead( 'qbfind' ); $s .= $this->searchForm(); - $s .= $this->menuHead( "qbbrowse" ); + $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 ) { @@ -197,48 +223,51 @@ class SkinCologneBlue extends Skin { } if ( $wgOut->isArticle() ) { - $s .= $this->menuHead( "qbedit" ); - $s .= "" . $this->editThisPage() . ""; + $s .= $this->menuHead( 'qbedit' ); + $s .= '' . $this->editThisPage() . ''; - $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) ); + $s .= $sep . $this->getSkin()->linkKnown( + Title::newFromText( wfMsgForContent( 'edithelppage' ) ), + wfMsg( 'edithelp' ) + ); if( $wgUser->isLoggedIn() ) { $s .= $sep . $this->moveThisPage(); } - if ( $wgUser->isAllowed('delete') ) { + if ( $wgUser->isAllowed( 'delete' ) ) { $dtp = $this->deleteThisPage(); - if ( "" != $dtp ) { + if ( $dtp != '' ) { $s .= $sep . $dtp; } } - if ( $wgUser->isAllowed('protect') ) { + if ( $wgUser->isAllowed( 'protect' ) ) { $ptp = $this->protectThisPage(); - if ( "" != $ptp ) { + if ( $ptp != '' ) { $s .= $sep . $ptp; } } $s .= $sep; - $s .= $this->menuHead( "qbpageoptions" ); + $s .= $this->menuHead( 'qbpageoptions' ); $s .= $this->talkLink() - . $sep . $this->commentLink() - . $sep . $this->printableLink(); + . $sep . $this->commentLink() + . $sep . $this->printableLink(); if ( $wgUser->isLoggedIn() ) { $s .= $sep . $this->watchThisPage(); } $s .= $sep; - $s .= $this->menuHead("qbpageinfo") - . $this->historyLink() - . $sep . $this->whatLinksHere() - . $sep . $this->watchPageLinksLink(); + $s .= $this->menuHead( 'qbpageinfo' ) + . $this->historyLink() + . $sep . $this->whatLinksHere() + . $sep . $this->watchPageLinksLink(); if( $tns == NS_USER || $tns == NS_USER_TALK ) { - $id=User::idFromName($wgTitle->getText()); - if ($id != 0) { + $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(); } } @@ -246,70 +275,96 @@ class SkinCologneBlue extends Skin { $s .= $sep; } - $s .= $this->menuHead( "qbmyoptions" ); + $s .= $this->menuHead( 'qbmyoptions' ); if ( $wgUser->isLoggedIn() ) { - $name = $wgUser->getName(); - $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), - wfMsg( 'mytalk' ) ); + $tl = $this->getSkin()->link( + $wgUser->getTalkPage(), + wfMsg( 'mytalk' ), + array(), + array(), + array( 'known', 'noclasses' ) + ); if ( $wgUser->getNewtalk() ) { - $tl .= " *"; + $tl .= ' *'; } - $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(), - wfMsg( "mypage" ) ) - . $sep . $tl - . $sep . $this->specialLink( "watchlist" ) - . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ), - wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) ) - . $sep . $this->specialLink( "preferences" ) - . $sep . $this->specialLink( "userlogout" ); + $s .= $this->getSkin()->link( + $wgUser->getUserPage(), + wfMsg( 'mypage' ), + array(), + array(), + array( 'known', 'noclasses' ) + ) . $sep . $tl . $sep . $this->getSkin()->specialLink( 'Watchlist' ) + . $sep . + $this->getSkin()->link( + SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ), + wfMsg( 'mycontris' ), + array(), + array(), + array( 'known', 'noclasses' ) + ) . $sep . $this->getSkin()->specialLink( 'Preferences' ) + . $sep . $this->getSkin()->specialLink( 'Userlogout' ); } else { - $s .= $this->specialLink( "userlogin" ); + $s .= $this->getSkin()->specialLink( 'Userlogin' ); } - $s .= $this->menuHead( "qbspecialpages" ) - . $this->specialLink( "newpages" ) - . $sep . $this->specialLink( "imagelist" ) - . $sep . $this->specialLink( "statistics" ) - . $sep . $this->bugReportsLink(); - if ( $wgUser->isLoggedIn() && $wgEnableUploads ) { - $s .= $sep . $this->specialLink( "upload" ); + $s .= $this->menuHead( 'qbspecialpages' ) + . $this->getSkin()->specialLink( 'Newpages' ) + . $sep . $this->getSkin()->specialLink( 'Listfiles' ) + . $sep . $this->getSkin()->specialLink( 'Statistics' ); + if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) { + $s .= $sep . $this->getUploadLink(); } + global $wgSiteSupportPage; - if( $wgSiteSupportPage) { - $s .= $sep."" - .wfMsg( "sitesupport" ).""; + + if( $wgSiteSupportPage ) { + $s .= $sep . '' + . wfMsg( 'sitesupport' ) . ''; } - $s .= $sep . $this->makeKnownLinkObj( - Title::makeTitle( NS_SPECIAL, 'Specialpages' ), - wfMsg( 'moredotdotdot' ) ); + $s .= $sep . $this->getSkin()->link( + SpecialPage::getTitleFor( 'Specialpages' ), + wfMsg( 'moredotdotdot' ), + array(), + array(), + array( 'known', 'noclasses' ) + ); $s .= $sep . "\n
\n"; return $s; } - function menuHead( $key ) - { + function menuHead( $key ) { $s = "\n
" . wfMsg( $key ) . "
"; return $s; } - function searchForm( $label = "" ) - { - global $wgRequest; + function searchForm( $label = '' ) { + global $wgRequest, $wgUseTwoButtonsSearchForm; $search = $wgRequest->getText( 'search' ); - $action = $this->escapeSearchLink(); - $s = "
"; - if ( "" != $label ) { $s .= "{$label}: "; } + $action = $this->data['searchaction']; + $s = "searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">"; + if( $label != '' ) { + $s .= "{$label}: "; + } - $s .= "" - . "
"; + $s .= "searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\"" + . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />
" + . "searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />"; + + if( $wgUseTwoButtonsSearchForm ) { + $s .= "searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n"; + } else { + $s .= '
\n"; + } + + $s .= ''; + + // Ensure unique id's for search boxes made after the first + $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1; return $s; } } - -?>