By flipping '"Courier New", monospace' to 'monospace, "Courier New"', we can get...
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * Cologne Blue: A nicer-looking alternative to Standard.
4 *
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) ) {
11 die( -1 );
12 }
13
14 /**
15 * @todo document
16 * @ingroup Skins
17 */
18 class SkinCologneBlue extends Skin {
19
20 function getStylesheet() {
21 return 'common/cologneblue.css';
22 }
23
24 function getSkinName() {
25 return 'cologneblue';
26 }
27
28 function doBeforeContent() {
29 $mainPageObj = Title::newMainPage();
30
31 $s = "\n<div id='content'>\n<div id='topbar'>" .
32 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
33
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>';
37
38 $s .= '</td><td class="top" align="right" valign="bottom" width="100%">';
39 $s .= $this->sysLinks();
40 $s .= '</td></tr><tr><td valign="top">';
41
42 $s .= '<font size="-1"><span id="sitesub">';
43 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
44 $s .= '</td><td align="right">';
45
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";
51 }
52 $s .= '<br />' . $this->pageTitleLinks();
53 $s .= '</span></font>';
54
55 $s .= "</td></tr></table>\n";
56
57 $s .= "\n</div>\n<div id='article'>";
58
59 $notice = wfGetSiteNotice();
60 if( $notice ) {
61 $s .= "\n<div id='siteNotice'>$notice</div>\n";
62 }
63 $s .= $this->pageTitle();
64 $s .= $this->pageSubtitle() . "\n";
65 return $s;
66 }
67
68 function doAfterContent(){
69 global $wgLang;
70
71 $s = "\n</div><br clear='all' />\n";
72
73 $s .= "\n<div id='footer'>";
74 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
75
76 $qb = $this->qbSetting();
77 if ( 1 == $qb || 3 == $qb ) { # Left
78 $s .= $this->getQuickbarCompensator();
79 }
80 $s .= '<td class="bottom" align="center" valign="top">';
81
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' )
90 ),
91 $this->aboutLink(),
92 $this->searchForm( wfMsg( 'qbfind' ) )
93 ) );
94
95 $s .= "\n<br />" . $this->pageStats();
96
97 $s .= '</td>';
98 if ( 2 == $qb ) { # Right
99 $s .= $this->getQuickbarCompensator();
100 }
101 $s .= "</tr></table>\n</div>\n</div>\n";
102
103 if ( 0 != $qb ) {
104 $s .= $this->quickBar();
105 }
106 return $s;
107 }
108
109 function reallyGenerateUserStylesheet() {
110 $s = parent::reallyGenerateUserStylesheet();
111 $qb = $this->qbSetting();
112
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
129 }
130 return $s;
131 }
132
133 function sysLinks() {
134 global $wgUser, $wgLang, $wgContLang;
135 $li = SpecialPage::getTitleFor( 'Userlogin' );
136 $lo = SpecialPage::getTitleFor( 'Userlogout' );
137
138 $rt = $this->mTitle->getPrefixedURL();
139 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
140 $q = array();
141 } else {
142 $q = array( 'returnto' => $rt );
143 }
144
145 $s = array(
146 $this->mainPageLink(),
147 $this->linkKnown(
148 Title::newFromText( wfMsgForContent( 'aboutpage' ) ),
149 wfMsg( 'about' )
150 ),
151 $this->linkKnown(
152 Title::newFromText( wfMsgForContent( 'helppage' ) ),
153 wfMsg( 'help' )
154 ),
155 $this->linkKnown(
156 Title::newFromText( wfMsgForContent( 'faqpage' ) ),
157 wfMsg( 'faq' )
158 ),
159 $this->specialLink( 'specialpages' )
160 );
161
162 /* show links to different language variants */
163 if( $this->variantLinks() ) {
164 $s[] = $this->variantLinks();
165 }
166 if( $this->extensionTabLinks() ) {
167 $s[] = $this->extensionTabLinks();
168 }
169 if ( $wgUser->isLoggedIn() ) {
170 $s[] = $this->linkKnown(
171 $lo,
172 wfMsg( 'logout' ),
173 array(),
174 $q
175 );
176 } else {
177 $s[] = $this->linkKnown(
178 $li,
179 wfMsg( 'login' ),
180 array(),
181 $q
182 );
183 }
184
185 return $wgLang->pipeList( $s );
186 }
187
188 /**
189 * Compute the sidebar
190 * @access private
191 */
192 function quickBar(){
193 global $wgOut, $wgUser, $wgEnableUploads;
194
195 $tns = $this->mTitle->getNamespace();
196
197 $s = "\n<div id='quickbar'>";
198
199 $sep = '<br />';
200 $s .= $this->menuHead( 'qbfind' );
201 $s .= $this->searchForm();
202
203 $s .= $this->menuHead( 'qbbrowse' );
204
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 );
211
212 foreach ( $browseLinks as $link ) {
213 if ( $link['text'] != '-' ) {
214 $s .= "<a href=\"{$link['href']}\">" .
215 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
216 }
217 }
218
219 if ( $wgOut->isArticle() ) {
220 $s .= $this->menuHead( 'qbedit' );
221 $s .= '<strong>' . $this->editThisPage() . '</strong>';
222
223 $s .= $sep . $this->linkKnown(
224 Title::newFromText( wfMsgForContent( 'edithelppage' ) ),
225 wfMsg( 'edithelp' )
226 );
227
228 if( $wgUser->isLoggedIn() ) {
229 $s .= $sep . $this->moveThisPage();
230 }
231 if ( $wgUser->isAllowed( 'delete' ) ) {
232 $dtp = $this->deleteThisPage();
233 if ( $dtp != '' ) {
234 $s .= $sep . $dtp;
235 }
236 }
237 if ( $wgUser->isAllowed( 'protect' ) ) {
238 $ptp = $this->protectThisPage();
239 if ( $ptp != '' ) {
240 $s .= $sep . $ptp;
241 }
242 }
243 $s .= $sep;
244
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();
251 }
252
253 $s .= $sep;
254
255 $s .= $this->menuHead( 'qbpageinfo' )
256 . $this->historyLink()
257 . $sep . $this->whatLinksHere()
258 . $sep . $this->watchPageLinksLink();
259
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();
266 }
267 }
268 }
269 $s .= $sep;
270 }
271
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' )
281 );
282 if ( $wgUser->getNewtalk() ) {
283 $tl .= ' *';
284 }
285
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' );
304 }
305
306 $s .= $this->menuHead( 'qbspecialpages' )
307 . $this->specialLink( 'newpages' )
308 . $sep . $this->specialLink( 'listfiles' )
309 . $sep . $this->specialLink( 'statistics' );
310 if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
311 $s .= $sep . $this->getUploadLink();
312 }
313
314 global $wgSiteSupportPage;
315
316 if( $wgSiteSupportPage ) {
317 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
318 . wfMsg( 'sitesupport' ) . '</a>';
319 }
320
321 $s .= $sep . $this->link(
322 SpecialPage::getTitleFor( 'Specialpages' ),
323 wfMsg( 'moredotdotdot' ),
324 array(),
325 array(),
326 array( 'known', 'noclasses' )
327 );
328
329 $s .= $sep . "\n</div>\n";
330 return $s;
331 }
332
333 function menuHead( $key ) {
334 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
335 return $s;
336 }
337
338 function searchForm( $label = '' ) {
339 global $wgRequest, $wgUseTwoButtonsSearchForm;
340
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}: ";
346 }
347
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' ) ) . "\" />";
351
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";
356 }
357
358 $s .= '</form>';
359
360 // Ensure unique id's for search boxes made after the first
361 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
362
363 return $s;
364 }
365 }