3 * Standard (a.k.a. Classic) skin: old MediaWiki default skin
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
25 if( !defined( 'MEDIAWIKI' ) ) {
33 class SkinStandard
extends SkinLegacy
{
34 var $skinname = 'standard', $stylename = 'standard',
35 $template = 'StandardTemplate';
38 * @param $out OutputPage
40 function setupSkinUserCss( OutputPage
$out ) {
41 parent
::setupSkinUserCss( $out );
42 $out->addModuleStyles( 'skins.standard' );
44 $qb = $this->qbSetting();
47 if ( 2 == $qb ) { # Right
48 $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
49 $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
50 $rules[] = "/* @noflip */#topbar, #footer { margin-right: 152px; }";
51 } elseif ( 1 == $qb ||
3 == $qb ) {
52 $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
53 $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
54 $rules[] = "/* @noflip */#topbar, #footer { margin-left: 152px; }";
56 $rules[] = "/* @noflip */#quickbar { position: fixed; padding: 4px; }";
58 } elseif ( 4 == $qb ) {
59 $rules[] = "/* @noflip */#quickbar { position: fixed; right: 0; top: 0; padding: 4px; }";
60 $rules[] = "/* @noflip */#quickbar { border-right: 1px solid gray; }";
61 $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
62 $rules[] = "/* @noflip */#topbar, #footer { margin-right: 152px; }";
64 $style = implode( "\n", $rules );
65 $out->addInlineStyle( $style, 'flip' );
70 class StandardTemplate
extends LegacyTemplate
{
75 function doAfterContent() {
76 wfProfileIn( __METHOD__
);
77 wfProfileIn( __METHOD__
. '-1' );
79 $s = "\n</div><br style=\"clear:both\" />\n";
80 $s .= "\n<div id='footer'>";
81 $s .= '<table cellspacing="0"><tr>';
83 wfProfileOut( __METHOD__
. '-1' );
84 wfProfileIn( __METHOD__
. '-2' );
85 $l = $this->getSkin()->getLanguage()->alignStart();
86 $s .= "<td class='bottom' style='text-align: $l; vertical-align: top;'>";
88 $s .= $this->bottomLinks();
89 $s .= "\n<br />" . $this->getSkin()->getLanguage()->pipeList( array(
90 $this->getSkin()->mainPageLink(),
91 $this->getSkin()->aboutLink(),
92 Linker
::specialLink( 'Recentchanges' ),
93 $this->searchForm() ) )
94 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
97 $s .= "</tr></table>\n</div>\n</div>\n";
99 wfProfileOut( __METHOD__
. '-2' );
100 wfProfileIn( __METHOD__
. '-3' );
101 if ( $this->getSkin()->qbSetting() != 0 ) {
102 $s .= $this->quickBar();
104 wfProfileOut( __METHOD__
. '-3' );
105 wfProfileOut( __METHOD__
);
112 function quickBar() {
115 wfProfileIn( __METHOD__
);
117 $action = $this->getSkin()->getRequest()->getText( 'action' );
118 $wpPreview = $this->getSkin()->getRequest()->getBool( 'wpPreview' );
119 $title = $this->getSkin()->getTitle();
120 $tns = $title->getNamespace();
122 $s = "\n<div id='quickbar'>";
123 $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />";
127 # Use the first heading from the Monobook sidebar as the "browse" section
128 $bar = $this->getSkin()->buildSidebar();
129 unset( $bar['SEARCH'] );
130 unset( $bar['LANGUAGES'] );
131 unset( $bar['TOOLBOX'] );
134 foreach ( $bar as $browseLinks ) {
135 if ( is_array( $browseLinks ) ) {
136 if ( $barnumber > 1 ) {
137 $s .= "\n<hr class='sep' />";
139 foreach ( $browseLinks as $link ) {
140 if ( $link['text'] != '-' ) {
141 $s .= "<a href=\"{$link['href']}\">" .
142 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
146 if ( $barnumber == 1 ) {
147 // only show watchlist link if logged in
148 if( $this->data
['loggedin'] ) {
149 $s.= Linker
::specialLink( 'Watchlist' ) ;
150 $s .= $sep . Linker
::linkKnown(
151 SpecialPage
::getTitleFor( 'Contributions' ),
152 wfMessage( 'mycontris' )->escaped(),
154 array( 'target' => $this->data
['username'] )
158 $barnumber = $barnumber +
1;
161 $s .= "\n<hr class='sep' />";
162 $articleExists = $title->getArticleID();
163 if ( $this->data
['isarticle'] ||
$action == 'edit' ||
$action == 'history' ||
$wpPreview ) {
164 if( $this->data
['isarticle'] ) {
165 $s .= '<strong>' . $this->editThisPage() . '</strong>';
166 } else { # backlink to the article in edit or history mode
167 if( $articleExists ){ # no backlink if no article
171 case NS_PROJECT_TALK
:
173 case NS_MEDIAWIKI_TALK
:
174 case NS_TEMPLATE_TALK
:
176 case NS_CATEGORY_TALK
:
177 $text = wfMessage('viewtalkpage');
180 $text = wfMessage( 'articlepage' );
183 $text = wfMessage( 'userpage' );
186 $text = wfMessage( 'projectpage' );
189 $text = wfMessage( 'imagepage' );
192 $text = wfMessage( 'mediawikipage' );
195 $text = wfMessage( 'templatepage' );
198 $text = wfMessage( 'viewhelppage' );
201 $text = wfMessage( 'categorypage' );
204 $text = wfMessage( 'articlepage' );
207 $link = $title->getText();
208 $nstext = $wgContLang->getNsText( $tns );
209 if( $nstext ) { # add namespace if necessary
210 $link = $nstext . ':' . $link;
213 $s .= Linker
::link( Title
::newFromText( $link ), $text->escaped() );
214 } elseif( $title->getNamespace() != NS_SPECIAL
) {
215 # we just throw in a "New page" text to tell the user that he's in edit mode,
216 # and to avoid messing with the separator that is prepended to the next item
217 $s .= '<strong>' . wfMessage( 'newpage' )->escaped() . '</strong>';
221 # "Post a comment" link
222 if( ( $title->isTalkPage() ||
$this->getSkin()->getOutput()->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
223 $s .= '<br />' . Linker
::link(
225 wfMessage( 'postcomment' )->escaped(),
234 * Watching could cause problems in edit mode:
235 * if user edits article, then loads "watch this article" in background and then saves
236 * article with "Watch this article" checkbox disabled, the article is transparently
237 * unwatched. Therefore we do not show the "Watch this page" link in edit mode.
239 if ( $this->data
['loggedin'] && $articleExists ) {
240 if( $action != 'edit' && $action != 'submit' ) {
241 $s .= $sep . $this->watchThisPage();
243 if ( $title->userCan( 'edit' ) )
244 $s .= $sep . $this->moveThisPage();
246 if ( $this->getSkin()->getUser()->isAllowed( 'delete' ) && $articleExists ) {
247 $s .= $sep . $this->deleteThisPage() .
248 $sep . $this->protectThisPage();
250 $s .= $sep . $this->talkLink();
251 if( $articleExists && $action != 'history' ) {
252 $s .= $sep . $this->historyLink();
254 $s .= $sep . $this->whatLinksHere();
256 if( $this->getSkin()->getOutput()->isArticleRelated() ) {
257 $s .= $sep . $this->watchPageLinksLink();
261 NS_USER
== $title->getNamespace() ||
262 $title->getNamespace() == NS_USER_TALK
265 $id = User
::idFromName( $title->getText() );
266 $ip = User
::isIP( $title->getText() );
269 $s .= $sep . $this->userContribsLink();
271 if( $this->getSkin()->showEmailUser( $id ) ) {
272 $s .= $sep . $this->emailUserLink();
275 $s .= "\n<br /><hr class='sep' />";
278 if( UploadBase
::isEnabled() && UploadBase
::isAllowed( $this->getSkin()->getUser() ) === true ) {
279 $s .= $this->getUploadLink() . $sep;
282 $s .= Linker
::specialLink( 'Specialpages' );
284 global $wgSiteSupportPage;
285 if( $wgSiteSupportPage ) {
286 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
287 '" class="internal">' . wfMessage( 'sitesupport' )->escaped() . '</a>';
290 $s .= "\n<br /></div>\n";
291 wfProfileOut( __METHOD__
);