r63861 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63860‎ | r63861 | r63862 >
Date:12:51, 17 March 2010
Author:demon
Status:ok
Tags:
Comment:
Make ModernTemplate extend MonoBookTemplate so we can cut down at least /some/ of the line-by-line duplication. Could use some more work though.
Modified paths:
  • /trunk/phase3/skins/Modern.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/Modern.php
@@ -10,6 +10,8 @@
1111 if( !defined( 'MEDIAWIKI' ) )
1212 die( -1 );
1313
 14+require( dirname(__FILE__) . '/MonoBook.php' );
 15+
1416 /**
1517 * Inherit main code from SkinTemplate, set the CSS and template filter.
1618 * @todo document
@@ -43,7 +45,7 @@
4446 * @todo document
4547 * @ingroup Skins
4648 */
47 -class ModernTemplate extends QuickTemplate {
 49+class ModernTemplate extends MonoBookTemplate {
4850 var $skin;
4951 /**
5052 * Template filter callback for Modern skin.
@@ -205,134 +207,6 @@
206208 <?php
207209 wfRestoreWarnings();
208210 } // end of execute() method
209 -
210 - /*************************************************************************************************/
211 - function searchBox() {
212 - global $wgUseTwoButtonsSearchForm;
213 -?>
214 - <!-- search -->
215 - <div id="p-search" class="portlet">
216 - <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
217 - <div id="searchBody" class="pBody">
218 - <form action="<?php $this->text('wgScript') ?>" id="searchform">
219 - <input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/>
220 - <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search');
221 - if( isset( $this->data['search'] ) ) {
222 - ?> value="<?php $this->text('search') ?>"<?php } ?> />
223 - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /><?php if ($wgUseTwoButtonsSearchForm) { ?>&nbsp;
224 - <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /><?php } else { ?>
225 -
226 - <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php } ?>
227 -
228 - </form>
229 - </div>
230 - </div>
231 -<?php
232 - }
233 -
234 - /*************************************************************************************************/
235 - function toolbox() {
236 -?>
237 - <!-- toolbox -->
238 - <div class="portlet" id="p-tb">
239 - <h5><?php $this->msg('toolbox') ?></h5>
240 - <div class="pBody">
241 - <ul>
242 -<?php
243 - if($this->data['notspecialpage']) { ?>
244 - <li id="t-whatlinkshere"><a href="<?php
245 - echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
246 - ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
247 -<?php
248 - if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
249 - <li id="t-recentchangeslinked"><a href="<?php
250 - echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
251 - ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked-toolbox') ?></a></li>
252 -<?php }
253 - }
254 - if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
255 - <li id="t-trackbacklink"><a href="<?php
256 - echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
257 - ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
258 -<?php }
259 - if($this->data['feeds']) { ?>
260 - <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
261 - ?><a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php
262 - 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>&nbsp;
263 - <?php } ?></li><?php
264 - }
265 -
266 - foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
267 -
268 - if($this->data['nav_urls'][$special]) {
269 - ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
270 - ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
271 -<?php }
272 - }
273 -
274 - if(!empty($this->data['nav_urls']['print']['href'])) { ?>
275 - <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
276 - ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
277 - }
278 -
279 - if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
280 - <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
281 - ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
282 - } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
283 - <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
284 - }
285 -
286 - wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
287 -?>
288 - </ul>
289 - </div>
290 - </div>
291 -<?php
292 - }
293 -
294 - /*************************************************************************************************/
295 - function languageBox() {
296 - if( $this->data['language_urls'] ) {
297 -?>
298 - <div id="p-lang" class="portlet">
299 - <h5><?php $this->msg('otherlanguages') ?></h5>
300 - <div class="pBody">
301 - <ul>
302 -<?php foreach($this->data['language_urls'] as $langlink) { ?>
303 - <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
304 - ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
305 -<?php } ?>
306 - </ul>
307 - </div>
308 - </div>
309 -<?php
310 - }
311 - }
312 -
313 - /*************************************************************************************************/
314 - function customBox( $bar, $cont ) {
315 -?>
316 - <div class='generated-sidebar portlet' id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>>
317 - <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
318 - <div class='pBody'>
319 -<?php if ( is_array( $cont ) ) { ?>
320 - <ul>
321 -<?php foreach($cont as $key => $val) { ?>
322 - <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
323 - if ( $val['active'] ) { ?> class="active" <?php }
324 - ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
325 -<?php } ?>
326 - </ul>
327 -<?php } else {
328 - # allow raw HTML block to be defined by extensions
329 - print $cont;
330 - }
331 -?>
332 - </div>
333 - </div>
334 -<?php
335 - }
336 -
337211 } // end of class
338212
339213

Follow-up revisions

RevisionCommit summaryAuthorDate
r67626Merge from trunk r67623....platonides15:08, 8 June 2010

Status & tagging log