r55765 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55764‎ | r55765 | r55766 >
Date:23:13, 2 September 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
(bug 18862) RevisionDelete dropdowns
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -710,6 +710,8 @@
711711 'revdelete-no-change',
712712 'revdelete-concurrent-change',
713713 'revdelete-only-restricted',
 714+ 'revdelete-reason-dropdown',
 715+ 'revdelete-otherreason',
714716 ),
715717 'suppression' => array(
716718 'suppressionlog',
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -153,6 +153,8 @@
154154 $rev = Revision::newFromId( $this->ids[0] );
155155 $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj;
156156 }
 157+
 158+ $this->otherReason = $wgRequest->getVal( 'wpReason' );
157159 # We need a target page!
158160 if( is_null($this->targetObj) ) {
159161 $wgOut->addWikiMsg( 'undelete-header' );
@@ -365,9 +367,17 @@
366368 Xml::openElement( 'fieldset' ) .
367369 Xml::element( 'legend', null, wfMsg( 'revdelete-legend' ) ) .
368370 $this->buildCheckBoxes( $bitfields ) .
369 - '<p>' . Xml::inputLabel( wfMsg( 'revdelete-log' ), 'wpReason', 'wpReason', 60 ) . '</p>' .
370 - '<p>' . Xml::submitButton( wfMsg( 'revdelete-submit' ),
371 - array( 'name' => 'wpSubmit' ) ) . '</p>' .
 371+ "\n<table><tr>\n" .
 372+ '<td>' . Xml::label( wfMsg('revdelete-log'), 'wpRevDeleteReasonList' ) . '</td>' .
 373+ '<td>' . Xml::listDropDown( 'wpRevDeleteReasonList',
 374+ wfMsgForContent( 'revdelete-reason-dropdown' ),
 375+ wfMsgForContent( 'revdelete-reasonotherlist' ), '', 'wpReasonDropDown', 1
 376+ ) . '</td>' .
 377+ "\n</tr><tr>\n" .
 378+ '<td>' . Xml::label( wfMsg( 'revdelete-otherreason' ), 'wpReason' ) . '</td>' .
 379+ '<td>' . Xml::input( 'wpReason', 60, $this->otherReason, array('id'=>'wpReason') ) . '</td>' .
 380+ "\n</tr></table>\n" .
 381+ Xml::submitButton( wfMsg( 'revdelete-submit' ), array( 'name' => 'wpSubmit' ) ) .
372382 Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .
373383 Xml::hidden( 'target', $this->targetObj->getPrefixedText() ) .
374384 Xml::hidden( 'type', $this->typeName ) .
@@ -398,9 +408,10 @@
399409 // FIXME: all items checked for just one rev are checked, even if not set for the others
400410 foreach( $this->checks as $item ) {
401411 list( $message, $name, $field ) = $item;
402 - $line = Xml::tags( 'div', null, Xml::checkLabel( wfMsg($message), $name, $name,
403 - $bitfields & $field ) );
404 - if( $field == Revision::DELETED_RESTRICTED ) $line = "<b>$line</b>";
 412+ $innerHTML = Xml::checkLabel( wfMsg($message), $name, $name, $bitfields & $field );
 413+ if( $field == Revision::DELETED_RESTRICTED )
 414+ $innerHTML = "<b>$innerHTML</b>";
 415+ $line = Xml::tags( 'div', null, $innerHTML );
405416 $html .= $line;
406417 }
407418 return $html;
@@ -418,7 +429,14 @@
419430 return false;
420431 }
421432 $bitfield = $this->extractBitfield( $request );
422 - $comment = $request->getText( 'wpReason' );
 433+ $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
 434+ $comment = $listReason;
 435+ if( $comment != 'other' && $this->otherReason != '' ) {
 436+ // Entry from drop down menu + additional comment
 437+ $comment .= wfMsgForContent( 'colon-separator' ) . $this->otherReason;
 438+ } elseif( $comment == 'other' ) {
 439+ $comment = $this->otherReason;
 440+ }
423441 # Can the user set this field?
424442 if( $bitfield & Revision::DELETED_RESTRICTED && !$wgUser->isAllowed('suppressrevision') ) {
425443 $wgOut->permissionRequired( 'suppressrevision' );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1462,7 +1462,13 @@
14631463 'revdelete-suppress' => 'Suppress data from administrators as well as others',
14641464 'revdelete-hide-image' => 'Hide file content',
14651465 'revdelete-unsuppress' => 'Remove restrictions on restored revisions',
1466 -'revdelete-log' => 'Log comment:',
 1466+'revdelete-reasonotherlist' => 'Other reason',
 1467+'revdelete-reason-dropdown' => '*Common delete reasons
 1468+** Author request
 1469+** Copyright violation
 1470+** Vandalism',
 1471+'revdelete-log' => 'Reason for deletion:',
 1472+'revdelete-otherreason' => 'Other/additional reason:',
14671473 'revdelete-submit' => 'Apply to selected revision',
14681474 'revdelete-logentry' => 'changed revision visibility of [[$1]]',
14691475 'logdelete-logentry' => 'changed event visibility of [[$1]]',

Comments

#Comment by Gurch (talk | contribs)   08:55, 3 September 2009

Please remove the entries in 'revdelete-reason-dropdown' before making this change live on Wikimedia. Giving administrators the implicit go-ahead to delete individual revisions just for being 'vandalism' is an extremely bad idea.

Status & tagging log