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' );
30 $qb = $this->qbSetting();
33 if ( 2 == $qb ) { # Right
34 $rules[] = "#quickbar { position: absolute; right: 4px; }";
35 $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
36 } elseif ( 1 == $qb ) {
37 $rules[] = "#quickbar { position: absolute; left: 4px; }";
38 $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
39 } elseif ( 3 == $qb ) { # Floating left
40 $rules[] = "#quickbar { position:absolute; left:4px }";
41 $rules[] = "#topbar { margin-left: 148px }";
42 $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
43 $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
44 } elseif ( 4 == $qb ) { # Floating right
45 $rules[] = "#quickbar { position: fixed; right: 4px; }";
46 $rules[] = "#topbar { margin-right: 148px }";
47 $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
48 $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
50 $style = implode( "\n", $rules );
51 if ( $wgContLang->getDir() === 'rtl' ) {
52 $style = CSSJanus
::transform( $style, true, false );
54 $out->addInlineStyle( $style );
59 class CologneBlueTemplate
extends LegacyTemplate
{
64 function doBeforeContent() {
65 $mainPageObj = Title
::newMainPage();
67 $s = "\n<div id='content'>\n<div id='topbar'>" .
68 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
70 $s .= '<td class="top" nowrap="nowrap">';
71 $s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
72 $s .= '<span id="sitetitle">' . wfMsg( 'sitetitle' ) . '</span></a>';
74 $s .= '</td><td class="top" id="top-syslinks" width="100%">';
75 $s .= $this->sysLinks();
76 $s .= '</td></tr><tr><td class="top-linkcollection">';
78 $s .= '<font size="-1"><span id="sitesub">';
79 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
80 $s .= '</td><td class="top-linkcollection">';
82 $s .= '<font size="-1"><span id="langlinks">';
83 $s .= str_replace( '<br />', '', $this->otherLanguages() );
84 $cat = $this->getSkin()->getCategoryLinks();
88 $s .= '<br />' . $this->pageTitleLinks();
89 $s .= '</span></font>';
91 $s .= "</td></tr></table>\n";
93 $s .= "\n</div>\n<div id='article'>";
95 $notice = $this->getSkin()->getSiteNotice();
97 $s .= "\n<div id='siteNotice'>$notice</div>\n";
99 $s .= $this->pageTitle();
100 $s .= $this->pageSubtitle() . "\n";
107 function doAfterContent(){
110 $s = "\n</div><br clear='all' />\n";
112 $s .= "\n<div id='footer'>";
113 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
115 $qb = $this->getSkin()->qbSetting();
116 if ( 1 == $qb ||
3 == $qb ) { # Left
117 $s .= $this->getQuickbarCompensator();
119 $s .= '<td class="bottom">';
121 $s .= $this->bottomLinks();
122 $s .= $wgLang->pipeList( array(
123 "\n<br />" . Linker
::link(
124 Title
::newMainPage(),
128 array( 'known', 'noclasses' )
130 $this->getSkin()->aboutLink(),
131 $this->searchForm( wfMsg( 'qbfind' ) )
134 $s .= "\n<br />" . $this->pageStats();
137 if ( 2 == $qb ) { # Right
138 $s .= $this->getQuickbarCompensator();
140 $s .= "</tr></table>\n</div>\n</div>\n";
143 $s .= $this->quickBar();
151 function sysLinks() {
152 global $wgUser, $wgLang;
153 $li = SpecialPage
::getTitleFor( 'Userlogin' );
154 $lo = SpecialPage
::getTitleFor( 'Userlogout' );
156 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
157 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
160 $q = array( 'returnto' => $rt );
164 $this->getSkin()->mainPageLink(),
166 Title
::newFromText( wfMsgForContent( 'aboutpage' ) ),
170 Title
::newFromText( wfMsgForContent( 'helppage' ) ),
174 Title
::newFromText( wfMsgForContent( 'faqpage' ) ),
177 Linker
::specialLink( 'Specialpages' )
180 /* show links to different language variants */
181 if( $this->variantLinks() ) {
182 $s[] = $this->variantLinks();
184 if( $this->extensionTabLinks() ) {
185 $s[] = $this->extensionTabLinks();
187 if ( $wgUser->isLoggedIn() ) {
188 $s[] = Linker
::linkKnown(
195 $s[] = Linker
::linkKnown(
203 return $wgLang->pipeList( $s );
207 * Compute the sidebar
213 global $wgOut, $wgUser;
215 $tns = $this->getSkin()->getTitle()->getNamespace();
217 $s = "\n<div id='quickbar'>";
220 $s .= $this->menuHead( 'qbfind' );
221 $s .= $this->searchForm();
223 $s .= $this->menuHead( 'qbbrowse' );
225 # Use the first heading from the Monobook sidebar as the "browse" section
226 $bar = $this->getSkin()->buildSidebar();
227 unset( $bar['SEARCH'] );
228 unset( $bar['LANGUAGES'] );
229 unset( $bar['TOOLBOX'] );
232 foreach ( $bar as $heading => $browseLinks ) {
233 if ( $barnumber > 1 ) {
234 $headingMsg = wfMessage( $heading );
235 if ( $headingMsg->exists() ) {
236 $h = $headingMsg->text();
240 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
242 foreach ( $browseLinks as $link ) {
243 if ( $link['text'] != '-' ) {
244 $s .= "<a href=\"{$link['href']}\">" .
245 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
251 if ( $wgOut->isArticle() ) {
252 $s .= $this->menuHead( 'qbedit' );
253 $s .= '<strong>' . $this->editThisPage() . '</strong>';
255 $s .= $sep . Linker
::linkKnown(
256 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
260 if( $wgUser->isLoggedIn() ) {
261 $s .= $sep . $this->moveThisPage();
263 if ( $wgUser->isAllowed( 'delete' ) ) {
264 $dtp = $this->deleteThisPage();
269 if ( $wgUser->isAllowed( 'protect' ) ) {
270 $ptp = $this->protectThisPage();
277 $s .= $this->menuHead( 'qbpageoptions' );
278 $s .= $this->talkLink()
279 . $sep . $this->commentLink()
280 . $sep . $this->printableLink();
281 if ( $wgUser->isLoggedIn() ) {
282 $s .= $sep . $this->watchThisPage();
287 $s .= $this->menuHead( 'qbpageinfo' )
288 . $this->historyLink()
289 . $sep . $this->whatLinksHere()
290 . $sep . $this->watchPageLinksLink();
292 if( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
293 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
295 $s .= $sep . $this->userContribsLink();
296 if( $this->getSkin()->showEmailUser( $id ) ) {
297 $s .= $sep . $this->emailUserLink();
304 $s .= $this->menuHead( 'qbmyoptions' );
305 if ( $wgUser->isLoggedIn() ) {
307 $wgUser->getTalkPage(),
311 array( 'known', 'noclasses' )
313 if ( $wgUser->getNewtalk() ) {
318 $wgUser->getUserPage(),
322 array( 'known', 'noclasses' )
323 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
326 SpecialPage
::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
327 wfMsg( 'mycontris' ),
330 array( 'known', 'noclasses' )
331 ) . $sep . Linker
::specialLink( 'Preferences' )
332 . $sep . Linker
::specialLink( 'Userlogout' );
334 $s .= Linker
::specialLink( 'Userlogin' );
337 $s .= $this->menuHead( 'qbspecialpages' )
338 . Linker
::specialLink( 'Newpages' )
339 . $sep . Linker
::specialLink( 'Listfiles' )
340 . $sep . Linker
::specialLink( 'Statistics' );
341 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
342 $s .= $sep . $this->getUploadLink();
345 global $wgSiteSupportPage;
347 if( $wgSiteSupportPage ) {
348 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
349 . wfMsg( 'sitesupport' ) . '</a>';
352 $s .= $sep . Linker
::link(
353 SpecialPage
::getTitleFor( 'Specialpages' ),
354 wfMsg( 'moredotdotdot' ),
357 array( 'known', 'noclasses' )
360 $s .= $sep . "\n</div>\n";
368 function menuHead( $key ) {
369 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
374 * @param $label string
377 function searchForm( $label = '' ) {
378 global $wgRequest, $wgUseTwoButtonsSearchForm;
380 $search = $wgRequest->getText( 'search' );
381 $action = $this->data
['searchaction'];
382 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
387 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
388 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
389 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
391 if( $wgUseTwoButtonsSearchForm ) {
392 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
394 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
399 // Ensure unique id's for search boxes made after the first
400 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;