10 if( !defined( 'MEDIAWIKI' ) )
17 class SkinStandard
extends Skin
{
22 function getHeadScripts( $allowUserJs ) {
23 global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
25 $s = parent
::getHeadScripts( $allowUserJs );
26 if ( 3 == $this->qbSetting() ) { # Floating left
27 $s .= "<script language='javascript' type='$wgJsMimeType' " .
28 "src='{$wgStylePath}/common/sticky.js?$wgStyleVersion'></script>\n";
36 function setupSkinUserCss( OutputPage
$out ){
37 if ( 3 == $this->qbSetting() ) { # Floating left
38 $out->addStyle( 'common/quickbar.css' );
39 } else if ( 4 == $this->qbSetting() ) { # Floating right
40 $out->addStyle( 'common/quickbar-right.css' );
42 parent
::setupSkinUserCss( $out );
48 function reallyGenerateUserStylesheet() {
49 $s = parent
::reallyGenerateUserStylesheet();
50 $qb = $this->qbSetting();
52 if ( 2 == $qb ) { # Right
53 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
54 "border-left: 2px solid #000000; }\n" .
55 "#article { margin-left: 4px; margin-right: 152px; }\n";
56 } else if ( 1 == $qb ||
3 == $qb ) {
57 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
58 "border-right: 1px solid gray; }\n" .
59 "#article { margin-left: 152px; margin-right: 4px; }\n";
60 } else if ( 4 == $qb) {
61 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
62 "#article { margin-right: 152px; margin-left: 4px; }\n";
70 function getBodyOptions() {
71 $a = parent
::getBodyOptions();
73 if ( 3 == $this->qbSetting() ) { # Floating left
74 $qb = "setup(\"quickbar\")";
76 $a["onload"] .= ";$qb";
84 function doAfterContent() {
86 $fname = 'SkinStandard::doAfterContent';
87 wfProfileIn( $fname );
88 wfProfileIn( $fname.'-1' );
90 $s = "\n</div><br style=\"clear:both\" />\n";
91 $s .= "\n<div id='footer'>";
92 $s .= '<table border="0" cellspacing="0"><tr>';
94 wfProfileOut( $fname.'-1' );
95 wfProfileIn( $fname.'-2' );
97 $qb = $this->qbSetting();
99 $left = ($qb == 1 ||
$qb == 3);
100 if($wgContLang->isRTL()) $left = !$left;
102 if ( $shove && $left ) { # Left
103 $s .= $this->getQuickbarCompensator();
105 wfProfileOut( $fname.'-2' );
106 wfProfileIn( $fname.'-3' );
107 $l = $wgContLang->isRTL() ?
'right' : 'left';
108 $s .= "<td class='bottom' align='$l' valign='top'>";
110 $separator = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
112 $s .= $this->bottomLinks();
113 $s .= "\n<br />" . $this->mainPageLink()
114 . $separator . $this->aboutLink()
115 . $separator . $this->specialLink( 'recentchanges' )
116 . $separator . $this->searchForm()
117 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
120 if ( $shove && !$left ) { # Right
121 $s .= $this->getQuickbarCompensator();
123 $s .= "</tr></table>\n</div>\n</div>\n";
125 wfProfileOut( $fname.'-3' );
126 wfProfileIn( $fname.'-4' );
127 if ( 0 != $qb ) { $s .= $this->quickBar(); }
128 wfProfileOut( $fname.'-4' );
129 wfProfileOut( $fname );
133 function quickBar() {
134 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
135 global $wgEnableUploads, $wgRemoteUploads;
137 $fname = 'Skin::quickBar';
138 wfProfileIn( $fname );
140 $action = $wgRequest->getText( 'action' );
141 $wpPreview = $wgRequest->getBool( 'wpPreview' );
142 $tns=$wgTitle->getNamespace();
144 $s = "\n<div id='quickbar'>";
145 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
149 # Use the first heading from the Monobook sidebar as the "browse" section
150 $bar = $this->buildSidebar();
151 unset( $bar['SEARCH'] );
152 unset( $bar['LANGUAGES'] );
153 unset( $bar['TOOLBOX'] );
154 $browseLinks = reset( $bar );
156 foreach ( $browseLinks as $link ) {
157 if ( $link['text'] != '-' ) {
158 $s .= "<a href=\"{$link['href']}\">" .
159 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
163 if( $wgUser->isLoggedIn() ) {
164 $s.= $this->specialLink( 'watchlist' ) ;
165 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
166 wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
168 // only show watchlist link if logged in
169 $s .= "\n<hr class='sep' />";
170 $articleExists = $wgTitle->getArticleId();
171 if ( $wgOut->isArticle() ||
$action =='edit' ||
$action =='history' ||
$wpPreview) {
172 if($wgOut->isArticle()) {
173 $s .= '<strong>' . $this->editThisPage() . '</strong>';
174 } else { # backlink to the article in edit or history mode
175 if($articleExists){ # no backlink if no article
179 case NS_PROJECT_TALK
:
181 case NS_MEDIAWIKI_TALK
:
182 case NS_TEMPLATE_TALK
:
184 case NS_CATEGORY_TALK
:
185 $text = wfMsg('viewtalkpage');
188 $text = wfMsg( 'articlepage' );
191 $text = wfMsg( 'userpage' );
194 $text = wfMsg( 'projectpage' );
197 $text = wfMsg( 'imagepage' );
200 $text = wfMsg( 'mediawikipage' );
203 $text = wfMsg( 'templatepage' );
206 $text = wfMsg( 'viewhelppage' );
209 $text = wfMsg( 'categorypage' );
212 $text= wfMsg( 'articlepage' );
215 $link = $wgTitle->getText();
216 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
217 $link = $nstext . ':' . $link ;
220 $s .= $this->makeLink( $link, $text );
221 } elseif( $wgTitle->getNamespace() != NS_SPECIAL
) {
222 # we just throw in a "New page" text to tell the user that he's in edit mode,
223 # and to avoid messing with the separator that is prepended to the next item
224 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
229 # "Post a comment" link
230 if( ( $wgTitle->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
231 $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
233 #if( $tns%2 && $action!='edit' && !$wpPreview) {
234 #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
238 watching could cause problems in edit mode:
239 if user edits article, then loads "watch this article" in background and then saves
240 article with "Watch this article" checkbox disabled, the article is transparently
241 unwatched. Therefore we do not show the "Watch this page" link in edit mode
243 if ( $wgUser->isLoggedIn() && $articleExists) {
244 if($action!='edit' && $action != 'submit' )
246 $s .= $sep . $this->watchThisPage();
248 if ( $wgTitle->userCan( 'edit' ) )
249 $s .= $sep . $this->moveThisPage();
251 if ( $wgUser->isAllowed('delete') and $articleExists ) {
252 $s .= $sep . $this->deleteThisPage() .
253 $sep . $this->protectThisPage();
255 $s .= $sep . $this->talkLink();
256 if ($articleExists && $action !='history') {
257 $s .= $sep . $this->historyLink();
259 $s.=$sep . $this->whatLinksHere();
261 if($wgOut->isArticleRelated()) {
262 $s .= $sep . $this->watchPageLinksLink();
265 if ( NS_USER
== $wgTitle->getNamespace()
266 ||
$wgTitle->getNamespace() == NS_USER_TALK
) {
268 $id=User
::idFromName($wgTitle->getText());
269 $ip=User
::isIP($wgTitle->getText());
272 $s .= $sep . $this->userContribsLink();
274 if( $this->showEmailUser( $id ) ) {
275 $s .= $sep . $this->emailUserLink();
278 $s .= "\n<br /><hr class='sep' />";
281 if ( $wgUser->isLoggedIn() && ( $wgEnableUploads ||
$wgRemoteUploads ) ) {
282 $s .= $this->specialLink( 'upload' ) . $sep;
284 $s .= $this->specialLink( 'specialpages' )
285 . $sep . $this->bugReportsLink();
287 global $wgSiteSupportPage;
288 if( $wgSiteSupportPage ) {
289 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
290 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
293 $s .= "\n<br /></div>\n";
294 wfProfileOut( $fname );