00001 <?php
00010 if( !defined( 'MEDIAWIKI' ) )
00011 die( -1 );
00012
00017 class SkinStandard extends Skin {
00018
00022 function getHeadScripts( $allowUserJs ) {
00023 global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
00024
00025 $s = parent::getHeadScripts( $allowUserJs );
00026 if ( 3 == $this->qbSetting() ) { # Floating left
00027 $s .= "<script language='javascript' type='$wgJsMimeType' " .
00028 "src='{$wgStylePath}/common/sticky.js?$wgStyleVersion'></script>\n";
00029 }
00030 return $s;
00031 }
00032
00036 function setupSkinUserCss( OutputPage $out ){
00037 if ( 3 == $this->qbSetting() ) { # Floating left
00038 $out->addStyle( 'common/quickbar.css' );
00039 } else if ( 4 == $this->qbSetting() ) { # Floating right
00040 $out->addStyle( 'common/quickbar-right.css' );
00041 }
00042 parent::setupSkinUserCss( $out );
00043 }
00044
00048 function reallyGenerateUserStylesheet() {
00049 $s = parent::reallyGenerateUserStylesheet();
00050 $qb = $this->qbSetting();
00051
00052 if ( 2 == $qb ) { # Right
00053 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
00054 "border-left: 2px solid #000000; }\n" .
00055 "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
00056 } else if ( 1 == $qb || 3 == $qb ) {
00057 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
00058 "border-right: 1px solid gray; }\n" .
00059 "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
00060 } else if ( 4 == $qb) {
00061 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
00062 "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
00063 }
00064 return $s;
00065 }
00066
00070 function getBodyOptions() {
00071 $a = parent::getBodyOptions();
00072
00073 if ( 3 == $this->qbSetting() ) { # Floating left
00074 $qb = "setup(\"quickbar\")";
00075 if($a["onload"]) {
00076 $a["onload"] .= ";$qb";
00077 } else {
00078 $a["onload"] = $qb;
00079 }
00080 }
00081 return $a;
00082 }
00083
00084 function doAfterContent() {
00085 global $wgContLang, $wgLang;
00086 $fname = 'SkinStandard::doAfterContent';
00087 wfProfileIn( $fname );
00088 wfProfileIn( $fname.'-1' );
00089
00090 $s = "\n</div><br style=\"clear:both\" />\n";
00091 $s .= "\n<div id='footer'>";
00092 $s .= '<table border="0" cellspacing="0"><tr>';
00093
00094 wfProfileOut( $fname.'-1' );
00095 wfProfileIn( $fname.'-2' );
00096
00097 $qb = $this->qbSetting();
00098 $shove = ($qb != 0);
00099 $left = ($qb == 1 || $qb == 3);
00100 if($wgContLang->isRTL()) $left = !$left;
00101
00102 if ( $shove && $left ) { # Left
00103 $s .= $this->getQuickbarCompensator();
00104 }
00105 wfProfileOut( $fname.'-2' );
00106 wfProfileIn( $fname.'-3' );
00107 $l = $wgContLang->isRTL() ? 'right' : 'left';
00108 $s .= "<td class='bottom' align='$l' valign='top'>";
00109
00110 $s .= $this->bottomLinks();
00111 $s .= "\n<br />" . $wgLang->pipeList( array(
00112 $this->mainPageLink(),
00113 $this->aboutLink(),
00114 $this->specialLink( 'recentchanges' ),
00115 $this->searchForm() ) )
00116 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
00117
00118 $s .= "</td>";
00119 if ( $shove && !$left ) { # Right
00120 $s .= $this->getQuickbarCompensator();
00121 }
00122 $s .= "</tr></table>\n</div>\n</div>\n";
00123
00124 wfProfileOut( $fname.'-3' );
00125 wfProfileIn( $fname.'-4' );
00126 if ( 0 != $qb ) { $s .= $this->quickBar(); }
00127 wfProfileOut( $fname.'-4' );
00128 wfProfileOut( $fname );
00129 return $s;
00130 }
00131
00132 function quickBar() {
00133 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
00134 global $wgEnableUploads, $wgRemoteUploads;
00135
00136 $fname = 'Skin::quickBar';
00137 wfProfileIn( $fname );
00138
00139 $action = $wgRequest->getText( 'action' );
00140 $wpPreview = $wgRequest->getBool( 'wpPreview' );
00141 $tns=$wgTitle->getNamespace();
00142
00143 $s = "\n<div id='quickbar'>";
00144 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
00145
00146 $sep = "\n<br />";
00147
00148 # Use the first heading from the Monobook sidebar as the "browse" section
00149 $bar = $this->buildSidebar();
00150 unset( $bar['SEARCH'] );
00151 unset( $bar['LANGUAGES'] );
00152 unset( $bar['TOOLBOX'] );
00153 $browseLinks = reset( $bar );
00154
00155 foreach ( $browseLinks as $link ) {
00156 if ( $link['text'] != '-' ) {
00157 $s .= "<a href=\"{$link['href']}\">" .
00158 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
00159 }
00160 }
00161
00162 if( $wgUser->isLoggedIn() ) {
00163 $s.= $this->specialLink( 'watchlist' ) ;
00164 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
00165 wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
00166 }
00167
00168 $s .= "\n<hr class='sep' />";
00169 $articleExists = $wgTitle->getArticleId();
00170 if ( $wgOut->isArticle() || $action =='edit' || $action =='history' || $wpPreview) {
00171 if($wgOut->isArticle()) {
00172 $s .= '<strong>' . $this->editThisPage() . '</strong>';
00173 } else { # backlink to the article in edit or history mode
00174 if($articleExists){ # no backlink if no article
00175 switch($tns) {
00176 case NS_TALK:
00177 case NS_USER_TALK:
00178 case NS_PROJECT_TALK:
00179 case NS_FILE_TALK:
00180 case NS_MEDIAWIKI_TALK:
00181 case NS_TEMPLATE_TALK:
00182 case NS_HELP_TALK:
00183 case NS_CATEGORY_TALK:
00184 $text = wfMsg('viewtalkpage');
00185 break;
00186 case NS_MAIN:
00187 $text = wfMsg( 'articlepage' );
00188 break;
00189 case NS_USER:
00190 $text = wfMsg( 'userpage' );
00191 break;
00192 case NS_PROJECT:
00193 $text = wfMsg( 'projectpage' );
00194 break;
00195 case NS_FILE:
00196 $text = wfMsg( 'imagepage' );
00197 break;
00198 case NS_MEDIAWIKI:
00199 $text = wfMsg( 'mediawikipage' );
00200 break;
00201 case NS_TEMPLATE:
00202 $text = wfMsg( 'templatepage' );
00203 break;
00204 case NS_HELP:
00205 $text = wfMsg( 'viewhelppage' );
00206 break;
00207 case NS_CATEGORY:
00208 $text = wfMsg( 'categorypage' );
00209 break;
00210 default:
00211 $text= wfMsg( 'articlepage' );
00212 }
00213
00214 $link = $wgTitle->getText();
00215 if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
00216 $link = $nstext . ':' . $link ;
00217 }
00218
00219 $s .= $this->makeLink( $link, $text );
00220 } elseif( $wgTitle->getNamespace() != NS_SPECIAL ) {
00221 # we just throw in a "New page" text to tell the user that he's in edit mode,
00222 # and to avoid messing with the separator that is prepended to the next item
00223 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
00224 }
00225
00226 }
00227
00228 # "Post a comment" link
00229 if( ( $wgTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
00230 $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
00231
00232 #if( $tns%2 && $action!='edit' && !$wpPreview) {
00233 #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
00234 #}
00235
00236
00237
00238
00239
00240
00241
00242 if ( $wgUser->isLoggedIn() && $articleExists) {
00243 if($action!='edit' && $action != 'submit' )
00244 {
00245 $s .= $sep . $this->watchThisPage();
00246 }
00247 if ( $wgTitle->userCan( 'edit' ) )
00248 $s .= $sep . $this->moveThisPage();
00249 }
00250 if ( $wgUser->isAllowed('delete') and $articleExists ) {
00251 $s .= $sep . $this->deleteThisPage() .
00252 $sep . $this->protectThisPage();
00253 }
00254 $s .= $sep . $this->talkLink();
00255 if ($articleExists && $action !='history') {
00256 $s .= $sep . $this->historyLink();
00257 }
00258 $s.=$sep . $this->whatLinksHere();
00259
00260 if($wgOut->isArticleRelated()) {
00261 $s .= $sep . $this->watchPageLinksLink();
00262 }
00263
00264 if ( NS_USER == $wgTitle->getNamespace()
00265 || $wgTitle->getNamespace() == NS_USER_TALK ) {
00266
00267 $id=User::idFromName($wgTitle->getText());
00268 $ip=User::isIP($wgTitle->getText());
00269
00270 if( $id || $ip ){
00271 $s .= $sep . $this->userContribsLink();
00272 }
00273 if( $this->showEmailUser( $id ) ) {
00274 $s .= $sep . $this->emailUserLink();
00275 }
00276 }
00277 $s .= "\n<br /><hr class='sep' />";
00278 }
00279
00280 if ( $wgUser->isLoggedIn() && ( $wgEnableUploads || $wgRemoteUploads ) ) {
00281 $s .= $this->specialLink( 'upload' ) . $sep;
00282 }
00283 $s .= $this->specialLink( 'specialpages' );
00284
00285 global $wgSiteSupportPage;
00286 if( $wgSiteSupportPage ) {
00287 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
00288 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>';
00289 }
00290
00291 $s .= "\n<br /></div>\n";
00292 wfProfileOut( $fname );
00293 return $s;
00294 }
00295
00296
00297 }