Display something nicer looking when the wiki hasn't been configured.
[mediawiki.git] / skins / CologneBlue.php
blob8571b4beedcacf19ebf86d2192464773e6d9ff47
1 <?php
2 /**
3 * See skin.doc
5 * @todo document
6 * @package MediaWiki
7 * @subpackage Skins
8 */
10 if( !defined( 'MEDIAWIKI' ) )
11 die();
13 /**
14 * @todo document
15 * @package MediaWiki
16 * @subpackage Skins
18 class SkinCologneBlue extends Skin {
20 function getStylesheet() {
21 return "common/cologneblue.css";
23 function getSkinName() {
24 return "cologneblue";
27 function doBeforeContent() {
28 global $wgOut, $wgTitle;
30 $s = "";
31 $qb = $this->qbSetting();
32 $mainPageObj = Title::newMainPage();
34 $s .= "\n<div id='content'>\n<div id='topbar'>" .
35 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
37 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
38 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
39 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
41 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
42 $s .= $this->sysLinks();
43 $s .= "</td></tr><tr><td valign='top'>";
45 $s .= "<font size='-1'><span id='sitesub'>";
46 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
47 $s .= "</td><td align='right'>" ;
49 $s .= "<font size='-1'><span id='langlinks'>" ;
50 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
51 $cat = $this->getCategoryLinks();
52 if( $cat ) $s .= "<br />$cat\n";
53 $s .= "<br />" . $this->pageTitleLinks();
54 $s .= "</span></font>";
56 $s .= "</td></tr></table>\n";
58 $s .= "\n</div>\n<div id='article'>";
60 $notice = wfGetSiteNotice();
61 if( $notice ) {
62 $s .= "\n<div id='siteNotice'>$notice</div>\n";
64 $s .= $this->pageTitle();
65 $s .= $this->pageSubtitle() . "\n";
66 return $s;
69 function doAfterContent()
71 global $wgOut;
73 $s = "\n</div><br clear='all' />\n";
75 $s .= "\n<div id='footer'>";
76 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
78 $qb = $this->qbSetting();
79 if ( 1 == $qb || 3 == $qb ) { # Left
80 $s .= $this->getQuickbarCompensator();
82 $s .= "<td class='bottom' align='center' valign='top'>";
84 $s .= $this->bottomLinks();
85 $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
86 . $this->aboutLink() . " | "
87 . $this->searchForm( wfMsg( "qbfind" ) );
89 $s .= "\n<br />" . $this->pageStats();
91 $s .= "</td>";
92 if ( 2 == $qb ) { # Right
93 $s .= $this->getQuickbarCompensator();
95 $s .= "</tr></table>\n</div>\n</div>\n";
97 if ( 0 != $qb ) { $s .= $this->quickBar(); }
98 return $s;
101 function doGetUserStyles() {
102 global $wgOut, $wgStyleSheetPath;
103 $s = parent::doGetUserStyles();
104 $qb = $this->qbSetting();
106 if ( 2 == $qb ) { # Right
107 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
108 "#article { margin-left: 4px; margin-right: 148px; }\n";
109 } else if ( 1 == $qb ) {
110 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
111 "#article { margin-left: 148px; margin-right: 4px; }\n";
112 } else if ( 3 == $qb ) { # Floating
113 $s .= "#quickbar { position:absolute; left:4px } \n" .
114 "#topbar { margin-left: 148px }\n" .
115 "#article { margin-left:148px; margin-right: 4px; } \n" .
116 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
118 return $s;
121 function sysLinks() {
122 global $wgUser, $wgContLang, $wgTitle;
123 $li = $wgContLang->specialPage("Userlogin");
124 $lo = $wgContLang->specialPage("Userlogout");
126 $rt = $wgTitle->getPrefixedURL();
127 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
128 $q = "";
129 } else {
130 $q = "returnto={$rt}";
133 $s = "" .
134 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
135 . " | " .
136 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
137 . " | " .
138 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
139 . " | " .
140 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
141 . " | " .
142 $this->specialLink( "specialpages" ) . " | ";
144 if ( $wgUser->isLoggedIn() ) {
145 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
146 } else {
147 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
150 /* show links to different language variants */
151 global $wgDisableLangConversion;
152 $variants = $wgContLang->getVariants();
153 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
154 $actstr = '';
155 foreach( $variants as $code ) {
156 $varname = $wgContLang->getVariantname( $code );
157 if( $varname == 'disable' )
158 continue;
159 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
165 return $s;
169 * Compute the sidebar
170 * @private
172 function quickBar()
174 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks;
176 $tns=$wgTitle->getNamespace();
178 $s = "\n<div id='quickbar'>";
180 $sep = "<br />";
181 $s .= $this->menuHead( "qbfind" );
182 $s .= $this->searchForm();
184 $s .= $this->menuHead( "qbbrowse" );
186 foreach ( $wgNavigationLinks as $link ) {
187 $msg = wfMsgForContent( $link['href'] );
188 $text = wfMsg( $link['text'] );
189 if ( $msg != '-' && $text != '-' ) {
190 $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
191 htmlspecialchars( $text ) . '</a>' . $sep;
195 if ( $wgOut->isArticle() ) {
196 $s .= $this->menuHead( "qbedit" );
197 $s .= "<strong>" . $this->editThisPage() . "</strong>";
199 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
201 if( $wgUser->isLoggedIn() ) {
202 $s .= $sep . $this->moveThisPage();
204 if ( $wgUser->isAllowed('delete') ) {
205 $dtp = $this->deleteThisPage();
206 if ( "" != $dtp ) {
207 $s .= $sep . $dtp;
210 if ( $wgUser->isAllowed('protect') ) {
211 $ptp = $this->protectThisPage();
212 if ( "" != $ptp ) {
213 $s .= $sep . $ptp;
216 $s .= $sep;
218 $s .= $this->menuHead( "qbpageoptions" );
219 $s .= $this->talkLink()
220 . $sep . $this->commentLink()
221 . $sep . $this->printableLink();
222 if ( $wgUser->isLoggedIn() ) {
223 $s .= $sep . $this->watchThisPage();
226 $s .= $sep;
228 $s .= $this->menuHead("qbpageinfo")
229 . $this->historyLink()
230 . $sep . $this->whatLinksHere()
231 . $sep . $this->watchPageLinksLink();
233 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
234 $id=User::idFromName($wgTitle->getText());
235 if ($id != 0) {
236 $s .= $sep . $this->userContribsLink();
237 if( $this->showEmailUser( $id ) ) {
238 $s .= $sep . $this->emailUserLink();
242 $s .= $sep;
245 $s .= $this->menuHead( "qbmyoptions" );
246 if ( $wgUser->isLoggedIn() ) {
247 $name = $wgUser->getName();
248 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
249 wfMsg( 'mytalk' ) );
250 if ( $wgUser->getNewtalk() ) {
251 $tl .= " *";
254 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
255 wfMsg( "mypage" ) )
256 . $sep . $tl
257 . $sep . $this->specialLink( "watchlist" )
258 . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
259 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
260 . $sep . $this->specialLink( "preferences" )
261 . $sep . $this->specialLink( "userlogout" );
262 } else {
263 $s .= $this->specialLink( "userlogin" );
266 $s .= $this->menuHead( "qbspecialpages" )
267 . $this->specialLink( "newpages" )
268 . $sep . $this->specialLink( "imagelist" )
269 . $sep . $this->specialLink( "statistics" )
270 . $sep . $this->bugReportsLink();
271 if ( $wgUser->isLoggedIn() && !$wgDisableUploads ) {
272 $s .= $sep . $this->specialLink( "upload" );
274 global $wgSiteSupportPage;
275 if( $wgSiteSupportPage) {
276 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
277 .wfMsg( "sitesupport" )."</a>";
280 $s .= $sep . $this->makeKnownLinkObj(
281 Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
282 wfMsg( 'moredotdotdot' ) );
284 $s .= $sep . "\n</div>\n";
285 return $s;
288 function menuHead( $key )
290 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
291 return $s;
294 function searchForm( $label = "" )
296 global $wgRequest;
298 $search = $wgRequest->getText( 'search' );
299 $action = $this->escapeSearchLink();
300 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
301 if ( "" != $label ) { $s .= "{$label}: "; }
303 $s .= "<input type='text' name=\"search\" size='14' value=\""
304 . htmlspecialchars(substr($search,0,256)) . "\" />"
305 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
307 return $s;