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