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 = '<div id="catlinks" class="catlinks">' . $this->getSkin()->getCategoryLinks() . '</div>';
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 if( is_array( $browseLinks ) ) {
239 foreach ( $browseLinks as $link ) {
240 if ( $link['text'] != '-' ) {
241 $s .= "<a href=\"{$link['href']}\">" .
242 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
249 if ( $wgOut->isArticle() ) {
250 $s .= $this->menuHead( 'qbedit' );
251 $s .= '<strong>' . $this->editThisPage() . '</strong>';
253 $s .= $sep . Linker
::linkKnown(
254 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
258 if( $wgUser->isLoggedIn() ) {
259 $s .= $sep . $this->moveThisPage();
261 if ( $wgUser->isAllowed( 'delete' ) ) {
262 $dtp = $this->deleteThisPage();
267 if ( $wgUser->isAllowed( 'protect' ) ) {
268 $ptp = $this->protectThisPage();
275 $s .= $this->menuHead( 'qbpageoptions' );
276 $s .= $this->talkLink()
277 . $sep . $this->commentLink()
278 . $sep . $this->printableLink();
279 if ( $wgUser->isLoggedIn() ) {
280 $s .= $sep . $this->watchThisPage();
285 $s .= $this->menuHead( 'qbpageinfo' )
286 . $this->historyLink()
287 . $sep . $this->whatLinksHere()
288 . $sep . $this->watchPageLinksLink();
290 if( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
291 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
293 $s .= $sep . $this->userContribsLink();
294 if( $this->getSkin()->showEmailUser( $id ) ) {
295 $s .= $sep . $this->emailUserLink();
302 $s .= $this->menuHead( 'qbmyoptions' );
303 if ( $wgUser->isLoggedIn() ) {
305 $wgUser->getTalkPage(),
309 array( 'known', 'noclasses' )
311 if ( $wgUser->getNewtalk() ) {
316 $wgUser->getUserPage(),
320 array( 'known', 'noclasses' )
321 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
324 SpecialPage
::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
325 wfMsg( 'mycontris' ),
328 array( 'known', 'noclasses' )
329 ) . $sep . Linker
::specialLink( 'Preferences' )
330 . $sep . Linker
::specialLink( 'Userlogout' );
332 $s .= Linker
::specialLink( 'Userlogin' );
335 $s .= $this->menuHead( 'qbspecialpages' )
336 . Linker
::specialLink( 'Newpages' )
337 . $sep . Linker
::specialLink( 'Listfiles' )
338 . $sep . Linker
::specialLink( 'Statistics' );
339 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
340 $s .= $sep . $this->getUploadLink();
343 global $wgSiteSupportPage;
345 if( $wgSiteSupportPage ) {
346 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
347 . wfMsg( 'sitesupport' ) . '</a>';
350 $s .= $sep . Linker
::link(
351 SpecialPage
::getTitleFor( 'Specialpages' ),
352 wfMsg( 'moredotdotdot' ),
355 array( 'known', 'noclasses' )
358 $s .= $sep . "\n</div>\n";
366 function menuHead( $key ) {
367 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
372 * @param $label string
375 function searchForm( $label = '' ) {
376 global $wgRequest, $wgUseTwoButtonsSearchForm;
378 $search = $wgRequest->getText( 'search' );
379 $action = $this->data
['searchaction'];
380 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
385 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
386 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
387 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
389 if( $wgUseTwoButtonsSearchForm ) {
390 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
392 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
397 // Ensure unique id's for search boxes made after the first
398 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;