Reduce alarm settings UI to the capabilities of the Kolab 2 format

This commit is contained in:
Thomas Bruederli 2012-11-15 15:03:00 +01:00
parent c822a713f1
commit 32d64e419e
7 changed files with 18 additions and 4 deletions

View file

@ -87,6 +87,7 @@ abstract class calendar_driver
public $undelete = false; // event undelete action
public $categoriesimmutable = false;
public $alarm_types = array('DISPLAY');
public $alarm_absolute = true;
public $last_error;
/**

View file

@ -55,6 +55,11 @@ class kolab_driver extends calendar_driver
$this->cal->register_action('calendar-acl', array($this, 'calendar_acl'));
$this->freebusy_trigger = $this->rc->config->get('calendar_freebusy_trigger', false);
if (kolab_storage::$version == 2.0) {
$this->alarm_types = array('DISPLAY');
$this->alarm_absolute = false;
}
}

View file

@ -327,7 +327,7 @@ class calendar_ui
*/
function alarm_select($attrib = array())
{
return $this->cal->lib->alarm_select($attrib, $this->cal->driver->alarm_types);
return $this->cal->lib->alarm_select($attrib, $this->cal->driver->alarm_types, $this->cal->driver->alarm_absolute);
}
/**

View file

@ -239,7 +239,7 @@ class libcalendaring extends rcube_plugin
/**
* Render HTML form for alarm configuration
*/
public function alarm_select($attrib, $alarm_types)
public function alarm_select($attrib, $alarm_types, $absolute_time = true)
{
unset($attrib['name']);
$select_type = new html_select(array('name' => 'alarmtype[]', 'class' => 'edit-alarm-type'));
@ -252,9 +252,12 @@ class libcalendaring extends rcube_plugin
$input_time = new html_inputfield(array('name' => 'alarmtime[]', 'class' => 'edit-alarm-time', 'size' => 6));
$select_offset = new html_select(array('name' => 'alarmoffset[]', 'class' => 'edit-alarm-offset'));
foreach (array('-M','-H','-D','+M','+H','+D','@') as $trigger)
foreach (array('-M','-H','-D','+M','+H','+D') as $trigger)
$select_offset->add($this->gettext('trigger' . $trigger), $trigger);
if ($absolute_time)
$select_offset->add($this->gettext('trigger@'), '@');
// pre-set with default values from user settings
$preset = self::parse_alaram_value($this->rc->config->get('calendar_default_alarm_offset', '-15M'));
$hidden = array('style' => 'display:none');

View file

@ -46,6 +46,10 @@ class tasklist_kolab_driver extends tasklist_driver
$this->plugin = $plugin;
$this->_read_lists();
if (kolab_storage::$version == 2.0) {
$this->alarm_absolute = false;
}
}
/**

View file

@ -58,6 +58,7 @@ abstract class tasklist_driver
public $undelete = false; // task undelete action
public $sortable = false;
public $alarm_types = array('DISPLAY');
public $alarm_absolute = true;
public $last_error;
/**

View file

@ -173,7 +173,7 @@ class tasklist_ui
*/
function alarm_select($attrib = array())
{
return $this->plugin->lib->alarm_select($attrib, $this->plugin->driver->alarm_types);
return $this->plugin->lib->alarm_select($attrib, $this->plugin->driver->alarm_types, $this->plugin->driver->alarm_absolute);
}
/**