X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=skins%2FCologneBlue.php;h=214d9bc2c01ac26a3db1bb33d37e0956da3d68ee;hb=de13c31c1da57541f78cb9f9c75aff931c088a15;hp=8571b4beedcacf19ebf86d2192464773e6d9ff47;hpb=ba9ae792125f3e5dc4add3a3dbf1bf08f8e0553a;p=lhc%2Fweb%2Fwiklou.git diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 8571b4beed..214d9bc2c0 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -1,63 +1,112 @@ addModuleStyles( 'skins.cologneblue' ); + + $qb = $this->qbSetting(); + $rules = array(); + + 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' ); } - function doBeforeContent() { - global $wgOut, $wgTitle; +} - $s = ""; - $qb = $this->qbSetting(); +class CologneBlueTemplate extends LegacyTemplate { + + /** + * @return string + */ + function doBeforeContent() { $mainPageObj = Title::newMainPage(); - - $s .= "\n
\n
" . - ""; - $s .= "
"; - $s .= "escapeLocalURL() . "\">"; - $s .= "" . wfMsg( "sitetitle" ) . ""; + $s = "\n
\n
" . + ''; + + $s .= '
'; + $s .= ''; + $s .= '' . wfMsg( 'sitetitle' ) . ''; - $s .= ""; + $s .= '
"; + $s .= '
'; + + $s .= ''; + $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . ''; + $s .= ''; + + $s .= ''; + $s .= str_replace( '
', '', $this->otherLanguages() ); - $s .= ""; - $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . ""; - $s .= "
" ; + $s .= $this->getSkin()->getCategories(); - $s .= "" ; - $s .= str_replace ( "
" , "" , $this->otherLanguages() ); - $cat = $this->getCategoryLinks(); - if( $cat ) $s .= "
$cat\n"; - $s .= "
" . $this->pageTitleLinks(); - $s .= "
"; + $s .= '
' . $this->pageTitleLinks(); + $s .= ''; $s .= "
\n"; $s .= "\n
\n
"; - $notice = wfGetSiteNotice(); + $notice = $this->getSkin()->getSiteNotice(); if( $notice ) { $s .= "\n
$notice
\n"; } @@ -66,175 +115,191 @@ class SkinCologneBlue extends Skin { return $s; } - function doAfterContent() - { - global $wgOut; - + /** + * @return string + */ + function doAfterContent(){ $s = "\n

\n"; $s .= "\n\n
\n"; - if ( 0 != $qb ) { $s .= $this->quickBar(); } - return $s; - } - - function doGetUserStyles() { - global $wgOut, $wgStyleSheetPath; - $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 - $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 + if ( $this->getSkin()->qbSetting() != 0 ) { + $s .= $this->quickBar(); } return $s; } - + + /** + * @return string + */ function sysLinks() { - global $wgUser, $wgContLang, $wgTitle; - $li = $wgContLang->specialPage("Userlogin"); - $lo = $wgContLang->specialPage("Userlogout"); + $li = SpecialPage::getTitleFor( 'Userlogin' ); + $lo = SpecialPage::getTitleFor( 'Userlogout' ); - $rt = $wgTitle->getPrefixedURL(); + $rt = $this->getSkin()->getTitle()->getPrefixedURL(); if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) { - $q = ""; - } else { - $q = "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" ) . " | "; - - if ( $wgUser->isLoggedIn() ) { - $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q ); + $q = array(); } else { - $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q ); + $q = array( 'returnto' => $rt ); } + $s = array( + $this->getSkin()->mainPageLink(), + Linker::linkKnown( + Title::newFromText( wfMsgForContent( 'aboutpage' ) ), + wfMsg( 'about' ) + ), + Linker::linkKnown( + Title::newFromText( wfMsgForContent( 'helppage' ) ), + wfMsg( 'help' ) + ), + Linker::linkKnown( + Title::newFromText( wfMsgForContent( 'faqpage' ) ), + wfMsg( 'faq' ) + ), + Linker::specialLink( 'Specialpages' ) + ); + /* 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 . ''; - } + if( $this->variantLinks() ) { + $s[] = $this->variantLinks(); + } + if( $this->extensionTabLinks() ) { + $s[] = $this->extensionTabLinks(); + } + if ( $this->data['loggedin'] ) { + $s[] = Linker::linkKnown( + $lo, + wfMsg( 'logout' ), + array(), + $q + ); + } else { + $s[] = Linker::linkKnown( + $li, + wfMsg( 'login' ), + array(), + $q + ); } - - - return $s; + return $this->getSkin()->getLanguage()->pipeList( $s ); } /** * Compute the sidebar - * @private + * @access private + * + * @return string */ - function quickBar() - { - global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks; - - $tns=$wgTitle->getNamespace(); - + function quickBar(){ $s = "\n
"; - $sep = "
"; - $s .= $this->menuHead( "qbfind" ); + $sep = '
'; + $s .= $this->menuHead( 'qbfind' ); $s .= $this->searchForm(); - $s .= $this->menuHead( "qbbrowse" ); - - foreach ( $wgNavigationLinks as $link ) { - $msg = wfMsgForContent( $link['href'] ); - $text = wfMsg( $link['text'] ); - if ( $msg != '-' && $text != '-' ) { - $s .= '' . - htmlspecialchars( $text ) . '' . $sep; + $s .= $this->menuHead( 'qbbrowse' ); + + # Use the first heading from the Monobook sidebar as the "browse" section + $bar = $this->getSkin()->buildSidebar(); + unset( $bar['SEARCH'] ); + unset( $bar['LANGUAGES'] ); + unset( $bar['TOOLBOX'] ); + + $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() . ""; + $user = $this->getSkin()->getUser(); + + if ( $this->data['isarticle'] ) { + $s .= $this->menuHead( 'qbedit' ); + $s .= '' . $this->editThisPage() . ''; - $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) ); + $s .= $sep . Linker::linkKnown( + Title::newFromText( wfMsgForContent( 'edithelppage' ) ), + wfMsg( 'edithelp' ) + ); - if( $wgUser->isLoggedIn() ) { + if( $this->data['loggedin'] ) { $s .= $sep . $this->moveThisPage(); } - if ( $wgUser->isAllowed('delete') ) { + if ( $user->isAllowed( 'delete' ) ) { $dtp = $this->deleteThisPage(); - if ( "" != $dtp ) { + if ( $dtp != '' ) { $s .= $sep . $dtp; } } - if ( $wgUser->isAllowed('protect') ) { + if ( $user->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(); - if ( $wgUser->isLoggedIn() ) { + . $sep . $this->commentLink() + . $sep . $this->printableLink(); + if ( $this->data['loggedin'] ) { $s .= $sep . $this->watchThisPage(); } $s .= $sep; - $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) { + $s .= $this->menuHead( 'qbpageinfo' ) + . $this->historyLink() + . $sep . $this->whatLinksHere() + . $sep . $this->watchPageLinksLink(); + + $title = $this->getSkin()->getTitle(); + $tns = $title->getNamespace(); + if ( $tns == NS_USER || $tns == NS_USER_TALK ) { + $id = User::idFromName( $title->getText() ); + if( $id != 0 ) { $s .= $sep . $this->userContribsLink(); - if( $this->showEmailUser( $id ) ) { + if( $this->getSkin()->showEmailUser( $id ) ) { $s .= $sep . $this->emailUserLink(); } } @@ -242,70 +307,104 @@ class SkinCologneBlue extends Skin { $s .= $sep; } - $s .= $this->menuHead( "qbmyoptions" ); - if ( $wgUser->isLoggedIn() ) { - $name = $wgUser->getName(); - $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), - wfMsg( 'mytalk' ) ); - if ( $wgUser->getNewtalk() ) { - $tl .= " *"; + $s .= $this->menuHead( 'qbmyoptions' ); + if ( $this->data['loggedin'] ) { + $tl = Linker::link( + $user->getTalkPage(), + wfMsg( 'mytalk' ), + array(), + array(), + array( 'known', 'noclasses' ) + ); + if ( $user->getNewtalk() ) { + $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 .= Linker::link( + $user->getUserPage(), + wfMsg( 'mypage' ), + array(), + array(), + array( 'known', 'noclasses' ) + ) . $sep . $tl . $sep . Linker::specialLink( 'Watchlist' ) + . $sep . + Linker::link( + SpecialPage::getSafeTitleFor( 'Contributions', $user->getName() ), + wfMsg( 'mycontris' ), + array(), + array(), + array( 'known', 'noclasses' ) + ) . $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( "imagelist" ) - . $sep . $this->specialLink( "statistics" ) - . $sep . $this->bugReportsLink(); - if ( $wgUser->isLoggedIn() && !$wgDisableUploads ) { - $s .= $sep . $this->specialLink( "upload" ); + $s .= $this->menuHead( 'qbspecialpages' ) + . Linker::specialLink( 'Newpages' ) + . $sep . Linker::specialLink( 'Listfiles' ) + . $sep . Linker::specialLink( 'Statistics' ); + if( UploadBase::isEnabled() && UploadBase::isAllowed( $user ) === 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 . Linker::link( + SpecialPage::getTitleFor( 'Specialpages' ), + wfMsg( 'moredotdotdot' ), + array(), + array(), + array( 'known', 'noclasses' ) + ); $s .= $sep . "\n
\n"; return $s; } - function menuHead( $key ) - { + /** + * @param $key string + * @return string + */ + function menuHead( $key ) { $s = "\n
" . wfMsg( $key ) . "
"; return $s; } - function searchForm( $label = "" ) - { - global $wgRequest; + /** + * @param $label string + * @return string + */ + function searchForm( $label = '' ) { + global $wgUseTwoButtonsSearchForm; + + $search = $this->getSkin()->getRequest()->getText( 'search' ); + $action = $this->data['searchaction']; + $s = "
searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">"; + if( $label != '' ) { + $s .= "{$label}: "; + } + + $s .= "searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\"" + . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />
" + . "searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />"; - $search = $wgRequest->getText( 'search' ); - $action = $this->escapeSearchLink(); - $s = ""; - if ( "" != $label ) { $s .= "{$label}: "; } + if( $wgUseTwoButtonsSearchForm ) { + $s .= "searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n"; + } else { + $s .= '\n"; + } - $s .= "" - . "
"; + $s .= ''; + + // Ensure unique id's for search boxes made after the first + $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1; return $s; } } - -?>