MediaWiki
REL1_19
|
00001 <?php 00009 if( !defined( 'MEDIAWIKI' ) ) { 00010 die( -1 ); 00011 } 00012 00017 class SkinStandard extends SkinLegacy { 00018 var $skinname = 'standard', $stylename = 'standard', 00019 $template = 'StandardTemplate'; 00020 00024 function setupSkinUserCss( OutputPage $out ){ 00025 parent::setupSkinUserCss( $out ); 00026 $out->addModuleStyles( 'skins.standard' ); 00027 00028 $qb = $this->qbSetting(); 00029 $rules = array(); 00030 00031 if ( 2 == $qb ) { # Right 00032 $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }"; 00033 $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }"; 00034 $rules[] = "/* @noflip */#topbar, #footer { margin-right: 152px; }"; 00035 } elseif ( 1 == $qb || 3 == $qb ) { 00036 $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }"; 00037 $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }"; 00038 $rules[] = "/* @noflip */#topbar, #footer { margin-left: 152px; }"; 00039 if( 3 == $qb ) { 00040 $rules[] = "/* @noflip */#quickbar { position: fixed; padding: 4px; }"; 00041 } 00042 } elseif ( 4 == $qb ) { 00043 $rules[] = "/* @noflip */#quickbar { position: fixed; right: 0; top: 0; padding: 4px; }"; 00044 $rules[] = "/* @noflip */#quickbar { border-right: 1px solid gray; }"; 00045 $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }"; 00046 $rules[] = "/* @noflip */#topbar, #footer { margin-right: 152px; }"; 00047 } 00048 $style = implode( "\n", $rules ); 00049 $out->addInlineStyle( $style, 'flip' ); 00050 } 00051 00052 } 00053 00054 class StandardTemplate extends LegacyTemplate { 00055 00059 function doAfterContent() { 00060 wfProfileIn( __METHOD__ ); 00061 wfProfileIn( __METHOD__ . '-1' ); 00062 00063 $s = "\n</div><br style=\"clear:both\" />\n"; 00064 $s .= "\n<div id='footer'>"; 00065 $s .= '<table border="0" cellspacing="0"><tr>'; 00066 00067 wfProfileOut( __METHOD__ . '-1' ); 00068 wfProfileIn( __METHOD__ . '-2' ); 00069 $l = $this->getSkin()->getLanguage()->alignStart(); 00070 $s .= "<td class='bottom' align='$l' valign='top'>"; 00071 00072 $s .= $this->bottomLinks(); 00073 $s .= "\n<br />" . $this->getSkin()->getLanguage()->pipeList( array( 00074 $this->getSkin()->mainPageLink(), 00075 $this->getSkin()->aboutLink(), 00076 Linker::specialLink( 'Recentchanges' ), 00077 $this->searchForm() ) ) 00078 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>'; 00079 00080 $s .= '</td>'; 00081 $s .= "</tr></table>\n</div>\n</div>\n"; 00082 00083 wfProfileOut( __METHOD__ . '-2' ); 00084 wfProfileIn( __METHOD__ . '-3' ); 00085 if ( $this->getSkin()->qbSetting() != 0 ) { 00086 $s .= $this->quickBar(); 00087 } 00088 wfProfileOut( __METHOD__ . '-3' ); 00089 wfProfileOut( __METHOD__ ); 00090 return $s; 00091 } 00092 00096 function quickBar() { 00097 global $wgContLang; 00098 00099 wfProfileIn( __METHOD__ ); 00100 00101 $action = $this->getSkin()->getRequest()->getText( 'action' ); 00102 $wpPreview = $this->getSkin()->getRequest()->getBool( 'wpPreview' ); 00103 $title = $this->getSkin()->getTitle(); 00104 $tns = $title->getNamespace(); 00105 00106 $s = "\n<div id='quickbar'>"; 00107 $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />"; 00108 00109 $sep = "\n<br />"; 00110 00111 # Use the first heading from the Monobook sidebar as the "browse" section 00112 $bar = $this->getSkin()->buildSidebar(); 00113 unset( $bar['SEARCH'] ); 00114 unset( $bar['LANGUAGES'] ); 00115 unset( $bar['TOOLBOX'] ); 00116 00117 $barnumber = 1; 00118 foreach ( $bar as $browseLinks ) { 00119 if ( is_array( $browseLinks ) ) { 00120 if ( $barnumber > 1 ) { 00121 $s .= "\n<hr class='sep' />"; 00122 } 00123 foreach ( $browseLinks as $link ) { 00124 if ( $link['text'] != '-' ) { 00125 $s .= "<a href=\"{$link['href']}\">" . 00126 htmlspecialchars( $link['text'] ) . '</a>' . $sep; 00127 } 00128 } 00129 } 00130 if ( $barnumber == 1 ) { 00131 // only show watchlist link if logged in 00132 if( $this->data['loggedin'] ) { 00133 $s.= Linker::specialLink( 'Watchlist' ) ; 00134 $s .= $sep . Linker::linkKnown( 00135 SpecialPage::getTitleFor( 'Contributions' ), 00136 wfMsg( 'mycontris' ), 00137 array(), 00138 array( 'target' => $this->data['username'] ) 00139 ); 00140 } 00141 } 00142 $barnumber = $barnumber + 1; 00143 } 00144 00145 $s .= "\n<hr class='sep' />"; 00146 $articleExists = $title->getArticleId(); 00147 if ( $this->data['isarticle'] || $action == 'edit' || $action == 'history' || $wpPreview ) { 00148 if( $this->data['isarticle'] ) { 00149 $s .= '<strong>' . $this->editThisPage() . '</strong>'; 00150 } else { # backlink to the article in edit or history mode 00151 if( $articleExists ){ # no backlink if no article 00152 switch( $tns ) { 00153 case NS_TALK: 00154 case NS_USER_TALK: 00155 case NS_PROJECT_TALK: 00156 case NS_FILE_TALK: 00157 case NS_MEDIAWIKI_TALK: 00158 case NS_TEMPLATE_TALK: 00159 case NS_HELP_TALK: 00160 case NS_CATEGORY_TALK: 00161 $text = wfMsg('viewtalkpage'); 00162 break; 00163 case NS_MAIN: 00164 $text = wfMsg( 'articlepage' ); 00165 break; 00166 case NS_USER: 00167 $text = wfMsg( 'userpage' ); 00168 break; 00169 case NS_PROJECT: 00170 $text = wfMsg( 'projectpage' ); 00171 break; 00172 case NS_FILE: 00173 $text = wfMsg( 'imagepage' ); 00174 break; 00175 case NS_MEDIAWIKI: 00176 $text = wfMsg( 'mediawikipage' ); 00177 break; 00178 case NS_TEMPLATE: 00179 $text = wfMsg( 'templatepage' ); 00180 break; 00181 case NS_HELP: 00182 $text = wfMsg( 'viewhelppage' ); 00183 break; 00184 case NS_CATEGORY: 00185 $text = wfMsg( 'categorypage' ); 00186 break; 00187 default: 00188 $text = wfMsg( 'articlepage' ); 00189 } 00190 00191 $link = $title->getText(); 00192 $nstext = $wgContLang->getNsText( $tns ); 00193 if( $nstext ) { # add namespace if necessary 00194 $link = $nstext . ':' . $link; 00195 } 00196 00197 $s .= Linker::link( Title::newFromText( $link ), $text ); 00198 } elseif( $title->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( ( $title->isTalkPage() || $this->getSkin()->getOutput()->showNewSectionLink() ) && $action != 'edit' && !$wpPreview ) 00207 $s .= '<br />' . Linker::link( 00208 $title, 00209 wfMsg( 'postcomment' ), 00210 array(), 00211 array( 00212 'action' => 'edit', 00213 'section' => 'new' 00214 ) 00215 ); 00216 00223 if ( $this->data['loggedin'] && $articleExists ) { 00224 if( $action != 'edit' && $action != 'submit' ) { 00225 $s .= $sep . $this->watchThisPage(); 00226 } 00227 if ( $title->userCan( 'edit' ) ) 00228 $s .= $sep . $this->moveThisPage(); 00229 } 00230 if ( $this->getSkin()->getUser()->isAllowed( 'delete' ) && $articleExists ) { 00231 $s .= $sep . $this->deleteThisPage() . 00232 $sep . $this->protectThisPage(); 00233 } 00234 $s .= $sep . $this->talkLink(); 00235 if( $articleExists && $action != 'history' ) { 00236 $s .= $sep . $this->historyLink(); 00237 } 00238 $s .= $sep . $this->whatLinksHere(); 00239 00240 if( $this->getSkin()->getOutput()->isArticleRelated() ) { 00241 $s .= $sep . $this->watchPageLinksLink(); 00242 } 00243 00244 if ( 00245 NS_USER == $title->getNamespace() || 00246 $title->getNamespace() == NS_USER_TALK 00247 ) { 00248 00249 $id = User::idFromName( $title->getText() ); 00250 $ip = User::isIP( $title->getText() ); 00251 00252 if( $id || $ip ){ 00253 $s .= $sep . $this->userContribsLink(); 00254 } 00255 if( $this->getSkin()->showEmailUser( $id ) ) { 00256 $s .= $sep . $this->emailUserLink(); 00257 } 00258 } 00259 $s .= "\n<br /><hr class='sep' />"; 00260 } 00261 00262 if( UploadBase::isEnabled() && UploadBase::isAllowed( $this->getSkin()->getUser() ) === true ) { 00263 $s .= $this->getUploadLink() . $sep; 00264 } 00265 00266 $s .= Linker::specialLink( 'Specialpages' ); 00267 00268 global $wgSiteSupportPage; 00269 if( $wgSiteSupportPage ) { 00270 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) . 00271 '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>'; 00272 } 00273 00274 $s .= "\n<br /></div>\n"; 00275 wfProfileOut( __METHOD__ ); 00276 return $s; 00277 } 00278 00279 }