Add support for using ICU to perform normalization, which is much much faster than...
[mediawiki.git] / skins / CologneBlue.php
blob665f5d744ffa2850aba692d9eccce3b3833c6b3f
1 <?php
2 /**
3 * See skin.doc
5 * @todo document
6 * @package MediaWiki
7 * @subpackage Skins
8 */
10 /**
11 * @todo document
12 * @package MediaWiki
13 * @subpackage Skins
15 class SkinCologneBlue extends Skin {
17 function getStylesheet() {
18 return "common/cologneblue.css";
20 function getSkinName() {
21 return "cologneblue";
24 function doBeforeContent() {
25 global $wgUser, $wgOut, $wgTitle, $wgSiteNotice;
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 if( $wgSiteNotice ) {
58 $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
60 $s .= $this->pageTitle();
61 $s .= $this->pageSubtitle() . "\n";
62 return $s;
65 function doAfterContent()
67 global $wgUser, $wgOut;
69 $s = "\n</div><br clear='all' />\n";
71 $s .= "\n<div id='footer'>";
72 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
74 $qb = $this->qbSetting();
75 if ( 1 == $qb || 3 == $qb ) { # Left
76 $s .= $this->getQuickbarCompensator();
78 $s .= "<td class='bottom' align='center' valign='top'>";
80 $s .= $this->bottomLinks();
81 $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
82 . $this->aboutLink() . " | "
83 . $this->searchForm( wfMsg( "qbfind" ) );
85 $s .= "\n<br />" . $this->pageStats();
87 $s .= "</td>";
88 if ( 2 == $qb ) { # Right
89 $s .= $this->getQuickbarCompensator();
91 $s .= "</tr></table>\n</div>\n</div>\n";
93 if ( 0 != $qb ) { $s .= $this->quickBar(); }
94 return $s;
96 function doGetUserStyles()
98 global $wgUser, $wgOut, $wgStyleSheetPath;
99 $s = '';
100 $qb = $this->qbSetting();
102 if ( 2 == $qb ) { # Right
103 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
104 "#article { margin-left: 4px; margin-right: 148px; }\n";
105 } else if ( 1 == $qb ) {
106 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
107 "#article { margin-left: 148px; margin-right: 4px; }\n";
108 } else if ( 3 == $qb ) { # Floating
109 $s .= "#quickbar { position:absolute; left:4px } \n" .
110 "#topbar { margin-left: 148px }\n" .
111 "#article { margin-left:148px; margin-right: 4px; } \n" .
112 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
114 $s .= parent::doGetUserStyles();
115 return $s;
117 function sysLinks()
119 global $wgUser, $wgContLang, $wgTitle;
120 $li = $wgContLang->specialPage("Userlogin");
121 $lo = $wgContLang->specialPage("Userlogout");
123 $rt = $wgTitle->getPrefixedURL();
124 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
125 $q = "";
126 } else {
127 $q = "returnto={$rt}";
130 $s = "" .
131 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
132 . " | " .
133 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
134 . " | " .
135 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
136 . " | " .
137 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
138 . " | " .
139 $this->specialLink( "specialpages" ) . " | ";
141 if ( $wgUser->getID() )
143 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
145 else
147 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
150 return $s;
154 * Compute the sidebar
155 * @private
157 function quickBar()
159 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks;
161 $tns=$wgTitle->getNamespace();
163 $s = "\n<div id='quickbar'>";
165 $sep = "<br />";
166 $s .= $this->menuHead( "qbfind" );
167 $s .= $this->searchForm();
169 $s .= $this->menuHead( "qbbrowse" );
171 foreach ( $wgNavigationLinks as $link ) {
172 $msg = wfMsgForContent( $link['href'] );
173 if ( $msg != '-' ) {
174 $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
175 wfMsg( $link['text'] ) . '</a>' . $sep;
179 if ( $wgOut->isArticle() ) {
180 $s .= $this->menuHead( "qbedit" );
181 $s .= "<strong>" . $this->editThisPage() . "</strong>";
183 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
185 if ( 0 != $wgUser->getID() ) {
186 $s .= $sep . $this->moveThisPage();
188 if ( $wgUser->isSysop() ) {
189 $dtp = $this->deleteThisPage();
190 if ( "" != $dtp ) {
191 $s .= $sep . $dtp;
193 $ptp = $this->protectThisPage();
194 if ( "" != $ptp ) {
195 $s .= $sep . $ptp;
198 $s .= $sep;
200 $s .= $this->menuHead( "qbpageoptions" );
201 $s .= $this->talkLink()
202 . $sep . $this->commentLink()
203 . $sep . $this->printableLink();
204 if ( 0 != $wgUser->getID() ) {
205 $s .= $sep . $this->watchThisPage();
208 $s .= $sep;
210 $s .= $this->menuHead("qbpageinfo")
211 . $this->historyLink()
212 . $sep . $this->whatLinksHere()
213 . $sep . $this->watchPageLinksLink();
215 if ( Namespace::getUser() == $tns || Namespace::getTalk(Namespace::getUser()) == $tns ) {
216 $id=User::idFromName($wgTitle->getText());
217 if ($id != 0) {
218 $s .= $sep . $this->userContribsLink();
219 if ( 0 != $wgUser->getID() ) {
220 $s .= $sep . $this->emailUserLink();
224 $s .= $sep;
227 $s .= $this->menuHead( "qbmyoptions" );
228 if ( 0 != $wgUser->getID() ) {
229 $name = $wgUser->getName();
230 $tl = $this->makeKnownLink( $wgContLang->getNsText(
231 Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
232 wfMsg( "mytalk" ) );
233 if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
235 $s .= $this->makeKnownLink( $wgContLang->getNsText(
236 Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
237 . $sep . $tl
238 . $sep . $this->specialLink( "watchlist" )
239 . $sep . $this->makeKnownLink( $wgContLang->specialPage( "Contributions" ),
240 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
241 . $sep . $this->specialLink( "preferences" )
242 . $sep . $this->specialLink( "userlogout" );
243 } else {
244 $s .= $this->specialLink( "userlogin" );
247 $s .= $this->menuHead( "qbspecialpages" )
248 . $this->specialLink( "newpages" )
249 . $sep . $this->specialLink( "imagelist" )
250 . $sep . $this->specialLink( "statistics" )
251 . $sep . $this->bugReportsLink();
252 if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
253 $s .= $sep . $this->specialLink( "upload" );
255 global $wgSiteSupportPage;
256 if( $wgSiteSupportPage) {
257 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
258 .wfMsg( "sitesupport" )."</a>";
261 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( "Specialpages" ), wfMsg("moredotdotdot") );
263 $s .= $sep . "\n</div>\n";
264 return $s;
267 function menuHead( $key )
269 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
270 return $s;
273 function searchForm( $label = "" )
275 global $wgRequest;
277 $search = $wgRequest->getText( 'search' );
278 $action = $this->escapeSearchLink();
279 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
280 if ( "" != $label ) { $s .= "{$label}: "; }
282 $s .= "<input type='text' name=\"search\" size='14' value=\""
283 . htmlspecialchars(substr($search,0,256)) . "\" />"
284 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
286 return $s;