Bump $wgStyleVersion to 155.
[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;
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 .= "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ) . " | "
84 . $this->aboutLink() . " | "
85 . $this->searchForm( wfMsg( "qbfind" ) );
86
87 $s .= "\n<br />" . $this->pageStats();
88
89 $s .= "</td>";
90 if ( 2 == $qb ) { # Right
91 $s .= $this->getQuickbarCompensator();
92 }
93 $s .= "</tr></table>\n</div>\n</div>\n";
94
95 if ( 0 != $qb ) { $s .= $this->quickBar(); }
96 return $s;
97 }
98
99 function doGetUserStyles() {
100 global $wgOut;
101 $s = parent::doGetUserStyles();
102 $qb = $this->qbSetting();
103
104 if ( 2 == $qb ) { # Right
105 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
106 "#article { margin-left: 4px; margin-right: 148px; }\n";
107 } else if ( 1 == $qb ) {
108 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
109 "#article { margin-left: 148px; margin-right: 4px; }\n";
110 } else if ( 3 == $qb ) { # Floating left
111 $s .= "#quickbar { position:absolute; left:4px } \n" .
112 "#topbar { margin-left: 148px }\n" .
113 "#article { margin-left:148px; margin-right: 4px; } \n" .
114 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
115 } else if ( 4 == $qb ) { # Floating right
116 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
117 "#topbar { margin-right: 148px }\n" .
118 "#article { margin-right: 148px; margin-left: 4px; } \n" .
119 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
120 }
121 return $s;
122 }
123
124 function sysLinks() {
125 global $wgUser, $wgContLang, $wgTitle;
126 $li = $wgContLang->specialPage("Userlogin");
127 $lo = $wgContLang->specialPage("Userlogout");
128
129 $rt = $wgTitle->getPrefixedURL();
130 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
131 $q = "";
132 } else {
133 $q = "returnto={$rt}";
134 }
135
136 $s = "" .
137 $this->mainPageLink()
138 . " | " .
139 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
140 . " | " .
141 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
142 . " | " .
143 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
144 . " | " .
145 $this->specialLink( "specialpages" );
146
147 /* show links to different language variants */
148 $s .= $this->variantLinks();
149 $s .= $this->extensionTabLinks();
150
151 $s .= " | ";
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 $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 $browseLinks = reset( $bar );
182
183 foreach ( $browseLinks as $link ) {
184 if ( $link['text'] != '-' ) {
185 $s .= "<a href=\"{$link['href']}\">" .
186 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
187 }
188 }
189
190 if ( $wgOut->isArticle() ) {
191 $s .= $this->menuHead( "qbedit" );
192 $s .= "<strong>" . $this->editThisPage() . "</strong>";
193
194 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
195
196 if( $wgUser->isLoggedIn() ) {
197 $s .= $sep . $this->moveThisPage();
198 }
199 if ( $wgUser->isAllowed('delete') ) {
200 $dtp = $this->deleteThisPage();
201 if ( "" != $dtp ) {
202 $s .= $sep . $dtp;
203 }
204 }
205 if ( $wgUser->isAllowed('protect') ) {
206 $ptp = $this->protectThisPage();
207 if ( "" != $ptp ) {
208 $s .= $sep . $ptp;
209 }
210 }
211 $s .= $sep;
212
213 $s .= $this->menuHead( "qbpageoptions" );
214 $s .= $this->talkLink()
215 . $sep . $this->commentLink()
216 . $sep . $this->printableLink();
217 if ( $wgUser->isLoggedIn() ) {
218 $s .= $sep . $this->watchThisPage();
219 }
220
221 $s .= $sep;
222
223 $s .= $this->menuHead("qbpageinfo")
224 . $this->historyLink()
225 . $sep . $this->whatLinksHere()
226 . $sep . $this->watchPageLinksLink();
227
228 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
229 $id=User::idFromName($wgTitle->getText());
230 if ($id != 0) {
231 $s .= $sep . $this->userContribsLink();
232 if( $this->showEmailUser( $id ) ) {
233 $s .= $sep . $this->emailUserLink();
234 }
235 }
236 }
237 $s .= $sep;
238 }
239
240 $s .= $this->menuHead( "qbmyoptions" );
241 if ( $wgUser->isLoggedIn() ) {
242 $name = $wgUser->getName();
243 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
244 wfMsg( 'mytalk' ) );
245 if ( $wgUser->getNewtalk() ) {
246 $tl .= " *";
247 }
248
249 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
250 wfMsg( "mypage" ) )
251 . $sep . $tl
252 . $sep . $this->specialLink( "watchlist" )
253 . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
254 wfMsg( "mycontris" ) )
255 . $sep . $this->specialLink( "preferences" )
256 . $sep . $this->specialLink( "userlogout" );
257 } else {
258 $s .= $this->specialLink( "userlogin" );
259 }
260
261 $s .= $this->menuHead( "qbspecialpages" )
262 . $this->specialLink( "newpages" )
263 . $sep . $this->specialLink( "imagelist" )
264 . $sep . $this->specialLink( "statistics" )
265 . $sep . $this->bugReportsLink();
266 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
267 $s .= $sep . $this->specialLink( "upload" );
268 }
269 global $wgSiteSupportPage;
270 if( $wgSiteSupportPage) {
271 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
272 .wfMsg( "sitesupport" )."</a>";
273 }
274
275 $s .= $sep . $this->makeKnownLinkObj(
276 SpecialPage::getTitleFor( 'Specialpages' ),
277 wfMsg( 'moredotdotdot' ) );
278
279 $s .= $sep . "\n</div>\n";
280 return $s;
281 }
282
283 function menuHead( $key )
284 {
285 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
286 return $s;
287 }
288
289 function searchForm( $label = "" )
290 {
291 global $wgRequest;
292
293 $search = $wgRequest->getText( 'search' );
294 $action = $this->escapeSearchLink();
295 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
296 if ( "" != $label ) { $s .= "{$label}: "; }
297
298 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
299 . htmlspecialchars(substr($search,0,256)) . "\" /><br />"
300 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( "searcharticle" ) ) . "\" />"
301 . "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
302
303 // Ensure unique id's for search boxes made after the first
304 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
305
306 return $s;
307 }
308 }
309
310