9 if( !defined( 'MEDIAWIKI' ) )
16 class SkinStandard
extends Skin
{
21 function getHeadScripts( $allowUserJs ) {
22 global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
24 $s = parent
::getHeadScripts( $allowUserJs );
25 if ( 3 == $this->qbSetting() ) { # Floating left
26 $s .= "<script language='javascript' type='$wgJsMimeType' " .
27 "src='{$wgStylePath}/common/sticky.js?$wgStyleVersion'></script>\n";
35 function getUserStyles() {
36 global $wgStylePath, $wgStyleVersion;
38 if ( 3 == $this->qbSetting() ) { # Floating left
39 $s .= "<style type='text/css'>\n" .
40 "@import '{$wgStylePath}/common/quickbar.css?$wgStyleVersion';\n</style>\n";
41 } else if ( 4 == $this->qbSetting() ) { # Floating right
42 $s .= "<style type='text/css'>\n" .
43 "@import '{$wgStylePath}/common/quickbar-right.css?$wgStyleVersion';\n</style>\n";
45 $s .= parent
::getUserStyles();
52 function doGetUserStyles() {
55 $s = parent
::doGetUserStyles();
56 $qb = $this->qbSetting();
58 if ( 2 == $qb ) { # Right
59 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
60 "border-left: 2px solid #000000; }\n" .
61 "#article { margin-left: 4px; margin-right: 152px; }\n";
62 } else if ( 1 == $qb ||
3 == $qb ) {
63 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
64 "border-right: 1px solid gray; }\n" .
65 "#article { margin-left: 152px; margin-right: 4px; }\n";
66 } else if ( 4 == $qb) {
67 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
68 "#article { margin-right: 152px; margin-left: 4px; }\n";
76 function getBodyOptions() {
77 $a = parent
::getBodyOptions();
79 if ( 3 == $this->qbSetting() ) { # Floating left
80 $qb = "setup(\"quickbar\")";
82 $a["onload"] .= ";$qb";
90 function doAfterContent() {
92 $fname = 'SkinStandard::doAfterContent';
93 wfProfileIn( $fname );
94 wfProfileIn( $fname.'-1' );
96 $s = "\n</div><br style=\"clear:both\" />\n";
97 $s .= "\n<div id='footer'>";
98 $s .= '<table border="0" cellspacing="0"><tr>';
100 wfProfileOut( $fname.'-1' );
101 wfProfileIn( $fname.'-2' );
103 $qb = $this->qbSetting();
105 $left = ($qb == 1 ||
$qb == 3);
106 if($wgContLang->isRTL()) $left = !$left;
108 if ( $shove && $left ) { # Left
109 $s .= $this->getQuickbarCompensator();
111 wfProfileOut( $fname.'-2' );
112 wfProfileIn( $fname.'-3' );
113 $l = $wgContLang->isRTL() ?
'right' : 'left';
114 $s .= "<td class='bottom' align='$l' valign='top'>";
116 $s .= $this->bottomLinks();
117 $s .= "\n<br />" . $this->mainPageLink()
118 . ' | ' . $this->aboutLink()
119 . ' | ' . $this->specialLink( 'recentchanges' )
120 . ' | ' . $this->searchForm()
121 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
124 if ( $shove && !$left ) { # Right
125 $s .= $this->getQuickbarCompensator();
127 $s .= "</tr></table>\n</div>\n</div>\n";
129 wfProfileOut( $fname.'-3' );
130 wfProfileIn( $fname.'-4' );
131 if ( 0 != $qb ) { $s .= $this->quickBar(); }
132 wfProfileOut( $fname.'-4' );
133 wfProfileOut( $fname );
137 function quickBar() {
138 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
139 global $wgEnableUploads, $wgRemoteUploads;
141 $fname = 'Skin::quickBar';
142 wfProfileIn( $fname );
144 $action = $wgRequest->getText( 'action' );
145 $wpPreview = $wgRequest->getBool( 'wpPreview' );
146 $tns=$wgTitle->getNamespace();
148 $s = "\n<div id='quickbar'>";
149 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
153 # Use the first heading from the Monobook sidebar as the "browse" section
154 $bar = $this->buildSidebar();
155 $browseLinks = reset( $bar );
157 foreach ( $browseLinks as $link ) {
158 if ( $link['text'] != '-' ) {
159 $s .= "<a href=\"{$link['href']}\">" .
160 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
164 if( $wgUser->isLoggedIn() ) {
165 $s.= $this->specialLink( 'watchlist' ) ;
166 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
167 wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
169 // only show watchlist link if logged in
170 $s .= "\n<hr class='sep' />";
171 $articleExists = $wgTitle->getArticleId();
172 if ( $wgOut->isArticle() ||
$action =='edit' ||
$action =='history' ||
$wpPreview) {
173 if($wgOut->isArticle()) {
174 $s .= '<strong>' . $this->editThisPage() . '</strong>';
175 } else { # backlink to the article in edit or history mode
176 if($articleExists){ # no backlink if no article
180 case NS_PROJECT_TALK
:
182 case NS_MEDIAWIKI_TALK
:
183 case NS_TEMPLATE_TALK
:
185 case NS_CATEGORY_TALK
:
186 $text = wfMsg('viewtalkpage');
189 $text = wfMsg( 'articlepage' );
192 $text = wfMsg( 'userpage' );
195 $text = wfMsg( 'projectpage' );
198 $text = wfMsg( 'imagepage' );
201 $text = wfMsg( 'mediawikipage' );
204 $text = wfMsg( 'templatepage' );
207 $text = wfMsg( 'viewhelppage' );
210 $text = wfMsg( 'categorypage' );
213 $text= wfMsg( 'articlepage' );
216 $link = $wgTitle->getText();
217 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
218 $link = $nstext . ':' . $link ;
221 $s .= $this->makeLink( $link, $text );
222 } elseif( $wgTitle->getNamespace() != NS_SPECIAL
) {
223 # we just throw in a "New page" text to tell the user that he's in edit mode,
224 # and to avoid messing with the separator that is prepended to the next item
225 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
230 # "Post a comment" link
231 if( ( $wgTitle->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
232 $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
234 #if( $tns%2 && $action!='edit' && !$wpPreview) {
235 #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
239 watching could cause problems in edit mode:
240 if user edits article, then loads "watch this article" in background and then saves
241 article with "Watch this article" checkbox disabled, the article is transparently
242 unwatched. Therefore we do not show the "Watch this page" link in edit mode
244 if ( $wgUser->isLoggedIn() && $articleExists) {
245 if($action!='edit' && $action != 'submit' )
247 $s .= $sep . $this->watchThisPage();
249 if ( $wgTitle->userCan( 'edit' ) )
250 $s .= $sep . $this->moveThisPage();
252 if ( $wgUser->isAllowed('delete') and $articleExists ) {
253 $s .= $sep . $this->deleteThisPage() .
254 $sep . $this->protectThisPage();
256 $s .= $sep . $this->talkLink();
257 if ($articleExists && $action !='history') {
258 $s .= $sep . $this->historyLink();
260 $s.=$sep . $this->whatLinksHere();
262 if($wgOut->isArticleRelated()) {
263 $s .= $sep . $this->watchPageLinksLink();
266 if ( NS_USER
== $wgTitle->getNamespace()
267 ||
$wgTitle->getNamespace() == NS_USER_TALK
) {
269 $id=User
::idFromName($wgTitle->getText());
270 $ip=User
::isIP($wgTitle->getText());
273 $s .= $sep . $this->userContribsLink();
275 if( $this->showEmailUser( $id ) ) {
276 $s .= $sep . $this->emailUserLink();
279 $s .= "\n<br /><hr class='sep' />";
282 if ( $wgUser->isLoggedIn() && ( $wgEnableUploads ||
$wgRemoteUploads ) ) {
283 $s .= $this->specialLink( 'upload' ) . $sep;
285 $s .= $this->specialLink( 'specialpages' )
286 . $sep . $this->bugReportsLink();
288 global $wgSiteSupportPage;
289 if( $wgSiteSupportPage ) {
290 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
291 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
294 $s .= "\n<br /></div>\n";
295 wfProfileOut( $fname );