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