MediaWiki
REL1_22
|
00001 <?php 00028 if ( !defined( 'MEDIAWIKI' ) ) { 00029 die( -1 ); 00030 } 00031 00037 class SkinMonoBook extends SkinTemplate { 00039 var $skinname = 'monobook', $stylename = 'monobook', 00040 $template = 'MonoBookTemplate', $useHeadElement = true; 00041 00045 function setupSkinUserCss( OutputPage $out ) { 00046 parent::setupSkinUserCss( $out ); 00047 00048 $out->addModuleStyles( 'skins.monobook' ); 00049 00050 // TODO: Migrate all of these 00051 $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' ); 00052 $out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' ); 00053 00054 } 00055 } 00056 00061 class MonoBookTemplate extends BaseTemplate { 00062 00071 function execute() { 00072 // Suppress warnings to prevent notices about missing indexes in $this->data 00073 wfSuppressWarnings(); 00074 00075 $this->html( 'headelement' ); 00076 ?><div id="globalWrapper"> 00077 <div id="column-content"><div id="content" class="mw-body-primary" role="main"> 00078 <a id="top"></a> 00079 <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div><?php } ?> 00080 00081 <h1 id="firstHeading" class="firstHeading" lang="<?php 00082 $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); 00083 $this->text( 'pageLanguage' ); 00084 ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1> 00085 <div id="bodyContent" class="mw-body"> 00086 <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div> 00087 <div id="contentSub"<?php $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) ?></div> 00088 <?php if ( $this->data['undelete'] ) { ?> 00089 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div> 00090 <?php } ?><?php if ( $this->data['newtalk'] ) { ?> 00091 <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div> 00092 <?php } ?> 00093 <div id="jump-to-nav" class="mw-jump"><?php $this->msg( 'jumpto' ) ?> <a href="#column-one"><?php $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' ) ?><a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a></div> 00094 00095 <!-- start content --> 00096 <?php $this->html( 'bodytext' ) ?> 00097 <?php if ( $this->data['catlinks'] ) { $this->html( 'catlinks' ); } ?> 00098 <!-- end content --> 00099 <?php if ( $this->data['dataAfterContent'] ) { $this->html( 'dataAfterContent' ); } ?> 00100 <div class="visualClear"></div> 00101 </div> 00102 </div></div> 00103 <div id="column-one"<?php $this->html( 'userlangattributes' ) ?>> 00104 <h2><?php $this->msg( 'navigation-heading' ) ?></h2> 00105 <?php $this->cactions(); ?> 00106 <div class="portlet" id="p-personal" role="navigation"> 00107 <h3><?php $this->msg( 'personaltools' ) ?></h3> 00108 <div class="pBody"> 00109 <ul<?php $this->html( 'userlangattributes' ) ?>> 00110 <?php foreach ( $this->getPersonalTools() as $key => $item ) { ?> 00111 <?php echo $this->makeListItem( $key, $item ); ?> 00112 00113 <?php } ?> 00114 </ul> 00115 </div> 00116 </div> 00117 <div class="portlet" id="p-logo" role="banner"> 00118 <?php 00119 echo Html::element( 'a', array( 00120 'href' => $this->data['nav_urls']['mainpage']['href'], 00121 'style' => "background-image: url({$this->data['logopath']});" ) 00122 + Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ); ?> 00123 00124 </div> 00125 <?php 00126 $this->renderPortals( $this->data['sidebar'] ); 00127 ?> 00128 </div><!-- end of the left (by default at least) column --> 00129 <div class="visualClear"></div> 00130 <?php 00131 $validFooterIcons = $this->getFooterIcons( "icononly" ); 00132 $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links 00133 00134 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { ?> 00135 <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>> 00136 <?php 00137 $footerEnd = '</div>'; 00138 } else { 00139 $footerEnd = ''; 00140 } 00141 foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?> 00142 <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico"> 00143 <?php foreach ( $footerIcons as $icon ) { ?> 00144 <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?> 00145 00146 <?php } 00147 ?> 00148 </div> 00149 <?php } 00150 00151 if ( count( $validFooterLinks ) > 0 ) { 00152 ?> <ul id="f-list"> 00153 <?php 00154 foreach ( $validFooterLinks as $aLink ) { ?> 00155 <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li> 00156 <?php 00157 } 00158 ?> 00159 </ul> 00160 <?php } 00161 echo $footerEnd; 00162 ?> 00163 00164 </div> 00165 <?php 00166 $this->printTrail(); 00167 echo Html::closeElement( 'body' ); 00168 echo Html::closeElement( 'html' ); 00169 wfRestoreWarnings(); 00170 } // end of execute() method 00171 00172 /*************************************************************************************************/ 00173 00177 protected function renderPortals( $sidebar ) { 00178 if ( !isset( $sidebar['SEARCH'] ) ) { 00179 $sidebar['SEARCH'] = true; 00180 } 00181 if ( !isset( $sidebar['TOOLBOX'] ) ) { 00182 $sidebar['TOOLBOX'] = true; 00183 } 00184 if ( !isset( $sidebar['LANGUAGES'] ) ) { 00185 $sidebar['LANGUAGES'] = true; 00186 } 00187 00188 foreach ( $sidebar as $boxName => $content ) { 00189 if ( $content === false ) { 00190 continue; 00191 } 00192 00193 if ( $boxName == 'SEARCH' ) { 00194 $this->searchBox(); 00195 } elseif ( $boxName == 'TOOLBOX' ) { 00196 $this->toolbox(); 00197 } elseif ( $boxName == 'LANGUAGES' ) { 00198 $this->languageBox(); 00199 } else { 00200 $this->customBox( $boxName, $content ); 00201 } 00202 } 00203 } 00204 00205 function searchBox() { 00206 global $wgUseTwoButtonsSearchForm; 00207 ?> 00208 <div id="p-search" class="portlet" role="search"> 00209 <h3><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h3> 00210 <div id="searchBody" class="pBody"> 00211 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform"> 00212 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/> 00213 <?php echo $this->makeSearchInput( array( "id" => "searchInput" ) ); ?> 00214 00215 <?php echo $this->makeSearchButton( "go", array( "id" => "searchGoButton", "class" => "searchButton" ) ); 00216 if ( $wgUseTwoButtonsSearchForm ) { ?>  00217 <?php echo $this->makeSearchButton( "fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ) ); 00218 } else { ?> 00219 00220 <div><a href="<?php $this->text( 'searchaction' ) ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div><?php 00221 } ?> 00222 00223 </form> 00224 </div> 00225 </div> 00226 <?php 00227 } 00228 00233 function cactions() { 00234 ?> 00235 <div id="p-cactions" class="portlet" role="navigation"> 00236 <h3><?php $this->msg( 'views' ) ?></h3> 00237 <div class="pBody"> 00238 <ul><?php 00239 foreach ( $this->data['content_actions'] as $key => $tab ) { 00240 echo ' 00241 ' . $this->makeListItem( $key, $tab ); 00242 } ?> 00243 00244 </ul> 00245 </div> 00246 </div> 00247 <?php 00248 } 00249 /*************************************************************************************************/ 00250 function toolbox() { 00251 ?> 00252 <div class="portlet" id="p-tb" role="navigation"> 00253 <h3><?php $this->msg( 'toolbox' ) ?></h3> 00254 <div class="pBody"> 00255 <ul> 00256 <?php 00257 foreach ( $this->getToolbox() as $key => $tbitem ) { ?> 00258 <?php echo $this->makeListItem( $key, $tbitem ); ?> 00259 00260 <?php 00261 } 00262 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); 00263 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); 00264 ?> 00265 </ul> 00266 </div> 00267 </div> 00268 <?php 00269 } 00270 00271 /*************************************************************************************************/ 00272 function languageBox() { 00273 if ( $this->data['language_urls'] ) { 00274 ?> 00275 <div id="p-lang" class="portlet" role="navigation"> 00276 <h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3> 00277 <div class="pBody"> 00278 <ul> 00279 <?php foreach ( $this->data['language_urls'] as $key => $langlink ) { ?> 00280 <?php echo $this->makeListItem( $key, $langlink ); ?> 00281 00282 <?php } ?> 00283 </ul> 00284 </div> 00285 </div> 00286 <?php 00287 } 00288 } 00289 00290 /*************************************************************************************************/ 00295 function customBox( $bar, $cont ) { 00296 $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ), 'role' => 'navigation' ); 00297 $tooltip = Linker::titleAttrib( "p-$bar" ); 00298 if ( $tooltip !== false ) { 00299 $portletAttribs['title'] = $tooltip; 00300 } 00301 echo ' ' . Html::openElement( 'div', $portletAttribs ); 00302 $msgObj = wfMessage( $bar ); 00303 ?> 00304 00305 <h3><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?></h3> 00306 <div class='pBody'> 00307 <?php if ( is_array( $cont ) ) { ?> 00308 <ul> 00309 <?php foreach ( $cont as $key => $val ) { ?> 00310 <?php echo $this->makeListItem( $key, $val ); ?> 00311 00312 <?php } ?> 00313 </ul> 00314 <?php } else { 00315 # allow raw HTML block to be defined by extensions 00316 print $cont; 00317 } 00318 ?> 00319 </div> 00320 </div> 00321 <?php 00322 } 00323 } // end of class 00324 00325