MediaWiki
REL1_20
|
00001 <?php 00025 if( !defined( 'MEDIAWIKI' ) ) { 00026 die( -1 ); 00027 } 00028 00033 class SkinCologneBlue extends SkinLegacy { 00034 var $skinname = 'cologneblue', $stylename = 'cologneblue', 00035 $template = 'CologneBlueTemplate'; 00036 00040 function setupSkinUserCss( OutputPage $out ){ 00041 parent::setupSkinUserCss( $out ); 00042 $out->addModuleStyles( 'skins.cologneblue' ); 00043 00044 $qb = $this->qbSetting(); 00045 $rules = array(); 00046 00047 if ( 2 == $qb ) { # Right 00048 $rules[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }"; 00049 $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }"; 00050 $rules[] = "/* @noflip */#footer { margin-right: 152px; }"; 00051 } elseif ( 1 == $qb ) { 00052 $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }"; 00053 $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }"; 00054 $rules[] = "/* @noflip */#footer { margin-left: 152px; }"; 00055 } elseif ( 3 == $qb ) { # Floating left 00056 $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }"; 00057 $rules[] = "/* @noflip */#topbar { margin-left: 148px }"; 00058 $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }"; 00059 $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE 00060 $rules[] = "/* @noflip */#footer { margin-left: 152px; }"; 00061 } elseif ( 4 == $qb ) { # Floating right 00062 $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }"; 00063 $rules[] = "/* @noflip */#topbar { margin-right: 148px }"; 00064 $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }"; 00065 $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE 00066 $rules[] = "/* @noflip */#footer { margin-right: 152px; }"; 00067 } 00068 $style = implode( "\n", $rules ); 00069 $out->addInlineStyle( $style, 'flip' ); 00070 } 00071 00072 } 00073 00074 class CologneBlueTemplate extends LegacyTemplate { 00075 00079 function doBeforeContent() { 00080 $mainPageObj = Title::newMainPage(); 00081 00082 $s = "\n<div id='content'>\n<div id='topbar'>" . 00083 '<table width="100%" cellspacing="0" cellpadding="8"><tr>'; 00084 00085 $s .= '<td class="top" nowrap="nowrap">'; 00086 $s .= '<a href="' . htmlspecialchars( $mainPageObj->getLocalURL() ) . '">'; 00087 $s .= '<span id="sitetitle">' . wfMessage( 'sitetitle' )->escaped() . '</span></a>'; 00088 00089 $s .= '</td><td class="top" id="top-syslinks" width="100%">'; 00090 $s .= $this->sysLinks(); 00091 $s .= '</td></tr><tr><td class="top-subheader">'; 00092 00093 $s .= '<font size="-1"><span id="sitesub">'; 00094 $s .= wfMessage( 'sitesubtitle' )->escaped() . '</span></font>'; 00095 $s .= '</td><td class="top-linkcollection">'; 00096 00097 $s .= '<font size="-1"><span id="langlinks">'; 00098 $s .= str_replace( '<br />', '', $this->otherLanguages() ); 00099 00100 $s .= $this->getSkin()->getCategories(); 00101 00102 $s .= '<br />' . $this->pageTitleLinks(); 00103 $s .= '</span></font>'; 00104 00105 $s .= "</td></tr></table>\n"; 00106 00107 $s .= "\n</div>\n<div id='article'>"; 00108 00109 $notice = $this->getSkin()->getSiteNotice(); 00110 if( $notice ) { 00111 $s .= "\n<div id='siteNotice'>$notice</div>\n"; 00112 } 00113 $s .= $this->pageTitle(); 00114 $s .= $this->pageSubtitle() . "\n"; 00115 return $s; 00116 } 00117 00121 function doAfterContent(){ 00122 $s = "\n</div><br clear='all' />\n"; 00123 00124 $s .= "\n<div id='footer'>"; 00125 $s .= '<table width="98%" cellspacing="0"><tr>'; 00126 00127 $s .= '<td class="bottom">'; 00128 00129 $s .= $this->bottomLinks(); 00130 $s .= $this->getSkin()->getLanguage()->pipeList( array( 00131 "\n<br />" . Linker::linkKnown( 00132 Title::newMainPage() 00133 ), 00134 $this->getSkin()->aboutLink(), 00135 $this->searchForm( wfMessage( 'qbfind' )->text() ) 00136 ) ); 00137 00138 $s .= "\n<br />" . $this->pageStats(); 00139 00140 $s .= '</td>'; 00141 $s .= "</tr></table>\n</div>\n</div>\n"; 00142 00143 if ( $this->getSkin()->qbSetting() != 0 ) { 00144 $s .= $this->quickBar(); 00145 } 00146 return $s; 00147 } 00148 00152 function sysLinks() { 00153 $li = SpecialPage::getTitleFor( 'Userlogin' ); 00154 $lo = SpecialPage::getTitleFor( 'Userlogout' ); 00155 00156 $rt = $this->getSkin()->getTitle()->getPrefixedURL(); 00157 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) { 00158 $q = array(); 00159 } else { 00160 $q = array( 'returnto' => $rt ); 00161 } 00162 00163 $s = array( 00164 $this->getSkin()->mainPageLink(), 00165 Linker::linkKnown( 00166 Title::newFromText( wfMessage( 'aboutpage' )->inContentLanguage()->text() ), 00167 wfMessage( 'about' )->text() 00168 ), 00169 Linker::linkKnown( 00170 Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ), 00171 wfMessage( 'help' )->text() 00172 ), 00173 Linker::linkKnown( 00174 Title::newFromText( wfMessage( 'faqpage' )->inContentLanguage()->text() ), 00175 wfMessage( 'faq' )->text() 00176 ), 00177 Linker::specialLink( 'Specialpages' ) 00178 ); 00179 00180 /* show links to different language variants */ 00181 if( $this->variantLinks() ) { 00182 $s[] = $this->variantLinks(); 00183 } 00184 if( $this->extensionTabLinks() ) { 00185 $s[] = $this->extensionTabLinks(); 00186 } 00187 if ( $this->data['loggedin'] ) { 00188 $s[] = Linker::linkKnown( 00189 $lo, 00190 wfMessage( 'logout' )->text(), 00191 array(), 00192 $q 00193 ); 00194 } else { 00195 $s[] = Linker::linkKnown( 00196 $li, 00197 wfMessage( 'login' )->text(), 00198 array(), 00199 $q 00200 ); 00201 } 00202 00203 return $this->getSkin()->getLanguage()->pipeList( $s ); 00204 } 00205 00212 function quickBar(){ 00213 $s = "\n<div id='quickbar'>"; 00214 00215 $sep = '<br />'; 00216 $s .= $this->menuHead( 'qbfind' ); 00217 $s .= $this->searchForm(); 00218 00219 $s .= $this->menuHead( 'qbbrowse' ); 00220 00221 # Use the first heading from the Monobook sidebar as the "browse" section 00222 $bar = $this->getSkin()->buildSidebar(); 00223 unset( $bar['SEARCH'] ); 00224 unset( $bar['LANGUAGES'] ); 00225 unset( $bar['TOOLBOX'] ); 00226 00227 $barnumber = 1; 00228 foreach ( $bar as $heading => $browseLinks ) { 00229 if ( $barnumber > 1 ) { 00230 $headingMsg = wfMessage( $heading ); 00231 if ( $headingMsg->exists() ) { 00232 $h = $headingMsg->text(); 00233 } else { 00234 $h = $heading; 00235 } 00236 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>"; 00237 } 00238 if( is_array( $browseLinks ) ) { 00239 foreach ( $browseLinks as $link ) { 00240 if ( $link['text'] != '-' ) { 00241 $s .= "<a href=\"{$link['href']}\">" . 00242 htmlspecialchars( $link['text'] ) . '</a>' . $sep; 00243 } 00244 } 00245 } 00246 $barnumber++; 00247 } 00248 00249 $user = $this->getSkin()->getUser(); 00250 00251 if ( $this->data['isarticle'] ) { 00252 $s .= $this->menuHead( 'qbedit' ); 00253 $s .= '<strong>' . $this->editThisPage() . '</strong>'; 00254 00255 $s .= $sep . Linker::linkKnown( 00256 Title::newFromText( wfMessage( 'edithelppage' )->inContentLanguage()->text() ), 00257 wfMessage( 'edithelp' )->text() 00258 ); 00259 00260 if( $this->data['loggedin'] ) { 00261 $s .= $sep . $this->moveThisPage(); 00262 } 00263 if ( $user->isAllowed( 'delete' ) ) { 00264 $dtp = $this->deleteThisPage(); 00265 if ( $dtp != '' ) { 00266 $s .= $sep . $dtp; 00267 } 00268 } 00269 if ( $user->isAllowed( 'protect' ) ) { 00270 $ptp = $this->protectThisPage(); 00271 if ( $ptp != '' ) { 00272 $s .= $sep . $ptp; 00273 } 00274 } 00275 $s .= $sep; 00276 00277 $s .= $this->menuHead( 'qbpageoptions' ); 00278 $s .= $this->talkLink() 00279 . $sep . $this->commentLink() 00280 . $sep . $this->printableLink(); 00281 if ( $this->data['loggedin'] ) { 00282 $s .= $sep . $this->watchThisPage(); 00283 } 00284 00285 $s .= $sep; 00286 00287 $s .= $this->menuHead( 'qbpageinfo' ) 00288 . $this->historyLink() 00289 . $sep . $this->whatLinksHere() 00290 . $sep . $this->watchPageLinksLink(); 00291 00292 $title = $this->getSkin()->getTitle(); 00293 $tns = $title->getNamespace(); 00294 if ( $tns == NS_USER || $tns == NS_USER_TALK ) { 00295 $id = User::idFromName( $title->getText() ); 00296 if( $id != 0 ) { 00297 $s .= $sep . $this->userContribsLink(); 00298 if( $this->getSkin()->showEmailUser( $id ) ) { 00299 $s .= $sep . $this->emailUserLink(); 00300 } 00301 } 00302 } 00303 $s .= $sep; 00304 } 00305 00306 $s .= $this->menuHead( 'qbmyoptions' ); 00307 if ( $this->data['loggedin'] ) { 00308 $tl = Linker::linkKnown( 00309 $user->getTalkPage(), 00310 wfMessage( 'mytalk' )->escaped() 00311 ); 00312 if ( $user->getNewtalk() ) { 00313 $tl .= ' *'; 00314 } 00315 00316 $s .= Linker::linkKnown( 00317 $user->getUserPage(), 00318 wfMessage( 'mypage' )->escaped() 00319 ) . $sep . $tl . $sep . Linker::specialLink( 'Watchlist' ) 00320 . $sep . 00321 Linker::linkKnown( 00322 SpecialPage::getSafeTitleFor( 'Contributions', $user->getName() ), 00323 wfMessage( 'mycontris' )->escaped() 00324 ) . $sep . Linker::specialLink( 'Preferences' ) 00325 . $sep . Linker::specialLink( 'Userlogout' ); 00326 } else { 00327 $s .= Linker::specialLink( 'Userlogin' ); 00328 } 00329 00330 $s .= $this->menuHead( 'qbspecialpages' ) 00331 . Linker::specialLink( 'Newpages' ) 00332 . $sep . Linker::specialLink( 'Listfiles' ) 00333 . $sep . Linker::specialLink( 'Statistics' ); 00334 if( UploadBase::isEnabled() && UploadBase::isAllowed( $user ) === true ) { 00335 $s .= $sep . $this->getUploadLink(); 00336 } 00337 00338 global $wgSiteSupportPage; 00339 00340 if( $wgSiteSupportPage ) { 00341 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">' 00342 . wfMessage( 'sitesupport' )->escaped() . '</a>'; 00343 } 00344 00345 $s .= $sep . Linker::linkKnown( 00346 SpecialPage::getTitleFor( 'Specialpages' ), 00347 wfMessage( 'moredotdotdot' )->text() 00348 ); 00349 00350 $s .= $sep . "\n</div>\n"; 00351 return $s; 00352 } 00353 00358 function menuHead( $key ) { 00359 $s = "\n<h6>" . wfMessage( $key )->text() . "</h6>"; 00360 return $s; 00361 } 00362 00367 function searchForm( $label = '' ) { 00368 global $wgUseTwoButtonsSearchForm; 00369 00370 $search = $this->getSkin()->getRequest()->getText( 'search' ); 00371 $action = $this->data['searchaction']; 00372 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">"; 00373 if( $label != '' ) { 00374 $s .= "{$label}: "; 00375 } 00376 00377 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\"" 00378 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />" 00379 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . wfMessage( 'searcharticle' )->escaped() . "\" />"; 00380 00381 if( $wgUseTwoButtonsSearchForm ) { 00382 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . wfMessage( 'search' )->escaped() . "\" />\n"; 00383 } else { 00384 $s .= '<div><a href="' . $action . '" rel="search">' . wfMessage( 'powersearch-legend' )->escaped() . "</a></div>\n"; 00385 } 00386 00387 $s .= '</form>'; 00388 00389 // Ensure unique id's for search boxes made after the first 00390 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1; 00391 00392 return $s; 00393 } 00394 }