Various XHTML fixes
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * See skin.doc
4 *
5 * @todo document
6 * @package MediaWiki
7 * @subpackage Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die();
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";
22 }
23 function getSkinName() {
24 return "cologneblue";
25 }
26
27 function doBeforeContent() {
28 global $wgUser, $wgOut, $wgTitle, $wgSiteNotice;
29
30 $s = "";
31 $qb = $this->qbSetting();
32 $mainPageObj = Title::newMainPage();
33
34 $s .= "\n<div id='content'>\n<div id='topbar'>" .
35 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
36
37 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
38 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
39 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
40
41 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
42 $s .= $this->sysLinks();
43 $s .= "</td></tr><tr><td valign='top'>";
44
45 $s .= "<font size='-1'><span id='sitesub'>";
46 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
47 $s .= "</td><td align='right'>" ;
48
49 $s .= "<font size='-1'><span id='langlinks'>" ;
50 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
51 $cat = $this->getCategoryLinks();
52 if( $cat ) $s .= "<br />$cat\n";
53 $s .= "<br />" . $this->pageTitleLinks();
54 $s .= "</span></font>";
55
56 $s .= "</td></tr></table>\n";
57
58 $s .= "\n</div>\n<div id='article'>";
59
60 if( $wgSiteNotice ) {
61 $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
62 }
63 $s .= $this->pageTitle();
64 $s .= $this->pageSubtitle() . "\n";
65 return $s;
66 }
67
68 function doAfterContent()
69 {
70 global $wgUser, $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 function doGetUserStyles()
100 {
101 global $wgUser, $wgOut, $wgStyleSheetPath;
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
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 }
117 return $s;
118 }
119 function sysLinks()
120 {
121 global $wgUser, $wgContLang, $wgTitle;
122 $li = $wgContLang->specialPage("Userlogin");
123 $lo = $wgContLang->specialPage("Userlogout");
124
125 $rt = $wgTitle->getPrefixedURL();
126 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
127 $q = "";
128 } else {
129 $q = "returnto={$rt}";
130 }
131
132 $s = "" .
133 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
134 . " | " .
135 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
136 . " | " .
137 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
138 . " | " .
139 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
140 . " | " .
141 $this->specialLink( "specialpages" ) . " | ";
142
143 if ( $wgUser->getID() )
144 {
145 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
146 }
147 else
148 {
149 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
150 }
151
152 /* show links to different language variants */
153 global $wgDisableLangConversion;
154 $variants = $wgContLang->getVariants();
155 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
156 $actstr = '';
157 foreach( $variants as $code ) {
158 $varname = $wgContLang->getVariantname( $code );
159 if( $varname == 'disable' )
160 continue;
161 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
162 }
163 }
164
165
166
167 return $s;
168 }
169
170 /**
171 * Compute the sidebar
172 * @private
173 */
174 function quickBar()
175 {
176 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks;
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 foreach ( $wgNavigationLinks as $link ) {
189 $msg = wfMsgForContent( $link['href'] );
190 $text = wfMsg( $link['text'] );
191 if ( $msg != '-' && $text != '-' ) {
192 $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
193 htmlspecialchars( $text ) . '</a>' . $sep;
194 }
195 }
196
197 if ( $wgOut->isArticle() ) {
198 $s .= $this->menuHead( "qbedit" );
199 $s .= "<strong>" . $this->editThisPage() . "</strong>";
200
201 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
202
203 if ( 0 != $wgUser->getID() ) {
204 $s .= $sep . $this->moveThisPage();
205 }
206 if ( $wgUser->isAllowed('delete') ) {
207 $dtp = $this->deleteThisPage();
208 if ( "" != $dtp ) {
209 $s .= $sep . $dtp;
210 }
211 }
212 if ( $wgUser->isAllowed('protect') ) {
213 $ptp = $this->protectThisPage();
214 if ( "" != $ptp ) {
215 $s .= $sep . $ptp;
216 }
217 }
218 $s .= $sep;
219
220 $s .= $this->menuHead( "qbpageoptions" );
221 $s .= $this->talkLink()
222 . $sep . $this->commentLink()
223 . $sep . $this->printableLink();
224 if ( 0 != $wgUser->getID() ) {
225 $s .= $sep . $this->watchThisPage();
226 }
227
228 $s .= $sep;
229
230 $s .= $this->menuHead("qbpageinfo")
231 . $this->historyLink()
232 . $sep . $this->whatLinksHere()
233 . $sep . $this->watchPageLinksLink();
234
235 if ( Namespace::getUser() == $tns || Namespace::getTalk(Namespace::getUser()) == $tns ) {
236 $id=User::idFromName($wgTitle->getText());
237 if ($id != 0) {
238 $s .= $sep . $this->userContribsLink();
239 if( $this->showEmailUser( $id ) ) {
240 $s .= $sep . $this->emailUserLink();
241 }
242 }
243 }
244 $s .= $sep;
245 }
246
247 $s .= $this->menuHead( "qbmyoptions" );
248 if ( 0 != $wgUser->getID() ) {
249 $name = $wgUser->getName();
250 $tl = $this->makeKnownLink( $wgContLang->getNsText(
251 Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
252 wfMsg( "mytalk" ) );
253 if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
254
255 $s .= $this->makeKnownLink( $wgContLang->getNsText(
256 Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
257 . $sep . $tl
258 . $sep . $this->specialLink( "watchlist" )
259 . $sep . $this->makeKnownLink( $wgContLang->specialPage( "Contributions" ),
260 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
261 . $sep . $this->specialLink( "preferences" )
262 . $sep . $this->specialLink( "userlogout" );
263 } else {
264 $s .= $this->specialLink( "userlogin" );
265 }
266
267 $s .= $this->menuHead( "qbspecialpages" )
268 . $this->specialLink( "newpages" )
269 . $sep . $this->specialLink( "imagelist" )
270 . $sep . $this->specialLink( "statistics" )
271 . $sep . $this->bugReportsLink();
272 if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
273 $s .= $sep . $this->specialLink( "upload" );
274 }
275 global $wgSiteSupportPage;
276 if( $wgSiteSupportPage) {
277 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
278 .wfMsg( "sitesupport" )."</a>";
279 }
280
281 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( "Specialpages" ), wfMsg("moredotdotdot") );
282
283 $s .= $sep . "\n</div>\n";
284 return $s;
285 }
286
287 function menuHead( $key )
288 {
289 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
290 return $s;
291 }
292
293 function searchForm( $label = "" )
294 {
295 global $wgRequest;
296
297 $search = $wgRequest->getText( 'search' );
298 $action = $this->escapeSearchLink();
299 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
300 if ( "" != $label ) { $s .= "{$label}: "; }
301
302 $s .= "<input type='text' name=\"search\" size='14' value=\""
303 . htmlspecialchars(substr($search,0,256)) . "\" />"
304 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
305
306 return $s;
307 }
308 }
309
310 ?>