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[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }";
34 $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }";
35 $rules[] = "/* @noflip */#footer { margin-right: 152px; }";
36 } elseif ( 1 == $qb ) {
37 $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }";
38 $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }";
39 $rules[] = "/* @noflip */#footer { margin-left: 152px; }";
40 } elseif ( 3 == $qb ) { # Floating left
41 $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }";
42 $rules[] = "/* @noflip */#topbar { margin-left: 148px }";
43 $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }";
44 $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE
45 $rules[] = "/* @noflip */#footer { margin-left: 152px; }";
46 } elseif ( 4 == $qb ) { # Floating right
47 $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }";
48 $rules[] = "/* @noflip */#topbar { margin-right: 148px }";
49 $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }";
50 $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE
51 $rules[] = "/* @noflip */#footer { margin-right: 152px; }";
53 $style = implode( "\n", $rules );
54 $out->addInlineStyle( $style, 'flip' );
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="' . htmlspecialchars( $mainPageObj->getLocalURL() ) . '">';
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-subheader">';
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() );
85 $s .= $this->getSkin()->getCategories();
87 $s .= '<br />' . $this->pageTitleLinks();
88 $s .= '</span></font>';
90 $s .= "</td></tr></table>\n";
92 $s .= "\n</div>\n<div id='article'>";
94 $notice = $this->getSkin()->getSiteNotice();
96 $s .= "\n<div id='siteNotice'>$notice</div>\n";
98 $s .= $this->pageTitle();
99 $s .= $this->pageSubtitle() . "\n";
106 function doAfterContent(){
107 $s = "\n</div><br clear='all' />\n";
109 $s .= "\n<div id='footer'>";
110 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
112 $s .= '<td class="bottom">';
114 $s .= $this->bottomLinks();
115 $s .= $this->getSkin()->getLanguage()->pipeList( array(
116 "\n<br />" . Linker
::link(
117 Title
::newMainPage(),
121 array( 'known', 'noclasses' )
123 $this->getSkin()->aboutLink(),
124 $this->searchForm( wfMsg( 'qbfind' ) )
127 $s .= "\n<br />" . $this->pageStats();
130 $s .= "</tr></table>\n</div>\n</div>\n";
132 if ( $this->getSkin()->qbSetting() != 0 ) {
133 $s .= $this->quickBar();
141 function sysLinks() {
142 $li = SpecialPage
::getTitleFor( 'Userlogin' );
143 $lo = SpecialPage
::getTitleFor( 'Userlogout' );
145 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
146 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
149 $q = array( 'returnto' => $rt );
153 $this->getSkin()->mainPageLink(),
155 Title
::newFromText( wfMsgForContent( 'aboutpage' ) ),
159 Title
::newFromText( wfMsgForContent( 'helppage' ) ),
163 Title
::newFromText( wfMsgForContent( 'faqpage' ) ),
166 Linker
::specialLink( 'Specialpages' )
169 /* show links to different language variants */
170 if( $this->variantLinks() ) {
171 $s[] = $this->variantLinks();
173 if( $this->extensionTabLinks() ) {
174 $s[] = $this->extensionTabLinks();
176 if ( $this->data
['loggedin'] ) {
177 $s[] = Linker
::linkKnown(
184 $s[] = Linker
::linkKnown(
192 return $this->getSkin()->getLanguage()->pipeList( $s );
196 * Compute the sidebar
202 $s = "\n<div id='quickbar'>";
205 $s .= $this->menuHead( 'qbfind' );
206 $s .= $this->searchForm();
208 $s .= $this->menuHead( 'qbbrowse' );
210 # Use the first heading from the Monobook sidebar as the "browse" section
211 $bar = $this->getSkin()->buildSidebar();
212 unset( $bar['SEARCH'] );
213 unset( $bar['LANGUAGES'] );
214 unset( $bar['TOOLBOX'] );
217 foreach ( $bar as $heading => $browseLinks ) {
218 if ( $barnumber > 1 ) {
219 $headingMsg = wfMessage( $heading );
220 if ( $headingMsg->exists() ) {
221 $h = $headingMsg->text();
225 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
227 if( is_array( $browseLinks ) ) {
228 foreach ( $browseLinks as $link ) {
229 if ( $link['text'] != '-' ) {
230 $s .= "<a href=\"{$link['href']}\">" .
231 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
238 $user = $this->getSkin()->getUser();
240 if ( $this->data
['isarticle'] ) {
241 $s .= $this->menuHead( 'qbedit' );
242 $s .= '<strong>' . $this->editThisPage() . '</strong>';
244 $s .= $sep . Linker
::linkKnown(
245 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
249 if( $this->data
['loggedin'] ) {
250 $s .= $sep . $this->moveThisPage();
252 if ( $user->isAllowed( 'delete' ) ) {
253 $dtp = $this->deleteThisPage();
258 if ( $user->isAllowed( 'protect' ) ) {
259 $ptp = $this->protectThisPage();
266 $s .= $this->menuHead( 'qbpageoptions' );
267 $s .= $this->talkLink()
268 . $sep . $this->commentLink()
269 . $sep . $this->printableLink();
270 if ( $this->data
['loggedin'] ) {
271 $s .= $sep . $this->watchThisPage();
276 $s .= $this->menuHead( 'qbpageinfo' )
277 . $this->historyLink()
278 . $sep . $this->whatLinksHere()
279 . $sep . $this->watchPageLinksLink();
281 $title = $this->getSkin()->getTitle();
282 $tns = $title->getNamespace();
283 if ( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
284 $id = User
::idFromName( $title->getText() );
286 $s .= $sep . $this->userContribsLink();
287 if( $this->getSkin()->showEmailUser( $id ) ) {
288 $s .= $sep . $this->emailUserLink();
295 $s .= $this->menuHead( 'qbmyoptions' );
296 if ( $this->data
['loggedin'] ) {
298 $user->getTalkPage(),
302 array( 'known', 'noclasses' )
304 if ( $user->getNewtalk() ) {
309 $user->getUserPage(),
313 array( 'known', 'noclasses' )
314 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
317 SpecialPage
::getSafeTitleFor( 'Contributions', $user->getName() ),
318 wfMsg( 'mycontris' ),
321 array( 'known', 'noclasses' )
322 ) . $sep . Linker
::specialLink( 'Preferences' )
323 . $sep . Linker
::specialLink( 'Userlogout' );
325 $s .= Linker
::specialLink( 'Userlogin' );
328 $s .= $this->menuHead( 'qbspecialpages' )
329 . Linker
::specialLink( 'Newpages' )
330 . $sep . Linker
::specialLink( 'Listfiles' )
331 . $sep . Linker
::specialLink( 'Statistics' );
332 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $user ) === true ) {
333 $s .= $sep . $this->getUploadLink();
336 global $wgSiteSupportPage;
338 if( $wgSiteSupportPage ) {
339 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
340 . wfMsg( 'sitesupport' ) . '</a>';
343 $s .= $sep . Linker
::link(
344 SpecialPage
::getTitleFor( 'Specialpages' ),
345 wfMsg( 'moredotdotdot' ),
348 array( 'known', 'noclasses' )
351 $s .= $sep . "\n</div>\n";
359 function menuHead( $key ) {
360 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
365 * @param $label string
368 function searchForm( $label = '' ) {
369 global $wgUseTwoButtonsSearchForm;
371 $search = $this->getSkin()->getRequest()->getText( 'search' );
372 $action = $this->data
['searchaction'];
373 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
378 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
379 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
380 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
382 if( $wgUseTwoButtonsSearchForm ) {
383 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
385 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
390 // Ensure unique id's for search boxes made after the first
391 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;