10 if( !defined( 'MEDIAWIKI' ) )
18 class SkinStandard
extends Skin
{
23 function getHeadScripts() {
26 $s = parent
::getHeadScripts();
27 if ( 3 == $this->qbSetting() ) { # Floating left
28 $s .= "<script language='javascript' type='text/javascript' " .
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";
44 $s .= parent
::getUserStyles();
51 function doGetUserStyles() {
52 global $wgUser, $wgOut, $wgStylePath;
54 $s = parent
::doGetUserStyles();
55 $qb = $this->qbSetting();
57 if ( 2 == $qb ) { # Right
58 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
59 "border-left: 2px solid #000000; }\n" .
60 "#article { margin-left: 4px; margin-right: 152px; }\n";
61 } else if ( 1 == $qb ||
3 == $qb ) {
62 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
63 "border-right: 1px solid gray; }\n" .
64 "#article { margin-left: 152px; margin-right: 4px; }\n";
72 function getBodyOptions() {
73 $a = parent
::getBodyOptions();
75 if ( 3 == $this->qbSetting() ) { # Floating left
76 $qb = "setup(\"quickbar\")";
78 $a["onload"] .= ";$qb";
86 function doAfterContent() {
87 global $wgUser, $wgOut, $wgContLang;
88 $fname = 'SkinStandard::doAfterContent';
89 wfProfileIn( $fname );
90 wfProfileIn( $fname.'-1' );
92 $s = "\n</div><br style=\"clear:both\" />\n";
93 $s .= "\n<div id='footer'>";
94 $s .= '<table border="0" cellspacing="0"><tr>';
96 wfProfileOut( $fname.'-1' );
97 wfProfileIn( $fname.'-2' );
99 $qb = $this->qbSetting();
101 $left = ($qb == 1 ||
$qb == 3);
102 if($wgContLang->isRTL()) $left = !$left;
104 if ( $shove && $left ) { # Left
105 $s .= $this->getQuickbarCompensator();
107 wfProfileOut( $fname.'-2' );
108 wfProfileIn( $fname.'-3' );
109 $l = $wgContLang->isRTL() ?
'right' : 'left';
110 $s .= "<td class='bottom' align='$l' valign='top'>";
112 $s .= $this->bottomLinks();
113 $s .= "\n<br />" . $this->mainPageLink()
114 . ' | ' . $this->aboutLink()
115 . ' | ' . $this->specialLink( 'recentchanges' )
116 . ' | ' . $this->searchForm()
117 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
120 if ( $shove && !$left ) { # Right
121 $s .= $this->getQuickbarCompensator();
123 $s .= "</tr></table>\n</div>\n</div>\n";
125 wfProfileOut( $fname.'-3' );
126 wfProfileIn( $fname.'-4' );
127 if ( 0 != $qb ) { $s .= $this->quickBar(); }
128 wfProfileOut( $fname.'-4' );
129 wfProfileOut( $fname );
133 function quickBar() {
134 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
135 global $wgDisableUploads, $wgRemoteUploads, $wgNavigationLinks;
137 $fname = 'Skin::quickBar';
138 wfProfileIn( $fname );
140 $action = $wgRequest->getText( 'action' );
141 $wpPreview = $wgRequest->getBool( 'wpPreview' );
142 $tns=$wgTitle->getNamespace();
144 $s = "\n<div id='quickbar'>";
145 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
149 foreach ( $wgNavigationLinks as $link ) {
150 $msg = wfMsgForContent( $link['href'] );
152 $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
153 wfMsg( $link['text'] ) . '</a>' . $sep;
158 if ($wgUser->getID()) {
159 $s.= $this->specialLink( 'watchlist' ) ;
160 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
161 wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
163 // only show watchlist link if logged in
164 $s .= "\n<hr class='sep' />";
165 $articleExists = $wgTitle->getArticleId();
166 if ( $wgOut->isArticle() ||
$action =='edit' ||
$action =='history' ||
$wpPreview) {
167 if($wgOut->isArticle()) {
168 $s .= '<strong>' . $this->editThisPage() . '</strong>';
169 } else { # backlink to the article in edit or history mode
170 if($articleExists){ # no backlink if no article
173 $text = wfMsg('articlepage');
176 $text = wfMsg('viewtalkpage');
179 $text = wfMsg('userpage');
182 $text = wfMsg('viewtalkpage');
185 $text = wfMsg('wikipediapage');
188 $text = wfMsg('viewtalkpage');
191 $text = wfMsg('imagepage');
194 $text = wfMsg('viewtalkpage');
197 $text= wfMsg('articlepage');
200 $link = $wgTitle->getText();
201 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
202 $link = $nstext . ':' . $link ;
205 $s .= $this->makeLink( $link, $text );
206 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
207 # we just throw in a "New page" text to tell the user that he's in edit mode,
208 # and to avoid messing with the separator that is prepended to the next item
209 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
215 if( $tns%2
&& $action!='edit' && !$wpPreview) {
216 $s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
220 watching could cause problems in edit mode:
221 if user edits article, then loads "watch this article" in background and then saves
222 article with "Watch this article" checkbox disabled, the article is transparently
223 unwatched. Therefore we do not show the "Watch this page" link in edit mode
225 if ( 0 != $wgUser->getID() && $articleExists) {
226 if($action!='edit' && $action != 'submit' )
228 $s .= $sep . $this->watchThisPage();
230 if ( $wgTitle->userCanEdit() )
231 $s .= $sep . $this->moveThisPage();
233 if ( $wgUser->isAllowed('delete') and $articleExists ) {
234 $s .= $sep . $this->deleteThisPage() .
235 $sep . $this->protectThisPage();
237 $s .= $sep . $this->talkLink();
238 if ($articleExists && $action !='history') {
239 $s .= $sep . $this->historyLink();
241 $s.=$sep . $this->whatLinksHere();
243 if($wgOut->isArticleRelated()) {
244 $s .= $sep . $this->watchPageLinksLink();
247 if ( Namespace::getUser() == $wgTitle->getNamespace()
248 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
251 $id=User
::idFromName($wgTitle->getText());
252 $ip=User
::isIP($wgTitle->getText());
255 $s .= $sep . $this->userContribsLink();
257 if( $this->showEmailUser( $id ) ) {
258 $s .= $sep . $this->emailUserLink();
261 $s .= "\n<br /><hr class='sep' />";
264 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
265 $s .= $this->specialLink( 'upload' ) . $sep;
267 $s .= $this->specialLink( 'specialpages' )
268 . $sep . $this->bugReportsLink();
270 global $wgSiteSupportPage;
271 if( $wgSiteSupportPage ) {
272 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
273 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
276 $s .= "\n<br /></div>\n";
277 wfProfileOut( $fname );