E_STRICT
[mediawiki.git] / skins / CologneBlue.php
blob72598f26bff13b070233fb290c453f65bcabbc7f
1 <?php
2 /**
3 * See docs/skin.txt
5 * @todo document
6 * @addtogroup Skins
7 */
9 if( !defined( 'MEDIAWIKI' ) )
10 die( -1 );
12 /**
13 * @todo document
14 * @addtogroup Skins
16 class SkinCologneBlue extends Skin {
18 function getStylesheet() {
19 return 'common/cologneblue.css';
21 function getSkinName() {
22 return "cologneblue";
25 function doBeforeContent() {
27 $s = "";
28 $qb = $this->qbSetting();
29 $mainPageObj = Title::newMainPage();
31 $s .= "\n<div id='content'>\n<div id='topbar'>" .
32 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
34 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
35 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
36 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
38 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
39 $s .= $this->sysLinks();
40 $s .= "</td></tr><tr><td valign='top'>";
42 $s .= "<font size='-1'><span id='sitesub'>";
43 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
44 $s .= "</td><td align='right'>" ;
46 $s .= "<font size='-1'><span id='langlinks'>" ;
47 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
48 $cat = $this->getCategoryLinks();
49 if( $cat ) $s .= "<br />$cat\n";
50 $s .= "<br />" . $this->pageTitleLinks();
51 $s .= "</span></font>";
53 $s .= "</td></tr></table>\n";
55 $s .= "\n</div>\n<div id='article'>";
57 $notice = wfGetSiteNotice();
58 if( $notice ) {
59 $s .= "\n<div id='siteNotice'>$notice</div>\n";
61 $s .= $this->pageTitle();
62 $s .= $this->pageSubtitle() . "\n";
63 return $s;
66 function doAfterContent()
68 global $wgOut;
70 $s = "\n</div><br clear='all' />\n";
72 $s .= "\n<div id='footer'>";
73 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
75 $qb = $this->qbSetting();
76 if ( 1 == $qb || 3 == $qb ) { # Left
77 $s .= $this->getQuickbarCompensator();
79 $s .= "<td class='bottom' align='center' valign='top'>";
81 $s .= $this->bottomLinks();
82 $s .= "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ) . " | "
83 . $this->aboutLink() . " | "
84 . $this->searchForm( wfMsg( "qbfind" ) );
86 $s .= "\n<br />" . $this->pageStats();
88 $s .= "</td>";
89 if ( 2 == $qb ) { # Right
90 $s .= $this->getQuickbarCompensator();
92 $s .= "</tr></table>\n</div>\n</div>\n";
94 if ( 0 != $qb ) { $s .= $this->quickBar(); }
95 return $s;
98 function doGetUserStyles() {
99 global $wgOut;
100 $s = parent::doGetUserStyles();
101 $qb = $this->qbSetting();
103 if ( 2 == $qb ) { # Right
104 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
105 "#article { margin-left: 4px; margin-right: 148px; }\n";
106 } else if ( 1 == $qb ) {
107 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
108 "#article { margin-left: 148px; margin-right: 4px; }\n";
109 } else if ( 3 == $qb ) { # Floating left
110 $s .= "#quickbar { position:absolute; left:4px } \n" .
111 "#topbar { margin-left: 148px }\n" .
112 "#article { margin-left:148px; margin-right: 4px; } \n" .
113 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
114 } else if ( 4 == $qb ) { # Floating right
115 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
116 "#topbar { margin-right: 148px }\n" .
117 "#article { margin-right: 148px; margin-left: 4px; } \n" .
118 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
120 return $s;
123 function sysLinks() {
124 global $wgUser, $wgContLang, $wgTitle;
125 $li = $wgContLang->specialPage("Userlogin");
126 $lo = $wgContLang->specialPage("Userlogout");
128 $rt = $wgTitle->getPrefixedURL();
129 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
130 $q = "";
131 } else {
132 $q = "returnto={$rt}";
135 $s = "" .
136 $this->mainPageLink()
137 . " | " .
138 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
139 . " | " .
140 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
141 . " | " .
142 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
143 . " | " .
144 $this->specialLink( "specialpages" );
146 /* show links to different language variants */
147 $s .= $this->variantLinks();
148 $s .= $this->extensionTabLinks();
150 $s .= " | ";
151 if ( $wgUser->isLoggedIn() ) {
152 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
153 } else {
154 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
157 return $s;
161 * Compute the sidebar
162 * @access private
164 function quickBar()
166 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
168 $tns=$wgTitle->getNamespace();
170 $s = "\n<div id='quickbar'>";
172 $sep = "<br />";
173 $s .= $this->menuHead( "qbfind" );
174 $s .= $this->searchForm();
176 $s .= $this->menuHead( "qbbrowse" );
178 # Use the first heading from the Monobook sidebar as the "browse" section
179 $bar = $this->buildSidebar();
180 $browseLinks = reset( $bar );
182 foreach ( $browseLinks as $link ) {
183 if ( $link['text'] != '-' ) {
184 $s .= "<a href=\"{$link['href']}\">" .
185 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
189 if ( $wgOut->isArticle() ) {
190 $s .= $this->menuHead( "qbedit" );
191 $s .= "<strong>" . $this->editThisPage() . "</strong>";
193 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
195 if( $wgUser->isLoggedIn() ) {
196 $s .= $sep . $this->moveThisPage();
198 if ( $wgUser->isAllowed('delete') ) {
199 $dtp = $this->deleteThisPage();
200 if ( "" != $dtp ) {
201 $s .= $sep . $dtp;
204 if ( $wgUser->isAllowed('protect') ) {
205 $ptp = $this->protectThisPage();
206 if ( "" != $ptp ) {
207 $s .= $sep . $ptp;
210 $s .= $sep;
212 $s .= $this->menuHead( "qbpageoptions" );
213 $s .= $this->talkLink()
214 . $sep . $this->commentLink()
215 . $sep . $this->printableLink();
216 if ( $wgUser->isLoggedIn() ) {
217 $s .= $sep . $this->watchThisPage();
220 $s .= $sep;
222 $s .= $this->menuHead("qbpageinfo")
223 . $this->historyLink()
224 . $sep . $this->whatLinksHere()
225 . $sep . $this->watchPageLinksLink();
227 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
228 $id=User::idFromName($wgTitle->getText());
229 if ($id != 0) {
230 $s .= $sep . $this->userContribsLink();
231 if( $this->showEmailUser( $id ) ) {
232 $s .= $sep . $this->emailUserLink();
236 $s .= $sep;
239 $s .= $this->menuHead( "qbmyoptions" );
240 if ( $wgUser->isLoggedIn() ) {
241 $name = $wgUser->getName();
242 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
243 wfMsg( 'mytalk' ) );
244 if ( $wgUser->getNewtalk() ) {
245 $tl .= " *";
248 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
249 wfMsg( "mypage" ) )
250 . $sep . $tl
251 . $sep . $this->specialLink( "watchlist" )
252 . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
253 wfMsg( "mycontris" ) )
254 . $sep . $this->specialLink( "preferences" )
255 . $sep . $this->specialLink( "userlogout" );
256 } else {
257 $s .= $this->specialLink( "userlogin" );
260 $s .= $this->menuHead( "qbspecialpages" )
261 . $this->specialLink( "newpages" )
262 . $sep . $this->specialLink( "imagelist" )
263 . $sep . $this->specialLink( "statistics" )
264 . $sep . $this->bugReportsLink();
265 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
266 $s .= $sep . $this->specialLink( "upload" );
268 global $wgSiteSupportPage;
269 if( $wgSiteSupportPage) {
270 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
271 .wfMsg( "sitesupport" )."</a>";
274 $s .= $sep . $this->makeKnownLinkObj(
275 SpecialPage::getTitleFor( 'Specialpages' ),
276 wfMsg( 'moredotdotdot' ) );
278 $s .= $sep . "\n</div>\n";
279 return $s;
282 function menuHead( $key )
284 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
285 return $s;
288 function searchForm( $label = "" )
290 global $wgRequest;
292 $search = $wgRequest->getText( 'search' );
293 $action = $this->escapeSearchLink();
294 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
295 if ( "" != $label ) { $s .= "{$label}: "; }
297 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
298 . htmlspecialchars(substr($search,0,256)) . "\" /><br />"
299 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( "searcharticle" ) ) . "\" />"
300 . "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
302 // Ensure unique id's for search boxes made after the first
303 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
305 return $s;