3 * Standard (a.k.a. Classic) skin: old MediaWiki default skin
9 if( !defined( 'MEDIAWIKI' ) ) {
17 class SkinStandard
extends SkinLegacy
{
18 var $skinname = 'standard', $stylename = 'standard',
19 $template = 'StandardTemplate';
24 function setupSkinUserCss( OutputPage
$out ){
25 parent
::setupSkinUserCss( $out );
26 $out->AddModuleStyles( 'skins.standard' );
29 $qb = $this->qbSetting();
32 if ( 2 == $qb ) { # Right
33 $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
34 $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
35 } elseif ( 1 == $qb ||
3 == $qb ) {
36 $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
37 $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
39 $rules[] = "#quickbar { position: fixed; padding: 4px; }";
41 } elseif ( 4 == $qb ) {
42 $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
43 $rules[] = "#quickbar { border-right: 1px solid gray; }";
44 $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
46 $style = implode( "\n", $rules );
47 if ( $wgContLang->getDir() === 'rtl' ) {
48 $style = CSSJanus
::transform( $style, true, false );
50 $out->addInlineStyle( $style );
55 class StandardTemplate
extends LegacyTemplate
{
57 function doAfterContent() {
58 global $wgContLang, $wgLang;
59 wfProfileIn( __METHOD__
);
60 wfProfileIn( __METHOD__
. '-1' );
62 $s = "\n</div><br style=\"clear:both\" />\n";
63 $s .= "\n<div id='footer'>";
64 $s .= '<table border="0" cellspacing="0"><tr>';
66 wfProfileOut( __METHOD__
. '-1' );
67 wfProfileIn( __METHOD__
. '-2' );
69 $qb = $this->getSkin()->qbSetting();
70 $shove = ( $qb != 0 );
71 $left = ( $qb == 1 ||
$qb == 3 );
73 if ( $shove && $left ) { # Left
74 $s .= $this->getQuickbarCompensator();
76 wfProfileOut( __METHOD__
. '-2' );
77 wfProfileIn( __METHOD__
. '-3' );
78 $l = $wgContLang->alignStart();
79 $s .= "<td class='bottom' align='$l' valign='top'>";
81 $s .= $this->bottomLinks();
82 $s .= "\n<br />" . $wgLang->pipeList( array(
83 $this->getSkin()->mainPageLink(),
84 $this->getSkin()->aboutLink(),
85 $this->getSkin()->specialLink( 'Recentchanges' ),
86 $this->searchForm() ) )
87 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
90 if ( $shove && !$left ) { # Right
91 $s .= $this->getQuickbarCompensator();
93 $s .= "</tr></table>\n</div>\n</div>\n";
95 wfProfileOut( __METHOD__
. '-3' );
96 wfProfileIn( __METHOD__
. '-4' );
98 $s .= $this->quickBar();
100 wfProfileOut( __METHOD__
. '-4' );
101 wfProfileOut( __METHOD__
);
105 function quickBar() {
106 global $wgOut, $wgUser, $wgRequest, $wgContLang;
108 wfProfileIn( __METHOD__
);
110 $action = $wgRequest->getText( 'action' );
111 $wpPreview = $wgRequest->getBool( 'wpPreview' );
112 $tns = $this->getSkin()->getTitle()->getNamespace();
114 $s = "\n<div id='quickbar'>";
115 $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />";
119 # Use the first heading from the Monobook sidebar as the "browse" section
120 $bar = $this->getSkin()->buildSidebar();
121 unset( $bar['SEARCH'] );
122 unset( $bar['LANGUAGES'] );
123 unset( $bar['TOOLBOX'] );
124 $browseLinks = reset( $bar );
126 foreach ( $browseLinks as $link ) {
127 if ( $link['text'] != '-' ) {
128 $s .= "<a href=\"{$link['href']}\">" .
129 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
133 if( $wgUser->isLoggedIn() ) {
134 $s.= $this->getSkin()->specialLink( 'Watchlist' ) ;
135 $s .= $sep . $this->getSkin()->linkKnown(
136 SpecialPage
::getTitleFor( 'Contributions' ),
137 wfMsg( 'mycontris' ),
139 array( 'target' => $wgUser->getName() )
142 // only show watchlist link if logged in
143 $s .= "\n<hr class='sep' />";
144 $articleExists = $this->getSkin()->getTitle()->getArticleId();
145 if ( $wgOut->isArticle() ||
$action == 'edit' ||
$action == 'history' ||
$wpPreview ) {
146 if( $wgOut->isArticle() ) {
147 $s .= '<strong>' . $this->editThisPage() . '</strong>';
148 } else { # backlink to the article in edit or history mode
149 if( $articleExists ){ # no backlink if no article
153 case NS_PROJECT_TALK
:
155 case NS_MEDIAWIKI_TALK
:
156 case NS_TEMPLATE_TALK
:
158 case NS_CATEGORY_TALK
:
159 $text = wfMsg('viewtalkpage');
162 $text = wfMsg( 'articlepage' );
165 $text = wfMsg( 'userpage' );
168 $text = wfMsg( 'projectpage' );
171 $text = wfMsg( 'imagepage' );
174 $text = wfMsg( 'mediawikipage' );
177 $text = wfMsg( 'templatepage' );
180 $text = wfMsg( 'viewhelppage' );
183 $text = wfMsg( 'categorypage' );
186 $text = wfMsg( 'articlepage' );
189 $link = $this->getSkin()->getTitle()->getText();
190 $nstext = $wgContLang->getNsText( $tns );
191 if( $nstext ) { # add namespace if necessary
192 $link = $nstext . ':' . $link;
195 $s .= $this->getSkin()->link(
196 Title
::newFromText( $link ),
199 } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL
) {
200 # we just throw in a "New page" text to tell the user that he's in edit mode,
201 # and to avoid messing with the separator that is prepended to the next item
202 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
206 # "Post a comment" link
207 if( ( $this->getSkin()->getTitle()->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
208 $s .= '<br />' . $this->getSkin()->link(
209 $this->getSkin()->getTitle(),
210 wfMsg( 'postcomment' ),
216 array( 'known', 'noclasses' )
220 watching could cause problems in edit mode:
221 if user edits article, then loads "watch this article" in background and then saves
222 article with "Watch this article" checkbox disabled, the article is transparently
223 unwatched. Therefore we do not show the "Watch this page" link in edit mode
225 if ( $wgUser->isLoggedIn() && $articleExists ) {
226 if( $action != 'edit' && $action != 'submit' ) {
227 $s .= $sep . $this->watchThisPage();
229 if ( $this->getSkin()->getTitle()->userCan( 'edit' ) )
230 $s .= $sep . $this->moveThisPage();
232 if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
233 $s .= $sep . $this->deleteThisPage() .
234 $sep . $this->protectThisPage();
236 $s .= $sep . $this->talkLink();
237 if( $articleExists && $action != 'history' ) {
238 $s .= $sep . $this->historyLink();
240 $s .= $sep . $this->whatLinksHere();
242 if( $wgOut->isArticleRelated() ) {
243 $s .= $sep . $this->watchPageLinksLink();
247 NS_USER
== $this->getSkin()->getTitle()->getNamespace() ||
248 $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
251 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
252 $ip = User
::isIP( $this->getSkin()->getTitle()->getText() );
255 $s .= $sep . $this->userContribsLink();
257 if( $this->showEmailUser( $id ) ) {
258 $s .= $sep . $this->emailUserLink();
261 $s .= "\n<br /><hr class='sep' />";
264 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
265 $s .= $this->getUploadLink() . $sep;
268 $s .= $this->getSkin()->specialLink( 'Specialpages' );
270 global $wgSiteSupportPage;
271 if( $wgSiteSupportPage ) {
272 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
273 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
276 $s .= "\n<br /></div>\n";
277 wfProfileOut( __METHOD__
);