10 if( !defined( 'MEDIAWIKI' ) )
18 class SkinStandard
extends Skin
{
23 function getHeadScripts() {
24 global $wgStylePath, $wgJsMimeType;
26 $s = parent
::getHeadScripts();
27 if ( 3 == $this->qbSetting() ) { # Floating left
28 $s .= "<script language='javascript' type='$wgJsMimeType' " .
29 "src='{$wgStylePath}/common/sticky.js'></script>\n";
37 function getUserStyles() {
40 if ( 3 == $this->qbSetting() ) { # Floating left
41 $s .= "<style type='text/css'>\n" .
42 "@import '{$wgStylePath}/common/quickbar.css';\n</style>\n";
43 } else if ( 4 == $this->qbSetting() ) { # Floating right
44 $s .= "<style type='text/css'>\n" .
45 "@import '{$wgStylePath}/common/quickbar-right.css';\n</style>\n";
47 $s .= parent
::getUserStyles();
54 function doGetUserStyles() {
55 global $wgStylePath, $wgLang, $wgUser;
57 $s = parent
::doGetUserStyles();
58 $qb = $this->qbSetting();
60 if ( (!$wgUser->isLoggedIn() && $wgLang->isRTL() ) ||
61 ( 2 == $qb ) ) { # Right
62 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
63 "border-left: 2px solid #000000; }\n" .
64 "#article { margin-left: 4px; margin-right: 152px; }\n";
65 } else if ( (!$wgUser->isLoggedIn()) ||
66 ( 1 == $qb ||
3 == $qb ) ) {
67 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
68 "border-right: 1px solid gray; }\n" .
69 "#article { margin-left: 152px; margin-right: 4px; }\n";
70 } else if ( 4 == $qb) {
71 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
72 "#article { margin-right: 152px; margin-left: 4px; }\n";
80 function getBodyOptions() {
81 $a = parent
::getBodyOptions();
83 if ( 3 == $this->qbSetting() ) { # Floating left
84 $qb = "setup(\"quickbar\")";
86 $a["onload"] .= ";$qb";
94 function doAfterContent() {
96 $fname = 'SkinStandard::doAfterContent';
97 wfProfileIn( $fname );
98 wfProfileIn( $fname.'-1' );
100 $s = "\n</div><br style=\"clear:both\" />\n";
101 $s .= "\n<div id='footer'>";
102 $s .= '<table border="0" cellspacing="0"><tr>';
104 wfProfileOut( $fname.'-1' );
105 wfProfileIn( $fname.'-2' );
107 $qb = $this->qbSetting();
109 $left = ($qb == 1 ||
$qb == 3);
110 if($wgLang->isRTL()) $left = !$left;
112 if ( $shove && $left ) { # Left
113 $s .= $this->getQuickbarCompensator();
115 wfProfileOut( $fname.'-2' );
116 wfProfileIn( $fname.'-3' );
117 $l = $wgLang->isRTL() ?
'right' : 'left';
118 $s .= "<td class='bottom' align='$l' valign='top'>";
120 $s .= $this->bottomLinks();
121 $s .= "\n<br />" . $this->mainPageLink()
122 . ' | ' . $this->aboutLink()
123 . ' | ' . $this->specialLink( 'recentchanges' )
124 . ' | ' . $this->searchForm()
125 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
128 if ( $shove && !$left ) { # Right
129 $s .= $this->getQuickbarCompensator();
131 $s .= "</tr></table>\n</div>\n</div>\n";
133 wfProfileOut( $fname.'-3' );
134 wfProfileIn( $fname.'-4' );
135 if ( 0 != $qb ) { $s .= $this->quickBar(); }
136 wfProfileOut( $fname.'-4' );
137 wfProfileOut( $fname );
141 function quickBar() {
142 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
143 global $wgEnableUploads, $wgRemoteUploads;
145 $fname = 'Skin::quickBar';
146 wfProfileIn( $fname );
148 $action = $wgRequest->getText( 'action' );
149 $wpPreview = $wgRequest->getBool( 'wpPreview' );
150 $tns=$wgTitle->getNamespace();
152 $s = "\n<div id='quickbar'>";
153 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
157 # Use the first heading from the Monobook sidebar as the "browse" section
158 $bar = $this->buildSidebar();
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
183 $text = wfMsg('articlepage');
186 $text = wfMsg('viewtalkpage');
189 $text = wfMsg('userpage');
192 $text = wfMsg('viewtalkpage');
195 $text = wfMsg('projectpage');
198 $text = wfMsg('viewtalkpage');
201 $text = wfMsg('imagepage');
204 $text = wfMsg('viewtalkpage');
207 $text= wfMsg('articlepage');
210 $link = $wgTitle->getText();
211 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
212 $link = $nstext . ':' . $link ;
215 $s .= $this->makeLink( $link, $text );
216 } elseif( $wgTitle->getNamespace() != NS_SPECIAL
) {
217 # we just throw in a "New page" text to tell the user that he's in edit mode,
218 # and to avoid messing with the separator that is prepended to the next item
219 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
224 # "Post a comment" link
225 if( ( $wgTitle->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
226 $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
228 #if( $tns%2 && $action!='edit' && !$wpPreview) {
229 #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
233 watching could cause problems in edit mode:
234 if user edits article, then loads "watch this article" in background and then saves
235 article with "Watch this article" checkbox disabled, the article is transparently
236 unwatched. Therefore we do not show the "Watch this page" link in edit mode
238 if ( $wgUser->isLoggedIn() && $articleExists) {
239 if($action!='edit' && $action != 'submit' )
241 $s .= $sep . $this->watchThisPage();
243 if ( $wgTitle->userCanEdit() )
244 $s .= $sep . $this->moveThisPage();
246 if ( $wgUser->isAllowed('delete') and $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($wgOut->isArticleRelated()) {
257 $s .= $sep . $this->watchPageLinksLink();
260 if ( NS_USER
== $wgTitle->getNamespace()
261 ||
$wgTitle->getNamespace() == NS_USER_TALK
) {
263 $id=User
::idFromName($wgTitle->getText());
264 $ip=User
::isIP($wgTitle->getText());
267 $s .= $sep . $this->userContribsLink();
269 if( $this->showEmailUser( $id ) ) {
270 $s .= $sep . $this->emailUserLink();
273 $s .= "\n<br /><hr class='sep' />";
276 if ( $wgUser->isLoggedIn() && ( $wgEnableUploads ||
$wgRemoteUploads ) ) {
277 $s .= $this->specialLink( 'upload' ) . $sep;
279 $s .= $this->specialLink( 'specialpages' )
280 . $sep . $this->bugReportsLink();
282 global $wgSiteSupportPage;
283 if( $wgSiteSupportPage ) {
284 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
285 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
288 $s .= "\n<br /></div>\n";
289 wfProfileOut( $fname );