Installer is no longer hardcoded to xhtml doctype
[mediawiki.git] / skins / CologneBlue.php
blobd12333a766079aa6c12959247fab24bfef10b585
1 <?php
2 /**
3 * Cologne Blue: A nicer-looking alternative to Standard.
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
10 if( !defined( 'MEDIAWIKI' ) ) {
11 die( -1 );
14 /**
15 * @todo document
16 * @ingroup Skins
18 class SkinCologneBlue extends Skin {
20 function getStylesheet() {
21 return 'common/cologneblue.css';
24 function getSkinName() {
25 return 'cologneblue';
28 function doBeforeContent() {
29 $mainPageObj = Title::newMainPage();
31 $s = "\n<div id='content'>\n<div id='topbar'>" .
32 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
34 $s .= '<td class="top" align="left" valign="middle" nowrap="nowrap">';
35 $s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
36 $s .= '<span id="sitetitle">' . wfMsg( 'sitetitle' ) . '</span></a>';
38 $s .= '</td><td class="top" align="right" valign="bottom" width="100%">';
39 $s .= $this->sysLinks();
40 $s .= '</td></tr><tr><td valign="top">';
42 $s .= '<font size="-1"><span id="sitesub">';
43 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
44 $s .= '</td><td align="right">';
46 $s .= '<font size="-1"><span id="langlinks">';
47 $s .= str_replace( '<br />', '', $this->otherLanguages() );
48 $cat = $this->getCategoryLinks();
49 if( $cat ) {
50 $s .= "<br />$cat\n";
52 $s .= '<br />' . $this->pageTitleLinks();
53 $s .= '</span></font>';
55 $s .= "</td></tr></table>\n";
57 $s .= "\n</div>\n<div id='article'>";
59 $notice = wfGetSiteNotice();
60 if( $notice ) {
61 $s .= "\n<div id='siteNotice'>$notice</div>\n";
63 $s .= $this->pageTitle();
64 $s .= $this->pageSubtitle() . "\n";
65 return $s;
68 function doAfterContent(){
69 global $wgLang;
71 $s = "\n</div><br clear='all' />\n";
73 $s .= "\n<div id='footer'>";
74 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
76 $qb = $this->qbSetting();
77 if ( 1 == $qb || 3 == $qb ) { # Left
78 $s .= $this->getQuickbarCompensator();
80 $s .= '<td class="bottom" align="center" valign="top">';
82 $s .= $this->bottomLinks();
83 $s .= $wgLang->pipeList( array(
84 "\n<br />" . $this->link(
85 Title::newMainPage(),
86 null,
87 array(),
88 array(),
89 array( 'known', 'noclasses' )
91 $this->aboutLink(),
92 $this->searchForm( wfMsg( 'qbfind' ) )
93 ) );
95 $s .= "\n<br />" . $this->pageStats();
97 $s .= '</td>';
98 if ( 2 == $qb ) { # Right
99 $s .= $this->getQuickbarCompensator();
101 $s .= "</tr></table>\n</div>\n</div>\n";
103 if ( 0 != $qb ) {
104 $s .= $this->quickBar();
106 return $s;
109 function reallyGenerateUserStylesheet() {
110 $s = parent::reallyGenerateUserStylesheet();
111 $qb = $this->qbSetting();
113 if ( 2 == $qb ) { # Right
114 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
115 "#article { margin-left: 4px; margin-right: 148px; }\n";
116 } elseif ( 1 == $qb ) {
117 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
118 "#article { margin-left: 148px; margin-right: 4px; }\n";
119 } elseif ( 3 == $qb ) { # Floating left
120 $s .= "#quickbar { position:absolute; left:4px } \n" .
121 "#topbar { margin-left: 148px }\n" .
122 "#article { margin-left:148px; margin-right: 4px; } \n" .
123 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
124 } elseif ( 4 == $qb ) { # Floating right
125 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
126 "#topbar { margin-right: 148px }\n" .
127 "#article { margin-right: 148px; margin-left: 4px; } \n" .
128 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
130 return $s;
133 function sysLinks() {
134 global $wgUser, $wgLang, $wgContLang;
135 $li = SpecialPage::getTitleFor( 'Userlogin' );
136 $lo = SpecialPage::getTitleFor( 'Userlogout' );
138 $rt = $this->mTitle->getPrefixedURL();
139 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
140 $q = array();
141 } else {
142 $q = array( 'returnto' => $rt );
145 $s = array(
146 $this->mainPageLink(),
147 $this->linkKnown(
148 Title::newFromText( wfMsgForContent( 'aboutpage' ) ),
149 wfMsg( 'about' )
151 $this->linkKnown(
152 Title::newFromText( wfMsgForContent( 'helppage' ) ),
153 wfMsg( 'help' )
155 $this->linkKnown(
156 Title::newFromText( wfMsgForContent( 'faqpage' ) ),
157 wfMsg( 'faq' )
159 $this->specialLink( 'specialpages' )
162 /* show links to different language variants */
163 if( $this->variantLinks() ) {
164 $s[] = $this->variantLinks();
166 if( $this->extensionTabLinks() ) {
167 $s[] = $this->extensionTabLinks();
169 if ( $wgUser->isLoggedIn() ) {
170 $s[] = $this->linkKnown(
171 $lo,
172 wfMsg( 'logout' ),
173 array(),
176 } else {
177 $s[] = $this->linkKnown(
178 $li,
179 wfMsg( 'login' ),
180 array(),
185 return $wgLang->pipeList( $s );
189 * Compute the sidebar
190 * @access private
192 function quickBar(){
193 global $wgOut, $wgUser, $wgEnableUploads;
195 $tns = $this->mTitle->getNamespace();
197 $s = "\n<div id='quickbar'>";
199 $sep = '<br />';
200 $s .= $this->menuHead( 'qbfind' );
201 $s .= $this->searchForm();
203 $s .= $this->menuHead( 'qbbrowse' );
205 # Use the first heading from the Monobook sidebar as the "browse" section
206 $bar = $this->buildSidebar();
207 unset( $bar['SEARCH'] );
208 unset( $bar['LANGUAGES'] );
209 unset( $bar['TOOLBOX'] );
210 $browseLinks = reset( $bar );
212 foreach ( $browseLinks as $link ) {
213 if ( $link['text'] != '-' ) {
214 $s .= "<a href=\"{$link['href']}\">" .
215 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
219 if ( $wgOut->isArticle() ) {
220 $s .= $this->menuHead( 'qbedit' );
221 $s .= '<strong>' . $this->editThisPage() . '</strong>';
223 $s .= $sep . $this->linkKnown(
224 Title::newFromText( wfMsgForContent( 'edithelppage' ) ),
225 wfMsg( 'edithelp' )
228 if( $wgUser->isLoggedIn() ) {
229 $s .= $sep . $this->moveThisPage();
231 if ( $wgUser->isAllowed( 'delete' ) ) {
232 $dtp = $this->deleteThisPage();
233 if ( $dtp != '' ) {
234 $s .= $sep . $dtp;
237 if ( $wgUser->isAllowed( 'protect' ) ) {
238 $ptp = $this->protectThisPage();
239 if ( $ptp != '' ) {
240 $s .= $sep . $ptp;
243 $s .= $sep;
245 $s .= $this->menuHead( 'qbpageoptions' );
246 $s .= $this->talkLink()
247 . $sep . $this->commentLink()
248 . $sep . $this->printableLink();
249 if ( $wgUser->isLoggedIn() ) {
250 $s .= $sep . $this->watchThisPage();
253 $s .= $sep;
255 $s .= $this->menuHead( 'qbpageinfo' )
256 . $this->historyLink()
257 . $sep . $this->whatLinksHere()
258 . $sep . $this->watchPageLinksLink();
260 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
261 $id = User::idFromName( $this->mTitle->getText() );
262 if( $id != 0 ) {
263 $s .= $sep . $this->userContribsLink();
264 if( $this->showEmailUser( $id ) ) {
265 $s .= $sep . $this->emailUserLink();
269 $s .= $sep;
272 $s .= $this->menuHead( 'qbmyoptions' );
273 if ( $wgUser->isLoggedIn() ) {
274 $name = $wgUser->getName();
275 $tl = $this->link(
276 $wgUser->getTalkPage(),
277 wfMsg( 'mytalk' ),
278 array(),
279 array(),
280 array( 'known', 'noclasses' )
282 if ( $wgUser->getNewtalk() ) {
283 $tl .= ' *';
286 $s .= $this->link(
287 $wgUser->getUserPage(),
288 wfMsg( 'mypage' ),
289 array(),
290 array(),
291 array( 'known', 'noclasses' )
292 ) . $sep . $tl . $sep . $this->specialLink( 'watchlist' )
293 . $sep .
294 $this->link(
295 SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
296 wfMsg( 'mycontris' ),
297 array(),
298 array(),
299 array( 'known', 'noclasses' )
300 ) . $sep . $this->specialLink( 'preferences' )
301 . $sep . $this->specialLink( 'userlogout' );
302 } else {
303 $s .= $this->specialLink( 'userlogin' );
306 $s .= $this->menuHead( 'qbspecialpages' )
307 . $this->specialLink( 'newpages' )
308 . $sep . $this->specialLink( 'listfiles' )
309 . $sep . $this->specialLink( 'statistics' );
310 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
311 $s .= $sep . $this->specialLink( 'upload' );
314 global $wgSiteSupportPage;
316 if( $wgSiteSupportPage ) {
317 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
318 . wfMsg( 'sitesupport' ) . '</a>';
321 $s .= $sep . $this->link(
322 SpecialPage::getTitleFor( 'Specialpages' ),
323 wfMsg( 'moredotdotdot' ),
324 array(),
325 array(),
326 array( 'known', 'noclasses' )
329 $s .= $sep . "\n</div>\n";
330 return $s;
333 function menuHead( $key ) {
334 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
335 return $s;
338 function searchForm( $label = '' ) {
339 global $wgRequest, $wgUseTwoButtonsSearchForm;
341 $search = $wgRequest->getText( 'search' );
342 $action = $this->escapeSearchLink();
343 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
344 if( $label != '' ) {
345 $s .= "{$label}: ";
348 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
349 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
350 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
352 if( $wgUseTwoButtonsSearchForm ) {
353 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
354 } else {
355 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
358 $s .= '</form>';
360 // Ensure unique id's for search boxes made after the first
361 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
363 return $s;