<?php
/**
- * See skin.doc
+ * See skin.txt
*
* @todo document
* @package MediaWiki
* @subpackage Skins
*/
+if( !defined( 'MEDIAWIKI' ) )
+ die( -1 );
+
/**
* @todo document
* @package MediaWiki
*/
class SkinCologneBlue extends Skin {
+ private $searchboxes = '';
+ // How many search boxes have we made? Avoid duplicate id's.
+
function getStylesheet() {
- return "common/cologneblue.css";
+ return 'common/cologneblue.css';
}
function getSkinName() {
return "cologneblue";
}
function doBeforeContent() {
- global $wgUser, $wgOut, $wgTitle, $wgSiteNotice;
$s = "";
$qb = $this->qbSetting();
$mainPageObj = Title::newMainPage();
-
+
$s .= "\n<div id='content'>\n<div id='topbar'>" .
"<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
$s .= "</td><td align='right'>" ;
$s .= "<font size='-1'><span id='langlinks'>" ;
- $s .= str_replace ( "<br>" , "" , $this->otherLanguages() );
+ $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
$cat = $this->getCategoryLinks();
if( $cat ) $s .= "<br />$cat\n";
$s .= "<br />" . $this->pageTitleLinks();
$s .= "\n</div>\n<div id='article'>";
- if( $wgSiteNotice ) {
- $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
+ $notice = wfGetSiteNotice();
+ if( $notice ) {
+ $s .= "\n<div id='siteNotice'>$notice</div>\n";
}
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() . "\n";
function doAfterContent()
{
- global $wgUser, $wgOut;
+ global $wgOut;
$s = "\n</div><br clear='all' />\n";
if ( 0 != $qb ) { $s .= $this->quickBar(); }
return $s;
}
- function doGetUserStyles()
- {
- global $wgUser, $wgOut, $wgStyleSheetPath;
- $s = '';
+
+ function doGetUserStyles() {
+ global $wgOut;
+ $s = parent::doGetUserStyles();
$qb = $this->qbSetting();
if ( 2 == $qb ) { # Right
} else if ( 1 == $qb ) {
$s .= "#quickbar { position: absolute; left: 4px; }\n" .
"#article { margin-left: 148px; margin-right: 4px; }\n";
- } else if ( 3 == $qb ) { # Floating
+ } 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
}
- $s .= parent::doGetUserStyles();
return $s;
}
- function sysLinks()
- {
+
+ function sysLinks() {
global $wgUser, $wgContLang, $wgTitle;
$li = $wgContLang->specialPage("Userlogin");
$lo = $wgContLang->specialPage("Userlogout");
$rt = $wgTitle->getPrefixedURL();
if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
$q = "";
- } else {
- $q = "returnto={$rt}";
+ } else {
+ $q = "returnto={$rt}";
}
-
+
$s = "" .
$this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
. " | " .
. " | " .
$this->specialLink( "specialpages" ) . " | ";
- if ( $wgUser->getID() )
- {
+ if ( $wgUser->isLoggedIn() ) {
$s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
- }
- else
- {
+ } else {
$s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
}
+ /* show links to different language variants */
+ $s .= $this->variantLinks();
+
return $s;
}
/**
* Compute the sidebar
- * @private
+ * @access private
*/
function quickBar()
{
- global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks;
+ global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
$tns=$wgTitle->getNamespace();
$s .= $this->menuHead( "qbbrowse" );
- foreach ( $wgNavigationLinks as $link ) {
- $msg = wfMsgForContent( $link['href'] );
- if ( $msg != '-' ) {
- $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
- wfMsg( $link['text'] ) . '</a>' . $sep;
+ # Use the first heading from the Monobook sidebar as the "browse" section
+ $bar = $this->buildSidebar();
+ $browseLinks = reset( $bar );
+
+ foreach ( $browseLinks as $link ) {
+ if ( $link['text'] != '-' ) {
+ $s .= "<a href=\"{$link['href']}\">" .
+ htmlspecialchars( $link['text'] ) . '</a>' . $sep;
}
}
$s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
- if ( 0 != $wgUser->getID() ) {
+ if( $wgUser->isLoggedIn() ) {
$s .= $sep . $this->moveThisPage();
}
- if ( $wgUser->isSysop() ) {
+ if ( $wgUser->isAllowed('delete') ) {
$dtp = $this->deleteThisPage();
if ( "" != $dtp ) {
$s .= $sep . $dtp;
}
+ }
+ if ( $wgUser->isAllowed('protect') ) {
$ptp = $this->protectThisPage();
if ( "" != $ptp ) {
$s .= $sep . $ptp;
$s .= $this->menuHead( "qbpageoptions" );
$s .= $this->talkLink()
- . $sep . $this->commentLink()
+ . $sep . $this->commentLink()
. $sep . $this->printableLink();
- if ( 0 != $wgUser->getID() ) {
+ if ( $wgUser->isLoggedIn() ) {
$s .= $sep . $this->watchThisPage();
}
. $this->historyLink()
. $sep . $this->whatLinksHere()
. $sep . $this->watchPageLinksLink();
-
- if ( Namespace::getUser() == $tns || Namespace::getTalk(Namespace::getUser()) == $tns ) {
+
+ if( $tns == NS_USER || $tns == NS_USER_TALK ) {
$id=User::idFromName($wgTitle->getText());
if ($id != 0) {
$s .= $sep . $this->userContribsLink();
- if ( 0 != $wgUser->getID() ) {
+ if( $this->showEmailUser( $id ) ) {
$s .= $sep . $this->emailUserLink();
}
}
}
$s .= $this->menuHead( "qbmyoptions" );
- if ( 0 != $wgUser->getID() ) {
+ if ( $wgUser->isLoggedIn() ) {
$name = $wgUser->getName();
- $tl = $this->makeKnownLink( $wgContLang->getNsText(
- Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
- wfMsg( "mytalk" ) );
- if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
+ $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
+ wfMsg( 'mytalk' ) );
+ if ( $wgUser->getNewtalk() ) {
+ $tl .= " *";
+ }
- $s .= $this->makeKnownLink( $wgContLang->getNsText(
- Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
+ $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
+ wfMsg( "mypage" ) )
. $sep . $tl
. $sep . $this->specialLink( "watchlist" )
- . $sep . $this->makeKnownLink( $wgContLang->specialPage( "Contributions" ),
- wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
+ . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
+ wfMsg( "mycontris" ) )
. $sep . $this->specialLink( "preferences" )
. $sep . $this->specialLink( "userlogout" );
} else {
}
$s .= $this->menuHead( "qbspecialpages" )
- . $this->specialLink( "newpages" )
- . $sep . $this->specialLink( "imagelist" )
- . $sep . $this->specialLink( "statistics" )
+ . $this->specialLink( "newpages" )
+ . $sep . $this->specialLink( "imagelist" )
+ . $sep . $this->specialLink( "statistics" )
. $sep . $this->bugReportsLink();
- if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
+ if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
$s .= $sep . $this->specialLink( "upload" );
}
global $wgSiteSupportPage;
$s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
.wfMsg( "sitesupport" )."</a>";
}
-
- $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( "Specialpages" ), wfMsg("moredotdotdot") );
+
+ $s .= $sep . $this->makeKnownLinkObj(
+ SpecialPage::getTitleFor( 'Specialpages' ),
+ wfMsg( 'moredotdotdot' ) );
$s .= $sep . "\n</div>\n";
return $s;
$search = $wgRequest->getText( 'search' );
$action = $this->escapeSearchLink();
- $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
+ $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
if ( "" != $label ) { $s .= "{$label}: "; }
- $s .= "<input type='text' name=\"search\" size='14' value=\""
- . htmlspecialchars(substr($search,0,256)) . "\" />"
- . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
+ $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
+ . htmlspecialchars(substr($search,0,256)) . "\" /><br />"
+ . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( "searcharticle" ) ) . "\" />"
+ . "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
+
+ // Ensure unique id's for search boxes made after the first
+ $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
return $s;
}