3 * Standard (a.k.a. Classic) skin: old MediaWiki default skin
9 if( !defined( 'MEDIAWIKI' ) )
16 class SkinStandard
extends Skin
{
21 function getHeadScripts( $allowUserJs, $extraHtml = '' ) {
22 global $wgStylePath, $wgJsMimeType, $wgStyleVersion, $wgOut;
24 $s = parent
::getHeadScripts( $allowUserJs, $extraHtml );
25 if ( 3 == $this->qbSetting() ) { # Floating left
26 $wgOut->addScriptFile ( "{$wgStylePath}/common/sticky.js" );
34 function setupSkinUserCss( OutputPage
$out ){
35 if ( 3 == $this->qbSetting() ) { # Floating left
36 $out->addStyle( 'common/quickbar.css' );
37 } else if ( 4 == $this->qbSetting() ) { # Floating right
38 $out->addStyle( 'common/quickbar-right.css' );
40 parent
::setupSkinUserCss( $out );
46 function reallyGenerateUserStylesheet() {
47 $s = parent
::reallyGenerateUserStylesheet();
48 $qb = $this->qbSetting();
50 if ( 2 == $qb ) { # Right
51 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
52 "border-left: 2px solid #000000; }\n" .
53 "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
54 } else if ( 1 == $qb ||
3 == $qb ) {
55 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
56 "border-right: 1px solid gray; }\n" .
57 "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
58 } else if ( 4 == $qb) {
59 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
60 "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
68 function getBodyOptions() {
69 $a = parent
::getBodyOptions();
71 if ( 3 == $this->qbSetting() ) { # Floating left
72 $qb = "setup(\"quickbar\")";
74 $a['onload'] .= ";$qb";
82 function doAfterContent() {
83 global $wgContLang, $wgLang;
84 wfProfileIn( __METHOD__
);
85 wfProfileIn( __METHOD__
. '-1' );
87 $s = "\n</div><br style=\"clear:both\" />\n";
88 $s .= "\n<div id='footer'>";
89 $s .= '<table border="0" cellspacing="0"><tr>';
91 wfProfileOut( __METHOD__
. '-1' );
92 wfProfileIn( __METHOD__
. '-2' );
94 $qb = $this->qbSetting();
95 $shove = ( $qb != 0 );
96 $left = ( $qb == 1 ||
$qb == 3 );
97 if( $wgContLang->isRTL() ) $left = !$left;
99 if ( $shove && $left ) { # Left
100 $s .= $this->getQuickbarCompensator();
102 wfProfileOut( __METHOD__
. '-2' );
103 wfProfileIn( __METHOD__
. '-3' );
104 $l = $wgContLang->isRTL() ?
'right' : 'left';
105 $s .= "<td class='bottom' align='$l' valign='top'>";
107 $s .= $this->bottomLinks();
108 $s .= "\n<br />" . $wgLang->pipeList( array(
109 $this->mainPageLink(),
111 $this->specialLink( 'recentchanges' ),
112 $this->searchForm() ) )
113 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
116 if ( $shove && !$left ) { # Right
117 $s .= $this->getQuickbarCompensator();
119 $s .= "</tr></table>\n</div>\n</div>\n";
121 wfProfileOut( __METHOD__
. '-3' );
122 wfProfileIn( __METHOD__
. '-4' );
124 $s .= $this->quickBar();
126 wfProfileOut( __METHOD__
. '-4' );
127 wfProfileOut( __METHOD__
);
131 function quickBar() {
132 global $wgOut, $wgUser, $wgRequest, $wgContLang;
133 global $wgEnableUploads, $wgRemoteUploads;
135 wfProfileIn( __METHOD__
);
137 $action = $wgRequest->getText( 'action' );
138 $wpPreview = $wgRequest->getBool( 'wpPreview' );
139 $tns = $this->mTitle
->getNamespace();
141 $s = "\n<div id='quickbar'>";
142 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
146 # Use the first heading from the Monobook sidebar as the "browse" section
147 $bar = $this->buildSidebar();
148 unset( $bar['SEARCH'] );
149 unset( $bar['LANGUAGES'] );
150 unset( $bar['TOOLBOX'] );
151 $browseLinks = reset( $bar );
153 foreach ( $browseLinks as $link ) {
154 if ( $link['text'] != '-' ) {
155 $s .= "<a href=\"{$link['href']}\">" .
156 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
160 if( $wgUser->isLoggedIn() ) {
161 $s.= $this->specialLink( 'watchlist' ) ;
162 $s .= $sep . $this->linkKnown(
163 SpecialPage
::getTitleFor( 'Contributions' ),
164 wfMsg( 'mycontris' ),
166 array( 'target' => $wgUser->getName() )
169 // only show watchlist link if logged in
170 $s .= "\n<hr class='sep' />";
171 $articleExists = $this->mTitle
->getArticleId();
172 if ( $wgOut->isArticle() ||
$action == 'edit' ||
$action == 'history' ||
$wpPreview ) {
173 if( $wgOut->isArticle() ) {
174 $s .= '<strong>' . $this->editThisPage() . '</strong>';
175 } else { # backlink to the article in edit or history mode
176 if( $articleExists ){ # no backlink if no article
180 case NS_PROJECT_TALK
:
182 case NS_MEDIAWIKI_TALK
:
183 case NS_TEMPLATE_TALK
:
185 case NS_CATEGORY_TALK
:
186 $text = wfMsg('viewtalkpage');
189 $text = wfMsg( 'articlepage' );
192 $text = wfMsg( 'userpage' );
195 $text = wfMsg( 'projectpage' );
198 $text = wfMsg( 'imagepage' );
201 $text = wfMsg( 'mediawikipage' );
204 $text = wfMsg( 'templatepage' );
207 $text = wfMsg( 'viewhelppage' );
210 $text = wfMsg( 'categorypage' );
213 $text = wfMsg( 'articlepage' );
216 $link = $this->mTitle
->getText();
217 if( $nstext = $wgContLang->getNsText( $tns ) ) { # add namespace if necessary
218 $link = $nstext . ':' . $link;
222 Title
::newFromText( $link ),
225 } elseif( $this->mTitle
->getNamespace() != NS_SPECIAL
) {
226 # we just throw in a "New page" text to tell the user that he's in edit mode,
227 # and to avoid messing with the separator that is prepended to the next item
228 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
232 # "Post a comment" link
233 if( ( $this->mTitle
->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
234 $s .= '<br />' . $this->link(
236 wfMsg( 'postcomment' ),
242 array( 'known', 'noclasses' )
245 #if( $tns%2 && $action!='edit' && !$wpPreview) {
246 #$s.= '<br />'.$this->linkKnown( Title::newFromText( $wgTitle->getPrefixedText() ),wfMsg('postcomment'),array(),array('action'=>'edit','section'=>'new'));
250 watching could cause problems in edit mode:
251 if user edits article, then loads "watch this article" in background and then saves
252 article with "Watch this article" checkbox disabled, the article is transparently
253 unwatched. Therefore we do not show the "Watch this page" link in edit mode
255 if ( $wgUser->isLoggedIn() && $articleExists) {
256 if( $action != 'edit' && $action != 'submit' ){
257 $s .= $sep . $this->watchThisPage();
259 if ( $this->mTitle
->userCan( 'edit' ) )
260 $s .= $sep . $this->moveThisPage();
262 if ( $wgUser->isAllowed( 'delete' ) and $articleExists ) {
263 $s .= $sep . $this->deleteThisPage() .
264 $sep . $this->protectThisPage();
266 $s .= $sep . $this->talkLink();
267 if( $articleExists && $action != 'history' ) {
268 $s .= $sep . $this->historyLink();
270 $s.= $sep . $this->whatLinksHere();
272 if( $wgOut->isArticleRelated() ) {
273 $s .= $sep . $this->watchPageLinksLink();
276 if ( NS_USER
== $this->mTitle
->getNamespace()
277 ||
$this->mTitle
->getNamespace() == NS_USER_TALK
) {
279 $id = User
::idFromName( $this->mTitle
->getText() );
280 $ip = User
::isIP( $this->mTitle
->getText() );
283 $s .= $sep . $this->userContribsLink();
285 if( $this->showEmailUser( $id ) ) {
286 $s .= $sep . $this->emailUserLink();
289 $s .= "\n<br /><hr class='sep' />";
292 if ( $wgUser->isLoggedIn() && ( $wgEnableUploads ||
$wgRemoteUploads ) ) {
293 $s .= $this->specialLink( 'upload' ) . $sep;
295 $s .= $this->specialLink( 'specialpages' );
297 global $wgSiteSupportPage;
298 if( $wgSiteSupportPage ) {
299 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
300 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
303 $s .= "\n<br /></div>\n";
304 wfProfileOut( __METHOD__
);