Revert broken rewrite of login forms:
[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->link(
83 Title::newMainPage(),
84 null,
85 array(),
86 array(),
87 array( 'known', 'noclasses' )
88 ),
89 $this->aboutLink(),
90 $this->searchForm( wfMsg( 'qbfind' ) )
91 ) );
92
93 $s .= "\n<br />" . $this->pageStats();
94
95 $s .= '</td>';
96 if ( 2 == $qb ) { # Right
97 $s .= $this->getQuickbarCompensator();
98 }
99 $s .= "</tr></table>\n</div>\n</div>\n";
100
101 if ( 0 != $qb ) {
102 $s .= $this->quickBar();
103 }
104 return $s;
105 }
106
107 function reallyGenerateUserStylesheet() {
108 $s = parent::reallyGenerateUserStylesheet();
109 $qb = $this->qbSetting();
110
111 if ( 2 == $qb ) { # Right
112 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
113 "#article { margin-left: 4px; margin-right: 148px; }\n";
114 } else if ( 1 == $qb ) {
115 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
116 "#article { margin-left: 148px; margin-right: 4px; }\n";
117 } else if ( 3 == $qb ) { # Floating left
118 $s .= "#quickbar { position:absolute; left:4px } \n" .
119 "#topbar { margin-left: 148px }\n" .
120 "#article { margin-left:148px; margin-right: 4px; } \n" .
121 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
122 } else if ( 4 == $qb ) { # Floating right
123 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
124 "#topbar { margin-right: 148px }\n" .
125 "#article { margin-right: 148px; margin-left: 4px; } \n" .
126 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
127 }
128 return $s;
129 }
130
131 function sysLinks() {
132 global $wgUser, $wgLang, $wgContLang;
133 $li = SpecialPage::getTitleFor( 'Userlogin' );
134 $lo = SpecialPage::getTitleFor( 'Userlogout' );
135
136 $rt = $this->mTitle->getPrefixedURL();
137 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
138 $q = array();
139 } else {
140 $q = array( 'returnto' => $rt );
141 }
142
143 $s = array(
144 $this->mainPageLink(),
145 $this->linkKnown(
146 Title::newFromText( wfMsgForContent( 'aboutpage' ) ),
147 wfMsg( 'about' )
148 ),
149 $this->linkKnown(
150 Title::newFromText( wfMsgForContent( 'helppage' ) ),
151 wfMsg( 'help' )
152 ),
153 $this->linkKnown(
154 Title::newFromText( wfMsgForContent( 'faqpage' ) ),
155 wfMsg( 'faq' )
156 ),
157 $this->specialLink( 'specialpages' )
158 );
159
160 /* show links to different language variants */
161 if( $this->variantLinks() ) {
162 $s[] = $this->variantLinks();
163 }
164 if( $this->extensionTabLinks() ) {
165 $s[] = $this->extensionTabLinks();
166 }
167 if ( $wgUser->isLoggedIn() ) {
168 $s[] = $this->linkKnown(
169 $lo,
170 wfMsg( 'logout' ),
171 array(),
172 $q
173 );
174 } else {
175 $s[] = $this->linkKnown(
176 $li,
177 wfMsg( 'login' ),
178 array(),
179 $q
180 );
181 }
182
183 return $wgLang->pipeList( $s );
184 }
185
186 /**
187 * Compute the sidebar
188 * @access private
189 */
190 function quickBar(){
191 global $wgOut, $wgUser, $wgEnableUploads;
192
193 $tns = $this->mTitle->getNamespace();
194
195 $s = "\n<div id='quickbar'>";
196
197 $sep = '<br />';
198 $s .= $this->menuHead( 'qbfind' );
199 $s .= $this->searchForm();
200
201 $s .= $this->menuHead( 'qbbrowse' );
202
203 # Use the first heading from the Monobook sidebar as the "browse" section
204 $bar = $this->buildSidebar();
205 unset( $bar['SEARCH'] );
206 unset( $bar['LANGUAGES'] );
207 unset( $bar['TOOLBOX'] );
208 $browseLinks = reset( $bar );
209
210 foreach ( $browseLinks as $link ) {
211 if ( $link['text'] != '-' ) {
212 $s .= "<a href=\"{$link['href']}\">" .
213 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
214 }
215 }
216
217 if ( $wgOut->isArticle() ) {
218 $s .= $this->menuHead( 'qbedit' );
219 $s .= '<strong>' . $this->editThisPage() . '</strong>';
220
221 $s .= $sep . $this->linkKnown(
222 Title::newFromText( wfMsgForContent( 'edithelppage' ) ),
223 wfMsg( 'edithelp' )
224 );
225
226 if( $wgUser->isLoggedIn() ) {
227 $s .= $sep . $this->moveThisPage();
228 }
229 if ( $wgUser->isAllowed( 'delete' ) ) {
230 $dtp = $this->deleteThisPage();
231 if ( '' != $dtp ) {
232 $s .= $sep . $dtp;
233 }
234 }
235 if ( $wgUser->isAllowed( 'protect' ) ) {
236 $ptp = $this->protectThisPage();
237 if ( '' != $ptp ) {
238 $s .= $sep . $ptp;
239 }
240 }
241 $s .= $sep;
242
243 $s .= $this->menuHead( 'qbpageoptions' );
244 $s .= $this->talkLink()
245 . $sep . $this->commentLink()
246 . $sep . $this->printableLink();
247 if ( $wgUser->isLoggedIn() ) {
248 $s .= $sep . $this->watchThisPage();
249 }
250
251 $s .= $sep;
252
253 $s .= $this->menuHead( 'qbpageinfo' )
254 . $this->historyLink()
255 . $sep . $this->whatLinksHere()
256 . $sep . $this->watchPageLinksLink();
257
258 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
259 $id = User::idFromName( $this->mTitle->getText() );
260 if( $id != 0 ) {
261 $s .= $sep . $this->userContribsLink();
262 if( $this->showEmailUser( $id ) ) {
263 $s .= $sep . $this->emailUserLink();
264 }
265 }
266 }
267 $s .= $sep;
268 }
269
270 $s .= $this->menuHead( 'qbmyoptions' );
271 if ( $wgUser->isLoggedIn() ) {
272 $name = $wgUser->getName();
273 $tl = $this->link(
274 $wgUser->getTalkPage(),
275 wfMsg( 'mytalk' ),
276 array(),
277 array(),
278 array( 'known', 'noclasses' )
279 );
280 if ( $wgUser->getNewtalk() ) {
281 $tl .= " *";
282 }
283
284 $s .= $this->link(
285 $wgUser->getUserPage(),
286 wfMsg( 'mypage' ),
287 array(),
288 array(),
289 array( 'known', 'noclasses' )
290 )
291 . $sep . $tl
292 . $sep . $this->specialLink( 'watchlist' )
293 . $sep . $this->link(
294 SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
295 wfMsg( 'mycontris' ),
296 array(),
297 array(),
298 array( 'known', 'noclasses' )
299 )
300 . $sep . $this->specialLink( 'preferences' )
301 . $sep . $this->specialLink( 'userlogout' );
302 } else {
303 $s .= $this->specialLink( 'userlogin' );
304 }
305
306 $s .= $this->menuHead( 'qbspecialpages' )
307 . $this->specialLink( 'newpages' )
308 . $sep . $this->specialLink( 'listfiles' )
309 . $sep . $this->specialLink( 'statistics' );
310 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
311 $s .= $sep . $this->specialLink( 'upload' );
312 }
313
314 global $wgSiteSupportPage;
315
316 if( $wgSiteSupportPage ) {
317 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
318 . wfMsg( 'sitesupport' ) . '</a>';
319 }
320
321 $s .= $sep . $this->link(
322 SpecialPage::getTitleFor( 'Specialpages' ),
323 wfMsg( 'moredotdotdot' ),
324 array(),
325 array(),
326 array( 'known', 'noclasses' )
327 );
328
329 $s .= $sep . "\n</div>\n";
330 return $s;
331 }
332
333 function menuHead( $key ){
334 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
335 return $s;
336 }
337
338 function searchForm( $label = '' ){
339 global $wgRequest, $wgUseTwoButtonsSearchForm;
340
341 $search = $wgRequest->getText( 'search' );
342 $action = $this->escapeSearchLink();
343 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
344 if( '' != $label ) {
345 $s .= "{$label}: ";
346 }
347
348 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
349 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
350 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
351
352 if( $wgUseTwoButtonsSearchForm )
353 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
354 else
355 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
356
357 $s .= '</form>';
358
359 // Ensure unique id's for search boxes made after the first
360 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
361
362 return $s;
363 }
364 }