MediaWiki
REL1_23
|
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( array( 'mediawiki.skinning.interface', 'skins.monobook.styles' ) ); 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 00225 <?php $this->renderAfterPortlet( 'search' ); ?> 00226 </div> 00227 </div> 00228 <?php 00229 } 00230 00235 function cactions() { 00236 ?> 00237 <div id="p-cactions" class="portlet" role="navigation"> 00238 <h3><?php $this->msg( 'views' ) ?></h3> 00239 <div class="pBody"> 00240 <ul><?php 00241 foreach ( $this->data['content_actions'] as $key => $tab ) { 00242 echo ' 00243 ' . $this->makeListItem( $key, $tab ); 00244 } ?> 00245 00246 </ul> 00247 <?php $this->renderAfterPortlet( 'cactions' ); ?> 00248 </div> 00249 </div> 00250 <?php 00251 } 00252 /*************************************************************************************************/ 00253 function toolbox() { 00254 ?> 00255 <div class="portlet" id="p-tb" role="navigation"> 00256 <h3><?php $this->msg( 'toolbox' ) ?></h3> 00257 <div class="pBody"> 00258 <ul> 00259 <?php 00260 foreach ( $this->getToolbox() as $key => $tbitem ) { ?> 00261 <?php echo $this->makeListItem( $key, $tbitem ); ?> 00262 00263 <?php 00264 } 00265 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); 00266 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); 00267 ?> 00268 </ul> 00269 <?php $this->renderAfterPortlet( 'tb' ); ?> 00270 </div> 00271 </div> 00272 <?php 00273 } 00274 00275 /*************************************************************************************************/ 00276 function languageBox() { 00277 if ( $this->data['language_urls'] !== false ) { 00278 ?> 00279 <div id="p-lang" class="portlet" role="navigation"> 00280 <h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3> 00281 <div class="pBody"> 00282 <ul> 00283 <?php foreach ( $this->data['language_urls'] as $key => $langlink ) { ?> 00284 <?php echo $this->makeListItem( $key, $langlink ); ?> 00285 00286 <?php } ?> 00287 </ul> 00288 00289 <?php $this->renderAfterPortlet( 'lang' ); ?> 00290 </div> 00291 </div> 00292 <?php 00293 } 00294 } 00295 00296 /*************************************************************************************************/ 00301 function customBox( $bar, $cont ) { 00302 $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ), 'role' => 'navigation' ); 00303 $tooltip = Linker::titleAttrib( "p-$bar" ); 00304 if ( $tooltip !== false ) { 00305 $portletAttribs['title'] = $tooltip; 00306 } 00307 echo ' ' . Html::openElement( 'div', $portletAttribs ); 00308 $msgObj = wfMessage( $bar ); 00309 ?> 00310 00311 <h3><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?></h3> 00312 <div class='pBody'> 00313 <?php if ( is_array( $cont ) ) { ?> 00314 <ul> 00315 <?php foreach ( $cont as $key => $val ) { ?> 00316 <?php echo $this->makeListItem( $key, $val ); ?> 00317 00318 <?php } ?> 00319 </ul> 00320 <?php } else { 00321 # allow raw HTML block to be defined by extensions 00322 print $cont; 00323 } 00324 00325 $this->renderAfterPortlet( $bar ); 00326 ?> 00327 </div> 00328 </div> 00329 <?php 00330 } 00331 00332 } // end of class