r71718 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71717‎ | r71718 | r71719 >
Date:17:50, 26 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
restore form state for end date in event of error, use $startTimestamp instead of $timestamp
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -514,7 +514,7 @@
515515 // If there was an error, we'll need to restore the state of the form
516516 if ( $wgRequest->wasPosted() ) {
517517 $startArray = $wgRequest->getArray( 'start' );
518 - $timestamp = $startArray['year'] .
 518+ $startTimestamp = $startArray['year'] .
519519 $startArray['month'] .
520520 $startArray['day'] .
521521 $startArray['hour'] .
@@ -522,8 +522,8 @@
523523 ;
524524 $projectSelected = $wgRequest->getVal( 'project_name' );
525525 $noticeLanguages = $wgRequest->getArray( 'project_languages' );
526 - } else {
527 - $timestamp = null;
 526+ } else { // Defaults
 527+ $startTimestamp = null;
528528 $projectSelected = '';
529529 $noticeLanguages = array();
530530 }
@@ -547,12 +547,12 @@
548548 // Start Date
549549 $htmlOut .= Xml::openElement( 'tr' );
550550 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-date' ) );
551 - $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'start', $timestamp ) );
 551+ $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'start', $startTimestamp ) );
552552 $htmlOut .= Xml::closeElement( 'tr' );
553553 // Start Time
554554 $htmlOut .= Xml::openElement( 'tr' );
555555 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-hour' ) );
556 - $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start', $timestamp ) );
 556+ $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start', $startTimestamp ) );
557557 $htmlOut .= Xml::closeElement( 'tr' );
558558 // Project
559559 $htmlOut .= Xml::openElement( 'tr' );
@@ -738,16 +738,22 @@
739739 // If there was an error, we'll need to restore the state of the form
740740 if ( $wgRequest->wasPosted() ) {
741741 $startArray = $wgRequest->getArray( 'start' );
742 - $timestamp = $startArray['year'] .
 742+ $startTimestamp = $startArray['year'] .
743743 $startArray['month'] .
744744 $startArray['day'] .
745745 $startArray['hour'] .
746746 $startArray['min'] . '00'
747747 ;
 748+ $endArray = $wgRequest->getArray( 'end' );
 749+ $endTimestamp = $endArray['year'] .
 750+ $endArray['month'] .
 751+ $endArray['day'] . '000000'
 752+ ;
748753 $projectSelected = $wgRequest->getVal( 'project_name' );
749754 $noticeLanguages = $wgRequest->getArray( 'project_languages' );
750 - } else {
751 - $timestamp = $row->not_start;
 755+ } else { // Defaults
 756+ $startTimestamp = $row->not_start;
 757+ $endTimestamp = $row->not_end;
752758 $projectSelected = $row->not_project;
753759 $noticeLanguages = $this->getNoticeLanguages( $notice );
754760 }
@@ -761,17 +767,17 @@
762768 // Start Date
763769 $htmlOut .= Xml::openElement( 'tr' );
764770 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-date' ) );
765 - $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'start', $timestamp ) );
 771+ $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'start', $startTimestamp ) );
766772 $htmlOut .= Xml::closeElement( 'tr' );
767773 // Start Time
768774 $htmlOut .= Xml::openElement( 'tr' );
769775 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-hour' ) . "(GMT)" );
770 - $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start', $timestamp ) );
 776+ $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start', $startTimestamp ) );
771777 $htmlOut .= Xml::closeElement( 'tr' );
772778 // End Date
773779 $htmlOut .= Xml::openElement( 'tr' );
774780 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-end-date' ) );
775 - $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'end', $row->not_end ) );
 781+ $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'end', $endTimestamp ) );
776782 $htmlOut .= Xml::closeElement( 'tr' );
777783 // Project
778784 $htmlOut .= Xml::openElement( 'tr' );

Status & tagging log