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 } elseif ( 1 == $qb ) {
36 $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }";
37 $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }";
38 } elseif ( 3 == $qb ) { # Floating left
39 $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }";
40 $rules[] = "/* @noflip */#topbar { margin-left: 148px }";
41 $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }";
42 $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE
43 } elseif ( 4 == $qb ) { # Floating right
44 $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }";
45 $rules[] = "/* @noflip */#topbar { margin-right: 148px }";
46 $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }";
47 $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE
49 $style = implode( "\n", $rules );
50 $out->addInlineStyle( $style, /* flip css if RTL */true );
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(){
104 $s = "\n</div><br clear='all' />\n";
106 $s .= "\n<div id='footer'>";
107 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
109 $qb = $this->getSkin()->qbSetting();
110 if ( 1 == $qb ||
3 == $qb ) { # Left
111 $s .= $this->getQuickbarCompensator();
113 $s .= '<td class="bottom">';
115 $s .= $this->bottomLinks();
116 $s .= $this->getSkin()->getLang()->pipeList( array(
117 "\n<br />" . Linker
::link(
118 Title
::newMainPage(),
122 array( 'known', 'noclasses' )
124 $this->getSkin()->aboutLink(),
125 $this->searchForm( wfMsg( 'qbfind' ) )
128 $s .= "\n<br />" . $this->pageStats();
131 if ( 2 == $qb ) { # Right
132 $s .= $this->getQuickbarCompensator();
134 $s .= "</tr></table>\n</div>\n</div>\n";
137 $s .= $this->quickBar();
145 function sysLinks() {
146 $li = SpecialPage
::getTitleFor( 'Userlogin' );
147 $lo = SpecialPage
::getTitleFor( 'Userlogout' );
149 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
150 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
153 $q = array( 'returnto' => $rt );
157 $this->getSkin()->mainPageLink(),
159 Title
::newFromText( wfMsgForContent( 'aboutpage' ) ),
163 Title
::newFromText( wfMsgForContent( 'helppage' ) ),
167 Title
::newFromText( wfMsgForContent( 'faqpage' ) ),
170 Linker
::specialLink( 'Specialpages' )
173 /* show links to different language variants */
174 if( $this->variantLinks() ) {
175 $s[] = $this->variantLinks();
177 if( $this->extensionTabLinks() ) {
178 $s[] = $this->extensionTabLinks();
180 if ( $this->data
['loggedin'] ) {
181 $s[] = Linker
::linkKnown(
188 $s[] = Linker
::linkKnown(
196 return $this->getSkin()->getLang()->pipeList( $s );
200 * Compute the sidebar
206 $tns = $this->getSkin()->getTitle()->getNamespace();
208 $s = "\n<div id='quickbar'>";
211 $s .= $this->menuHead( 'qbfind' );
212 $s .= $this->searchForm();
214 $s .= $this->menuHead( 'qbbrowse' );
216 # Use the first heading from the Monobook sidebar as the "browse" section
217 $bar = $this->getSkin()->buildSidebar();
218 unset( $bar['SEARCH'] );
219 unset( $bar['LANGUAGES'] );
220 unset( $bar['TOOLBOX'] );
223 foreach ( $bar as $heading => $browseLinks ) {
224 if ( $barnumber > 1 ) {
225 $headingMsg = wfMessage( $heading );
226 if ( $headingMsg->exists() ) {
227 $h = $headingMsg->text();
231 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
233 if( is_array( $browseLinks ) ) {
234 foreach ( $browseLinks as $link ) {
235 if ( $link['text'] != '-' ) {
236 $s .= "<a href=\"{$link['href']}\">" .
237 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
244 if ( $this->data
['isarticle'] ) {
245 $s .= $this->menuHead( 'qbedit' );
246 $s .= '<strong>' . $this->editThisPage() . '</strong>';
248 $s .= $sep . Linker
::linkKnown(
249 Title
::newFromText( wfMsgForContent( 'edithelppage' ) ),
253 if( $this->data
['loggedin'] ) {
254 $s .= $sep . $this->moveThisPage();
256 if ( $this->getSkin()->getUser()->isAllowed( 'delete' ) ) {
257 $dtp = $this->deleteThisPage();
262 if ( $this->getSkin()->getUser()->isAllowed( 'protect' ) ) {
263 $ptp = $this->protectThisPage();
270 $s .= $this->menuHead( 'qbpageoptions' );
271 $s .= $this->talkLink()
272 . $sep . $this->commentLink()
273 . $sep . $this->printableLink();
274 if ( $this->data
['loggedin'] ) {
275 $s .= $sep . $this->watchThisPage();
280 $s .= $this->menuHead( 'qbpageinfo' )
281 . $this->historyLink()
282 . $sep . $this->whatLinksHere()
283 . $sep . $this->watchPageLinksLink();
285 if( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
286 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
288 $s .= $sep . $this->userContribsLink();
289 if( $this->getSkin()->showEmailUser( $id ) ) {
290 $s .= $sep . $this->emailUserLink();
297 $s .= $this->menuHead( 'qbmyoptions' );
298 if ( $this->data
['loggedin'] ) {
300 $this->getSkin()->getUser()->getTalkPage(),
304 array( 'known', 'noclasses' )
306 if ( $this->getSkin()->getUser()->getNewtalk() ) {
311 $this->getSkin()->getUser()->getUserPage(),
315 array( 'known', 'noclasses' )
316 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
319 SpecialPage
::getSafeTitleFor( 'Contributions', $this->getSkin()->getUser()->getName() ),
320 wfMsg( 'mycontris' ),
323 array( 'known', 'noclasses' )
324 ) . $sep . Linker
::specialLink( 'Preferences' )
325 . $sep . Linker
::specialLink( 'Userlogout' );
327 $s .= Linker
::specialLink( 'Userlogin' );
330 $s .= $this->menuHead( 'qbspecialpages' )
331 . Linker
::specialLink( 'Newpages' )
332 . $sep . Linker
::specialLink( 'Listfiles' )
333 . $sep . Linker
::specialLink( 'Statistics' );
334 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $this->getSkin()->getUser() ) === true ) {
335 $s .= $sep . $this->getUploadLink();
338 global $wgSiteSupportPage;
340 if( $wgSiteSupportPage ) {
341 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
342 . wfMsg( 'sitesupport' ) . '</a>';
345 $s .= $sep . Linker
::link(
346 SpecialPage
::getTitleFor( 'Specialpages' ),
347 wfMsg( 'moredotdotdot' ),
350 array( 'known', 'noclasses' )
353 $s .= $sep . "\n</div>\n";
361 function menuHead( $key ) {
362 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
367 * @param $label string
370 function searchForm( $label = '' ) {
371 global $wgUseTwoButtonsSearchForm;
373 $search = $this->getSkin()->getRequest()->getText( 'search' );
374 $action = $this->data
['searchaction'];
375 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
380 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
381 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
382 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
384 if( $wgUseTwoButtonsSearchForm ) {
385 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
387 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
392 // Ensure unique id's for search boxes made after the first
393 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;