* (bug 2514) Fixing msg:searchquery, setSubtitle() no longer accepts wikisyntax
[mediawiki.git] / skins / CologneBlue.php
blobd1ef0946a0f21244c1b7bc018161510f643369a3
1 <?php
2 /**
3 * See skin.txt
5 * @todo document
6 * @package MediaWiki
7 * @subpackage Skins
8 */
10 if( !defined( 'MEDIAWIKI' ) )
11 die();
13 /**
14 * @todo document
15 * @package MediaWiki
16 * @subpackage Skins
18 class SkinCologneBlue extends Skin {
20 function getStylesheet() {
21 return "common/cologneblue.css";
23 function getSkinName() {
24 return "cologneblue";
27 function doBeforeContent() {
28 global $wgOut, $wgTitle;
30 $s = "";
31 $qb = $this->qbSetting();
32 $mainPageObj = Title::newMainPage();
34 $s .= "\n<div id='content'>\n<div id='topbar'>" .
35 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
37 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
38 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
39 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
41 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
42 $s .= $this->sysLinks();
43 $s .= "</td></tr><tr><td valign='top'>";
45 $s .= "<font size='-1'><span id='sitesub'>";
46 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
47 $s .= "</td><td align='right'>" ;
49 $s .= "<font size='-1'><span id='langlinks'>" ;
50 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
51 $cat = $this->getCategoryLinks();
52 if( $cat ) $s .= "<br />$cat\n";
53 $s .= "<br />" . $this->pageTitleLinks();
54 $s .= "</span></font>";
56 $s .= "</td></tr></table>\n";
58 $s .= "\n</div>\n<div id='article'>";
60 $notice = wfGetSiteNotice();
61 if( $notice ) {
62 $s .= "\n<div id='siteNotice'>$notice</div>\n";
64 $s .= $this->pageTitle();
65 $s .= $this->pageSubtitle() . "\n";
66 return $s;
69 function doAfterContent()
71 global $wgOut;
73 $s = "\n</div><br clear='all' />\n";
75 $s .= "\n<div id='footer'>";
76 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
78 $qb = $this->qbSetting();
79 if ( 1 == $qb || 3 == $qb ) { # Left
80 $s .= $this->getQuickbarCompensator();
82 $s .= "<td class='bottom' align='center' valign='top'>";
84 $s .= $this->bottomLinks();
85 $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
86 . $this->aboutLink() . " | "
87 . $this->searchForm( wfMsg( "qbfind" ) );
89 $s .= "\n<br />" . $this->pageStats();
91 $s .= "</td>";
92 if ( 2 == $qb ) { # Right
93 $s .= $this->getQuickbarCompensator();
95 $s .= "</tr></table>\n</div>\n</div>\n";
97 if ( 0 != $qb ) { $s .= $this->quickBar(); }
98 return $s;
101 function doGetUserStyles() {
102 global $wgOut, $wgStyleSheetPath;
103 $s = parent::doGetUserStyles();
104 $qb = $this->qbSetting();
106 if ( 2 == $qb ) { # Right
107 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
108 "#article { margin-left: 4px; margin-right: 148px; }\n";
109 } else if ( 1 == $qb ) {
110 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
111 "#article { margin-left: 148px; margin-right: 4px; }\n";
112 } else if ( 3 == $qb ) { # Floating
113 $s .= "#quickbar { position:absolute; left:4px } \n" .
114 "#topbar { margin-left: 148px }\n" .
115 "#article { margin-left:148px; margin-right: 4px; } \n" .
116 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
118 return $s;
121 function sysLinks() {
122 global $wgUser, $wgContLang, $wgTitle;
123 $li = $wgContLang->specialPage("Userlogin");
124 $lo = $wgContLang->specialPage("Userlogout");
126 $rt = $wgTitle->getPrefixedURL();
127 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
128 $q = "";
129 } else {
130 $q = "returnto={$rt}";
133 $s = "" .
134 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
135 . " | " .
136 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
137 . " | " .
138 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
139 . " | " .
140 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
141 . " | " .
142 $this->specialLink( "specialpages" ) . " | ";
144 if ( $wgUser->isLoggedIn() ) {
145 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
146 } else {
147 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
150 /* show links to different language variants */
151 global $wgDisableLangConversion;
152 $variants = $wgContLang->getVariants();
153 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
154 $actstr = '';
155 foreach( $variants as $code ) {
156 $varname = $wgContLang->getVariantname( $code );
157 if( $varname == 'disable' )
158 continue;
159 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
165 return $s;
169 * Compute the sidebar
170 * @private
172 function quickBar()
174 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
176 $tns=$wgTitle->getNamespace();
178 $s = "\n<div id='quickbar'>";
180 $sep = "<br />";
181 $s .= $this->menuHead( "qbfind" );
182 $s .= $this->searchForm();
184 $s .= $this->menuHead( "qbbrowse" );
186 if ( $wgOut->isArticle() ) {
187 $s .= $this->menuHead( "qbedit" );
188 $s .= "<strong>" . $this->editThisPage() . "</strong>";
190 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
192 if( $wgUser->isLoggedIn() ) {
193 $s .= $sep . $this->moveThisPage();
195 if ( $wgUser->isAllowed('delete') ) {
196 $dtp = $this->deleteThisPage();
197 if ( "" != $dtp ) {
198 $s .= $sep . $dtp;
201 if ( $wgUser->isAllowed('protect') ) {
202 $ptp = $this->protectThisPage();
203 if ( "" != $ptp ) {
204 $s .= $sep . $ptp;
207 $s .= $sep;
209 $s .= $this->menuHead( "qbpageoptions" );
210 $s .= $this->talkLink()
211 . $sep . $this->commentLink()
212 . $sep . $this->printableLink();
213 if ( $wgUser->isLoggedIn() ) {
214 $s .= $sep . $this->watchThisPage();
217 $s .= $sep;
219 $s .= $this->menuHead("qbpageinfo")
220 . $this->historyLink()
221 . $sep . $this->whatLinksHere()
222 . $sep . $this->watchPageLinksLink();
224 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
225 $id=User::idFromName($wgTitle->getText());
226 if ($id != 0) {
227 $s .= $sep . $this->userContribsLink();
228 if( $this->showEmailUser( $id ) ) {
229 $s .= $sep . $this->emailUserLink();
233 $s .= $sep;
236 $s .= $this->menuHead( "qbmyoptions" );
237 if ( $wgUser->isLoggedIn() ) {
238 $name = $wgUser->getName();
239 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
240 wfMsg( 'mytalk' ) );
241 if ( $wgUser->getNewtalk() ) {
242 $tl .= " *";
245 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
246 wfMsg( "mypage" ) )
247 . $sep . $tl
248 . $sep . $this->specialLink( "watchlist" )
249 . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
250 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
251 . $sep . $this->specialLink( "preferences" )
252 . $sep . $this->specialLink( "userlogout" );
253 } else {
254 $s .= $this->specialLink( "userlogin" );
257 $s .= $this->menuHead( "qbspecialpages" )
258 . $this->specialLink( "newpages" )
259 . $sep . $this->specialLink( "imagelist" )
260 . $sep . $this->specialLink( "statistics" )
261 . $sep . $this->bugReportsLink();
262 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
263 $s .= $sep . $this->specialLink( "upload" );
265 global $wgSiteSupportPage;
266 if( $wgSiteSupportPage) {
267 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
268 .wfMsg( "sitesupport" )."</a>";
271 $s .= $sep . $this->makeKnownLinkObj(
272 Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
273 wfMsg( 'moredotdotdot' ) );
275 $s .= $sep . "\n</div>\n";
276 return $s;
279 function menuHead( $key )
281 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
282 return $s;
285 function searchForm( $label = "" )
287 global $wgRequest;
289 $search = $wgRequest->getText( 'search' );
290 $action = $this->escapeSearchLink();
291 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
292 if ( "" != $label ) { $s .= "{$label}: "; }
294 $s .= "<input type='text' name=\"search\" size='14' value=\""
295 . htmlspecialchars(substr($search,0,256)) . "\" />"
296 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
298 return $s;