From 1f10cb3124c165302830cf318ad4b6589547b79c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 6 Aug 2013 16:08:15 +0200 Subject: [PATCH] Framework: Rename DateTime form element to DateTimePicker refs #4440 --- .../Web/Form/Element/{DateTime.php => DateTimePicker.php} | 2 +- .../application/forms/Command/AcknowledgeForm.php | 6 +++--- .../application/forms/Command/RescheduleNextCheckForm.php | 5 ++--- .../application/forms/Command/ScheduleDowntimeForm.php | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) rename library/Icinga/Web/Form/Element/{DateTime.php => DateTimePicker.php} (96%) diff --git a/library/Icinga/Web/Form/Element/DateTime.php b/library/Icinga/Web/Form/Element/DateTimePicker.php similarity index 96% rename from library/Icinga/Web/Form/Element/DateTime.php rename to library/Icinga/Web/Form/Element/DateTimePicker.php index 3f4752abc..37f58c350 100644 --- a/library/Icinga/Web/Form/Element/DateTime.php +++ b/library/Icinga/Web/Form/Element/DateTimePicker.php @@ -33,7 +33,7 @@ use Zend_Form_Element_Xhtml; /** * Datetime form element */ -class DateTime extends Zend_Form_Element_Xhtml +class DateTimePicker extends Zend_Form_Element_Xhtml { /** * Default form view helper to use for rendering diff --git a/modules/monitoring/application/forms/Command/AcknowledgeForm.php b/modules/monitoring/application/forms/Command/AcknowledgeForm.php index 6c2deda55..f351a232a 100644 --- a/modules/monitoring/application/forms/Command/AcknowledgeForm.php +++ b/modules/monitoring/application/forms/Command/AcknowledgeForm.php @@ -28,7 +28,7 @@ namespace Monitoring\Form\Command; -use Icinga\Web\Form\Element\DateTime; +use Icinga\Web\Form\Element\DateTimePicker; use \DateTime as PhpDateTime; use \DateInterval; use Icinga\Web\Form\Element\Note; @@ -94,14 +94,14 @@ class AcknowledgeForm extends CommandForm $interval = new DateInterval('PT1H'); // Add 3600 seconds $now->add($interval); - $expireTime = new DateTime( + $expireTime = new DateTimePicker( array( 'name' => 'expiretime', 'label' => t('Expire time'), 'value' => $now->format($this->getDateFormat()) ) ); - + $this->addElements(array($expireNote, $expireCheck, $expireTime)); } else { $this->addElements(array($expireNote, $expireCheck)); diff --git a/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php b/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php index 80b1e913c..9011cbb1e 100644 --- a/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php +++ b/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php @@ -28,7 +28,7 @@ namespace Monitoring\Form\Command; -use Icinga\Web\Form\Element\DateTime; +use Icinga\Web\Form\Element\DateTimePicker; use Zend_Form_Element_Checkbox; use DateTime as PhpDateTime; @@ -45,8 +45,7 @@ class RescheduleNextCheckForm extends WithChildrenCommandForm { $now = new PhpDateTime(); - - $dateElement = new DateTime( + $dateElement = new DateTimePicker( array( 'name' => 'checktime', 'label' => t('Check time'), diff --git a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php index 1ac6afada..1bbdc2785 100644 --- a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php +++ b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php @@ -28,7 +28,7 @@ namespace Monitoring\Form\Command; -use Icinga\Web\Form\Element\DateTime; +use Icinga\Web\Form\Element\DateTimePicker; use Icinga\Protocol\Commandpipe\Downtime; use Icinga\Protocol\Commandpipe\Comment; use \DateTime as PhpDateTime; @@ -146,7 +146,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm list($timestampStart, $timestampEnd) = $this->generateDefaultTimestamps(); - $dateTimeStart = new DateTime( + $dateTimeStart = new DateTimePicker( array( 'name' => 'starttime', 'label' => t('Start time'), @@ -156,7 +156,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm $dateTimeStart->setRequired(true); $dateTimeStart->addValidator($this->createDateTimeValidator(), true); - $dateTimeEnd = new DateTime( + $dateTimeEnd = new DateTimePicker( array( 'name' => 'endtime', 'label' => t('End time'), @@ -188,7 +188,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm ); $this->enableAutoSubmit(array('type')); - + if ($this->getRequest()->getPost('type') === self::TYPE_FLEXIBLE) { $hoursText = new Zend_Form_Element_Text('hours'); $hoursText->setLabel(t('Flexible duration'));