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';
22 * @param $out OutputPage
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
{
60 function doAfterContent() {
61 global $wgContLang, $wgLang;
62 wfProfileIn( __METHOD__
);
63 wfProfileIn( __METHOD__
. '-1' );
65 $s = "\n</div><br style=\"clear:both\" />\n";
66 $s .= "\n<div id='footer'>";
67 $s .= '<table border="0" cellspacing="0"><tr>';
69 wfProfileOut( __METHOD__
. '-1' );
70 wfProfileIn( __METHOD__
. '-2' );
72 $qb = $this->getSkin()->qbSetting();
73 $shove = ( $qb != 0 );
74 $left = ( $qb == 1 ||
$qb == 3 );
76 if ( $shove && $left ) { # Left
77 $s .= $this->getQuickbarCompensator();
79 wfProfileOut( __METHOD__
. '-2' );
80 wfProfileIn( __METHOD__
. '-3' );
81 $l = $wgContLang->alignStart();
82 $s .= "<td class='bottom' align='$l' valign='top'>";
84 $s .= $this->bottomLinks();
85 $s .= "\n<br />" . $wgLang->pipeList( array(
86 $this->getSkin()->mainPageLink(),
87 $this->getSkin()->aboutLink(),
88 Linker
::specialLink( 'Recentchanges' ),
89 $this->searchForm() ) )
90 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
93 if ( $shove && !$left ) { # Right
94 $s .= $this->getQuickbarCompensator();
96 $s .= "</tr></table>\n</div>\n</div>\n";
98 wfProfileOut( __METHOD__
. '-3' );
99 wfProfileIn( __METHOD__
. '-4' );
101 $s .= $this->quickBar();
103 wfProfileOut( __METHOD__
. '-4' );
104 wfProfileOut( __METHOD__
);
111 function quickBar() {
112 global $wgOut, $wgUser, $wgRequest, $wgContLang;
114 wfProfileIn( __METHOD__
);
116 $action = $wgRequest->getText( 'action' );
117 $wpPreview = $wgRequest->getBool( 'wpPreview' );
118 $tns = $this->getSkin()->getTitle()->getNamespace();
120 $s = "\n<div id='quickbar'>";
121 $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />";
125 # Use the first heading from the Monobook sidebar as the "browse" section
126 $bar = $this->getSkin()->buildSidebar();
127 unset( $bar['SEARCH'] );
128 unset( $bar['LANGUAGES'] );
129 unset( $bar['TOOLBOX'] );
132 foreach ( $bar as $browseLinks ) {
133 if ( $barnumber > 1 ) {
134 $s .= "\n<hr class='sep' />";
136 foreach ( $browseLinks as $link ) {
137 if ( $link['text'] != '-' ) {
138 $s .= "<a href=\"{$link['href']}\">" .
139 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
142 if ( $barnumber == 1 ) {
143 // only show watchlist link if logged in
144 if( $wgUser->isLoggedIn() ) {
145 $s.= Linker
::specialLink( 'Watchlist' ) ;
146 $s .= $sep . Linker
::linkKnown(
147 SpecialPage
::getTitleFor( 'Contributions' ),
148 wfMsg( 'mycontris' ),
150 array( 'target' => $wgUser->getName() )
154 $barnumber = $barnumber +
1;
157 $s .= "\n<hr class='sep' />";
158 $articleExists = $this->getSkin()->getTitle()->getArticleId();
159 if ( $wgOut->isArticle() ||
$action == 'edit' ||
$action == 'history' ||
$wpPreview ) {
160 if( $wgOut->isArticle() ) {
161 $s .= '<strong>' . $this->editThisPage() . '</strong>';
162 } else { # backlink to the article in edit or history mode
163 if( $articleExists ){ # no backlink if no article
167 case NS_PROJECT_TALK
:
169 case NS_MEDIAWIKI_TALK
:
170 case NS_TEMPLATE_TALK
:
172 case NS_CATEGORY_TALK
:
173 $text = wfMsg('viewtalkpage');
176 $text = wfMsg( 'articlepage' );
179 $text = wfMsg( 'userpage' );
182 $text = wfMsg( 'projectpage' );
185 $text = wfMsg( 'imagepage' );
188 $text = wfMsg( 'mediawikipage' );
191 $text = wfMsg( 'templatepage' );
194 $text = wfMsg( 'viewhelppage' );
197 $text = wfMsg( 'categorypage' );
200 $text = wfMsg( 'articlepage' );
203 $link = $this->getSkin()->getTitle()->getText();
204 $nstext = $wgContLang->getNsText( $tns );
205 if( $nstext ) { # add namespace if necessary
206 $link = $nstext . ':' . $link;
209 $s .= Linker
::link( Title
::newFromText( $link ), $text );
210 } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL
) {
211 # we just throw in a "New page" text to tell the user that he's in edit mode,
212 # and to avoid messing with the separator that is prepended to the next item
213 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
217 # "Post a comment" link
218 if( ( $this->getSkin()->getTitle()->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
219 $s .= '<br />' . $this->getSkin()->link(
220 $this->getSkin()->getTitle(),
221 wfMsg( 'postcomment' ),
227 array( 'known', 'noclasses' )
231 watching could cause problems in edit mode:
232 if user edits article, then loads "watch this article" in background and then saves
233 article with "Watch this article" checkbox disabled, the article is transparently
234 unwatched. Therefore we do not show the "Watch this page" link in edit mode
236 if ( $wgUser->isLoggedIn() && $articleExists ) {
237 if( $action != 'edit' && $action != 'submit' ) {
238 $s .= $sep . $this->watchThisPage();
240 if ( $this->getSkin()->getTitle()->userCan( 'edit' ) )
241 $s .= $sep . $this->moveThisPage();
243 if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
244 $s .= $sep . $this->deleteThisPage() .
245 $sep . $this->protectThisPage();
247 $s .= $sep . $this->talkLink();
248 if( $articleExists && $action != 'history' ) {
249 $s .= $sep . $this->historyLink();
251 $s .= $sep . $this->whatLinksHere();
253 if( $wgOut->isArticleRelated() ) {
254 $s .= $sep . $this->watchPageLinksLink();
258 NS_USER
== $this->getSkin()->getTitle()->getNamespace() ||
259 $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
262 $id = User
::idFromName( $this->getSkin()->getTitle()->getText() );
263 $ip = User
::isIP( $this->getSkin()->getTitle()->getText() );
266 $s .= $sep . $this->userContribsLink();
268 if( $this->getSkin()->showEmailUser( $id ) ) {
269 $s .= $sep . $this->emailUserLink();
272 $s .= "\n<br /><hr class='sep' />";
275 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $wgUser ) === true ) {
276 $s .= $this->getUploadLink() . $sep;
279 $s .= Linker
::specialLink( 'Specialpages' );
281 global $wgSiteSupportPage;
282 if( $wgSiteSupportPage ) {
283 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
284 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
287 $s .= "\n<br /></div>\n";
288 wfProfileOut( __METHOD__
);