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';
23 * @param $out OutputPage
25 function setupSkinUserCss( OutputPage
$out ){
26 parent
::setupSkinUserCss( $out );
27 $out->addModuleStyles( 'skins.cologneblue' );
29 $qb = $this->qbSetting();
32 if ( 2 == $qb ) { # Right
33 $rules[] = "#quickbar { position: absolute; right: 4px; }";
34 $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
35 } elseif ( 1 == $qb ) {
36 $rules[] = "#quickbar { position: absolute; left: 4px; }";
37 $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
38 } elseif ( 3 == $qb ) { # Floating left
39 $rules[] = "#quickbar { position:absolute; left:4px }";
40 $rules[] = "#topbar { margin-left: 148px }";
41 $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
42 $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
43 } elseif ( 4 == $qb ) { # Floating right
44 $rules[] = "#quickbar { position: fixed; right: 4px; }";
45 $rules[] = "#topbar { margin-right: 148px }";
46 $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
47 $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
49 $style = implode( "\n", $rules );
50 $out->addInlineStyle( $style );
55 class CologneBlueTemplate
extends LegacyTemplate
{
60 function doBeforeContent() {
61 $mainPageObj = Title
::newMainPage();
63 $s = "\n<div id='content'>\n<div id='topbar'>" .
64 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
66 $s .= '<td class="top" nowrap="nowrap">';
67 $s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
68 $s .= '<span id="sitetitle">' . wfMsg( 'sitetitle' ) . '</span></a>';
70 $s .= '</td><td class="top" id="top-syslinks" width="100%">';
71 $s .= $this->sysLinks();
72 $s .= '</td></tr><tr><td class="top-linkcollection">';
74 $s .= '<font size="-1"><span id="sitesub">';
75 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
76 $s .= '</td><td class="top-linkcollection">';
78 $s .= '<font size="-1"><span id="langlinks">';
79 $s .= str_replace( '<br />', '', $this->otherLanguages() );
80 $cat = $this->getSkin()->getCategoryLinks();
84 $s .= '<br />' . $this->pageTitleLinks();
85 $s .= '</span></font>';
87 $s .= "</td></tr></table>\n";
89 $s .= "\n</div>\n<div id='article'>";
91 $notice = $this->getSkin()->getSiteNotice();
93 $s .= "\n<div id='siteNotice'>$notice</div>\n";
95 $s .= $this->pageTitle();
96 $s .= $this->pageSubtitle() . "\n";
103 function doAfterContent(){
106 $s = "\n</div><br clear='all' />\n";
108 $s .= "\n<div id='footer'>";
109 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
111 $qb = $this->getSkin()->qbSetting();
112 if ( 1 == $qb ||
3 == $qb ) { # Left
113 $s .= $this->getQuickbarCompensator();
115 $s .= '<td class="bottom">';
117 $s .= $this->bottomLinks();
118 $s .= $wgLang->pipeList( array(
119 "\n<br />" . Linker
::link(
120 Title
::newMainPage(),
124 array( 'known', 'noclasses' )
126 $this->getSkin()->aboutLink(),
127 $this->searchForm( wfMsg( 'qbfind' ) )
130 $s .= "\n<br />" . $this->pageStats();
133 if ( 2 == $qb ) { # Right
134 $s .= $this->getQuickbarCompensator();
136 $s .= "</tr></table>\n</div>\n</div>\n";
139 $s .= $this->quickBar();
147 function sysLinks() {
148 global $wgUser, $wgLang;
149 $li = SpecialPage
::getTitleFor( 'Userlogin' );
150 $lo = SpecialPage
::getTitleFor( 'Userlogout' );
152 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
153 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
156 $q = array( 'returnto' => $rt );
160 $this->getSkin()->mainPageLink(),
162 Title
::newFromText( wfMsgForContent( 'aboutpage' ) ),
166 Title
::newFromText( wfMsgForContent( 'helppage' ) ),
170 Title
::newFromText( wfMsgForContent( 'faqpage' ) ),
173 Linker
::specialLink( 'Specialpages' )
176 /* show links to different language variants */
177 if( $this->variantLinks() ) {
178 $s[] = $this->variantLinks();
180 if( $this->extensionTabLinks() ) {
181 $s[] = $this->extensionTabLinks();
183 if ( $wgUser->isLoggedIn() ) {
184 $s[] = Linker
::linkKnown(
191 $s[] = Linker
::linkKnown(
199 return $wgLang->pipeList( $s );
203 * Compute the sidebar
209 global $wgOut, $wgUser;
211 $tns = $this->getSkin()->getTitle()->getNamespace();
213 $s = "\n<div id='quickbar'>";
216 $s .= $this->menuHead( 'qbfind' );
217 $s .= $this->searchForm();
219 $s .= $this->menuHead( 'qbbrowse' );
221 # Use the first heading from the Monobook sidebar as the "browse" section
222 $bar = $this->getSkin()->buildSidebar();
223 unset( $bar['SEARCH'] );
224 unset( $bar['LANGUAGES'] );
225 unset( $bar['TOOLBOX'] );
228 foreach ( $bar as $heading => $browseLinks ) {
229 if ( $barnumber > 1 ) {
230 $headingMsg = wfMessage( $heading );
231 if ( $headingMsg->exists() ) {
232 $h = $headingMsg->text();
236 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
238 foreach ( $browseLinks as $link ) {
239 if ( $link['text'] != '-' ) {
240 $s .= "<a href=\"{$link['href']}\">" .
241 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
247 if ( $wgOut->isArticle() ) {
248 $s .= $this->menuHead( 'qbedit' );
249 $s .= '<strong>' . $this->editThisPage() . '</strong>';
251 $s .= $sep . Linker
::linkKnown(
252 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
256 if( $wgUser->isLoggedIn() ) {
257 $s .= $sep . $this->moveThisPage();
259 if ( $wgUser->isAllowed( 'delete' ) ) {
260 $dtp = $this->deleteThisPage();
265 if ( $wgUser->isAllowed( 'protect' ) ) {
266 $ptp = $this->protectThisPage();
273 $s .= $this->menuHead( 'qbpageoptions' );
274 $s .= $this->talkLink()
275 . $sep . $this->commentLink()
276 . $sep . $this->printableLink();
277 if ( $wgUser->isLoggedIn() ) {
278 $s .= $sep . $this->watchThisPage();
283 $s .= $this->menuHead( 'qbpageinfo' )
284 . $this->historyLink()
285 . $sep . $this->whatLinksHere()
286 . $sep . $this->watchPageLinksLink();
288 if( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
289 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
291 $s .= $sep . $this->userContribsLink();
292 if( $this->getSkin()->showEmailUser( $id ) ) {
293 $s .= $sep . $this->emailUserLink();
300 $s .= $this->menuHead( 'qbmyoptions' );
301 if ( $wgUser->isLoggedIn() ) {
303 $wgUser->getTalkPage(),
307 array( 'known', 'noclasses' )
309 if ( $wgUser->getNewtalk() ) {
314 $wgUser->getUserPage(),
318 array( 'known', 'noclasses' )
319 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
322 SpecialPage
::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
323 wfMsg( 'mycontris' ),
326 array( 'known', 'noclasses' )
327 ) . $sep . Linker
::specialLink( 'Preferences' )
328 . $sep . Linker
::specialLink( 'Userlogout' );
330 $s .= Linker
::specialLink( 'Userlogin' );
333 $s .= $this->menuHead( 'qbspecialpages' )
334 . Linker
::specialLink( 'Newpages' )
335 . $sep . Linker
::specialLink( 'Listfiles' )
336 . $sep . Linker
::specialLink( 'Statistics' );
337 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
338 $s .= $sep . $this->getUploadLink();
341 global $wgSiteSupportPage;
343 if( $wgSiteSupportPage ) {
344 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
345 . wfMsg( 'sitesupport' ) . '</a>';
348 $s .= $sep . Linker
::link(
349 SpecialPage
::getTitleFor( 'Specialpages' ),
350 wfMsg( 'moredotdotdot' ),
353 array( 'known', 'noclasses' )
356 $s .= $sep . "\n</div>\n";
364 function menuHead( $key ) {
365 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
370 * @param $label string
373 function searchForm( $label = '' ) {
374 global $wgRequest, $wgUseTwoButtonsSearchForm;
376 $search = $wgRequest->getText( 'search' );
377 $action = $this->data
['searchaction'];
378 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
383 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
384 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
385 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
387 if( $wgUseTwoButtonsSearchForm ) {
388 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
390 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
395 // Ensure unique id's for search boxes made after the first
396 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;