* The accesskey to edit a page is now disabled when editing the page, to prevent...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 21 Jul 2008 02:47:42 +0000 (02:47 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 21 Jul 2008 02:47:42 +0000 (02:47 +0000)
* Fix watch checkbox for real in Firefox 3.  It still wasn't working right, due to the duplicate use of the W accesskey for the watch/unwatch tab.  This is now disabled on edit.

RELEASE-NOTES
skins/Modern.php
skins/MonoBook.php

index 740d874..54ffea4 100644 (file)
@@ -445,6 +445,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 12441) ./maintenance/generateSitemap.php fix -fspath requiring
   a trailing slash.
 * (bug 12568) configuration script now produce valid XHTML.
+* The accesskey to edit a page is now disabled when editing the page, to pre-
+  vent conflicts with Safari shortcuts.
 
 === API changes in 1.13 ===
 
index e75e4ae..3f5ce5e 100644 (file)
@@ -110,12 +110,27 @@ class ModernTemplate extends QuickTemplate {
                <h5><?php $this->msg('views') ?></h5>
                <div class="pBody">
                        <ul>
-       <?php                   foreach($this->data['content_actions'] as $key => $tab) { ?>
-                                <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
-                                               if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
-                                        ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
-                                        echo htmlspecialchars($tab['text']) ?></a></li>
-       <?php                    } ?>
+       <?php           foreach($this->data['content_actions'] as $key => $tab) {
+                                       echo '
+                                <li id="ca-' . Sanitizer::escapeId($key).'"';
+                                       if( $tab['class'] ) {
+                                               echo ' class="'.htmlspecialchars($tab['class']).'"';
+                                       }
+                                       echo'><a href="'.htmlspecialchars($tab['href']).'"';
+                                       # We don't want to give the watch tab an accesskey if the
+                                       # page is being edited, because that conflicts with the
+                                       # accesskey on the watch checkbox.  We also don't want to
+                                       # give the edit tab an accesskey, because that's fairly su-
+                                       # perfluous and conflicts with an accesskey (Ctrl-E) often
+                                       # used for editing in Safari.
+                                       if( in_array( $action, array( 'edit', 'submit' ) )
+                                       && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
+                                               echo $skin->tooltip( "ca-$key" );
+                                       } else {
+                                               echo $skin->tooltipAndAccesskey( "ca-$key" );
+                                       }
+                                       echo '>'.htmlspecialchars($tab['text']).'</a></li>';
+                               } ?>
                        </ul>
                </div>
        </div>
index bfd94d5..c17fc71 100644 (file)
@@ -46,8 +46,9 @@ class MonoBookTemplate extends QuickTemplate {
         * @access private
         */
        function execute() {
-               global $wgUser;
+               global $wgUser, $wgRequest;
                $this->skin = $skin = $wgUser->getSkin();
+               $action = $wgRequest->getText( 'action' );
 
                // Suppress warnings to prevent notices about missing indexes in $this->data
                wfSuppressWarnings();
@@ -123,12 +124,27 @@ class MonoBookTemplate extends QuickTemplate {
                <h5><?php $this->msg('views') ?></h5>
                <div class="pBody">
                        <ul>
-       <?php                   foreach($this->data['content_actions'] as $key => $tab) { ?>
-                                <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
-                                               if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
-                                        ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
-                                        echo htmlspecialchars($tab['text']) ?></a></li>
-       <?php                    } ?>
+       <?php           foreach($this->data['content_actions'] as $key => $tab) {
+                                       echo '
+                                <li id="ca-' . Sanitizer::escapeId($key).'"';
+                                       if( $tab['class'] ) {
+                                               echo ' class="'.htmlspecialchars($tab['class']).'"';
+                                       }
+                                       echo'><a href="'.htmlspecialchars($tab['href']).'"';
+                                       # We don't want to give the watch tab an accesskey if the
+                                       # page is being edited, because that conflicts with the
+                                       # accesskey on the watch checkbox.  We also don't want to
+                                       # give the edit tab an accesskey, because that's fairly su-
+                                       # perfluous and conflicts with an accesskey (Ctrl-E) often
+                                       # used for editing in Safari.
+                                       if( in_array( $action, array( 'edit', 'submit' ) )
+                                       && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
+                                               echo $skin->tooltip( "ca-$key" );
+                                       } else {
+                                               echo $skin->tooltipAndAccesskey( "ca-$key" );
+                                       }
+                                       echo '>'.htmlspecialchars($tab['text']).'</a></li>';
+                               } ?>
                        </ul>
                </div>
        </div>