Remove some unused $wgOut's.
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * Cologne Blue: A nicer-looking alternative to Standard.
4 *
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die( -1 );
12
13 /**
14 * @todo document
15 * @ingroup Skins
16 */
17 class SkinCologneBlue extends Skin {
18
19 function getStylesheet() {
20 return 'common/cologneblue.css';
21 }
22
23 function getSkinName() {
24 return 'cologneblue';
25 }
26
27 function doBeforeContent() {
28 $qb = $this->qbSetting();
29 $mainPageObj = Title::newMainPage();
30
31 $s = "\n<div id='content'>\n<div id='topbar'>" .
32 '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
33
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>';
37
38 $s .= '</td><td class="top" align="right" valign="bottom" width="100%">';
39 $s .= $this->sysLinks();
40 $s .= '</td></tr><tr><td valign="top">';
41
42 $s .= '<font size="-1"><span id="sitesub">';
43 $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
44 $s .= '</td><td align="right">';
45
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>';
52
53 $s .= "</td></tr></table>\n";
54
55 $s .= "\n</div>\n<div id='article'>";
56
57 $notice = wfGetSiteNotice();
58 if( $notice ) {
59 $s .= "\n<div id='siteNotice'>$notice</div>\n";
60 }
61 $s .= $this->pageTitle();
62 $s .= $this->pageSubtitle() . "\n";
63 return $s;
64 }
65
66 function doAfterContent(){
67 global $wgLang;
68
69 $s = "\n</div><br clear='all' />\n";
70
71 $s .= "\n<div id='footer'>";
72 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
73
74 $qb = $this->qbSetting();
75 if ( 1 == $qb || 3 == $qb ) { # Left
76 $s .= $this->getQuickbarCompensator();
77 }
78 $s .= '<td class="bottom" align="center" valign="top">';
79
80 $s .= $this->bottomLinks();
81 $s .= $wgLang->pipeList( array(
82 "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ),
83 $this->aboutLink(),
84 $this->searchForm( wfMsg( 'qbfind' ) )
85 ) );
86
87 $s .= "\n<br />" . $this->pageStats();
88
89 $s .= '</td>';
90 if ( 2 == $qb ) { # Right
91 $s .= $this->getQuickbarCompensator();
92 }
93 $s .= "</tr></table>\n</div>\n</div>\n";
94
95 if ( 0 != $qb ) {
96 $s .= $this->quickBar();
97 }
98 return $s;
99 }
100
101 function reallyGenerateUserStylesheet() {
102 $s = parent::reallyGenerateUserStylesheet();
103 $qb = $this->qbSetting();
104
105 if ( 2 == $qb ) { # Right
106 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
107 "#article { margin-left: 4px; margin-right: 148px; }\n";
108 } else if ( 1 == $qb ) {
109 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
110 "#article { margin-left: 148px; margin-right: 4px; }\n";
111 } else if ( 3 == $qb ) { # Floating left
112 $s .= "#quickbar { position:absolute; left:4px } \n" .
113 "#topbar { margin-left: 148px }\n" .
114 "#article { margin-left:148px; margin-right: 4px; } \n" .
115 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
116 } else if ( 4 == $qb ) { # Floating right
117 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
118 "#topbar { margin-right: 148px }\n" .
119 "#article { margin-right: 148px; margin-left: 4px; } \n" .
120 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
121 }
122 return $s;
123 }
124
125 function sysLinks() {
126 global $wgUser, $wgLang, $wgContLang, $wgTitle;
127 $li = $wgContLang->specialPage( 'Userlogin' );
128 $lo = $wgContLang->specialPage( 'Userlogout' );
129
130 $rt = $wgTitle->getPrefixedURL();
131 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
132 $q = '';
133 } else {
134 $q = "returnto={$rt}";
135 }
136
137 $s = array(
138 $this->mainPageLink(),
139 $this->makeKnownLink( wfMsgForContent( 'aboutpage' ), wfMsg( 'about' ) ),
140 $this->makeKnownLink( wfMsgForContent( 'helppage' ), wfMsg( 'help' ) ),
141 $this->makeKnownLink( wfMsgForContent( 'faqpage' ), wfMsg( 'faq' ) ),
142 $this->specialLink( 'specialpages' )
143 );
144
145 /* show links to different language variants */
146 if( $this->variantLinks() ) {
147 $s[] = $this->variantLinks();
148 }
149 if( $this->extensionTabLinks() ) {
150 $s[] = $this->extensionTabLinks();
151 }
152 if ( $wgUser->isLoggedIn() ) {
153 $s[] = $this->makeKnownLink( $lo, wfMsg( 'logout' ), $q );
154 } else {
155 $s[] = $this->makeKnownLink( $li, wfMsg( 'login' ), $q );
156 }
157
158 return $wgLang->pipeList( $s );
159 }
160
161 /**
162 * Compute the sidebar
163 * @access private
164 */
165 function quickBar(){
166 global $wgOut, $wgTitle, $wgUser, $wgEnableUploads;
167
168 $tns = $wgTitle->getNamespace();
169
170 $s = "\n<div id='quickbar'>";
171
172 $sep = '<br />';
173 $s .= $this->menuHead( 'qbfind' );
174 $s .= $this->searchForm();
175
176 $s .= $this->menuHead( 'qbbrowse' );
177
178 # Use the first heading from the Monobook sidebar as the "browse" section
179 $bar = $this->buildSidebar();
180 unset( $bar['SEARCH'] );
181 unset( $bar['LANGUAGES'] );
182 unset( $bar['TOOLBOX'] );
183 $browseLinks = reset( $bar );
184
185 foreach ( $browseLinks as $link ) {
186 if ( $link['text'] != '-' ) {
187 $s .= "<a href=\"{$link['href']}\">" .
188 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
189 }
190 }
191
192 if ( $wgOut->isArticle() ) {
193 $s .= $this->menuHead( 'qbedit' );
194 $s .= '<strong>' . $this->editThisPage() . '</strong>';
195
196 $s .= $sep . $this->makeKnownLink( wfMsgForContent( 'edithelppage' ), wfMsg( 'edithelp' ) );
197
198 if( $wgUser->isLoggedIn() ) {
199 $s .= $sep . $this->moveThisPage();
200 }
201 if ( $wgUser->isAllowed( 'delete' ) ) {
202 $dtp = $this->deleteThisPage();
203 if ( '' != $dtp ) {
204 $s .= $sep . $dtp;
205 }
206 }
207 if ( $wgUser->isAllowed( 'protect' ) ) {
208 $ptp = $this->protectThisPage();
209 if ( '' != $ptp ) {
210 $s .= $sep . $ptp;
211 }
212 }
213 $s .= $sep;
214
215 $s .= $this->menuHead( 'qbpageoptions' );
216 $s .= $this->talkLink()
217 . $sep . $this->commentLink()
218 . $sep . $this->printableLink();
219 if ( $wgUser->isLoggedIn() ) {
220 $s .= $sep . $this->watchThisPage();
221 }
222
223 $s .= $sep;
224
225 $s .= $this->menuHead( 'qbpageinfo' )
226 . $this->historyLink()
227 . $sep . $this->whatLinksHere()
228 . $sep . $this->watchPageLinksLink();
229
230 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
231 $id = User::idFromName( $wgTitle->getText() );
232 if( $id != 0 ) {
233 $s .= $sep . $this->userContribsLink();
234 if( $this->showEmailUser( $id ) ) {
235 $s .= $sep . $this->emailUserLink();
236 }
237 }
238 }
239 $s .= $sep;
240 }
241
242 $s .= $this->menuHead( 'qbmyoptions' );
243 if ( $wgUser->isLoggedIn() ) {
244 $name = $wgUser->getName();
245 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
246 wfMsg( 'mytalk' ) );
247 if ( $wgUser->getNewtalk() ) {
248 $tl .= " *";
249 }
250
251 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
252 wfMsg( 'mypage' ) )
253 . $sep . $tl
254 . $sep . $this->specialLink( 'watchlist' )
255 . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
256 wfMsg( 'mycontris' ) )
257 . $sep . $this->specialLink( 'preferences' )
258 . $sep . $this->specialLink( 'userlogout' );
259 } else {
260 $s .= $this->specialLink( 'userlogin' );
261 }
262
263 $s .= $this->menuHead( 'qbspecialpages' )
264 . $this->specialLink( 'newpages' )
265 . $sep . $this->specialLink( 'listfiles' )
266 . $sep . $this->specialLink( 'statistics' );
267 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
268 $s .= $sep . $this->specialLink( 'upload' );
269 }
270 global $wgSiteSupportPage;
271 if( $wgSiteSupportPage ) {
272 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
273 . wfMsg( 'sitesupport' ) . '</a>';
274 }
275
276 $s .= $sep . $this->makeKnownLinkObj(
277 SpecialPage::getTitleFor( 'Specialpages' ),
278 wfMsg( 'moredotdotdot' ) );
279
280 $s .= $sep . "\n</div>\n";
281 return $s;
282 }
283
284 function menuHead( $key ){
285 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
286 return $s;
287 }
288
289 function searchForm( $label = '' ){
290 global $wgRequest, $wgUseTwoButtonsSearchForm;
291
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 ) {
296 $s .= "{$label}: ";
297 }
298
299 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
300 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
301 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
302
303 if( $wgUseTwoButtonsSearchForm )
304 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
305 else
306 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
307
308 $s .= '</form>';
309
310 // Ensure unique id's for search boxes made after the first
311 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
312
313 return $s;
314 }
315 }