10 if( !defined( 'MEDIAWIKI' ) )
17 class SkinStandard
extends Skin
{
22 function getHeadScripts( $allowUserJs ) {
23 global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
25 $s = parent
::getHeadScripts( $allowUserJs );
26 if ( 3 == $this->qbSetting() ) { # Floating left
27 $s .= "<script language='javascript' type='$wgJsMimeType' " .
28 "src='{$wgStylePath}/common/sticky.js?$wgStyleVersion'></script>\n";
36 function getUserStyles() {
37 global $wgStylePath, $wgStyleVersion;
39 if ( 3 == $this->qbSetting() ) { # Floating left
40 $s .= "<style type='text/css'>\n" .
41 "@import '{$wgStylePath}/common/quickbar.css?$wgStyleVersion';\n</style>\n";
42 } else if ( 4 == $this->qbSetting() ) { # Floating right
43 $s .= "<style type='text/css'>\n" .
44 "@import '{$wgStylePath}/common/quickbar-right.css?$wgStyleVersion';\n</style>\n";
46 $s .= parent
::getUserStyles();
53 function doGetUserStyles() {
56 $s = parent
::doGetUserStyles();
57 $qb = $this->qbSetting();
59 if ( 2 == $qb ) { # Right
60 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
61 "border-left: 2px solid #000000; }\n" .
62 "#article { margin-left: 4px; margin-right: 152px; }\n";
63 } else if ( 1 == $qb ||
3 == $qb ) {
64 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
65 "border-right: 1px solid gray; }\n" .
66 "#article { margin-left: 152px; margin-right: 4px; }\n";
67 } else if ( 4 == $qb) {
68 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
69 "#article { margin-right: 152px; margin-left: 4px; }\n";
77 function getBodyOptions() {
78 $a = parent
::getBodyOptions();
80 if ( 3 == $this->qbSetting() ) { # Floating left
81 $qb = "setup(\"quickbar\")";
83 $a["onload"] .= ";$qb";
91 function doAfterContent() {
93 $fname = 'SkinStandard::doAfterContent';
94 wfProfileIn( $fname );
95 wfProfileIn( $fname.'-1' );
97 $s = "\n</div><br style=\"clear:both\" />\n";
98 $s .= "\n<div id='footer'>";
99 $s .= '<table border="0" cellspacing="0"><tr>';
101 wfProfileOut( $fname.'-1' );
102 wfProfileIn( $fname.'-2' );
104 $qb = $this->qbSetting();
106 $left = ($qb == 1 ||
$qb == 3);
107 if($wgContLang->isRTL()) $left = !$left;
109 if ( $shove && $left ) { # Left
110 $s .= $this->getQuickbarCompensator();
112 wfProfileOut( $fname.'-2' );
113 wfProfileIn( $fname.'-3' );
114 $l = $wgContLang->isRTL() ?
'right' : 'left';
115 $s .= "<td class='bottom' align='$l' valign='top'>";
117 $s .= $this->bottomLinks();
118 $s .= "\n<br />" . $this->mainPageLink()
119 . ' | ' . $this->aboutLink()
120 . ' | ' . $this->specialLink( 'recentchanges' )
121 . ' | ' . $this->searchForm()
122 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
125 if ( $shove && !$left ) { # Right
126 $s .= $this->getQuickbarCompensator();
128 $s .= "</tr></table>\n</div>\n</div>\n";
130 wfProfileOut( $fname.'-3' );
131 wfProfileIn( $fname.'-4' );
132 if ( 0 != $qb ) { $s .= $this->quickBar(); }
133 wfProfileOut( $fname.'-4' );
134 wfProfileOut( $fname );
138 function quickBar() {
139 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
140 global $wgEnableUploads, $wgRemoteUploads;
142 $fname = 'Skin::quickBar';
143 wfProfileIn( $fname );
145 $action = $wgRequest->getText( 'action' );
146 $wpPreview = $wgRequest->getBool( 'wpPreview' );
147 $tns=$wgTitle->getNamespace();
149 $s = "\n<div id='quickbar'>";
150 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
154 # Use the first heading from the Monobook sidebar as the "browse" section
155 $bar = $this->buildSidebar();
156 unset( $bar['SEARCH'] );
157 unset( $bar['LANGUAGES'] );
158 unset( $bar['TOOLBOX'] );
159 $browseLinks = reset( $bar );
161 foreach ( $browseLinks as $link ) {
162 if ( $link['text'] != '-' ) {
163 $s .= "<a href=\"{$link['href']}\">" .
164 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
168 if( $wgUser->isLoggedIn() ) {
169 $s.= $this->specialLink( 'watchlist' ) ;
170 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
171 wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
173 // only show watchlist link if logged in
174 $s .= "\n<hr class='sep' />";
175 $articleExists = $wgTitle->getArticleId();
176 if ( $wgOut->isArticle() ||
$action =='edit' ||
$action =='history' ||
$wpPreview) {
177 if($wgOut->isArticle()) {
178 $s .= '<strong>' . $this->editThisPage() . '</strong>';
179 } else { # backlink to the article in edit or history mode
180 if($articleExists){ # no backlink if no article
184 case NS_PROJECT_TALK
:
186 case NS_MEDIAWIKI_TALK
:
187 case NS_TEMPLATE_TALK
:
189 case NS_CATEGORY_TALK
:
190 $text = wfMsg('viewtalkpage');
193 $text = wfMsg( 'articlepage' );
196 $text = wfMsg( 'userpage' );
199 $text = wfMsg( 'projectpage' );
202 $text = wfMsg( 'imagepage' );
205 $text = wfMsg( 'mediawikipage' );
208 $text = wfMsg( 'templatepage' );
211 $text = wfMsg( 'viewhelppage' );
214 $text = wfMsg( 'categorypage' );
217 $text= wfMsg( 'articlepage' );
220 $link = $wgTitle->getText();
221 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
222 $link = $nstext . ':' . $link ;
225 $s .= $this->makeLink( $link, $text );
226 } elseif( $wgTitle->getNamespace() != NS_SPECIAL
) {
227 # we just throw in a "New page" text to tell the user that he's in edit mode,
228 # and to avoid messing with the separator that is prepended to the next item
229 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
234 # "Post a comment" link
235 if( ( $wgTitle->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
236 $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
238 #if( $tns%2 && $action!='edit' && !$wpPreview) {
239 #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
243 watching could cause problems in edit mode:
244 if user edits article, then loads "watch this article" in background and then saves
245 article with "Watch this article" checkbox disabled, the article is transparently
246 unwatched. Therefore we do not show the "Watch this page" link in edit mode
248 if ( $wgUser->isLoggedIn() && $articleExists) {
249 if($action!='edit' && $action != 'submit' )
251 $s .= $sep . $this->watchThisPage();
253 if ( $wgTitle->userCan( 'edit' ) )
254 $s .= $sep . $this->moveThisPage();
256 if ( $wgUser->isAllowed('delete') and $articleExists ) {
257 $s .= $sep . $this->deleteThisPage() .
258 $sep . $this->protectThisPage();
260 $s .= $sep . $this->talkLink();
261 if ($articleExists && $action !='history') {
262 $s .= $sep . $this->historyLink();
264 $s.=$sep . $this->whatLinksHere();
266 if($wgOut->isArticleRelated()) {
267 $s .= $sep . $this->watchPageLinksLink();
270 if ( NS_USER
== $wgTitle->getNamespace()
271 ||
$wgTitle->getNamespace() == NS_USER_TALK
) {
273 $id=User
::idFromName($wgTitle->getText());
274 $ip=User
::isIP($wgTitle->getText());
277 $s .= $sep . $this->userContribsLink();
279 if( $this->showEmailUser( $id ) ) {
280 $s .= $sep . $this->emailUserLink();
283 $s .= "\n<br /><hr class='sep' />";
286 if ( $wgUser->isLoggedIn() && ( $wgEnableUploads ||
$wgRemoteUploads ) ) {
287 $s .= $this->specialLink( 'upload' ) . $sep;
289 $s .= $this->specialLink( 'specialpages' )
290 . $sep . $this->bugReportsLink();
292 global $wgSiteSupportPage;
293 if( $wgSiteSupportPage ) {
294 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
295 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
298 $s .= "\n<br /></div>\n";
299 wfProfileOut( $fname );