(bug 20966) Use the name of the <button> element to determine which button was clicke...
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 6 Oct 2009 06:30:24 +0000 (06:30 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 6 Oct 2009 06:30:24 +0000 (06:30 +0000)
includes/HistoryPage.php
includes/Wiki.php
includes/specials/SpecialRevisiondelete.php

index a7bec6d..b17688a 100644 (file)
@@ -349,15 +349,17 @@ class HistoryPager extends ReverseChronologicalPager {
                $s = Xml::openElement( 'form', array( 'action' => $wgScript,
                        'id' => 'mw-history-compare' ) ) . "\n";
                $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
+               $s .= Xml::hidden( 'action', 'historysubmit' ) . "\n";
 
                $this->buttons = '<div>';
                if( $wgUser->isAllowed('deletedhistory') ) {
                        $float = $wgContLang->isRTL() ? 'left' : 'right';
+                       # Note bug #20966, <button> is non-standard in IE<8
                        $this->buttons .= Xml::element( 'button',
                                array(
                                        'type' => 'submit',
-                                       'name' => 'action',
-                                       'value' => 'revisiondelete',
+                                       'name' => 'revisiondelete',
+                                       'value' => '1',
                                        'style' => "float: $float;",
                                        'class' => 'mw-history-revisiondelete-button',
                                ),
index 9ef36b7..286bc8e 100644 (file)
@@ -465,6 +465,16 @@ class MediaWiki {
                        $action = 'nosuchaction';
                }
 
+               # Workaround for bug #20966: inability of IE to provide an action dependent
+               # on which submit button is clicked.
+               if ( $action === 'historysubmit' ) {
+                       if ( $request->getBool( 'revisiondelete' ) ) {
+                               $action = 'revisiondelete';
+                       } else {
+                               $action = 'view';
+                       }
+               }
+
                switch( $action ) {
                        case 'view':
                                $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
index 3cc91bb..985b8fa 100644 (file)
@@ -119,7 +119,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                // $this->ids = array_map( 'intval', $this->ids );
                $this->ids = array_unique( array_filter( $this->ids ) );
 
-               if ( $wgRequest->getVal( 'action' ) == 'revisiondelete' ) {
+               if ( $wgRequest->getVal( 'action' ) == 'historysubmit' ) {
                        # For show/hide form submission from history page
                        $this->targetObj = $GLOBALS['wgTitle'];
                        $this->typeName = 'revision';