r71688 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71687‎ | r71688 | r71689 >
Date:02:02, 26 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
preserve state of anon/logged-in checkboxes if session is lost
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -222,9 +222,19 @@
223223
224224 $htmlOut .= Xml::openElement( 'p', null );
225225 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
226 - $htmlOut .= Xml::check( 'displayAnon', true, array( 'id' => 'displayAnon' ) );
 226+ if ( $wgRequest->wasPosted() ) {
 227+ $displayAnon = $wgRequest->getCheck( 'displayAnon' );
 228+ } else {
 229+ $displayAnon = true;
 230+ }
 231+ $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 'id' => 'displayAnon' ) );
227232 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
228 - $htmlOut .= Xml::check( 'displayAccount', true, array( 'id' => 'displayAccount' ) );
 233+ if ( $wgRequest->wasPosted() ) {
 234+ $displayAccount = $wgRequest->getCheck( 'displayAccount' );
 235+ } else {
 236+ $displayAccount = true;
 237+ }
 238+ $htmlOut .= Xml::check( 'displayAccount', $displayAccount, array( 'id' => 'displayAccount' ) );
229239 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
230240 $htmlOut .= Xml::closeElement( 'p' );
231241
@@ -457,9 +467,19 @@
458468 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-settings' ) );
459469 $htmlOut .= Xml::openElement( 'p', null );
460470 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
461 - $htmlOut .= Xml::check( 'displayAnon', ( $row->tmp_display_anon == 1 ), wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
 471+ if ( $wgRequest->wasPosted() ) {
 472+ $displayAnon = $wgRequest->getCheck( 'displayAnon' );
 473+ } else {
 474+ $displayAnon = ( $row->tmp_display_anon == 1 );
 475+ }
 476+ $htmlOut .= Xml::check( 'displayAnon', $displayAnon, wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
462477 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
463 - $htmlOut .= Xml::check( 'displayAccount', ( $row->tmp_display_account == 1 ), wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
 478+ if ( $wgRequest->wasPosted() ) {
 479+ $displayAccount = $wgRequest->getCheck( 'displayAccount' );
 480+ } else {
 481+ $displayAccount = ( $row->tmp_display_account == 1 );
 482+ }
 483+ $htmlOut .= Xml::check( 'displayAccount', $displayAccount, wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
464484 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
465485 $htmlOut .= Xml::closeElement( 'p' );
466486 $htmlOut .= Xml::closeElement( 'fieldset' );

Status & tagging log