typos
[mediawiki.git] / skins / CologneBlue.php
blobbc4a4c535fb2c57e662153bf35c5c858997130c4
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 );
13 /**
14 * @todo document
15 * @ingroup Skins
17 class SkinCologneBlue extends Skin {
19 function getStylesheet() {
20 return 'common/cologneblue.css';
23 function getSkinName() {
24 return 'cologneblue';
27 function doBeforeContent() {
28 $qb = $this->qbSetting();
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 ) $s .= "<br />$cat\n";
50 $s .= '<br />' . $this->pageTitleLinks();
51 $s .= '</span></font>';
53 $s .= "</td></tr></table>\n";
55 $s .= "\n</div>\n<div id='article'>";
57 $notice = wfGetSiteNotice();
58 if( $notice ) {
59 $s .= "\n<div id='siteNotice'>$notice</div>\n";
61 $s .= $this->pageTitle();
62 $s .= $this->pageSubtitle() . "\n";
63 return $s;
66 function doAfterContent(){
67 global $wgLang;
69 $s = "\n</div><br clear='all' />\n";
71 $s .= "\n<div id='footer'>";
72 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
74 $qb = $this->qbSetting();
75 if ( 1 == $qb || 3 == $qb ) { # Left
76 $s .= $this->getQuickbarCompensator();
78 $s .= '<td class="bottom" align="center" valign="top">';
80 $s .= $this->bottomLinks();
81 $s .= $wgLang->pipeList( array(
82 "\n<br />" . $this->link(
83 Title::newMainPage(),
84 null,
85 array(),
86 array(),
87 array( 'known', 'noclasses' )
89 $this->aboutLink(),
90 $this->searchForm( wfMsg( 'qbfind' ) )
91 ) );
93 $s .= "\n<br />" . $this->pageStats();
95 $s .= '</td>';
96 if ( 2 == $qb ) { # Right
97 $s .= $this->getQuickbarCompensator();
99 $s .= "</tr></table>\n</div>\n</div>\n";
101 if ( 0 != $qb ) {
102 $s .= $this->quickBar();
104 return $s;
107 function reallyGenerateUserStylesheet() {
108 $s = parent::reallyGenerateUserStylesheet();
109 $qb = $this->qbSetting();
111 if ( 2 == $qb ) { # Right
112 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
113 "#article { margin-left: 4px; margin-right: 148px; }\n";
114 } else if ( 1 == $qb ) {
115 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
116 "#article { margin-left: 148px; margin-right: 4px; }\n";
117 } else if ( 3 == $qb ) { # Floating left
118 $s .= "#quickbar { position:absolute; left:4px } \n" .
119 "#topbar { margin-left: 148px }\n" .
120 "#article { margin-left:148px; margin-right: 4px; } \n" .
121 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
122 } else if ( 4 == $qb ) { # Floating right
123 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
124 "#topbar { margin-right: 148px }\n" .
125 "#article { margin-right: 148px; margin-left: 4px; } \n" .
126 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
128 return $s;
131 function sysLinks() {
132 global $wgUser, $wgLang, $wgContLang;
133 $li = $wgContLang->specialPage( 'Userlogin' );
134 $lo = $wgContLang->specialPage( 'Userlogout' );
136 $rt = $this->mTitle->getPrefixedURL();
137 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
138 $q = '';
139 } else {
140 $q = "returnto={$rt}";
143 $s = array(
144 $this->mainPageLink(),
145 $this->makeKnownLink( wfMsgForContent( 'aboutpage' ), wfMsg( 'about' ) ),
146 $this->makeKnownLink( wfMsgForContent( 'helppage' ), wfMsg( 'help' ) ),
147 $this->makeKnownLink( wfMsgForContent( 'faqpage' ), wfMsg( 'faq' ) ),
148 $this->specialLink( 'specialpages' )
151 /* show links to different language variants */
152 if( $this->variantLinks() ) {
153 $s[] = $this->variantLinks();
155 if( $this->extensionTabLinks() ) {
156 $s[] = $this->extensionTabLinks();
158 if ( $wgUser->isLoggedIn() ) {
159 $s[] = $this->makeKnownLink( $lo, wfMsg( 'logout' ), $q );
160 } else {
161 $s[] = $this->makeKnownLink( $li, wfMsg( 'login' ), $q );
164 return $wgLang->pipeList( $s );
168 * Compute the sidebar
169 * @access private
171 function quickBar(){
172 global $wgOut, $wgUser, $wgEnableUploads;
174 $tns = $this->mTitle->getNamespace();
176 $s = "\n<div id='quickbar'>";
178 $sep = '<br />';
179 $s .= $this->menuHead( 'qbfind' );
180 $s .= $this->searchForm();
182 $s .= $this->menuHead( 'qbbrowse' );
184 # Use the first heading from the Monobook sidebar as the "browse" section
185 $bar = $this->buildSidebar();
186 unset( $bar['SEARCH'] );
187 unset( $bar['LANGUAGES'] );
188 unset( $bar['TOOLBOX'] );
189 $browseLinks = reset( $bar );
191 foreach ( $browseLinks as $link ) {
192 if ( $link['text'] != '-' ) {
193 $s .= "<a href=\"{$link['href']}\">" .
194 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
198 if ( $wgOut->isArticle() ) {
199 $s .= $this->menuHead( 'qbedit' );
200 $s .= '<strong>' . $this->editThisPage() . '</strong>';
202 $s .= $sep . $this->makeKnownLink( wfMsgForContent( 'edithelppage' ), wfMsg( 'edithelp' ) );
204 if( $wgUser->isLoggedIn() ) {
205 $s .= $sep . $this->moveThisPage();
207 if ( $wgUser->isAllowed( 'delete' ) ) {
208 $dtp = $this->deleteThisPage();
209 if ( '' != $dtp ) {
210 $s .= $sep . $dtp;
213 if ( $wgUser->isAllowed( 'protect' ) ) {
214 $ptp = $this->protectThisPage();
215 if ( '' != $ptp ) {
216 $s .= $sep . $ptp;
219 $s .= $sep;
221 $s .= $this->menuHead( 'qbpageoptions' );
222 $s .= $this->talkLink()
223 . $sep . $this->commentLink()
224 . $sep . $this->printableLink();
225 if ( $wgUser->isLoggedIn() ) {
226 $s .= $sep . $this->watchThisPage();
229 $s .= $sep;
231 $s .= $this->menuHead( 'qbpageinfo' )
232 . $this->historyLink()
233 . $sep . $this->whatLinksHere()
234 . $sep . $this->watchPageLinksLink();
236 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
237 $id = User::idFromName( $this->mTitle->getText() );
238 if( $id != 0 ) {
239 $s .= $sep . $this->userContribsLink();
240 if( $this->showEmailUser( $id ) ) {
241 $s .= $sep . $this->emailUserLink();
245 $s .= $sep;
248 $s .= $this->menuHead( 'qbmyoptions' );
249 if ( $wgUser->isLoggedIn() ) {
250 $name = $wgUser->getName();
251 $tl = $this->link(
252 $wgUser->getTalkPage(),
253 wfMsg( 'mytalk' ),
254 array(),
255 array(),
256 array( 'known', 'noclasses' )
258 if ( $wgUser->getNewtalk() ) {
259 $tl .= " *";
262 $s .= $this->link(
263 $wgUser->getUserPage(),
264 wfMsg( 'mypage' ),
265 array(),
266 array(),
267 array( 'known', 'noclasses' )
269 . $sep . $tl
270 . $sep . $this->specialLink( 'watchlist' )
271 . $sep . $this->link(
272 SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
273 wfMsg( 'mycontris' ),
274 array(),
275 array(),
276 array( 'known', 'noclasses' )
278 . $sep . $this->specialLink( 'preferences' )
279 . $sep . $this->specialLink( 'userlogout' );
280 } else {
281 $s .= $this->specialLink( 'userlogin' );
284 $s .= $this->menuHead( 'qbspecialpages' )
285 . $this->specialLink( 'newpages' )
286 . $sep . $this->specialLink( 'listfiles' )
287 . $sep . $this->specialLink( 'statistics' );
288 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
289 $s .= $sep . $this->specialLink( 'upload' );
292 global $wgSiteSupportPage;
294 if( $wgSiteSupportPage ) {
295 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
296 . wfMsg( 'sitesupport' ) . '</a>';
299 $s .= $sep . $this->link(
300 SpecialPage::getTitleFor( 'Specialpages' ),
301 wfMsg( 'moredotdotdot' ),
302 array(),
303 array(),
304 array( 'known', 'noclasses' )
307 $s .= $sep . "\n</div>\n";
308 return $s;
311 function menuHead( $key ){
312 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
313 return $s;
316 function searchForm( $label = '' ){
317 global $wgRequest, $wgUseTwoButtonsSearchForm;
319 $search = $wgRequest->getText( 'search' );
320 $action = $this->escapeSearchLink();
321 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
322 if( '' != $label ) {
323 $s .= "{$label}: ";
326 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
327 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
328 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
330 if( $wgUseTwoButtonsSearchForm )
331 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
332 else
333 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
335 $s .= '</form>';
337 // Ensure unique id's for search boxes made after the first
338 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
340 return $s;