Show event date/time in alarm notification.
authorJan Schneider <jan@horde.org>
Wed, 3 Mar 2010 11:41:38 +0000 (12:41 +0100)
committerJan Schneider <jan@horde.org>
Wed, 3 Mar 2010 11:41:38 +0000 (12:41 +0100)
kronolith/js/kronolith.js
kronolith/lib/Event.php

index 302e00a..0902018 100644 (file)
@@ -138,22 +138,25 @@ KronolithCore = {
                 this.alarms.push(alarm.id);
 
                 message = alarm.title.escapeHTML();
-                if (!Object.isUndefined(alarm.params) &&
-                    !Object.isUndefined(alarm.params.notify)) {
-                    if (!Object.isUndefined(alarm.params.notify.ajax)) {
+                if (alarm.params && alarm.params.notify) {
+                    if (alarm.params.notify.ajax) {
                         message = new Element('a')
                             .insert(message)
                             .observe('click', function() {
                                 this.Growler.ungrowl(growl);
                                 this.go(alarm.params.notify.ajax);
                             }.bind(this));
-                    } else if (!Object.isUndefined(alarm.params.notify.url)) {
+                    } else if (alarm.params.notify.url) {
                         message = new Element('a', { href: alarm.params.notify.url })
                             .insert(message);
                     }
                 }
                 message = new Element('div')
                     .insert(message);
+                if (alarm.params && alarm.params.notify &&
+                    alarm.params.notify.subtitle) {
+                    message.insert(new Element('br')).insert(alarm.params.notify.subtitle);
+                }
                 if (alarm.user) {
                     var select = '<select>';
                     $H(Kronolith.conf.snooze).each(function(snooze) {
index 17ea894..116a46e 100644 (file)
@@ -1139,6 +1139,15 @@ abstract class Kronolith_Event
                     $methods['notify']['sound'] = $GLOBALS['registry']->get('themesuri', 'horde') . '/sounds/' . $methods['notify']['sound'];
                 }
             }
+            if ($this->isAllDay()) {
+                if ($this->start->compareDate($this->end) == 0) {
+                    $methods['notify']['subtitle'] = sprintf(_("On %s"), '<strong>' . $this->start->strftime($prefs->getValue('date_format')) . '</strong>');
+                } else {
+                    $methods['notify']['subtitle'] = sprintf(_("From %s to %s"), '<strong>' . $this->start->strftime($prefs->getValue('date_format')) . '</strong>', '<strong>' . $this->end->strftime($prefs->getValue('date_format')) . '</strong>');
+                }
+            } else {
+                $methods['notify']['subtitle'] = sprintf(_("From %s at %s to %s at %s"), '<strong>' . $this->start->strftime($prefs->getValue('date_format')), $this->start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia') . '</strong>', '<strong>' . $this->end->strftime($prefs->getValue('date_format')), $this->end->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia') . '</strong>');
+            }
         }
         if (isset($methods['mail'])) {
             $methods['mail']['body'] = sprintf(