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