BUG#523 Don't remove newlines in front of templates or template variables
[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 /**
11 * @todo document
12 * @package MediaWiki
13 * @subpackage Skins
14 */
15 class SkinCologneBlue extends Skin {
16
17 function getStylesheet() {
18 return "common/cologneblue.css";
19 }
20 function getSkinName() {
21 return "cologneblue";
22 }
23
24 function doBeforeContent() {
25 global $wgUser, $wgOut, $wgTitle, $wgSiteNotice;
26
27 $s = "";
28 $qb = $this->qbSetting();
29 $mainPageObj = Title::newMainPage();
30
31 $s .= "\n<div id='content'>\n<div id='topbar'>" .
32 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
33
34 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
35 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
36 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
37
38 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
39 $s .= $this->sysLinks();
40 $s .= "</td></tr><tr><td valign='top'>";
41
42 $s .= "<font size='-1'><span id='sitesub'>";
43 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
44 $s .= "</td><td align='right'>" ;
45
46 $s .= "<font size='-1'><span id='langlinks'>" ;
47 $s .= str_replace ( "<br>" , "" , $this->otherLanguages() );
48 $cat = $this->getCategoryLinks();
49 if( $cat ) $s .= "<br />$cat\n";
50 $s .= "<br />" . $this->pageTitleLinks();
51 $s .= "</span></font>";
52
53 $s .= "</td></tr></table>\n";
54
55 $s .= "\n</div>\n<div id='article'>";
56
57 if( $wgSiteNotice ) {
58 $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
59 }
60 $s .= $this->pageTitle();
61 $s .= $this->pageSubtitle() . "\n";
62 return $s;
63 }
64
65 function doAfterContent()
66 {
67 global $wgUser, $wgOut;
68
69 $s = "\n</div><br clear='all' />\n";
70
71 $s .= "\n<div id='footer'>";
72 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
73
74 $qb = $this->qbSetting();
75 if ( 1 == $qb || 3 == $qb ) { # Left
76 $s .= $this->getQuickbarCompensator();
77 }
78 $s .= "<td class='bottom' align='center' valign='top'>";
79
80 $s .= $this->bottomLinks();
81 $s .= "\n<br />" . $this->makeKnownLink( wfMsg( "mainpage" ) ) . " | "
82 . $this->aboutLink() . " | "
83 . $this->searchForm( wfMsg( "qbfind" ) );
84
85 $s .= "\n<br />" . $this->pageStats();
86
87 $s .= "</td>";
88 if ( 2 == $qb ) { # Right
89 $s .= $this->getQuickbarCompensator();
90 }
91 $s .= "</tr></table>\n</div>\n</div>\n";
92
93 if ( 0 != $qb ) { $s .= $this->quickBar(); }
94 return $s;
95 }
96 function doGetUserStyles()
97 {
98 global $wgUser, $wgOut, $wgStyleSheetPath;
99 $s = '';
100 $qb = $this->qbSetting();
101
102 if ( 2 == $qb ) { # Right
103 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
104 "#article { margin-left: 4px; margin-right: 148px; }\n";
105 } else if ( 1 == $qb ) {
106 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
107 "#article { margin-left: 148px; margin-right: 4px; }\n";
108 } else if ( 3 == $qb ) { # Floating
109 $s .= "#quickbar { position:absolute; left:4px } \n" .
110 "#topbar { margin-left: 148px }\n" .
111 "#article { margin-left:148px; margin-right: 4px; } \n" .
112 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
113 }
114 $s .= parent::doGetUserStyles();
115 return $s;
116 }
117 function sysLinks()
118 {
119 global $wgUser, $wgLang, $wgTitle;
120 $li = $wgLang->specialPage("Userlogin");
121 $lo = $wgLang->specialPage("Userlogout");
122
123 $rt = $wgTitle->getPrefixedURL();
124 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
125 $q = "";
126 } else {
127 $q = "returnto={$rt}";
128 }
129
130 $s = "" .
131 $this->makeKnownLink( wfMsg( "mainpage" ), wfMsg( "mainpage" ) )
132 . " | " .
133 $this->makeKnownLink( wfMsg( "aboutpage" ), wfMsg( "about" ) )
134 . " | " .
135 $this->makeKnownLink( wfMsg( "helppage" ), wfMsg( "help" ) )
136 . " | " .
137 $this->makeKnownLink( wfMsg( "faqpage" ), wfMsg("faq") )
138 . " | " .
139 $this->specialLink( "specialpages" ) . " | ";
140
141 if ( $wgUser->getID() )
142 {
143 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
144 }
145 else
146 {
147 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
148 }
149
150 return $s;
151 }
152
153 function quickBar()
154 {
155 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgDisableUploads;
156
157 $tns=$wgTitle->getNamespace();
158
159 $s = "\n<div id='quickbar'>";
160
161 $sep = "<br />";
162 $s .= $this->menuHead( "qbfind" );
163 $s .= $this->searchForm();
164
165 $s .= $this->menuHead( "qbbrowse" )
166 . $this->mainPageLink()
167 . $sep . $this->specialLink( "recentchanges" )
168 . $sep . $this->specialLink( "randompage" );
169 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
170 $s .= "\n";
171
172 if ( $wgOut->isArticle() ) {
173 $s .= $this->menuHead( "qbedit" );
174 $s .= "<strong>" . $this->editThisPage() . "</strong>";
175
176 $s .= $sep . $this->makeKnownLink( wfMsg( "edithelppage" ), wfMsg( "edithelp" ) );
177
178 if ( 0 != $wgUser->getID() ) {
179 $s .= $sep . $this->moveThisPage();
180 }
181 if ( $wgUser->isSysop() ) {
182 $dtp = $this->deleteThisPage();
183 if ( "" != $dtp ) {
184 $s .= $sep . $dtp;
185 }
186 $ptp = $this->protectThisPage();
187 if ( "" != $ptp ) {
188 $s .= $sep . $ptp;
189 }
190 }
191 $s .= $sep;
192
193 $s .= $this->menuHead( "qbpageoptions" );
194 $s .= $this->talkLink()
195 . $sep . $this->commentLink()
196 . $sep . $this->printableLink();
197 if ( 0 != $wgUser->getID() ) {
198 $s .= $sep . $this->watchThisPage();
199 }
200
201 $s .= $sep;
202
203 $s .= $this->menuHead("qbpageinfo")
204 . $this->historyLink()
205 . $sep . $this->whatLinksHere()
206 . $sep . $this->watchPageLinksLink();
207
208 if ( Namespace::getUser() == $tns || Namespace::getTalk(Namespace::getUser()) == $tns ) {
209 $id=User::idFromName($wgTitle->getText());
210 if ($id != 0) {
211 $s .= $sep . $this->userContribsLink();
212 if ( 0 != $wgUser->getID() ) {
213 $s .= $sep . $this->emailUserLink();
214 }
215 }
216 }
217 $s .= $sep;
218 }
219
220 $s .= $this->menuHead( "qbmyoptions" );
221 if ( 0 != $wgUser->getID() ) {
222 $name = $wgUser->getName();
223 $tl = $this->makeKnownLink( $wgLang->getNsText(
224 Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
225 wfMsg( "mytalk" ) );
226 if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
227
228 $s .= $this->makeKnownLink( $wgLang->getNsText(
229 Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
230 . $sep . $tl
231 . $sep . $this->specialLink( "watchlist" )
232 . $sep . $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
233 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
234 . $sep . $this->specialLink( "preferences" )
235 . $sep . $this->specialLink( "userlogout" );
236 } else {
237 $s .= $this->specialLink( "userlogin" );
238 }
239
240 $s .= $this->menuHead( "qbspecialpages" )
241 . $this->specialLink( "newpages" )
242 . $sep . $this->specialLink( "imagelist" )
243 . $sep . $this->specialLink( "statistics" )
244 . $sep . $this->bugReportsLink();
245 if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
246 $s .= $sep . $this->specialLink( "upload" );
247 }
248 global $wgSiteSupportPage;
249 if( $wgSiteSupportPage) {
250 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
251 .wfMsg( "sitesupport" )."</a>";
252 }
253
254 $s .= $sep . $this->makeKnownLink( $wgLang->specialPage( "Specialpages" ), wfMsg("moredotdotdot") );
255
256 $s .= $sep . "\n</div>\n";
257 return $s;
258 }
259
260 function menuHead( $key )
261 {
262 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
263 return $s;
264 }
265
266 function searchForm( $label = "" )
267 {
268 global $wgRequest;
269
270 $search = $wgRequest->getText( 'search' );
271 $action = $this->escapeSearchLink();
272 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
273 if ( "" != $label ) { $s .= "{$label}: "; }
274
275 $s .= "<input type='text' name=\"search\" size='14' value=\""
276 . htmlspecialchars(substr($search,0,256)) . "\" />"
277 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
278
279 return $s;
280 }
281 }
282
283 ?>