sysops -> Sysops
[mediawiki.git] / skins / CologneBlue.php
blob6889b396dc0d13e99de08580e6c5dd41b451dd70
1 <?php
2 /**
3 * See docs/skin.txt
5 * @todo document
6 * @addtogroup Skins
7 */
9 if( !defined( 'MEDIAWIKI' ) )
10 die( -1 );
12 /**
13 * @todo document
14 * @addtogroup Skins
16 class SkinCologneBlue extends Skin {
18 private $searchboxes = '';
19 // How many search boxes have we made? Avoid duplicate id's.
21 function getStylesheet() {
22 return 'common/cologneblue.css';
24 function getSkinName() {
25 return "cologneblue";
28 function doBeforeContent() {
30 $s = "";
31 $qb = $this->qbSetting();
32 $mainPageObj = Title::newMainPage();
34 $s .= "\n<div id='content'>\n<div id='topbar'>" .
35 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
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>";
41 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
42 $s .= $this->sysLinks();
43 $s .= "</td></tr><tr><td valign='top'>";
45 $s .= "<font size='-1'><span id='sitesub'>";
46 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
47 $s .= "</td><td align='right'>" ;
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>";
56 $s .= "</td></tr></table>\n";
58 $s .= "\n</div>\n<div id='article'>";
60 $notice = wfGetSiteNotice();
61 if( $notice ) {
62 $s .= "\n<div id='siteNotice'>$notice</div>\n";
64 $s .= $this->pageTitle();
65 $s .= $this->pageSubtitle() . "\n";
66 return $s;
69 function doAfterContent()
71 global $wgOut;
73 $s = "\n</div><br clear='all' />\n";
75 $s .= "\n<div id='footer'>";
76 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
78 $qb = $this->qbSetting();
79 if ( 1 == $qb || 3 == $qb ) { # Left
80 $s .= $this->getQuickbarCompensator();
82 $s .= "<td class='bottom' align='center' valign='top'>";
84 $s .= $this->bottomLinks();
85 $s .= "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ) . " | "
86 . $this->aboutLink() . " | "
87 . $this->searchForm( wfMsg( "qbfind" ) );
89 $s .= "\n<br />" . $this->pageStats();
91 $s .= "</td>";
92 if ( 2 == $qb ) { # Right
93 $s .= $this->getQuickbarCompensator();
95 $s .= "</tr></table>\n</div>\n</div>\n";
97 if ( 0 != $qb ) { $s .= $this->quickBar(); }
98 return $s;
101 function doGetUserStyles() {
102 global $wgOut;
103 $s = parent::doGetUserStyles();
104 $qb = $this->qbSetting();
106 if ( 2 == $qb ) { # Right
107 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
108 "#article { margin-left: 4px; margin-right: 148px; }\n";
109 } else if ( 1 == $qb ) {
110 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
111 "#article { margin-left: 148px; margin-right: 4px; }\n";
112 } else if ( 3 == $qb ) { # Floating left
113 $s .= "#quickbar { position:absolute; left:4px } \n" .
114 "#topbar { margin-left: 148px }\n" .
115 "#article { margin-left:148px; margin-right: 4px; } \n" .
116 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
117 } else if ( 4 == $qb ) { # Floating right
118 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
119 "#topbar { margin-right: 148px }\n" .
120 "#article { margin-right: 148px; margin-left: 4px; } \n" .
121 "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
123 return $s;
126 function sysLinks() {
127 global $wgUser, $wgContLang, $wgTitle;
128 $li = $wgContLang->specialPage("Userlogin");
129 $lo = $wgContLang->specialPage("Userlogout");
131 $rt = $wgTitle->getPrefixedURL();
132 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
133 $q = "";
134 } else {
135 $q = "returnto={$rt}";
138 $s = "" .
139 $this->mainPageLink()
140 . " | " .
141 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
142 . " | " .
143 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
144 . " | " .
145 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
146 . " | " .
147 $this->specialLink( "specialpages" );
149 /* show links to different language variants */
150 $s .= $this->variantLinks();
151 $s .= $this->extensionTabLinks();
153 $s .= " | ";
154 if ( $wgUser->isLoggedIn() ) {
155 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
156 } else {
157 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
160 return $s;
164 * Compute the sidebar
165 * @access private
167 function quickBar()
169 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
171 $tns=$wgTitle->getNamespace();
173 $s = "\n<div id='quickbar'>";
175 $sep = "<br />";
176 $s .= $this->menuHead( "qbfind" );
177 $s .= $this->searchForm();
179 $s .= $this->menuHead( "qbbrowse" );
181 # Use the first heading from the Monobook sidebar as the "browse" section
182 $bar = $this->buildSidebar();
183 $browseLinks = reset( $bar );
185 foreach ( $browseLinks as $link ) {
186 if ( $link['text'] != '-' ) {
187 $s .= "<a href=\"{$link['href']}\">" .
188 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
192 if ( $wgOut->isArticle() ) {
193 $s .= $this->menuHead( "qbedit" );
194 $s .= "<strong>" . $this->editThisPage() . "</strong>";
196 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
198 if( $wgUser->isLoggedIn() ) {
199 $s .= $sep . $this->moveThisPage();
201 if ( $wgUser->isAllowed('delete') ) {
202 $dtp = $this->deleteThisPage();
203 if ( "" != $dtp ) {
204 $s .= $sep . $dtp;
207 if ( $wgUser->isAllowed('protect') ) {
208 $ptp = $this->protectThisPage();
209 if ( "" != $ptp ) {
210 $s .= $sep . $ptp;
213 $s .= $sep;
215 $s .= $this->menuHead( "qbpageoptions" );
216 $s .= $this->talkLink()
217 . $sep . $this->commentLink()
218 . $sep . $this->printableLink();
219 if ( $wgUser->isLoggedIn() ) {
220 $s .= $sep . $this->watchThisPage();
223 $s .= $sep;
225 $s .= $this->menuHead("qbpageinfo")
226 . $this->historyLink()
227 . $sep . $this->whatLinksHere()
228 . $sep . $this->watchPageLinksLink();
230 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
231 $id=User::idFromName($wgTitle->getText());
232 if ($id != 0) {
233 $s .= $sep . $this->userContribsLink();
234 if( $this->showEmailUser( $id ) ) {
235 $s .= $sep . $this->emailUserLink();
239 $s .= $sep;
242 $s .= $this->menuHead( "qbmyoptions" );
243 if ( $wgUser->isLoggedIn() ) {
244 $name = $wgUser->getName();
245 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
246 wfMsg( 'mytalk' ) );
247 if ( $wgUser->getNewtalk() ) {
248 $tl .= " *";
251 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
252 wfMsg( "mypage" ) )
253 . $sep . $tl
254 . $sep . $this->specialLink( "watchlist" )
255 . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
256 wfMsg( "mycontris" ) )
257 . $sep . $this->specialLink( "preferences" )
258 . $sep . $this->specialLink( "userlogout" );
259 } else {
260 $s .= $this->specialLink( "userlogin" );
263 $s .= $this->menuHead( "qbspecialpages" )
264 . $this->specialLink( "newpages" )
265 . $sep . $this->specialLink( "imagelist" )
266 . $sep . $this->specialLink( "statistics" )
267 . $sep . $this->bugReportsLink();
268 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
269 $s .= $sep . $this->specialLink( "upload" );
271 global $wgSiteSupportPage;
272 if( $wgSiteSupportPage) {
273 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
274 .wfMsg( "sitesupport" )."</a>";
277 $s .= $sep . $this->makeKnownLinkObj(
278 SpecialPage::getTitleFor( 'Specialpages' ),
279 wfMsg( 'moredotdotdot' ) );
281 $s .= $sep . "\n</div>\n";
282 return $s;
285 function menuHead( $key )
287 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
288 return $s;
291 function searchForm( $label = "" )
293 global $wgRequest;
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}: "; }
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 . "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
305 // Ensure unique id's for search boxes made after the first
306 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
308 return $s;