3 * Cologne Blue: A nicer-looking alternative to Standard.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
25 if( !defined( 'MEDIAWIKI' ) ) {
33 class SkinCologneBlue
extends SkinLegacy
{
34 var $skinname = 'cologneblue', $stylename = 'cologneblue',
35 $template = 'CologneBlueTemplate';
38 * @param $out OutputPage
40 function setupSkinUserCss( OutputPage
$out ){
41 parent
::setupSkinUserCss( $out );
42 $out->addModuleStyles( 'skins.cologneblue' );
44 $qb = $this->qbSetting();
47 if ( 2 == $qb ) { # Right
48 $rules[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }";
49 $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }";
50 $rules[] = "/* @noflip */#footer { margin-right: 152px; }";
51 } elseif ( 1 == $qb ) {
52 $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }";
53 $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }";
54 $rules[] = "/* @noflip */#footer { margin-left: 152px; }";
55 } elseif ( 3 == $qb ) { # Floating left
56 $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }";
57 $rules[] = "/* @noflip */#topbar { margin-left: 148px }";
58 $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }";
59 $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE
60 $rules[] = "/* @noflip */#footer { margin-left: 152px; }";
61 } elseif ( 4 == $qb ) { # Floating right
62 $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }";
63 $rules[] = "/* @noflip */#topbar { margin-right: 148px }";
64 $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }";
65 $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE
66 $rules[] = "/* @noflip */#footer { margin-right: 152px; }";
68 $style = implode( "\n", $rules );
69 $out->addInlineStyle( $style, 'flip' );
74 class CologneBlueTemplate
extends LegacyTemplate
{
79 function doBeforeContent() {
80 $mainPageObj = Title
::newMainPage();
82 $s = "\n<div id='content'>\n<div id='topbar'>" .
83 '<table style="width: 100%;" cellspacing="0" cellpadding="8"><tr>';
85 $s .= '<td class="top" nowrap="nowrap">';
86 $s .= '<a href="' . htmlspecialchars( $mainPageObj->getLocalURL() ) . '">';
87 $s .= '<span id="sitetitle">' . wfMessage( 'sitetitle' )->escaped() . '</span></a>';
89 $s .= '</td><td class="top" id="top-syslinks" style="width: 100%;">';
90 $s .= $this->sysLinks();
91 $s .= '</td></tr><tr><td class="top-subheader">';
93 $s .= '<font size="-1"><span id="sitesub">';
94 $s .= wfMessage( 'sitesubtitle' )->escaped() . '</span></font>';
95 $s .= '</td><td class="top-linkcollection">';
97 $s .= '<font size="-1"><span id="langlinks">';
98 $s .= str_replace( '<br />', '', $this->otherLanguages() );
100 $s .= $this->getSkin()->getCategories();
102 $s .= '<br />' . $this->pageTitleLinks();
103 $s .= '</span></font>';
105 $s .= "</td></tr></table>\n";
107 $s .= "\n</div>\n<div id='article'>";
109 $notice = $this->getSkin()->getSiteNotice();
111 $s .= "\n<div id='siteNotice'>$notice</div>\n";
113 $s .= $this->pageTitle();
114 $s .= $this->pageSubtitle() . "\n";
121 function doAfterContent(){
122 $s = "\n</div><br clear='all' />\n";
124 $s .= "\n<div id='footer'>";
125 $s .= '<table style="width: 98%;" cellspacing="0"><tr>';
127 $s .= '<td class="bottom">';
129 $s .= $this->bottomLinks();
130 $s .= $this->getSkin()->getLanguage()->pipeList( array(
131 "\n<br />" . Linker
::linkKnown(
134 $this->getSkin()->aboutLink(),
135 $this->searchForm( wfMessage( 'qbfind' )->text() )
138 $s .= "\n<br />" . $this->pageStats();
141 $s .= "</tr></table>\n</div>\n</div>\n";
143 if ( $this->getSkin()->qbSetting() != 0 ) {
144 $s .= $this->quickBar();
152 function sysLinks() {
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( wfMessage( 'aboutpage' )->inContentLanguage()->text() ),
167 wfMessage( 'about' )->text()
170 Title
::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ),
171 wfMessage( 'help' )->text()
174 Title
::newFromText( wfMessage( 'faqpage' )->inContentLanguage()->text() ),
175 wfMessage( 'faq' )->text()
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 ( $this->data
['loggedin'] ) {
188 $s[] = Linker
::linkKnown(
190 wfMessage( 'logout' )->text(),
195 $s[] = Linker
::linkKnown(
197 wfMessage( 'login' )->text(),
203 return $this->getSkin()->getLanguage()->pipeList( $s );
207 * Compute the sidebar
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 $user = $this->getSkin()->getUser();
251 if ( $this->data
['isarticle'] ) {
252 $s .= $this->menuHead( 'qbedit' );
253 $s .= '<strong>' . $this->editThisPage() . '</strong>';
255 $s .= $sep . Linker
::linkKnown(
256 Title
::newFromText( wfMessage( 'edithelppage' )->inContentLanguage()->text() ),
257 wfMessage( 'edithelp' )->text()
260 if( $this->data
['loggedin'] ) {
261 $s .= $sep . $this->moveThisPage();
263 if ( $user->isAllowed( 'delete' ) ) {
264 $dtp = $this->deleteThisPage();
269 if ( $user->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 ( $this->data
['loggedin'] ) {
282 $s .= $sep . $this->watchThisPage();
287 $s .= $this->menuHead( 'qbpageinfo' )
288 . $this->historyLink()
289 . $sep . $this->whatLinksHere()
290 . $sep . $this->watchPageLinksLink();
292 $title = $this->getSkin()->getTitle();
293 $tns = $title->getNamespace();
294 if ( $tns == NS_USER ||
$tns == NS_USER_TALK
) {
295 $id = User
::idFromName( $title->getText() );
297 $s .= $sep . $this->userContribsLink();
298 if( $this->getSkin()->showEmailUser( $id ) ) {
299 $s .= $sep . $this->emailUserLink();
306 $s .= $this->menuHead( 'qbmyoptions' );
307 if ( $this->data
['loggedin'] ) {
308 $tl = Linker
::linkKnown(
309 $user->getTalkPage(),
310 wfMessage( 'mytalk' )->escaped()
312 if ( $user->getNewtalk() ) {
316 $s .= Linker
::linkKnown(
317 $user->getUserPage(),
318 wfMessage( 'mypage' )->escaped()
319 ) . $sep . $tl . $sep . Linker
::specialLink( 'Watchlist' )
322 SpecialPage
::getSafeTitleFor( 'Contributions', $user->getName() ),
323 wfMessage( 'mycontris' )->escaped()
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( $user ) === true ) {
335 $s .= $sep . $this->getUploadLink();
338 global $wgSiteSupportPage;
340 if( $wgSiteSupportPage ) {
341 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
342 . wfMessage( 'sitesupport' )->escaped() . '</a>';
345 $s .= $sep . Linker
::linkKnown(
346 SpecialPage
::getTitleFor( 'Specialpages' ),
347 wfMessage( 'moredotdotdot' )->text()
350 $s .= $sep . "\n</div>\n";
358 function menuHead( $key ) {
359 $s = "\n<h6>" . wfMessage( $key )->text() . "</h6>";
364 * @param $label string
367 function searchForm( $label = '' ) {
368 global $wgUseTwoButtonsSearchForm;
370 $search = $this->getSkin()->getRequest()->getText( 'search' );
371 $action = $this->data
['searchaction'];
372 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
377 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
378 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
379 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . wfMessage( 'searcharticle' )->escaped() . "\" />";
381 if( $wgUseTwoButtonsSearchForm ) {
382 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . wfMessage( 'search' )->escaped() . "\" />\n";
384 $s .= '<div><a href="' . $action . '" rel="search">' . wfMessage( 'powersearch-legend' )->escaped() . "</a></div>\n";
389 // Ensure unique id's for search boxes made after the first
390 $this->searchboxes
= $this->searchboxes
== '' ?
2 : $this->searchboxes +
1;