r57415 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57414‎ | r57415 | r57416 >
Date:06:30, 6 October 2009
Author:tstarling
Status:ok
Tags:bug27930 
Comment:
(bug 20966) Use the name of the <button> element to determine which button was clicked, instead of the value. This avoids some IE-specific non-standard behaviour.
Modified paths:
  • /trunk/phase3/includes/HistoryPage.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HistoryPage.php
@@ -349,15 +349,17 @@
350350 $s = Xml::openElement( 'form', array( 'action' => $wgScript,
351351 'id' => 'mw-history-compare' ) ) . "\n";
352352 $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
 353+ $s .= Xml::hidden( 'action', 'historysubmit' ) . "\n";
353354
354355 $this->buttons = '<div>';
355356 if( $wgUser->isAllowed('deletedhistory') ) {
356357 $float = $wgContLang->isRTL() ? 'left' : 'right';
 358+ # Note bug #20966, <button> is non-standard in IE<8
357359 $this->buttons .= Xml::element( 'button',
358360 array(
359361 'type' => 'submit',
360 - 'name' => 'action',
361 - 'value' => 'revisiondelete',
 362+ 'name' => 'revisiondelete',
 363+ 'value' => '1',
362364 'style' => "float: $float;",
363365 'class' => 'mw-history-revisiondelete-button',
364366 ),
Index: trunk/phase3/includes/Wiki.php
@@ -465,6 +465,16 @@
466466 $action = 'nosuchaction';
467467 }
468468
 469+ # Workaround for bug #20966: inability of IE to provide an action dependent
 470+ # on which submit button is clicked.
 471+ if ( $action === 'historysubmit' ) {
 472+ if ( $request->getBool( 'revisiondelete' ) ) {
 473+ $action = 'revisiondelete';
 474+ } else {
 475+ $action = 'view';
 476+ }
 477+ }
 478+
469479 switch( $action ) {
470480 case 'view':
471481 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -119,7 +119,7 @@
120120 // $this->ids = array_map( 'intval', $this->ids );
121121 $this->ids = array_unique( array_filter( $this->ids ) );
122122
123 - if ( $wgRequest->getVal( 'action' ) == 'revisiondelete' ) {
 123+ if ( $wgRequest->getVal( 'action' ) == 'historysubmit' ) {
124124 # For show/hide form submission from history page
125125 $this->targetObj = $GLOBALS['wgTitle'];
126126 $this->typeName = 'revision';

Follow-up revisions

RevisionCommit summaryAuthorDate
r91942Followup r91871 per CR. Write back the actually executed action to . Ping r57415diebuche09:42, 12 July 2011
r108380[mediawiki.action.history.js] Provide cleaner handling of action=historysubmi...krinkle02:08, 9 January 2012

Status & tagging log