r71983 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71982‎ | r71983 | r71984 >
Date:22:01, 30 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
adding state restoration for checkboxes in campaign detail form, removing redundant comments
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -724,11 +724,17 @@
725725 $endArray['month'] .
726726 $endArray['day'] . '000000'
727727 ;
 728+ $isEnabled = $wgRequest->getCheck( 'enabled' );
 729+ $isPreferred = $wgRequest->getCheck( 'preferred' );
 730+ $isLocked = $wgRequest->getCheck( 'locked' );
728731 $projectSelected = $wgRequest->getVal( 'project_name' );
729732 $noticeLanguages = $wgRequest->getArray( 'project_languages', array() );
730733 } else { // Defaults
731734 $startTimestamp = $row->not_start;
732735 $endTimestamp = $row->not_end;
 736+ $isEnabled = ( $row->not_enabled == '1' );
 737+ $isPreferred = ( $row->not_preferred == '1' );
 738+ $isLocked = ( $row->not_locked == '1' );
733739 $projectSelected = $row->not_project;
734740 $noticeLanguages = $this->getNoticeLanguages( $notice );
735741 }
@@ -767,17 +773,17 @@
768774 // Enabled
769775 $htmlOut .= Xml::openElement( 'tr' );
770776 $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-enabled' ), 'enabled' ) );
771 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'enabled', ( $row->not_enabled == '1' ), wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
 777+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'enabled', $isEnabled, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
772778 $htmlOut .= Xml::closeElement( 'tr' );
773779 // Preferred
774780 $htmlOut .= Xml::openElement( 'tr' );
775781 $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-preferred' ), 'preferred' ) );
776 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'preferred', ( $row->not_preferred == '1' ), wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
 782+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'preferred', $isPreferred, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
777783 $htmlOut .= Xml::closeElement( 'tr' );
778784 // Locked
779785 $htmlOut .= Xml::openElement( 'tr' );
780786 $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-locked' ), 'locked' ) );
781 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'locked', ( $row->not_locked == '1' ), wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
 787+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'locked', $isLocked, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
782788 $htmlOut .= Xml::closeElement( 'tr' );
783789 if ( $this->editable ) {
784790 // Locked
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -462,8 +462,8 @@
463463
464464 // If there was an error, we'll need to restore the state of the form
465465 if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'mainform' ) ) {
466 - $displayAnon = $wgRequest->getCheck( 'displayAnon' ); // Restore checkbox state in event of error
467 - $displayAccount = $wgRequest->getCheck( 'displayAccount' ); // Restore checkbox state in event of error
 466+ $displayAnon = $wgRequest->getCheck( 'displayAnon' );
 467+ $displayAccount = $wgRequest->getCheck( 'displayAccount' );
468468 $body = $wgRequest->getVal( 'templateBody', $body );
469469 } else { // Defaults
470470 $displayAnon = ( $row->tmp_display_anon == 1 );

Status & tagging log