[Tickets #7470] Re: Sunbird/Lightning alarm dismissal and snooze incompletely implemented
bugs at horde.org
bugs at horde.org
Wed Jan 21 14:48:00 UTC 2009
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/7470
------------------------------------------------------------------------------
Ticket | 7470
Updated By | b5b5b5b5 at centrum.sk
Summary | Sunbird/Lightning alarm dismissal and snooze
| incompletely implemented
Queue | Kronolith
Version | 2.3
Type | Enhancement
State | Feedback
Priority | 2. Medium
Milestone |
Patch | 1
Owners | Horde Developers
------------------------------------------------------------------------------
b5b5b5b5 at centrum.sk (2009-01-21 09:47) wrote:
20090121 \
- after applying these patches, it works - partly. (using horde v3.3.2
and kronolith v2.3 - sunbird & lightning v0.9)
- tryied to edit REMINDER(alarm) in existing event, saved and it was
remembered. fine
- !!! have tryied to snooze (e.g. 5min) it after the event showed up
first time, but after snoozing never showed up again.
p.s.
- when patching the Driver.php in /kronolith/lib was "squeaking" this:
{
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] y
}
- creating the file 'Driver.php.rej' after, which is 4002 bits long,
containing this:
{
***************
*** 739,744 ****
$vAlarm = &Horde_iCalendar::newComponent('valarm', $vEvent);
$vAlarm->setAttribute('ACTION', 'DISPLAY');
$vAlarm->setAttribute('TRIGGER;VALUE=DURATION',
'-PT' . $this->alarm . 'M');
$vEvent->addComponent($vAlarm);
}
}
--- 739,760 ----
$vAlarm = &Horde_iCalendar::newComponent('valarm', $vEvent);
$vAlarm->setAttribute('ACTION', 'DISPLAY');
$vAlarm->setAttribute('TRIGGER;VALUE=DURATION',
'-PT' . $this->alarm . 'M');
+
+ //
Send Sunbird/Lightning X-MOZ-LASTACK if the alarm has been dismissed
+ //
Send X-MOZ-SNOOZE-TIME if it's been snoozed
+
require_once 'Horde/Alarm.php';
+ $currentAlarm =
Horde_Alarm::factory();
+
if($currentAlarm->exists($this->_uid, $this->creatorID)) {
+
if($currentAlarm->isSnoozed($this->_uid, $this->creatorID)) {
+
$vEvent->setAttribute('X-MOZ-LASTACK', $modified);
+
$alarmHash = $currentAlarm->get($this->_uid,
$this->creatorID);
+
if(isset($alarmHash->snooze)) {
+
$vEvent->setAttribute('X-MOZ-SNOOZE-TIME',
$alarmHash['snooze']->timestamp());
+
}
+ }
+ } else {
+
$vEvent->setAttribute('X-MOZ-LASTACK', $modified);
+ }
$vEvent->addComponent($vAlarm);
}
}
***************
*** 896,902 ****
} else {
$duration = $vEvent->getAttribute('DURATION');
if (!is_array($duration) && !is_a($duration, 'PEAR_Error')) {
- $this->end = new
Horde_Date($this->start->timestamp() + $duration);
} else {
// End date equal to start date as per RFC 2445.
$this->end = Util::cloneObject($this->start);
--- 912,918 ----
} else {
$duration = $vEvent->getAttribute('DURATION');
if (!is_array($duration) && !is_a($duration, 'PEAR_Error')) {
+ $this->end = new Horde_Date($this->start->timestamp()
+ $duration);
} else {
// End date equal to start date as per RFC 2445.
$this->end = Util::cloneObject($this->start);
***************
*** 916,922 ****
$this->alarm = intval(($this->start->timestamp() -
$alarm) / 60);
}
- // @TODO: vCalendar 2.0 alarms
// Attendance.
// Importing attendance may result in confusion: editing an imported
--- 932,964 ----
$this->alarm = intval(($this->start->timestamp() -
$alarm) / 60);
}
+ // Dismissed or Snoozed
+ // Sunbird/Lightning sends an
X-MOZ-LASTACK if an alarm is snoozed or dismissed
+ // It sends an additional
X-MOZ-SNOOZE-TIME if snoozed with a date stamp
+ // containing the time the alarm should refire
+ $dismissed =
$vEvent->getAttribute('X-MOZ-LASTACK');
+ $snoozed =
$vEvent->getAttribute('X-MOZ-SNOOZE-TIME');
+ if(!is_a($dismissed, 'PEAR_ERROR')) {
+ require_once 'Horde/Alarm.php';
+ $currentAlarm = Horde_Alarm::factory();
+ if(!is_a($snoozed, 'PEAR_ERROR')) {
+ $snoozeTime = new
Horde_Date(strtotime($snoozed));
+ $snoozeLength =
intval(($snoozeTime->timestamp() - time()) / 60);
+
$currentAlarm->snooze($this->getUID(), $this->getCreatorId(),
$snoozeLength);
+ } else {
+
$currentAlarm->snooze($this->getUID(), $this->getCreatorId(), -1);
+ }
+ }
+
+ $components = $vEvent->getComponents();
+ foreach($components as $c) {
+ if($c->getType() == 'vAlarm') {
+ $myalarm =
$c->getAttribute('TRIGGER;VALUE=DURATION');
+ $this->alarm =
intval(Horde_iCalendar::_parseDuration($myalarm) / -60);
+ $this->save();
+ break;
+ }
+ }
// Attendance.
// Importing attendance may result in confusion: editing an imported
}
Daniel
More information about the bugs
mailing list