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