Nov. branch merge. Various features backported from stable, various bug fixes.
[lhc/web/wiklou.git] / includes / SkinCologneBlue.php
1 <?
2 # See skin.doc
3
4 class SkinCologneBlue extends Skin {
5
6 function initPage()
7 {
8 global $wgOut, $wgStyleSheetPath;
9
10 $wgOut->addLink( "stylesheet", "",
11 "{$wgStyleSheetPath}/cologneblue.css" );
12 }
13
14 function doBeforeContent()
15 {
16 global $wgUser, $wgOut, $wgTitle;
17
18 $s = "";
19 $qb = $this->qbSetting();
20
21 $s .= "\n<div id='content'>\n<div id='topbar'>" .
22 "<table width='100%' border=0 cellspacing=0 cellpadding=8><tr>";
23
24 $s .= "<td class='top' align=left valign=middle nowrap>";
25 $s .= "<a href=\"" . wfLocalUrlE( wfMsg( "mainpage" ) ) . "\">";
26 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
27
28 $s .= "</td><td class='top' align=right valign=bottom width='100%'>";
29 $s .= $this->sysLinks();
30 $s .= "</td></tr><tr><td valign=top>";
31
32 $s .= "<font size='-1'><span id='sitesub'>";
33 $s .= wfMsg( "sitesubtitle" ) . "</span></font>";
34 $s .= "</td><td align=right>" ;
35
36 $s .= "<font size='-1'><span id='langlinks'>" ;
37 $s .= str_replace ( "<br>" , "" , $this->otherLanguages() ) ;
38 $s .= "<br>" . $this->pageTitleLinks();
39 $s .= "</span></font>";
40
41 $s .= "</td></tr></table>\n";
42
43 $s .= "\n</div>\n<div id='article'>";
44
45 $s .= $this->pageTitle();
46 $s .= $this->pageSubtitle() . "\n<p>";
47 return $s;
48 }
49
50 function doAfterContent()
51 {
52 global $wgUser, $wgOut;
53
54 $s = "\n</div><br clear=all>\n";
55
56 $s .= "\n<div id='footer'>";
57 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
58
59 $qb = $this->qbSetting();
60 if ( 1 == $qb || 3 == $qb ) { # Left
61 $s .= $this->getQuickbarCompensator();
62 }
63 $s .= "<td class='bottom' align=center valign=top>";
64
65 $s .= $this->bottomLinks();
66 $s .= "\n<br>" . $this->makeKnownLink( wfMsg( "mainpage" ),
67 wfMsg( "mainpage" ) ) . " | "
68 . $this->aboutLink() . " | "
69 . $this->searchForm( wfMsg( "qbfind" ) );
70
71 $s .= "\n<br>" . $this->pageStats();
72
73 $s .= "</td>";
74 if ( 2 == $qb ) { # Right
75 $s .= $this->getQuickbarCompensator();
76 }
77 $s .= "</tr></table>\n</div>\n</div>\n";
78
79 if ( 0 != $qb ) { $s .= $this->quickBar(); }
80 return $s;
81 }
82 function doGetUserStyles()
83 {
84 global $wgUser, $wgOut, $wgStyleSheetPath;
85
86 $s = parent::doGetUserStyles();
87 $qb = $this->qbSetting();
88
89 if ( 2 == $qb ) { # Right
90 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
91 "#article { margin-left: 4px; margin-right: 148px; }\n";
92 } else if ( 1 == $qb || 3 == $qb ) {
93 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
94 "#article { margin-left: 148px; margin-right: 4px; }\n";
95 }
96 return $s;
97 }
98 function sysLinks()
99 {
100 global $wgUser, $wgLang, $wgTitle;
101 $li = $wgLang->specialPage("Userlogin");
102 $lo = $wgLang->specialPage("Userlogout");
103
104 $rt = $wgTitle->getPrefixedURL();
105 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
106 $q = "";
107 } else {
108 $q = "returnto={$rt}";
109 }
110
111 $s .= "\n<br>" . $this->makeKnownLink( $li,
112 wfMsg( "login" ), $q );
113
114 $s = "" .
115 $this->makeKnownLink( wfMsg( "mainpage" ), wfMsg( "mainpage" ) )
116 . " | " .
117 $this->makeKnownLink( wfMsg( "aboutpage" ), wfMsg( "about" ) )
118 . " | " .
119 $this->makeKnownLink( wfMsg( "helppage" ), wfMsg( "help" ) )
120 . " | " .
121 $this->makeKnownLink( wfMsg( "faqpage" ), wfMsg("faq") )
122 . " | " .
123 $this->specialLink( "specialpages" ) . " | ";
124
125 if ( $wgUser->getID() )
126 {
127 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
128 }
129 else
130 {
131 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
132 }
133
134 return $s;
135 }
136
137 function quickBar()
138 {
139 global $wgOut, $wgTitle, $wgUser, $wgLang;
140
141 $s = "\n<div id='quickbar'>";
142
143 $sep = "<br>";
144 $s .= $this->menuHead( "qbfind" );
145 $s .= $this->searchForm();
146
147 $s .= $this->menuHead( "qbbrowse" )
148 . $this->mainPageLink()
149 . $sep . $this->specialLink( "recentchanges" )
150 . $sep . $this->specialLink( "randompage" )
151 . $sep . $this->specialLink( "newpages" )
152 . $sep . $this->specialLink( "imagelist" )
153 . $sep . $this->specialLink( "statistics" )
154 . $sep . $this->specialLink( "specialpages" )
155 . $sep . $this->bugReportsLink() ;
156 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
157 $s .= "\n";
158
159 if ( $wgOut->isArticle() ) {
160 $s .= $this->menuHead( "qbedit" );
161 $s .= "<strong>" . $this->editThisPage() . "</strong>"
162 . $sep . $this->makeKnownLink( wfMsg( "edithelppage" ),
163 wfMsg( "edithelp" ) );
164
165 if ( 0 != $wgUser->getID() ) {
166 $s .= $sep . $this->specialLink( "upload" )
167 . $sep . $this->moveThisPage();
168 }
169 if ( $wgUser->isSysop() ) {
170 $s .= $sep . $this->deleteThisPage() .
171 $sep . $this->protectThisPage();
172 }
173 $s .= $sep;
174
175 $s .= $this->menuHead( "qbpageoptions" );
176 $s .= $this->talkLink()
177 . $sep . $this->printableLink();
178 if ( 0 != $wgUser->getID() ) {
179 $s .= $sep . $this->watchThisPage();
180 }
181 $s .= $sep;
182
183 $s .= $this->menuHead( "qbpageinfo" )
184 . $this->historyLink()
185 . $sep . $this->whatLinksHere()
186 . $sep . $this->watchPageLinksLink();
187
188 if ( Namespace::getUser() == $wgTitle->getNamespace() ) {
189 $s .= $sep . $this->userContribsLink();
190 if ( 0 != $wgUser->getID() ) {
191 $s .= $sep . $this->emailUserLink();
192 }
193 }
194 $s .= $sep;
195 }
196 $s .= $this->menuHead( "qbmyoptions" );
197 if ( 0 != $wgUser->getID() ) {
198 $name = $wgUser->getName();
199 $tl = $this->makeKnownLink( $wgLang->getNsText(
200 Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
201 wfMsg( "mytalk" ) );
202 if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
203
204 $s .= $this->makeKnownLink( $wgLang->getNsText(
205 Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
206 . $sep . $tl
207 . $sep . $this->specialLink( "watchlist" )
208 . $sep . $this->specialLink( "preferences" )
209 . $sep . $this->specialLink( "userlogout" );
210 } else {
211 $s .= $this->specialLink( "userlogin" );
212 }
213 $s .= $sep . "\n</div>\n";
214 return $s;
215 }
216
217 function menuHead( $key )
218 {
219 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
220 return $s;
221 }
222
223 function searchForm( $label = "" )
224 {
225 global $search;
226 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"" .
227 wfLocalUrlE( "" ) . "\">";
228 if ( "" != $label ) { $s .= "{$label}: "; }
229
230 $s .= "<input type=text name=\"search\" size=10 value=\""
231 . htmlspecialchars(substr($search,0,256)) . "\">"
232 . "<input type=submit value=\"" . wfMsg( "ok" ) . "\"></form>";
233
234 return $s;
235 }
236 }
237
238 ?>