From: Jan Schneider Date: Mon, 1 Mar 2010 11:46:43 +0000 (+0100) Subject: Read and save alarm methods. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3bfe32bf514ae36388ed6f58d1123209b29509a2;p=horde.git Read and save alarm methods. --- diff --git a/framework/Alarm/lib/Horde/Alarm.php b/framework/Alarm/lib/Horde/Alarm.php index 8ede6084a..48ce5731b 100644 --- a/framework/Alarm/lib/Horde/Alarm.php +++ b/framework/Alarm/lib/Horde/Alarm.php @@ -488,7 +488,7 @@ class Horde_Alarm if (!isset($methods)) { $methods = array( 'notify' => array( - '__desc' => _("Inline Notification"), + '__desc' => _("Inline"), 'sound' => array( 'type' => 'sound', 'desc' => _("Play a sound?"), @@ -496,7 +496,7 @@ class Horde_Alarm ) ), 'mail' => array( - '__desc' => _("Email Notification"), + '__desc' => _("Email"), 'email' => array( 'type' => 'text', 'desc' => _("Email address (optional)"), diff --git a/kronolith/index.php b/kronolith/index.php index a557e5330..ae8dba2a2 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -24,6 +24,49 @@ if ($help_link) { $today = new Horde_Date($_SERVER['REQUEST_TIME']); $_SESSION['horde_prefs']['nomenu'] = true; +$alarm_methods = $alarm_params = ''; +foreach (Horde_Alarm::notificationMethods() as $method => $params) { + $alarm_methods .= ' '; + if (count($params) < 2) { + continue; + } + $alarm_params .= ' '; +} + Kronolith::header(); echo "\n"; require KRONOLITH_TEMPLATES . '/index/index.inc'; diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 87ac96015..256e6deab 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2654,6 +2654,10 @@ KronolithCore = { this.toggleAllDay(); return; + case 'kronolithEventAlarmDefaultOn': + this.disableAlarmMethods(); + return; + case 'kronolithEventLinkNone': case 'kronolithEventLinkDaily': case 'kronolithEventLinkWeekly': @@ -3124,6 +3128,16 @@ KronolithCore = { elt.disable(); e.stop(); return; + } else if (elt.tagName == 'INPUT' && elt.name == 'event_alarms[]') { + $('kronolithEventAlarmDefaultOff').setValue(1); + if ($(elt.id + 'Params')) { + if (elt.getValue()) { + $(elt.id + 'Params').show(); + } else { + $(elt.id + 'Params').hide(); + } + } + return; } var calClass = elt.retrieve('calendarclass'); @@ -3370,6 +3384,7 @@ KronolithCore = { this.toggleAllDay(false); this.openTab($('kronolithEventForm').down('.tabset a.kronolithTabLink')); $('kronolithEventForm').enable(); + this.disableAlarmMethods(); $('kronolithEventForm').reset(); if (Kronolith.conf.maps.driver) { $('kronolithEventMapLink').hide(); @@ -3533,6 +3548,27 @@ KronolithCore = { throw $break; } }); + if (ev.m) { + $('kronolithEventAlarmDefaultOff').checked = true; + $H(ev.m).each(function(method) { + $('kronolithEventAlarm' + method.key).setValue(1); + $('kronolithEventAlarm' + method.key + 'Params').show(); + $H(method.value).each(function(param) { + var input = $('kronolithEventAlarmParam' + param.key); + if (input.type == 'radio') { + input.up('form').select('input[type=radio]').each(function(radio) { + if (radio.name == input.name && + radio.value == param.value) { + radio.setValue(1); + throw $break; + } + }); + } else { + input.setValue(param.value); + } + }); + }); + } } else { $('kronolithEventAlarmOff').setValue(true); } @@ -3711,6 +3747,20 @@ KronolithCore = { }, /** + * Disables all custom alarm methods in the event form. + */ + disableAlarmMethods: function() { + $('kronolithEventTabReminder').select('input').each(function(input) { + if (input.name == 'event_alarms[]') { + input.setValue(0); + if ($(input.id + 'Params')) { + $(input.id + 'Params').hide(); + } + } + }); + }, + + /** * Toggles the recurrence fields of the event edit form. * * @param string recur The recurrence part of the field name, i.e. 'None', diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 843762788..650311480 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -1274,6 +1274,9 @@ abstract class Kronolith_Event } $json->at = $attendees; } + if ($this->methods) { + $json->m = $this->methods; + } } return $json; diff --git a/kronolith/templates/index/edit.inc b/kronolith/templates/index/edit.inc index b0e568413..bc2d172c5 100644 --- a/kronolith/templates/index/edit.inc +++ b/kronolith/templates/index/edit.inc @@ -90,25 +90,23 @@