* (bug 6130, bug 5818) Replaced message 'go' with the new message 'searcharticle...
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * See skin.txt
4 *
5 * @todo document
6 * @package MediaWiki
7 * @subpackage Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die( -1 );
12
13 /**
14 * @todo document
15 * @package MediaWiki
16 * @subpackage Skins
17 */
18 class SkinCologneBlue extends Skin {
19
20 function getStylesheet() {
21 return "common/cologneblue.css?2";
22 }
23 function getSkinName() {
24 return "cologneblue";
25 }
26
27 function doBeforeContent() {
28
29 $s = "";
30 $qb = $this->qbSetting();
31 $mainPageObj = Title::newMainPage();
32
33 $s .= "\n<div id='content'>\n<div id='topbar'>" .
34 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
35
36 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
37 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
38 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
39
40 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
41 $s .= $this->sysLinks();
42 $s .= "</td></tr><tr><td valign='top'>";
43
44 $s .= "<font size='-1'><span id='sitesub'>";
45 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
46 $s .= "</td><td align='right'>" ;
47
48 $s .= "<font size='-1'><span id='langlinks'>" ;
49 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
50 $cat = $this->getCategoryLinks();
51 if( $cat ) $s .= "<br />$cat\n";
52 $s .= "<br />" . $this->pageTitleLinks();
53 $s .= "</span></font>";
54
55 $s .= "</td></tr></table>\n";
56
57 $s .= "\n</div>\n<div id='article'>";
58
59 $notice = wfGetSiteNotice();
60 if( $notice ) {
61 $s .= "\n<div id='siteNotice'>$notice</div>\n";
62 }
63 $s .= $this->pageTitle();
64 $s .= $this->pageSubtitle() . "\n";
65 return $s;
66 }
67
68 function doAfterContent()
69 {
70 global $wgOut;
71
72 $s = "\n</div><br clear='all' />\n";
73
74 $s .= "\n<div id='footer'>";
75 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
76
77 $qb = $this->qbSetting();
78 if ( 1 == $qb || 3 == $qb ) { # Left
79 $s .= $this->getQuickbarCompensator();
80 }
81 $s .= "<td class='bottom' align='center' valign='top'>";
82
83 $s .= $this->bottomLinks();
84 $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
85 . $this->aboutLink() . " | "
86 . $this->searchForm( wfMsg( "qbfind" ) );
87
88 $s .= "\n<br />" . $this->pageStats();
89
90 $s .= "</td>";
91 if ( 2 == $qb ) { # Right
92 $s .= $this->getQuickbarCompensator();
93 }
94 $s .= "</tr></table>\n</div>\n</div>\n";
95
96 if ( 0 != $qb ) { $s .= $this->quickBar(); }
97 return $s;
98 }
99
100 function doGetUserStyles() {
101 global $wgOut;
102 $s = parent::doGetUserStyles();
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, $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 = "" .
138 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
139 . " | " .
140 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
141 . " | " .
142 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
143 . " | " .
144 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
145 . " | " .
146 $this->specialLink( "specialpages" ) . " | ";
147
148 if ( $wgUser->isLoggedIn() ) {
149 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
150 } else {
151 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
152 }
153
154 /* show links to different language variants */
155 global $wgDisableLangConversion;
156 $variants = $wgContLang->getVariants();
157 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
158 $actstr = '';
159 foreach( $variants as $code ) {
160 $varname = $wgContLang->getVariantname( $code );
161 if( $varname == 'disable' )
162 continue;
163 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
164 }
165 }
166
167 return $s;
168 }
169
170 /**
171 * Compute the sidebar
172 * @access private
173 */
174 function quickBar()
175 {
176 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
177
178 $tns=$wgTitle->getNamespace();
179
180 $s = "\n<div id='quickbar'>";
181
182 $sep = "<br />";
183 $s .= $this->menuHead( "qbfind" );
184 $s .= $this->searchForm();
185
186 $s .= $this->menuHead( "qbbrowse" );
187
188 # Use the first heading from the Monobook sidebar as the "browse" section
189 $bar = $this->buildSidebar();
190 $browseLinks = reset( $bar );
191
192 foreach ( $browseLinks as $link ) {
193 if ( $link['text'] != '-' ) {
194 $s .= "<a href=\"{$link['href']}\">" .
195 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
196 }
197 }
198
199 if ( $wgOut->isArticle() ) {
200 $s .= $this->menuHead( "qbedit" );
201 $s .= "<strong>" . $this->editThisPage() . "</strong>";
202
203 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
204
205 if( $wgUser->isLoggedIn() ) {
206 $s .= $sep . $this->moveThisPage();
207 }
208 if ( $wgUser->isAllowed('delete') ) {
209 $dtp = $this->deleteThisPage();
210 if ( "" != $dtp ) {
211 $s .= $sep . $dtp;
212 }
213 }
214 if ( $wgUser->isAllowed('protect') ) {
215 $ptp = $this->protectThisPage();
216 if ( "" != $ptp ) {
217 $s .= $sep . $ptp;
218 }
219 }
220 $s .= $sep;
221
222 $s .= $this->menuHead( "qbpageoptions" );
223 $s .= $this->talkLink()
224 . $sep . $this->commentLink()
225 . $sep . $this->printableLink();
226 if ( $wgUser->isLoggedIn() ) {
227 $s .= $sep . $this->watchThisPage();
228 }
229
230 $s .= $sep;
231
232 $s .= $this->menuHead("qbpageinfo")
233 . $this->historyLink()
234 . $sep . $this->whatLinksHere()
235 . $sep . $this->watchPageLinksLink();
236
237 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
238 $id=User::idFromName($wgTitle->getText());
239 if ($id != 0) {
240 $s .= $sep . $this->userContribsLink();
241 if( $this->showEmailUser( $id ) ) {
242 $s .= $sep . $this->emailUserLink();
243 }
244 }
245 }
246 $s .= $sep;
247 }
248
249 $s .= $this->menuHead( "qbmyoptions" );
250 if ( $wgUser->isLoggedIn() ) {
251 $name = $wgUser->getName();
252 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
253 wfMsg( 'mytalk' ) );
254 if ( $wgUser->getNewtalk() ) {
255 $tl .= " *";
256 }
257
258 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
259 wfMsg( "mypage" ) )
260 . $sep . $tl
261 . $sep . $this->specialLink( "watchlist" )
262 . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
263 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
264 . $sep . $this->specialLink( "preferences" )
265 . $sep . $this->specialLink( "userlogout" );
266 } else {
267 $s .= $this->specialLink( "userlogin" );
268 }
269
270 $s .= $this->menuHead( "qbspecialpages" )
271 . $this->specialLink( "newpages" )
272 . $sep . $this->specialLink( "imagelist" )
273 . $sep . $this->specialLink( "statistics" )
274 . $sep . $this->bugReportsLink();
275 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
276 $s .= $sep . $this->specialLink( "upload" );
277 }
278 global $wgSiteSupportPage;
279 if( $wgSiteSupportPage) {
280 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
281 .wfMsg( "sitesupport" )."</a>";
282 }
283
284 $s .= $sep . $this->makeKnownLinkObj(
285 Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
286 wfMsg( 'moredotdotdot' ) );
287
288 $s .= $sep . "\n</div>\n";
289 return $s;
290 }
291
292 function menuHead( $key )
293 {
294 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
295 return $s;
296 }
297
298 function searchForm( $label = "" )
299 {
300 global $wgRequest;
301
302 $search = $wgRequest->getText( 'search' );
303 $action = $this->escapeSearchLink();
304 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
305 if ( "" != $label ) { $s .= "{$label}: "; }
306
307 $s .= "<input type='text' name=\"search\" size='14' value=\""
308 . htmlspecialchars(substr($search,0,256)) . "\" />"
309 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "searcharticle" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
310
311 return $s;
312 }
313 }
314
315 ?>