* (bug 6100) BiDi: different directionality for user interface and wiki content ...
[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?1";
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, $wgLang, $wgUser;
102 $s = parent::doGetUserStyles();
103 $qb = $this->qbSetting();
104
105 if ( (!$wgUser->isLoggedIn() && $wgLang->isRTL() ) ||
106 ( 2 == $qb ) ) { # Right
107 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
108 "#article { margin-left: 4px; margin-right: 148px; }\n";
109 } else if ( (!$wgUser->isLoggedIn()) || ( 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 left
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
117 } else if ( 4 == $qb ) { # Floating right
118 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
119 "#topbar { margin-right: 148px }\n" .
120 "#article { margin-right: 148px; margin-left: 4px; } \n" .
121 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
122 }
123 return $s;
124 }
125
126 function sysLinks() {
127 global $wgUser, $wgContLang, $wgTitle;
128 $li = $wgContLang->specialPage("Userlogin");
129 $lo = $wgContLang->specialPage("Userlogout");
130
131 $rt = $wgTitle->getPrefixedURL();
132 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
133 $q = "";
134 } else {
135 $q = "returnto={$rt}";
136 }
137
138 $s = "" .
139 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
140 . " | " .
141 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
142 . " | " .
143 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
144 . " | " .
145 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
146 . " | " .
147 $this->specialLink( "specialpages" ) . " | ";
148
149 if ( $wgUser->isLoggedIn() ) {
150 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
151 } else {
152 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
153 }
154
155 /* show links to different language variants */
156 global $wgDisableLangConversion;
157 $variants = $wgContLang->getVariants();
158 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
159 $actstr = '';
160 foreach( $variants as $code ) {
161 $varname = $wgContLang->getVariantname( $code );
162 if( $varname == 'disable' )
163 continue;
164 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
165 }
166 }
167
168 return $s;
169 }
170
171 /**
172 * Compute the sidebar
173 * @access private
174 */
175 function quickBar()
176 {
177 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
178
179 $tns=$wgTitle->getNamespace();
180
181 $s = "\n<div id='quickbar'>";
182
183 $sep = "<br />";
184 $s .= $this->menuHead( "qbfind" );
185 $s .= $this->searchForm();
186
187 $s .= $this->menuHead( "qbbrowse" );
188
189 # Use the first heading from the Monobook sidebar as the "browse" section
190 $bar = $this->buildSidebar();
191 $browseLinks = reset( $bar );
192
193 foreach ( $browseLinks as $link ) {
194 if ( $link['text'] != '-' ) {
195 $s .= "<a href=\"{$link['href']}\">" .
196 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
197 }
198 }
199
200 if ( $wgOut->isArticle() ) {
201 $s .= $this->menuHead( "qbedit" );
202 $s .= "<strong>" . $this->editThisPage() . "</strong>";
203
204 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
205
206 if( $wgUser->isLoggedIn() ) {
207 $s .= $sep . $this->moveThisPage();
208 }
209 if ( $wgUser->isAllowed('delete') ) {
210 $dtp = $this->deleteThisPage();
211 if ( "" != $dtp ) {
212 $s .= $sep . $dtp;
213 }
214 }
215 if ( $wgUser->isAllowed('protect') ) {
216 $ptp = $this->protectThisPage();
217 if ( "" != $ptp ) {
218 $s .= $sep . $ptp;
219 }
220 }
221 $s .= $sep;
222
223 $s .= $this->menuHead( "qbpageoptions" );
224 $s .= $this->talkLink()
225 . $sep . $this->commentLink()
226 . $sep . $this->printableLink();
227 if ( $wgUser->isLoggedIn() ) {
228 $s .= $sep . $this->watchThisPage();
229 }
230
231 $s .= $sep;
232
233 $s .= $this->menuHead("qbpageinfo")
234 . $this->historyLink()
235 . $sep . $this->whatLinksHere()
236 . $sep . $this->watchPageLinksLink();
237
238 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
239 $id=User::idFromName($wgTitle->getText());
240 if ($id != 0) {
241 $s .= $sep . $this->userContribsLink();
242 if( $this->showEmailUser( $id ) ) {
243 $s .= $sep . $this->emailUserLink();
244 }
245 }
246 }
247 $s .= $sep;
248 }
249
250 $s .= $this->menuHead( "qbmyoptions" );
251 if ( $wgUser->isLoggedIn() ) {
252 $name = $wgUser->getName();
253 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
254 wfMsg( 'mytalk' ) );
255 if ( $wgUser->getNewtalk() ) {
256 $tl .= " *";
257 }
258
259 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
260 wfMsg( "mypage" ) )
261 . $sep . $tl
262 . $sep . $this->specialLink( "watchlist" )
263 . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
264 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
265 . $sep . $this->specialLink( "preferences" )
266 . $sep . $this->specialLink( "userlogout" );
267 } else {
268 $s .= $this->specialLink( "userlogin" );
269 }
270
271 $s .= $this->menuHead( "qbspecialpages" )
272 . $this->specialLink( "newpages" )
273 . $sep . $this->specialLink( "imagelist" )
274 . $sep . $this->specialLink( "statistics" )
275 . $sep . $this->bugReportsLink();
276 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
277 $s .= $sep . $this->specialLink( "upload" );
278 }
279 global $wgSiteSupportPage;
280 if( $wgSiteSupportPage) {
281 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
282 .wfMsg( "sitesupport" )."</a>";
283 }
284
285 $s .= $sep . $this->makeKnownLinkObj(
286 Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
287 wfMsg( 'moredotdotdot' ) );
288
289 $s .= $sep . "\n</div>\n";
290 return $s;
291 }
292
293 function menuHead( $key )
294 {
295 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
296 return $s;
297 }
298
299 function searchForm( $label = "" )
300 {
301 global $wgRequest;
302
303 $search = $wgRequest->getText( 'search' );
304 $action = $this->escapeSearchLink();
305 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
306 if ( "" != $label ) { $s .= "{$label}: "; }
307
308 $s .= "<input type='text' name=\"search\" size='14' value=\""
309 . htmlspecialchars(substr($search,0,256)) . "\" />"
310 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
311
312 return $s;
313 }
314 }
315
316 ?>