r71711 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71710‎ | r71711 | r71712 >
Date:17:17, 26 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
adding start date and time state restore for campaign edit form too
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -704,6 +704,8 @@
705705 * Create form for managing campaign settings (start date, end date, languages, etc.)
706706 */
707707 function noticeDetailForm( $notice ) {
 708+ global $wgRequest;
 709+
708710 if ( $this->editable ) {
709711 $readonly = array();
710712 } else {
@@ -728,6 +730,20 @@
729731 );
730732
731733 if ( $row ) {
 734+
 735+ // If there was an error, we'll need to restore the state of the start date and time select lists
 736+ if ( $wgRequest->wasPosted() ) {
 737+ $startArray = $wgRequest->getArray( 'start' );
 738+ $timestamp = $startArray['year'] .
 739+ $startArray['month'] .
 740+ $startArray['day'] .
 741+ $startArray['hour'] .
 742+ $startArray['min'] . '00'
 743+ ;
 744+ } else {
 745+ $timestamp = $row->not_start;
 746+ }
 747+
732748 // Get all languages associated with the campaign
733749 $noticeLanguages = $this->getNoticeLanguages( $notice );
734750
@@ -740,12 +756,12 @@
741757 // Start Date
742758 $htmlOut .= Xml::openElement( 'tr' );
743759 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-date' ) );
744 - $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'start', $row->not_start ) );
 760+ $htmlOut .= Xml::tags( 'td', array(), $this->dateSelector( 'start', $timestamp ) );
745761 $htmlOut .= Xml::closeElement( 'tr' );
746762 // Start Time
747763 $htmlOut .= Xml::openElement( 'tr' );
748764 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-hour' ) . "(GMT)" );
749 - $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start', $row->not_start, "[$row->not_name]" ) );
 765+ $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start', $timestamp ) );
750766 $htmlOut .= Xml::closeElement( 'tr' );
751767 // End Date
752768 $htmlOut .= Xml::openElement( 'tr' );

Status & tagging log