3 * Cologne Blue: A nicer-looking alternative to Standard.
10 if( !defined( 'MEDIAWIKI' ) ) {
18 class SkinCologneBlue
extends SkinLegacy
{
19 var $skinname = 'cologneblue', $stylename = 'cologneblue',
20 $template = 'CologneBlueTemplate';
22 function setupSkinUserCss( OutputPage
$out ){
23 parent
::setupSkinUserCss( $out );
24 $out->addModuleStyles( 'skins.cologneblue' );
26 $qb = $this->qbSetting();
29 if ( 2 == $qb ) { # Right
30 $rules[] = "#quickbar { position: absolute; right: 4px; }";
31 $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
32 } elseif ( 1 == $qb ) {
33 $rules[] = "#quickbar { position: absolute; left: 4px; }";
34 $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
35 } elseif ( 3 == $qb ) { # Floating left
36 $rules[] = "#quickbar { position:absolute; left:4px }";
37 $rules[] = "#topbar { margin-left: 148px }";
38 $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
39 $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
40 } elseif ( 4 == $qb ) { # Floating right
41 $rules[] = "#quickbar { position: fixed; right: 4px; }";
42 $rules[] = "#topbar { margin-right: 148px }";
43 $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
44 $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
46 $style = implode( "\n", $rules );
47 $out->addInlineStyle( $style );
52 class CologneBlueTemplate
extends LegacyTemplate
{
54 function doBeforeContent() {
55 $mainPageObj = Title
::newMainPage();
57 $s = "\n<div id='content'>\n<div id='topbar'>" .
58 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
60 $s .= '<td class="top" nowrap="nowrap">';
61 $s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
62 $s .= '<span id="sitetitle">' . wfMsg( 'sitetitle' ) . '</span></a>';
64 $s .= '</td><td class="top" id="top-syslinks" width="100%">';
65 $s .= $this->sysLinks();
66 $s .= '</td></tr><tr><td class="top-linkcollection">';
68 $s .= '<font size="-1"><span id="sitesub">';
69 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
70 $s .= '</td><td class="top-linkcollection">';
72 $s .= '<font size="-1"><span id="langlinks">';
73 $s .= str_replace( '<br />', '', $this->otherLanguages() );
74 $cat = '<div id="catlinks" class="catlinks">' . $this->getSkin()->getCategoryLinks() . '</div>';
78 $s .= '<br />' . $this->pageTitleLinks();
79 $s .= '</span></font>';
81 $s .= "</td></tr></table>\n";
83 $s .= "\n</div>\n<div id='article'>";
85 $notice = $this->getSkin()->getSiteNotice();
87 $s .= "\n<div id='siteNotice'>$notice</div>\n";
89 $s .= $this->pageTitle();
90 $s .= $this->pageSubtitle() . "\n";
94 function doAfterContent(){
97 $s = "\n</div><br clear='all' />\n";
99 $s .= "\n<div id='footer'>";
100 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
102 $qb = $this->getSkin()->qbSetting();
103 if ( 1 == $qb ||
3 == $qb ) { # Left
104 $s .= $this->getQuickbarCompensator();
106 $s .= '<td class="bottom">';
108 $s .= $this->bottomLinks();
109 $s .= $wgLang->pipeList( array(
110 "\n<br />" . Linker
::link(
111 Title
::newMainPage(),
115 array( 'known', 'noclasses' )
117 $this->getSkin()->aboutLink(),
118 $this->searchForm( wfMsg( 'qbfind' ) )
121 $s .= "\n<br />" . $this->pageStats();
124 if ( 2 == $qb ) { # Right
125 $s .= $this->getQuickbarCompensator();
127 $s .= "</tr></table>\n</div>\n</div>\n";
130 $s .= $this->quickBar();
135 function sysLinks() {
136 global $wgUser, $wgLang;
137 $li = SpecialPage
::getTitleFor( 'Userlogin' );
138 $lo = SpecialPage
::getTitleFor( 'Userlogout' );
140 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
141 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
144 $q = array( 'returnto' => $rt );
148 $this->getSkin()->mainPageLink(),
150 Title
::newFromText( wfMsgForContent( 'aboutpage' ) ),
154 Title
::newFromText( wfMsgForContent( 'helppage' ) ),
158 Title
::newFromText( wfMsgForContent( 'faqpage' ) ),
161 Linker
::specialLink( 'Specialpages' )
164 /* show links to different language variants */
165 if( $this->variantLinks() ) {
166 $s[] = $this->variantLinks();
168 if( $this->extensionTabLinks() ) {
169 $s[] = $this->extensionTabLinks();
171 if ( $wgUser->isLoggedIn() ) {
172 $s[] = Linker
::linkKnown(
179 $s[] = Linker
::linkKnown(
187 return $wgLang->pipeList( $s );
191 * Compute the sidebar
195 global $wgOut, $wgUser;
197 $tns = $this->getSkin()->getTitle()->getNamespace();
199 $s = "\n<div id='quickbar'>";
202 $s .= $this->menuHead( 'qbfind' );
203 $s .= $this->searchForm();
205 $s .= $this->menuHead( 'qbbrowse' );
207 # Use the first heading from the Monobook sidebar as the "browse" section
208 $bar = $this->getSkin()->buildSidebar();
209 unset( $bar['SEARCH'] );
210 unset( $bar['LANGUAGES'] );
211 unset( $bar['TOOLBOX'] );
214 foreach ( $bar as $heading => $browseLinks ) {
215 if ( $barnumber > 1 ) {
216 $headingMsg = wfMessage( $heading );
217 if ( $headingMsg->exists() ) {
218 $h = $headingMsg->text();
222 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
224 if( is_array( $browseLinks ) ) {
225 foreach ( $browseLinks as $link ) {
226 if ( $link['text'] != '-' ) {
227 $s .= "<a href=\"{$link['href']}\">" .
228 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
235 if ( $wgOut->isArticle() ) {
236 $s .= $this->menuHead( 'qbedit' );
237 $s .= '<strong>' . $this->editThisPage() . '</strong>';
239 $s .= $sep . Linker
::linkKnown(
240 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
244 if( $wgUser->isLoggedIn() ) {
245 $s .= $sep . $this->moveThisPage();
247 if ( $wgUser->isAllowed( 'delete' ) ) {
248 $dtp = $this->deleteThisPage();
253 if ( $wgUser->isAllowed( 'protect' ) ) {
254 $ptp = $this->protectThisPage();
261 $s .= $this->menuHead( 'qbpageoptions' );
262 $s .= $this->talkLink()
263 . $sep . $this->commentLink()
264 . $sep . $this->printableLink();
265 if ( $wgUser->isLoggedIn() ) {
266 $s .= $sep . $this->watchThisPage();
271 $s .= $this->menuHead( 'qbpageinfo' )
272 . $this->historyLink()
273 . $sep . $this->whatLinksHere()
274 . $sep . $this->watchPageLinksLink();
276 if( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
277 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
279 $s .= $sep . $this->userContribsLink();
280 if( $this->getSkin()->showEmailUser( $id ) ) {
281 $s .= $sep . $this->emailUserLink();
288 $s .= $this->menuHead( 'qbmyoptions' );
289 if ( $wgUser->isLoggedIn() ) {
291 $wgUser->getTalkPage(),
295 array( 'known', 'noclasses' )
297 if ( $wgUser->getNewtalk() ) {
302 $wgUser->getUserPage(),
306 array( 'known', 'noclasses' )
307 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
310 SpecialPage
::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
311 wfMsg( 'mycontris' ),
314 array( 'known', 'noclasses' )
315 ) . $sep . Linker
::specialLink( 'Preferences' )
316 . $sep . Linker
::specialLink( 'Userlogout' );
318 $s .= Linker
::specialLink( 'Userlogin' );
321 $s .= $this->menuHead( 'qbspecialpages' )
322 . Linker
::specialLink( 'Newpages' )
323 . $sep . Linker
::specialLink( 'Listfiles' )
324 . $sep . Linker
::specialLink( 'Statistics' );
325 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
326 $s .= $sep . $this->getUploadLink();
329 global $wgSiteSupportPage;
331 if( $wgSiteSupportPage ) {
332 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
333 . wfMsg( 'sitesupport' ) . '</a>';
336 $s .= $sep . Linker
::link(
337 SpecialPage
::getTitleFor( 'Specialpages' ),
338 wfMsg( 'moredotdotdot' ),
341 array( 'known', 'noclasses' )
344 $s .= $sep . "\n</div>\n";
348 function menuHead( $key ) {
349 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
353 function searchForm( $label = '' ) {
354 global $wgRequest, $wgUseTwoButtonsSearchForm;
356 $search = $wgRequest->getText( 'search' );
357 $action = $this->data
['searchaction'];
358 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
363 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
364 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
365 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
367 if( $wgUseTwoButtonsSearchForm ) {
368 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
370 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
375 // Ensure unique id's for search boxes made after the first
376 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;