ee0c91b267d22bb72fa08275fb447facbf8cdafd
[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 = '';
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 $s .= parent::doGetUserStyles();
118 return $s;
119 }
120 function sysLinks()
121 {
122 global $wgUser, $wgContLang, $wgTitle;
123 $li = $wgContLang->specialPage("Userlogin");
124 $lo = $wgContLang->specialPage("Userlogout");
125
126 $rt = $wgTitle->getPrefixedURL();
127 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
128 $q = "";
129 } else {
130 $q = "returnto={$rt}";
131 }
132
133 $s = "" .
134 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
135 . " | " .
136 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
137 . " | " .
138 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
139 . " | " .
140 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
141 . " | " .
142 $this->specialLink( "specialpages" ) . " | ";
143
144 if ( $wgUser->getID() )
145 {
146 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
147 }
148 else
149 {
150 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
151 }
152
153 return $s;
154 }
155
156 /**
157 * Compute the sidebar
158 * @private
159 */
160 function quickBar()
161 {
162 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks;
163
164 $tns=$wgTitle->getNamespace();
165
166 $s = "\n<div id='quickbar'>";
167
168 $sep = "<br />";
169 $s .= $this->menuHead( "qbfind" );
170 $s .= $this->searchForm();
171
172 $s .= $this->menuHead( "qbbrowse" );
173
174 foreach ( $wgNavigationLinks as $link ) {
175 $msg = wfMsgForContent( $link['href'] );
176 $text = wfMsg( $link['text'] );
177 if ( $msg != '-' && $text != '-' ) {
178 $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
179 htmlspecialchars( $text ) . '</a>' . $sep;
180 }
181 }
182
183 if ( $wgOut->isArticle() ) {
184 $s .= $this->menuHead( "qbedit" );
185 $s .= "<strong>" . $this->editThisPage() . "</strong>";
186
187 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
188
189 if ( 0 != $wgUser->getID() ) {
190 $s .= $sep . $this->moveThisPage();
191 }
192 if ( $wgUser->isAllowed('delete') ) {
193 $dtp = $this->deleteThisPage();
194 if ( "" != $dtp ) {
195 $s .= $sep . $dtp;
196 }
197 }
198 if ( $wgUser->isAllowed('protect') ) {
199 $ptp = $this->protectThisPage();
200 if ( "" != $ptp ) {
201 $s .= $sep . $ptp;
202 }
203 }
204 $s .= $sep;
205
206 $s .= $this->menuHead( "qbpageoptions" );
207 $s .= $this->talkLink()
208 . $sep . $this->commentLink()
209 . $sep . $this->printableLink();
210 if ( 0 != $wgUser->getID() ) {
211 $s .= $sep . $this->watchThisPage();
212 }
213
214 $s .= $sep;
215
216 $s .= $this->menuHead("qbpageinfo")
217 . $this->historyLink()
218 . $sep . $this->whatLinksHere()
219 . $sep . $this->watchPageLinksLink();
220
221 if ( Namespace::getUser() == $tns || Namespace::getTalk(Namespace::getUser()) == $tns ) {
222 $id=User::idFromName($wgTitle->getText());
223 if ($id != 0) {
224 $s .= $sep . $this->userContribsLink();
225 if( $this->showEmailUser( $id ) ) {
226 $s .= $sep . $this->emailUserLink();
227 }
228 }
229 }
230 $s .= $sep;
231 }
232
233 $s .= $this->menuHead( "qbmyoptions" );
234 if ( 0 != $wgUser->getID() ) {
235 $name = $wgUser->getName();
236 $tl = $this->makeKnownLink( $wgContLang->getNsText(
237 Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
238 wfMsg( "mytalk" ) );
239 if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
240
241 $s .= $this->makeKnownLink( $wgContLang->getNsText(
242 Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
243 . $sep . $tl
244 . $sep . $this->specialLink( "watchlist" )
245 . $sep . $this->makeKnownLink( $wgContLang->specialPage( "Contributions" ),
246 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
247 . $sep . $this->specialLink( "preferences" )
248 . $sep . $this->specialLink( "userlogout" );
249 } else {
250 $s .= $this->specialLink( "userlogin" );
251 }
252
253 $s .= $this->menuHead( "qbspecialpages" )
254 . $this->specialLink( "newpages" )
255 . $sep . $this->specialLink( "imagelist" )
256 . $sep . $this->specialLink( "statistics" )
257 . $sep . $this->bugReportsLink();
258 if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
259 $s .= $sep . $this->specialLink( "upload" );
260 }
261 global $wgSiteSupportPage;
262 if( $wgSiteSupportPage) {
263 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
264 .wfMsg( "sitesupport" )."</a>";
265 }
266
267 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( "Specialpages" ), wfMsg("moredotdotdot") );
268
269 $s .= $sep . "\n</div>\n";
270 return $s;
271 }
272
273 function menuHead( $key )
274 {
275 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
276 return $s;
277 }
278
279 function searchForm( $label = "" )
280 {
281 global $wgRequest;
282
283 $search = $wgRequest->getText( 'search' );
284 $action = $this->escapeSearchLink();
285 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
286 if ( "" != $label ) { $s .= "{$label}: "; }
287
288 $s .= "<input type='text' name=\"search\" size='14' value=\""
289 . htmlspecialchars(substr($search,0,256)) . "\" />"
290 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
291
292 return $s;
293 }
294 }
295
296 ?>