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' );
27 $qb = $this->qbSetting();
30 if ( 2 == $qb ) { # Right
31 $rules[] = "#quickbar { position: absolute; right: 4px; }";
32 $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
33 } elseif ( 1 == $qb ) {
34 $rules[] = "#quickbar { position: absolute; left: 4px; }";
35 $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
36 } elseif ( 3 == $qb ) { # Floating left
37 $rules[] = "#quickbar { position:absolute; left:4px }";
38 $rules[] = "#topbar { margin-left: 148px }";
39 $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
40 $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
41 } elseif ( 4 == $qb ) { # Floating right
42 $rules[] = "#quickbar { position: fixed; right: 4px; }";
43 $rules[] = "#topbar { margin-right: 148px }";
44 $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
45 $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
47 $style = implode( "\n", $rules );
48 if ( $wgContLang->getDir() === 'rtl' ) {
49 $style = CSSJanus
::transform( $style, true, false );
51 $out->addInlineStyle( $style );
56 class CologneBlueTemplate
extends LegacyTemplate
{
58 function doBeforeContent() {
59 $mainPageObj = Title
::newMainPage();
61 $s = "\n<div id='content'>\n<div id='topbar'>" .
62 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
64 $s .= '<td class="top" nowrap="nowrap">';
65 $s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
66 $s .= '<span id="sitetitle">' . wfMsg( 'sitetitle' ) . '</span></a>';
68 $s .= '</td><td class="top" id="top-syslinks" width="100%">';
69 $s .= $this->sysLinks();
70 $s .= '</td></tr><tr><td class="top-linkcollection">';
72 $s .= '<font size="-1"><span id="sitesub">';
73 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
74 $s .= '</td><td class="top-linkcollection">';
76 $s .= '<font size="-1"><span id="langlinks">';
77 $s .= str_replace( '<br />', '', $this->otherLanguages() );
78 $cat = $this->getSkin()->getCategoryLinks();
82 $s .= '<br />' . $this->pageTitleLinks();
83 $s .= '</span></font>';
85 $s .= "</td></tr></table>\n";
87 $s .= "\n</div>\n<div id='article'>";
89 $notice = $this->getSkin()->getSiteNotice();
91 $s .= "\n<div id='siteNotice'>$notice</div>\n";
93 $s .= $this->pageTitle();
94 $s .= $this->pageSubtitle() . "\n";
98 function doAfterContent(){
101 $s = "\n</div><br clear='all' />\n";
103 $s .= "\n<div id='footer'>";
104 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
106 $qb = $this->getSkin()->qbSetting();
107 if ( 1 == $qb ||
3 == $qb ) { # Left
108 $s .= $this->getQuickbarCompensator();
110 $s .= '<td class="bottom">';
112 $s .= $this->bottomLinks();
113 $s .= $wgLang->pipeList( array(
114 "\n<br />" . $this->getSkin()->link(
115 Title
::newMainPage(),
119 array( 'known', 'noclasses' )
121 $this->getSkin()->aboutLink(),
122 $this->searchForm( wfMsg( 'qbfind' ) )
125 $s .= "\n<br />" . $this->pageStats();
128 if ( 2 == $qb ) { # Right
129 $s .= $this->getQuickbarCompensator();
131 $s .= "</tr></table>\n</div>\n</div>\n";
134 $s .= $this->quickBar();
139 function sysLinks() {
140 global $wgUser, $wgLang;
141 $li = SpecialPage
::getTitleFor( 'Userlogin' );
142 $lo = SpecialPage
::getTitleFor( 'Userlogout' );
144 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
145 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
148 $q = array( 'returnto' => $rt );
152 $this->getSkin()->mainPageLink(),
153 $this->getSkin()->linkKnown(
154 Title
::newFromText( wfMsgForContent( 'aboutpage' ) ),
157 $this->getSkin()->linkKnown(
158 Title
::newFromText( wfMsgForContent( 'helppage' ) ),
161 $this->getSkin()->linkKnown(
162 Title
::newFromText( wfMsgForContent( 'faqpage' ) ),
165 $this->getSkin()->specialLink( 'Specialpages' )
168 /* show links to different language variants */
169 if( $this->variantLinks() ) {
170 $s[] = $this->variantLinks();
172 if( $this->extensionTabLinks() ) {
173 $s[] = $this->extensionTabLinks();
175 if ( $wgUser->isLoggedIn() ) {
176 $s[] = $this->getSkin()->linkKnown(
183 $s[] = $this->getSkin()->linkKnown(
191 return $wgLang->pipeList( $s );
195 * Compute the sidebar
199 global $wgOut, $wgUser;
201 $tns = $this->getSkin()->getTitle()->getNamespace();
203 $s = "\n<div id='quickbar'>";
206 $s .= $this->menuHead( 'qbfind' );
207 $s .= $this->searchForm();
209 $s .= $this->menuHead( 'qbbrowse' );
211 # Use the first heading from the Monobook sidebar as the "browse" section
212 $bar = $this->getSkin()->buildSidebar();
213 unset( $bar['SEARCH'] );
214 unset( $bar['LANGUAGES'] );
215 unset( $bar['TOOLBOX'] );
216 $browseLinks = reset( $bar );
218 foreach ( $browseLinks as $link ) {
219 if ( $link['text'] != '-' ) {
220 $s .= "<a href=\"{$link['href']}\">" .
221 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
225 if ( $wgOut->isArticle() ) {
226 $s .= $this->menuHead( 'qbedit' );
227 $s .= '<strong>' . $this->editThisPage() . '</strong>';
229 $s .= $sep . $this->getSkin()->linkKnown(
230 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
234 if( $wgUser->isLoggedIn() ) {
235 $s .= $sep . $this->moveThisPage();
237 if ( $wgUser->isAllowed( 'delete' ) ) {
238 $dtp = $this->deleteThisPage();
243 if ( $wgUser->isAllowed( 'protect' ) ) {
244 $ptp = $this->protectThisPage();
251 $s .= $this->menuHead( 'qbpageoptions' );
252 $s .= $this->talkLink()
253 . $sep . $this->commentLink()
254 . $sep . $this->printableLink();
255 if ( $wgUser->isLoggedIn() ) {
256 $s .= $sep . $this->watchThisPage();
261 $s .= $this->menuHead( 'qbpageinfo' )
262 . $this->historyLink()
263 . $sep . $this->whatLinksHere()
264 . $sep . $this->watchPageLinksLink();
266 if( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
267 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
269 $s .= $sep . $this->userContribsLink();
270 if( $this->getSkin()->showEmailUser( $id ) ) {
271 $s .= $sep . $this->emailUserLink();
278 $s .= $this->menuHead( 'qbmyoptions' );
279 if ( $wgUser->isLoggedIn() ) {
280 $tl = $this->getSkin()->link(
281 $wgUser->getTalkPage(),
285 array( 'known', 'noclasses' )
287 if ( $wgUser->getNewtalk() ) {
291 $s .= $this->getSkin()->link(
292 $wgUser->getUserPage(),
296 array( 'known', 'noclasses' )
297 ) . $sep . $tl . $sep . $this->getSkin()->specialLink( 'Watchlist' )
299 $this->getSkin()->link(
300 SpecialPage
::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
301 wfMsg( 'mycontris' ),
304 array( 'known', 'noclasses' )
305 ) . $sep . $this->getSkin()->specialLink( 'Preferences' )
306 . $sep . $this->getSkin()->specialLink( 'Userlogout' );
308 $s .= $this->getSkin()->specialLink( 'Userlogin' );
311 $s .= $this->menuHead( 'qbspecialpages' )
312 . $this->getSkin()->specialLink( 'Newpages' )
313 . $sep . $this->getSkin()->specialLink( 'Listfiles' )
314 . $sep . $this->getSkin()->specialLink( 'Statistics' );
315 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
316 $s .= $sep . $this->getUploadLink();
319 global $wgSiteSupportPage;
321 if( $wgSiteSupportPage ) {
322 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
323 . wfMsg( 'sitesupport' ) . '</a>';
326 $s .= $sep . $this->getSkin()->link(
327 SpecialPage
::getTitleFor( 'Specialpages' ),
328 wfMsg( 'moredotdotdot' ),
331 array( 'known', 'noclasses' )
334 $s .= $sep . "\n</div>\n";
338 function menuHead( $key ) {
339 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
343 function searchForm( $label = '' ) {
344 global $wgRequest, $wgUseTwoButtonsSearchForm;
346 $search = $wgRequest->getText( 'search' );
347 $action = $this->data
['searchaction'];
348 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
353 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
354 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
355 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
357 if( $wgUseTwoButtonsSearchForm ) {
358 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
360 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
365 // Ensure unique id's for search boxes made after the first
366 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;