00001 <?php
00010 if( !defined( 'MEDIAWIKI' ) )
00011 die( -1 );
00012
00018 class SkinModern extends SkinTemplate {
00019 var $skinname = 'modern', $stylename = 'modern',
00020 $template = 'ModernTemplate', $useHeadElement = true;
00021
00022
00023
00024
00025
00026 function getPoweredBy() {
00027 global $wgVersion;
00028 return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
00029 }
00030
00031 function setupSkinUserCss( OutputPage $out ){
00032 global $wgStyleVersion, $wgJsMimeType, $wgStylePath;
00033
00034
00035 $out->addStyle( 'common/shared.css', 'screen' );
00036 $out->addStyle( 'modern/main.css', 'screen' );
00037 $out->addStyle( 'modern/print.css', 'print' );
00038 $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
00039 }
00040 }
00041
00046 class ModernTemplate extends QuickTemplate {
00047 var $skin;
00056 function execute() {
00057 global $wgRequest, $wgOut;
00058 $this->skin = $skin = $this->data['skin'];
00059 $action = $wgRequest->getText( 'action' );
00060
00061
00062 wfSuppressWarnings();
00063
00064 $this->html( 'headelement' );
00065 ?>
00066
00067 <!-- heading -->
00068 <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
00069
00070 <div id="mw_main">
00071 <div id="mw_contentwrapper">
00072 <!-- navigation portlet -->
00073 <div id="p-cactions" class="portlet">
00074 <h5><?php $this->msg('views') ?></h5>
00075 <div class="pBody">
00076 <ul>
00077 <?php foreach($this->data['content_actions'] as $key => $tab) {
00078 echo '
00079 <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
00080 if( $tab['class'] ) {
00081 echo ' class="'.htmlspecialchars($tab['class']).'"';
00082 }
00083 echo'><a href="'.htmlspecialchars($tab['href']).'"';
00084 # We don't want to give the watch tab an accesskey if the
00085 # page is being edited, because that conflicts with the
00086 # accesskey on the watch checkbox. We also don't want to
00087 # give the edit tab an accesskey, because that's fairly su-
00088 # perfluous and conflicts with an accesskey (Ctrl-E) often
00089 # used for editing in Safari.
00090 if( in_array( $action, array( 'edit', 'submit' ) )
00091 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
00092 echo $skin->tooltip( "ca-$key" );
00093 } else {
00094 echo $skin->tooltipAndAccesskey( "ca-$key" );
00095 }
00096 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
00097 } ?>
00098 </ul>
00099 </div>
00100 </div>
00101
00102 <!-- content -->
00103 <div id="mw_content">
00104 <!-- contentholder does nothing by default, but it allows users to style the text inside
00105 the content area without affecting the meaning of 'em' in #mw_content, which is used
00106 for the margins -->
00107 <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
00108 <div class='mw-topboxes'>
00109 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
00110 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
00111 <?php if($this->data['newtalk'] ) {
00112 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
00113 <?php } ?>
00114 <?php if($this->data['sitenotice']) {
00115 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
00116 <?php } ?>
00117 </div>
00118
00119 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
00120
00121 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
00122 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
00123
00124 <?php $this->html('bodytext') ?>
00125 <div class='mw_clear'></div>
00126 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
00127 <?php $this->html ('dataAfterContent') ?>
00128 </div><!-- mw_contentholder -->
00129 </div><!-- mw_content -->
00130 </div><!-- mw_contentwrapper -->
00131
00132 <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
00133
00134 <!-- portlets -->
00135 <?php
00136 $sidebar = $this->data['sidebar'];
00137 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
00138 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
00139 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
00140
00141 foreach ($sidebar as $boxName => $cont) {
00142 if ( $boxName == 'SEARCH' ) {
00143 $this->searchBox();
00144 } elseif ( $boxName == 'TOOLBOX' ) {
00145 $this->toolbox();
00146 } elseif ( $boxName == 'LANGUAGES' ) {
00147 $this->languageBox();
00148 } else {
00149 $this->customBox( $boxName, $cont );
00150 }
00151 }
00152 ?>
00153
00154 </div><!-- mw_portlets -->
00155
00156
00157 </div><!-- main -->
00158
00159 <div class="mw_clear"></div>
00160
00161 <!-- personal portlet -->
00162 <div class="portlet" id="p-personal">
00163 <h5><?php $this->msg('personaltools') ?></h5>
00164 <div class="pBody">
00165 <ul>
00166 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
00167 <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
00168 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
00169 echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
00170 if(!empty($item['class'])) { ?> class="<?php
00171 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
00172 echo htmlspecialchars($item['text']) ?></a></li>
00173 <?php } ?>
00174 </ul>
00175 </div>
00176 </div>
00177
00178
00179 <!-- footer -->
00180 <div id="footer"<?php $this->html('userlangattributes') ?>>
00181 <ul id="f-list">
00182 <?php
00183 $footerlinks = array(
00184 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
00185 'privacy', 'about', 'disclaimer', 'tagline',
00186 );
00187 foreach( $footerlinks as $aLink ) {
00188 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
00189 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
00190 <?php }
00191 }
00192 ?>
00193 </ul>
00194 <?php echo $this->html("poweredbyico"); ?>
00195 </div>
00196
00197 <?php $this->html('bottomscripts'); ?>
00198 <?php $this->html('reporttime') ?>
00199 <?php if ( $this->data['debug'] ): ?>
00200 <!-- Debug output:
00201 <?php $this->text( 'debug' ); ?>
00202 -->
00203 <?php endif; ?>
00204 </body></html>
00205 <?php
00206 wfRestoreWarnings();
00207 }
00208
00209
00210 function searchBox() {
00211 global $wgUseTwoButtonsSearchForm;
00212 ?>
00213 <!-- search -->
00214 <div id="p-search" class="portlet">
00215 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
00216 <div id="searchBody" class="pBody">
00217 <form action="<?php $this->text('wgScript') ?>" id="searchform">
00218 <input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/>
00219 <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search');
00220 if( isset( $this->data['search'] ) ) {
00221 ?> value="<?php $this->text('search') ?>"<?php } ?> />
00222 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /><?php if ($wgUseTwoButtonsSearchForm) { ?>
00223 <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /><?php } else { ?>
00224
00225 <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php } ?>
00226
00227 </form>
00228 </div>
00229 </div>
00230 <?php
00231 }
00232
00233
00234 function toolbox() {
00235 ?>
00236 <!-- toolbox -->
00237 <div class="portlet" id="p-tb">
00238 <h5><?php $this->msg('toolbox') ?></h5>
00239 <div class="pBody">
00240 <ul>
00241 <?php
00242 if($this->data['notspecialpage']) { ?>
00243 <li id="t-whatlinkshere"><a href="<?php
00244 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
00245 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
00246 <?php
00247 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
00248 <li id="t-recentchangeslinked"><a href="<?php
00249 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
00250 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked-toolbox') ?></a></li>
00251 <?php }
00252 }
00253 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
00254 <li id="t-trackbacklink"><a href="<?php
00255 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
00256 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
00257 <?php }
00258 if($this->data['feeds']) { ?>
00259 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
00260 ?><a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php
00261 echo htmlspecialchars($feed['href']) ?>" rel="alternate" type="application/<?php echo $key ?>+xml" class="feedlink"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>
00262 <?php } ?></li><?php
00263 }
00264
00265 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
00266
00267 if($this->data['nav_urls'][$special]) {
00268 ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
00269 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
00270 <?php }
00271 }
00272
00273 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
00274 <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
00275 ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
00276 }
00277
00278 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
00279 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
00280 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
00281 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
00282 <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
00283 }
00284
00285 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
00286 ?>
00287 </ul>
00288 </div>
00289 </div>
00290 <?php
00291 }
00292
00293
00294 function languageBox() {
00295 if( $this->data['language_urls'] ) {
00296 ?>
00297 <div id="p-lang" class="portlet">
00298 <h5><?php $this->msg('otherlanguages') ?></h5>
00299 <div class="pBody">
00300 <ul>
00301 <?php foreach($this->data['language_urls'] as $langlink) { ?>
00302 <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
00303 ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
00304 <?php } ?>
00305 </ul>
00306 </div>
00307 </div>
00308 <?php
00309 }
00310 }
00311
00312
00313 function customBox( $bar, $cont ) {
00314 ?>
00315 <div class='generated-sidebar portlet' id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>>
00316 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
00317 <div class='pBody'>
00318 <?php if ( is_array( $cont ) ) { ?>
00319 <ul>
00320 <?php foreach($cont as $key => $val) { ?>
00321 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
00322 if ( $val['active'] ) { ?> class="active" <?php }
00323 ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
00324 <?php } ?>
00325 </ul>
00326 <?php } else {
00327 # allow raw HTML block to be defined by extensions
00328 print $cont;
00329 }
00330 ?>
00331 </div>
00332 </div>
00333 <?php
00334 }
00335
00336 }
00337
00338