diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index bc3009d49c..965648b865 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -434,22 +434,42 @@ class calendar_hooks 'type' => 'select', 'label' => 'Default alarm for regular events', 'name' => 'default-alarm', - 'values' => isset($bo) ? array(0 => lang('None'))+$bo->alarms : array(), + 'values' => isset($bo) ? array(0 => lang('None'), -1 => lang('Custom'))+$bo->alarms : array(), 'help' => 'Alarm added automatic to new events before event start-time', 'xmlrpc' => True, 'admin' => False, 'default' => 0, + 'onchange' => 'app.preferences.cal_def_alarm_onchange' + ), + 'custom-default-alarm' => array( + 'type' => 'date-duration', + 'label' => 'Enter custom default alarm time', + 'name' => 'custom-default-alarm', + 'help' => 'Alarm added automatic to new events before event start-time.', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 0, ), 'default-alarm-wholeday' => array( 'type' => 'select', 'label' => 'Default alarm for whole-day events', 'name' => 'default-alarm-wholeday', - 'values' => isset($bo) ? array(0 => lang('None'))+$bo->alarms : array(), + 'values' => isset($bo) ? array(0 => lang('None'), -1 => lang('Custom'))+$bo->alarms : array(), 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', 'xmlrpc' => True, 'admin' => False, 'default' => 0, - ) + 'onchange' => 'app.preferences.cal_def_alarm_onchange' + ), + 'custom-default-alarm-wholeday' => array( + 'type' => 'date-duration', + 'label' => 'Enter custom default alarm time for wholeday event', + 'name' => 'custom-default-alarm-wholeday', + 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 0, + ), ); if (isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs { diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index cea393b7f9..63e5e6bec9 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1269,8 +1269,12 @@ class calendar_uiforms extends calendar_ui } // Set alarm sel_options $alarm_options = array(); - $default_alarm = $this->cal_prefs['default-alarm']; - if (!empty($event['whole_day']) && $event['whole_day']) $default_alarm = $this->cal_prefs['default-alarm-wholeday']; + $default_alarm = $this->cal_prefs['default-alarm'] != -1?$this->cal_prefs['default-alarm']:$this->cal_prefs['custom-default-alarm'] * 60; + if (!empty($event['whole_day']) && $event['whole_day']) + { + $default_alarm = $this->cal_prefs['default-alarm-wholeday'] != -1?$this->cal_prefs['default-alarm-wholeday']: + $this->cal_prefs['custom-default-alarm-wholeday'] * 60; + } if (!array_key_exists($default_alarm, $this->bo->alarms) && $default_alarm > 0) { $alarm_options = $this->bo->alarms + array($default_alarm => calendar_bo::secs2label ($default_alarm));