Remove hard coding of pipe separators in skins. Use Language::pipeList as much as...
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * See docs/skin.txt
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 function getSkinName() {
23 return "cologneblue";
24 }
25
26 function doBeforeContent() {
27
28 $s = "";
29 $qb = $this->qbSetting();
30 $mainPageObj = Title::newMainPage();
31
32 $s .= "\n<div id='content'>\n<div id='topbar'>" .
33 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
34
35 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
36 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
37 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
38
39 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
40 $s .= $this->sysLinks();
41 $s .= "</td></tr><tr><td valign='top'>";
42
43 $s .= "<font size='-1'><span id='sitesub'>";
44 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
45 $s .= "</td><td align='right'>" ;
46
47 $s .= "<font size='-1'><span id='langlinks'>" ;
48 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
49 $cat = $this->getCategoryLinks();
50 if( $cat ) $s .= "<br />$cat\n";
51 $s .= "<br />" . $this->pageTitleLinks();
52 $s .= "</span></font>";
53
54 $s .= "</td></tr></table>\n";
55
56 $s .= "\n</div>\n<div id='article'>";
57
58 $notice = wfGetSiteNotice();
59 if( $notice ) {
60 $s .= "\n<div id='siteNotice'>$notice</div>\n";
61 }
62 $s .= $this->pageTitle();
63 $s .= $this->pageSubtitle() . "\n";
64 return $s;
65 }
66
67 function doAfterContent()
68 {
69 global $wgOut, $wgLang;
70
71 $s = "\n</div><br clear='all' />\n";
72
73 $s .= "\n<div id='footer'>";
74 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
75
76 $qb = $this->qbSetting();
77 if ( 1 == $qb || 3 == $qb ) { # Left
78 $s .= $this->getQuickbarCompensator();
79 }
80 $s .= "<td class='bottom' align='center' valign='top'>";
81
82 $s .= $this->bottomLinks();
83 $s .= $wgLang->pipeList( array(
84 "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ),
85 $this->aboutLink(),
86 $this->searchForm( wfMsg( "qbfind" ) )
87 ) );
88
89 $s .= "\n<br />" . $this->pageStats();
90
91 $s .= "</td>";
92 if ( 2 == $qb ) { # Right
93 $s .= $this->getQuickbarCompensator();
94 }
95 $s .= "</tr></table>\n</div>\n</div>\n";
96
97 if ( 0 != $qb ) { $s .= $this->quickBar(); }
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 {
167 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
168
169 $tns=$wgTitle->getNamespace();
170
171 $s = "\n<div id='quickbar'>";
172
173 $sep = "<br />";
174 $s .= $this->menuHead( "qbfind" );
175 $s .= $this->searchForm();
176
177 $s .= $this->menuHead( "qbbrowse" );
178
179 # Use the first heading from the Monobook sidebar as the "browse" section
180 $bar = $this->buildSidebar();
181 unset( $bar['SEARCH'] );
182 unset( $bar['LANGUAGES'] );
183 unset( $bar['TOOLBOX'] );
184 $browseLinks = reset( $bar );
185
186 foreach ( $browseLinks as $link ) {
187 if ( $link['text'] != '-' ) {
188 $s .= "<a href=\"{$link['href']}\">" .
189 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
190 }
191 }
192
193 if ( $wgOut->isArticle() ) {
194 $s .= $this->menuHead( "qbedit" );
195 $s .= "<strong>" . $this->editThisPage() . "</strong>";
196
197 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
198
199 if( $wgUser->isLoggedIn() ) {
200 $s .= $sep . $this->moveThisPage();
201 }
202 if ( $wgUser->isAllowed('delete') ) {
203 $dtp = $this->deleteThisPage();
204 if ( "" != $dtp ) {
205 $s .= $sep . $dtp;
206 }
207 }
208 if ( $wgUser->isAllowed('protect') ) {
209 $ptp = $this->protectThisPage();
210 if ( "" != $ptp ) {
211 $s .= $sep . $ptp;
212 }
213 }
214 $s .= $sep;
215
216 $s .= $this->menuHead( "qbpageoptions" );
217 $s .= $this->talkLink()
218 . $sep . $this->commentLink()
219 . $sep . $this->printableLink();
220 if ( $wgUser->isLoggedIn() ) {
221 $s .= $sep . $this->watchThisPage();
222 }
223
224 $s .= $sep;
225
226 $s .= $this->menuHead("qbpageinfo")
227 . $this->historyLink()
228 . $sep . $this->whatLinksHere()
229 . $sep . $this->watchPageLinksLink();
230
231 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
232 $id=User::idFromName($wgTitle->getText());
233 if ($id != 0) {
234 $s .= $sep . $this->userContribsLink();
235 if( $this->showEmailUser( $id ) ) {
236 $s .= $sep . $this->emailUserLink();
237 }
238 }
239 }
240 $s .= $sep;
241 }
242
243 $s .= $this->menuHead( "qbmyoptions" );
244 if ( $wgUser->isLoggedIn() ) {
245 $name = $wgUser->getName();
246 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
247 wfMsg( 'mytalk' ) );
248 if ( $wgUser->getNewtalk() ) {
249 $tl .= " *";
250 }
251
252 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
253 wfMsg( "mypage" ) )
254 . $sep . $tl
255 . $sep . $this->specialLink( "watchlist" )
256 . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
257 wfMsg( "mycontris" ) )
258 . $sep . $this->specialLink( "preferences" )
259 . $sep . $this->specialLink( "userlogout" );
260 } else {
261 $s .= $this->specialLink( "userlogin" );
262 }
263
264 $s .= $this->menuHead( "qbspecialpages" )
265 . $this->specialLink( "newpages" )
266 . $sep . $this->specialLink( "listfiles" )
267 . $sep . $this->specialLink( "statistics" );
268 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
269 $s .= $sep . $this->specialLink( "upload" );
270 }
271 global $wgSiteSupportPage;
272 if( $wgSiteSupportPage) {
273 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
274 .wfMsg( "sitesupport" )."</a>";
275 }
276
277 $s .= $sep . $this->makeKnownLinkObj(
278 SpecialPage::getTitleFor( 'Specialpages' ),
279 wfMsg( 'moredotdotdot' ) );
280
281 $s .= $sep . "\n</div>\n";
282 return $s;
283 }
284
285 function menuHead( $key )
286 {
287 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
288 return $s;
289 }
290
291 function searchForm( $label = "" )
292 {
293 global $wgRequest, $wgUseTwoButtonsSearchForm;
294
295 $search = $wgRequest->getText( 'search' );
296 $action = $this->escapeSearchLink();
297 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
298 if ( "" != $label ) { $s .= "{$label}: "; }
299
300 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
301 . htmlspecialchars(substr($search,0,256)) . "\" /><br />"
302 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( "searcharticle" ) ) . "\" />";
303
304 if ($wgUseTwoButtonsSearchForm)
305 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" />\n";
306 else
307 $s .= '<div><a href="$action" rel="search">' . wfMsg ('powersearch-legend') . "</a></div>\n";
308
309 $s .= '</form>';
310
311 // Ensure unique id's for search boxes made after the first
312 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
313
314 return $s;
315 }
316 }
317
318