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'] );
121 $browseLinks = reset( $bar );
123 foreach ( $browseLinks as $link ) {
124 if ( $link['text'] != '-' ) {
125 $s .= "<a href=\"{$link['href']}\">" .
126 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
130 if( $wgUser->isLoggedIn() ) {
131 $s.= $this->getSkin()->specialLink( 'Watchlist' ) ;
132 $s .= $sep . $this->getSkin()->linkKnown(
133 SpecialPage
::getTitleFor( 'Contributions' ),
134 wfMsg( 'mycontris' ),
136 array( 'target' => $wgUser->getName() )
139 // only show watchlist link if logged in
140 $s .= "\n<hr class='sep' />";
141 $articleExists = $this->getSkin()->getTitle()->getArticleId();
142 if ( $wgOut->isArticle() ||
$action == 'edit' ||
$action == 'history' ||
$wpPreview ) {
143 if( $wgOut->isArticle() ) {
144 $s .= '<strong>' . $this->editThisPage() . '</strong>';
145 } else { # backlink to the article in edit or history mode
146 if( $articleExists ){ # no backlink if no article
150 case NS_PROJECT_TALK
:
152 case NS_MEDIAWIKI_TALK
:
153 case NS_TEMPLATE_TALK
:
155 case NS_CATEGORY_TALK
:
156 $text = wfMsg('viewtalkpage');
159 $text = wfMsg( 'articlepage' );
162 $text = wfMsg( 'userpage' );
165 $text = wfMsg( 'projectpage' );
168 $text = wfMsg( 'imagepage' );
171 $text = wfMsg( 'mediawikipage' );
174 $text = wfMsg( 'templatepage' );
177 $text = wfMsg( 'viewhelppage' );
180 $text = wfMsg( 'categorypage' );
183 $text = wfMsg( 'articlepage' );
186 $link = $this->getSkin()->getTitle()->getText();
187 $nstext = $wgContLang->getNsText( $tns );
188 if( $nstext ) { # add namespace if necessary
189 $link = $nstext . ':' . $link;
192 $s .= $this->getSkin()->link(
193 Title
::newFromText( $link ),
196 } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL
) {
197 # we just throw in a "New page" text to tell the user that he's in edit mode,
198 # and to avoid messing with the separator that is prepended to the next item
199 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
203 # "Post a comment" link
204 if( ( $this->getSkin()->getTitle()->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
205 $s .= '<br />' . $this->getSkin()->link(
206 $this->getSkin()->getTitle(),
207 wfMsg( 'postcomment' ),
213 array( 'known', 'noclasses' )
217 watching could cause problems in edit mode:
218 if user edits article, then loads "watch this article" in background and then saves
219 article with "Watch this article" checkbox disabled, the article is transparently
220 unwatched. Therefore we do not show the "Watch this page" link in edit mode
222 if ( $wgUser->isLoggedIn() && $articleExists ) {
223 if( $action != 'edit' && $action != 'submit' ) {
224 $s .= $sep . $this->watchThisPage();
226 if ( $this->getSkin()->getTitle()->userCan( 'edit' ) )
227 $s .= $sep . $this->moveThisPage();
229 if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
230 $s .= $sep . $this->deleteThisPage() .
231 $sep . $this->protectThisPage();
233 $s .= $sep . $this->talkLink();
234 if( $articleExists && $action != 'history' ) {
235 $s .= $sep . $this->historyLink();
237 $s .= $sep . $this->whatLinksHere();
239 if( $wgOut->isArticleRelated() ) {
240 $s .= $sep . $this->watchPageLinksLink();
244 NS_USER
== $this->getSkin()->getTitle()->getNamespace() ||
245 $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
248 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
249 $ip = User
::isIP( $this->getSkin()->getTitle()->getText() );
252 $s .= $sep . $this->userContribsLink();
254 if( $this->showEmailUser( $id ) ) {
255 $s .= $sep . $this->emailUserLink();
258 $s .= "\n<br /><hr class='sep' />";
261 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
262 $s .= $this->getUploadLink() . $sep;
265 $s .= $this->getSkin()->specialLink( 'Specialpages' );
267 global $wgSiteSupportPage;
268 if( $wgSiteSupportPage ) {
269 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
270 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
273 $s .= "\n<br /></div>\n";
274 wfProfileOut( __METHOD__
);