From f9a8a2a6ac21252a005bfd421b44d80a3299c8d0 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 29 Apr 2009 17:05:10 +0200 Subject: [PATCH] MFB: Correctly create all-day events if using the all-day link in the day view (stpierre@nebrwesleyan.edu, Bug #8220). --- kronolith/docs/CHANGES | 4 +++- kronolith/lib/Event.php | 18 +++++++++--------- kronolith/lib/Kronolith.php | 4 ++-- kronolith/new.php | 10 ++-------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/kronolith/docs/CHANGES b/kronolith/docs/CHANGES index e63b9abbc..0c0dd84c3 100644 --- a/kronolith/docs/CHANGES +++ b/kronolith/docs/CHANGES @@ -18,7 +18,9 @@ v3.0-git v2.3.2-cvs ---------- - +[jan] Correctly create all-day events if using the all-day link in the day + view (stpierre@nebrwesleyan.edu, Bug #8220). +[jan] Fix rendering of all-day events (Bug #8176). ------ diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 6af1cdfd3..2679c7e9d 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -1870,7 +1870,7 @@ abstract class Kronolith_Event '" id="' . $this->_formIDEncode($property) . '" size="4" maxlength="4" />'; case 'end[month]': - $sel = $this->isInitialized() ? $this->end->month : $this->start->month; + $sel = $this->end ? $this->end->month : $this->start->month; for ($i = 1; $i < 13; ++$i) { $options[$i] = strftime('%b', mktime(1, 1, 1, $i, 1)); } @@ -1879,7 +1879,7 @@ abstract class Kronolith_Event break; case 'end[day]': - $sel = $this->isInitialized() ? $this->end->mday : $this->start->mday; + $sel = $this->end ? $this->end->mday : $this->start->mday; for ($i = 1; $i < 32; ++$i) { $options[$i] = $i; } @@ -1888,9 +1888,9 @@ abstract class Kronolith_Event break; case 'end_hour': - $sel = $this->isInitialized() ? - $this->end->format($prefs->getValue('twentyFour') ? 'G' : 'g') : - $this->start->format($prefs->getValue('twentyFour') ? 'G' : 'g') + 1; + $sel = $this->end + ? $this->end->format($prefs->getValue('twentyFour') ? 'G' : 'g') + : $this->start->format($prefs->getValue('twentyFour') ? 'G' : 'g') + 1; $hour_min = $prefs->getValue('twentyFour') ? 0 : 1; $hour_max = $prefs->getValue('twentyFour') ? 24 : 13; for ($i = $hour_min; $i < $hour_max; ++$i) { @@ -1901,7 +1901,7 @@ abstract class Kronolith_Event break; case 'end_min': - $sel = $this->isInitialized() ? $this->end->min : $this->start->min; + $sel = $this->end ? $this->end->min : $this->start->min; $sel = sprintf('%02d', $sel); for ($i = 0; $i < 12; ++$i) { $min = sprintf('%02d', $i * 5); @@ -1940,7 +1940,7 @@ abstract class Kronolith_Event break; case 'recur_enddate[year]': - if ($this->isInitialized()) { + if ($this->end) { $end = ($this->recurs() && $this->recurrence->hasRecurEnd()) ? $this->recurrence->recurEnd->year : $this->end->year; @@ -1953,7 +1953,7 @@ abstract class Kronolith_Event '" id="' . $this->_formIDEncode($property) . '" size="4" maxlength="4" />'; case 'recur_enddate[month]': - if ($this->isInitialized()) { + if ($this->end) { $sel = ($this->recurs() && $this->recurrence->hasRecurEnd()) ? $this->recurrence->recurEnd->month : $this->end->month; @@ -1968,7 +1968,7 @@ abstract class Kronolith_Event break; case 'recur_enddate[day]': - if ($this->isInitialized()) { + if ($this->end) { $sel = ($this->recurs() && $this->recurrence->hasRecurEnd()) ? $this->recurrence->recurEnd->mday : $this->end->mday; diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index a77197a60..4a6e064f9 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -1504,8 +1504,8 @@ class Kronolith * recurring event, the date of this * intance. */ - public static function sendITipNotifications(&$event, &$notification, $action, - $instance = null) + public static function sendITipNotifications(&$event, &$notification, + $action, $instance = null) { global $conf; diff --git a/kronolith/new.php b/kronolith/new.php index 61585a683..45b6b8d5c 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -43,24 +43,18 @@ if (!$date) { } } $event->start = new Horde_Date($date); - -$url = Util::getFormData('url'); - -// Default to a 1 hour duration. $event->end = new Horde_Date($event->start); if (Util::getFormData('allday')) { $event->end->mday++; - /* - $event->end->hour = 23; - $event->end->min = $event->end->sec = 59; - */ } else { + // Default to a 1 hour duration. $event->end->hour++; } $month = $event->start->month; $year = $event->start->year; $buttons = array(''); +$url = Util::getFormData('url'); if (isset($url)) { $cancelurl = $url; } else { -- 2.11.0