monoboob/main.css cleanup; don't use underscore for selector
[lhc/web/wiklou.git] / skins / Standard.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 SkinStandard extends Skin {
19
20 /**
21 *
22 */
23 function getHeadScripts() {
24 global $wgStylePath;
25
26 $s = parent::getHeadScripts();
27 if ( 3 == $this->qbSetting() ) { # Floating left
28 $s .= "<script language='javascript' type='text/javascript' " .
29 "src='{$wgStylePath}/common/sticky.js'></script>\n";
30 }
31 return $s;
32 }
33
34 /**
35 *
36 */
37 function getUserStyles() {
38 global $wgStylePath;
39 $s = '';
40 if ( 3 == $this->qbSetting() ) { # Floating left
41 $s .= "<style type='text/css'>\n" .
42 "@import '{$wgStylePath}/common/quickbar.css';\n</style>\n";
43 }
44 $s .= parent::getUserStyles();
45 return $s;
46 }
47
48 /**
49 *
50 */
51 function doGetUserStyles() {
52 global $wgUser, $wgOut, $wgStylePath;
53
54 $s = parent::doGetUserStyles();
55 $qb = $this->qbSetting();
56
57 if ( 2 == $qb ) { # Right
58 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
59 "border-left: 2px solid #000000; }\n" .
60 "#article { margin-left: 4px; margin-right: 152px; }\n";
61 } else if ( 1 == $qb || 3 == $qb ) {
62 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
63 "border-right: 1px solid gray; }\n" .
64 "#article { margin-left: 152px; margin-right: 4px; }\n";
65 }
66 return $s;
67 }
68
69 /**
70 *
71 */
72 function getBodyOptions() {
73 $a = parent::getBodyOptions();
74
75 if ( 3 == $this->qbSetting() ) { # Floating left
76 $qb = "setup(\"quickbar\")";
77 if($a["onload"]) {
78 $a["onload"] .= ";$qb";
79 } else {
80 $a["onload"] = $qb;
81 }
82 }
83 return $a;
84 }
85
86 function doAfterContent() {
87 global $wgUser, $wgOut, $wgContLang;
88 $fname = 'SkinStandard::doAfterContent';
89 wfProfileIn( $fname );
90 wfProfileIn( $fname.'-1' );
91
92 $s = "\n</div><br style=\"clear:both\" />\n";
93 $s .= "\n<div id='footer'>";
94 $s .= '<table border="0" cellspacing="0"><tr>';
95
96 wfProfileOut( $fname.'-1' );
97 wfProfileIn( $fname.'-2' );
98
99 $qb = $this->qbSetting();
100 $shove = ($qb != 0);
101 $left = ($qb == 1 || $qb == 3);
102 if($wgContLang->isRTL()) $left = !$left;
103
104 if ( $shove && $left ) { # Left
105 $s .= $this->getQuickbarCompensator();
106 }
107 wfProfileOut( $fname.'-2' );
108 wfProfileIn( $fname.'-3' );
109 $l = $wgContLang->isRTL() ? 'right' : 'left';
110 $s .= "<td class='bottom' align='$l' valign='top'>";
111
112 $s .= $this->bottomLinks();
113 $s .= "\n<br />" . $this->mainPageLink()
114 . ' | ' . $this->aboutLink()
115 . ' | ' . $this->specialLink( 'recentchanges' )
116 . ' | ' . $this->searchForm()
117 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
118
119 $s .= "</td>";
120 if ( $shove && !$left ) { # Right
121 $s .= $this->getQuickbarCompensator();
122 }
123 $s .= "</tr></table>\n</div>\n</div>\n";
124
125 wfProfileOut( $fname.'-3' );
126 wfProfileIn( $fname.'-4' );
127 if ( 0 != $qb ) { $s .= $this->quickBar(); }
128 wfProfileOut( $fname.'-4' );
129 wfProfileOut( $fname );
130 return $s;
131 }
132
133 function quickBar() {
134 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
135 global $wgDisableUploads, $wgRemoteUploads, $wgNavigationLinks;
136
137 $fname = 'Skin::quickBar';
138 wfProfileIn( $fname );
139
140 $action = $wgRequest->getText( 'action' );
141 $wpPreview = $wgRequest->getBool( 'wpPreview' );
142 $tns=$wgTitle->getNamespace();
143
144 $s = "\n<div id='quickbar'>";
145 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
146
147 $sep = "\n<br />";
148
149 foreach ( $wgNavigationLinks as $link ) {
150 $msg = wfMsgForContent( $link['href'] );
151 $text = wfMsg( $link['text'] );
152 if ( $msg != '-' && $text != '-' ) {
153 $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
154 htmlspecialchars( $text ) . '</a>' . $sep;
155 }
156 }
157
158
159 if ($wgUser->getID()) {
160 $s.= $this->specialLink( 'watchlist' ) ;
161 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
162 wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
163 }
164 // only show watchlist link if logged in
165 $s .= "\n<hr class='sep' />";
166 $articleExists = $wgTitle->getArticleId();
167 if ( $wgOut->isArticle() || $action =='edit' || $action =='history' || $wpPreview) {
168 if($wgOut->isArticle()) {
169 $s .= '<strong>' . $this->editThisPage() . '</strong>';
170 } else { # backlink to the article in edit or history mode
171 if($articleExists){ # no backlink if no article
172 switch($tns) {
173 case 0:
174 $text = wfMsg('articlepage');
175 break;
176 case 1:
177 $text = wfMsg('viewtalkpage');
178 break;
179 case 2:
180 $text = wfMsg('userpage');
181 break;
182 case 3:
183 $text = wfMsg('viewtalkpage');
184 break;
185 case 4:
186 $text = wfMsg('wikipediapage');
187 break;
188 case 5:
189 $text = wfMsg('viewtalkpage');
190 break;
191 case 6:
192 $text = wfMsg('imagepage');
193 break;
194 case 7:
195 $text = wfMsg('viewtalkpage');
196 break;
197 default:
198 $text= wfMsg('articlepage');
199 }
200
201 $link = $wgTitle->getText();
202 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
203 $link = $nstext . ':' . $link ;
204 }
205
206 $s .= $this->makeLink( $link, $text );
207 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
208 # we just throw in a "New page" text to tell the user that he's in edit mode,
209 # and to avoid messing with the separator that is prepended to the next item
210 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
211 }
212
213 }
214
215
216 if( $tns%2 && $action!='edit' && !$wpPreview) {
217 $s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit&section=new');
218 }
219
220 /*
221 watching could cause problems in edit mode:
222 if user edits article, then loads "watch this article" in background and then saves
223 article with "Watch this article" checkbox disabled, the article is transparently
224 unwatched. Therefore we do not show the "Watch this page" link in edit mode
225 */
226 if ( 0 != $wgUser->getID() && $articleExists) {
227 if($action!='edit' && $action != 'submit' )
228 {
229 $s .= $sep . $this->watchThisPage();
230 }
231 if ( $wgTitle->userCanEdit() )
232 $s .= $sep . $this->moveThisPage();
233 }
234 if ( $wgUser->isAllowed('delete') and $articleExists ) {
235 $s .= $sep . $this->deleteThisPage() .
236 $sep . $this->protectThisPage();
237 }
238 $s .= $sep . $this->talkLink();
239 if ($articleExists && $action !='history') {
240 $s .= $sep . $this->historyLink();
241 }
242 $s.=$sep . $this->whatLinksHere();
243
244 if($wgOut->isArticleRelated()) {
245 $s .= $sep . $this->watchPageLinksLink();
246 }
247
248 if ( Namespace::getUser() == $wgTitle->getNamespace()
249 || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
250 ) {
251
252 $id=User::idFromName($wgTitle->getText());
253 $ip=User::isIP($wgTitle->getText());
254
255 if($id||$ip) {
256 $s .= $sep . $this->userContribsLink();
257 }
258 if( $this->showEmailUser( $id ) ) {
259 $s .= $sep . $this->emailUserLink();
260 }
261 }
262 $s .= "\n<br /><hr class='sep' />";
263 }
264
265 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads || $wgRemoteUploads ) ) {
266 $s .= $this->specialLink( 'upload' ) . $sep;
267 }
268 $s .= $this->specialLink( 'specialpages' )
269 . $sep . $this->bugReportsLink();
270
271 global $wgSiteSupportPage;
272 if( $wgSiteSupportPage ) {
273 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
274 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
275 }
276
277 $s .= "\n<br /></div>\n";
278 wfProfileOut( $fname );
279 return $s;
280 }
281
282
283 }
284
285 ?>