r11303 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r11302‎ | r11303 | r11304 >
Date:23:46, 11 October 2005
Author:tomgilder
Status:old
Tags:
Comment:
Usability/accessibility: don't link in navigation if page is active
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/skins/MonoBook.php (modified) (history)
  • /trunk/phase3/skins/monobook/main.css (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/monobook/main.css
@@ -682,6 +682,10 @@
683683 z-index: 3;
684684 }
685685
 686+#p-navigation strong {
 687+ font-weight: normal;
 688+}
 689+
686690 /*
687691 ** Search portlet
688692 */
Index: trunk/phase3/skins/MonoBook.php
@@ -48,6 +48,7 @@
4949 */
5050 function execute() {
5151 // Suppress warnings to prevent notices about missing indexes in $this->data
 52+ global $action;
5253 wfSuppressWarnings();
5354
5455 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -97,11 +98,11 @@
9899 <div id="p-cactions" class="portlet">
99100 <h5><?php $this->msg('views') ?></h5>
100101 <ul>
101 - <?php foreach($this->data['content_actions'] as $key => $action) {
 102+ <?php foreach($this->data['content_actions'] as $key => $tab) {
102103 ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
103 - <?php if($action['class']) { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
104 - ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
105 - echo htmlspecialchars($action['text']) ?></a></li><?php
 104+ <?php if($tab['class']) { ?>class="<?php echo htmlspecialchars($tab['class']) ?>"<?php } ?>
 105+ ><a href="<?php echo htmlspecialchars($tab['href']) ?>"><?php
 106+ echo htmlspecialchars($tab['text']) ?></a></li><?php
106107 } ?>
107108 </ul>
108109 </div>
@@ -130,9 +131,15 @@
131132 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
132133 <div class='pBody'>
133134 <ul>
134 - <?php foreach($cont as $key => $val) { ?>
135 - <li id="<?php echo htmlspecialchars($val['id']) ?>"><a href="<?php echo htmlspecialchars($val['href']) ?>"><?php echo htmlspecialchars($val['text'])?></a></li>
136 - <?php } ?>
 135+ <?php foreach($cont as $key => $val) {
 136+ echo '<li id="' . htmlspecialchars($val['id']) . '">';
 137+ if ( $val['active'] ) echo '<strong>';
 138+ if ( $val['dolink'] ) echo '<a href="' . htmlspecialchars($val['href']) . '">';
 139+ echo htmlspecialchars($val['text']);
 140+ if ( $val['active'] ) echo '</strong>';
 141+ if ( $val['dolink'] ) echo '</a>';
 142+ echo '</li>';
 143+ } ?>
137144 </ul>
138145 </div>
139146 </div>
Index: trunk/phase3/includes/Skin.php
@@ -1312,7 +1312,10 @@
13131313 * @access private
13141314 */
13151315 function buildSidebar() {
 1316+ global $wgTitle, $action;
 1317+
13161318 $fname = 'SkinTemplate::buildSidebar';
 1319+ $pageurl = $wgTitle->getLocalURL();
13171320 wfProfileIn( $fname );
13181321
13191322 $bar = array();
@@ -1333,10 +1336,14 @@
13341337 $text = $line[1];
13351338 if (wfEmptyMsg($line[0], $link))
13361339 $link = $line[0];
 1340+ $href = $this->makeInternalOrExternalUrl( $link );
 1341+ $active = ( $pageurl == $href );
13371342 $bar[$heading][] = array(
13381343 'text' => $text,
1339 - 'href' => $this->makeInternalOrExternalUrl( $link ),
 1344+ 'href' => $href,
13401345 'id' => 'n-' . strtr($line[1], ' ', '-'),
 1346+ 'active' => $active,
 1347+ 'dolink' => ( !$active || ($action != 'view' && $action != 'purge' ) )
13411348 );
13421349 } else { continue; }
13431350 }

Status & tagging log