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';
21 function setupSkinUserCss( OutputPage
$out ){
22 parent
::setupSkinUserCss( $out );
23 $out->AddModuleStyles( 'skins.standard' );
26 $qb = $this->qbSetting();
29 if ( 2 == $qb ) { # Right
30 $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
31 $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
32 } elseif ( 1 == $qb ||
3 == $qb ) {
33 $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
34 $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
36 $rules[] = "#quickbar { position: fixed; padding: 4px; }";
38 } elseif ( 4 == $qb ) {
39 $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
40 $rules[] = "#quickbar { border-right: 1px solid gray; }";
41 $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
43 $style = implode( "\n", $rules );
44 if ( $wgContLang->getDir() === 'rtl' ) {
45 $style = CSSJanus
::transform( $style, true, false );
47 $out->addInlineStyle( $style );
52 class StandardTemplate
extends LegacyTemplate
{
54 function doAfterContent() {
55 global $wgContLang, $wgLang;
56 wfProfileIn( __METHOD__
);
57 wfProfileIn( __METHOD__
. '-1' );
59 $s = "\n</div><br style=\"clear:both\" />\n";
60 $s .= "\n<div id='footer'>";
61 $s .= '<table border="0" cellspacing="0"><tr>';
63 wfProfileOut( __METHOD__
. '-1' );
64 wfProfileIn( __METHOD__
. '-2' );
66 $qb = $this->getSkin()->qbSetting();
67 $shove = ( $qb != 0 );
68 $left = ( $qb == 1 ||
$qb == 3 );
70 if ( $shove && $left ) { # Left
71 $s .= $this->getQuickbarCompensator();
73 wfProfileOut( __METHOD__
. '-2' );
74 wfProfileIn( __METHOD__
. '-3' );
75 $l = $wgContLang->alignStart();
76 $s .= "<td class='bottom' align='$l' valign='top'>";
78 $s .= $this->bottomLinks();
79 $s .= "\n<br />" . $wgLang->pipeList( array(
80 $this->getSkin()->mainPageLink(),
81 $this->getSkin()->aboutLink(),
82 $this->getSkin()->specialLink( 'Recentchanges' ),
83 $this->searchForm() ) )
84 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
87 if ( $shove && !$left ) { # Right
88 $s .= $this->getQuickbarCompensator();
90 $s .= "</tr></table>\n</div>\n</div>\n";
92 wfProfileOut( __METHOD__
. '-3' );
93 wfProfileIn( __METHOD__
. '-4' );
95 $s .= $this->quickBar();
97 wfProfileOut( __METHOD__
. '-4' );
98 wfProfileOut( __METHOD__
);
102 function quickBar() {
103 global $wgOut, $wgUser, $wgRequest, $wgContLang;
105 wfProfileIn( __METHOD__
);
107 $action = $wgRequest->getText( 'action' );
108 $wpPreview = $wgRequest->getBool( 'wpPreview' );
109 $tns = $this->getSkin()->getTitle()->getNamespace();
111 $s = "\n<div id='quickbar'>";
112 $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />";
116 # Use the first heading from the Monobook sidebar as the "browse" section
117 $bar = $this->getSkin()->buildSidebar();
118 unset( $bar['SEARCH'] );
119 unset( $bar['LANGUAGES'] );
120 unset( $bar['TOOLBOX'] );
123 foreach ( $bar as $heading => $browseLinks ) {
124 if ( $barnumber > 1 ) {
125 $s .= "\n<hr class='sep' />";
127 foreach ( $browseLinks as $link ) {
128 if ( $link['text'] != '-' ) {
129 $s .= "<a href=\"{$link['href']}\">" .
130 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
133 if ( $barnumber == 1 ) {
134 // only show watchlist link if logged in
135 if( $wgUser->isLoggedIn() ) {
136 $s.= $this->getSkin()->specialLink( 'Watchlist' ) ;
137 $s .= $sep . $this->getSkin()->linkKnown(
138 SpecialPage
::getTitleFor( 'Contributions' ),
139 wfMsg( 'mycontris' ),
141 array( 'target' => $wgUser->getName() )
145 $barnumber = $barnumber +
1;
148 $s .= "\n<hr class='sep' />";
149 $articleExists = $this->getSkin()->getTitle()->getArticleId();
150 if ( $wgOut->isArticle() ||
$action == 'edit' ||
$action == 'history' ||
$wpPreview ) {
151 if( $wgOut->isArticle() ) {
152 $s .= '<strong>' . $this->editThisPage() . '</strong>';
153 } else { # backlink to the article in edit or history mode
154 if( $articleExists ){ # no backlink if no article
158 case NS_PROJECT_TALK
:
160 case NS_MEDIAWIKI_TALK
:
161 case NS_TEMPLATE_TALK
:
163 case NS_CATEGORY_TALK
:
164 $text = wfMsg('viewtalkpage');
167 $text = wfMsg( 'articlepage' );
170 $text = wfMsg( 'userpage' );
173 $text = wfMsg( 'projectpage' );
176 $text = wfMsg( 'imagepage' );
179 $text = wfMsg( 'mediawikipage' );
182 $text = wfMsg( 'templatepage' );
185 $text = wfMsg( 'viewhelppage' );
188 $text = wfMsg( 'categorypage' );
191 $text = wfMsg( 'articlepage' );
194 $link = $this->getSkin()->getTitle()->getText();
195 $nstext = $wgContLang->getNsText( $tns );
196 if( $nstext ) { # add namespace if necessary
197 $link = $nstext . ':' . $link;
200 $s .= $this->getSkin()->link(
201 Title
::newFromText( $link ),
204 } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL
) {
205 # we just throw in a "New page" text to tell the user that he's in edit mode,
206 # and to avoid messing with the separator that is prepended to the next item
207 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
211 # "Post a comment" link
212 if( ( $this->getSkin()->getTitle()->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
213 $s .= '<br />' . $this->getSkin()->link(
214 $this->getSkin()->getTitle(),
215 wfMsg( 'postcomment' ),
221 array( 'known', 'noclasses' )
225 watching could cause problems in edit mode:
226 if user edits article, then loads "watch this article" in background and then saves
227 article with "Watch this article" checkbox disabled, the article is transparently
228 unwatched. Therefore we do not show the "Watch this page" link in edit mode
230 if ( $wgUser->isLoggedIn() && $articleExists ) {
231 if( $action != 'edit' && $action != 'submit' ) {
232 $s .= $sep . $this->watchThisPage();
234 if ( $this->getSkin()->getTitle()->userCan( 'edit' ) )
235 $s .= $sep . $this->moveThisPage();
237 if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
238 $s .= $sep . $this->deleteThisPage() .
239 $sep . $this->protectThisPage();
241 $s .= $sep . $this->talkLink();
242 if( $articleExists && $action != 'history' ) {
243 $s .= $sep . $this->historyLink();
245 $s .= $sep . $this->whatLinksHere();
247 if( $wgOut->isArticleRelated() ) {
248 $s .= $sep . $this->watchPageLinksLink();
252 NS_USER
== $this->getSkin()->getTitle()->getNamespace() ||
253 $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
256 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
257 $ip = User
::isIP( $this->getSkin()->getTitle()->getText() );
260 $s .= $sep . $this->userContribsLink();
262 if( $this->getSkin()->showEmailUser( $id ) ) {
263 $s .= $sep . $this->emailUserLink();
266 $s .= "\n<br /><hr class='sep' />";
269 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
270 $s .= $this->getUploadLink() . $sep;
273 $s .= $this->getSkin()->specialLink( 'Specialpages' );
275 global $wgSiteSupportPage;
276 if( $wgSiteSupportPage ) {
277 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
278 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
281 $s .= "\n<br /></div>\n";
282 wfProfileOut( __METHOD__
);