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