mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
* Calendar - Add checkbox to turn on or off emptying calendar before iCal import
This commit is contained in:
parent
b39bcc8c36
commit
24b869d61a
@ -144,18 +144,21 @@ class calendar_import_ical implements importexport_iface_import_plugin {
|
||||
$owner = $plugin_options['cal_owner'];
|
||||
|
||||
// Purge
|
||||
$remove_past = new Api\DateTime();
|
||||
$remove_future = new Api\DateTime();
|
||||
$plugin_options = array_merge(array('remove_past' => 100, 'remove_future' => 365), $plugin_options);
|
||||
foreach(array('remove_past','remove_future') as $date)
|
||||
if($plugin_options['empty_before_import'])
|
||||
{
|
||||
${$date}->add( (($date == 'remove_past' ? -1 : 1) * (int)$plugin_options[$date]) . ' days');
|
||||
$remove_past = new Api\DateTime();
|
||||
$remove_future = new Api\DateTime();
|
||||
$plugin_options = array_merge(array('remove_past' => 100, 'remove_future' => 365), $plugin_options);
|
||||
foreach(array('remove_past','remove_future') as $date)
|
||||
{
|
||||
${$date}->add( (($date == 'remove_past' ? -1 : 1) * (int)$plugin_options[$date]) . ' days');
|
||||
}
|
||||
$this->purge_calendar(
|
||||
$owner,
|
||||
array('from' => $remove_past, 'to' => $remove_future),
|
||||
$plugin_options['no_notification']
|
||||
);
|
||||
}
|
||||
$this->purge_calendar(
|
||||
$owner,
|
||||
array('from' => $remove_past, 'to' => $remove_future),
|
||||
$plugin_options['no_notification']
|
||||
);
|
||||
|
||||
// User wants conflicting events to not be imported
|
||||
if($_definition->plugin_options['skip_conflicts'])
|
||||
|
@ -70,7 +70,7 @@ class calendar_wizard_import_ical
|
||||
{
|
||||
$content['text'] = $this->steps['wizard_step55'];
|
||||
$content['step'] = 'wizard_step55';
|
||||
foreach(array('skip_conflicts','remove_past','remove_future') as $field)
|
||||
foreach(array('skip_conflicts','empty_before_import','remove_past','remove_future') as $field)
|
||||
{
|
||||
if(!$content[$field] && array_key_exists($field, $content['plugin_options']))
|
||||
{
|
||||
|
@ -9,9 +9,13 @@
|
||||
<description value="Do not import conflicting events"/>
|
||||
<checkbox id="skip_conflicts"/>
|
||||
</hbox>
|
||||
<description id="delete_title" value="Empty target calendar before importing" font_style="b" class="et2_bold"/>
|
||||
<integer label="How many days to be removed in the past (default 100)" id="remove_past"/>
|
||||
<integer label="How many days to be removed in the future (default 365)" id="remove_future"/>
|
||||
<description/>
|
||||
<hbox>
|
||||
<description id="delete_title" value="Empty target calendar before importing" font_style="b" class="et2_bold"/>
|
||||
<checkbox id="empty_before_import" onchange="var enabled = widget.getValue() == 'true'; var past = widget.getRoot().getWidgetById('remove_past'); var future = widget.getRoot().getWidgetById('remove_future');past.set_disabled(!enabled);future.set_disabled(!enabled);return true;"/>
|
||||
</hbox>
|
||||
<integer label="How many days to be removed in the past (default 100)" id="remove_past" disabled="!@empty_before_import"/>
|
||||
<integer label="How many days to be removed in the future (default 365)" id="remove_future" disabled="!@empty_before_import"/>
|
||||
</vbox>
|
||||
<styles>
|
||||
#importexport-wizardbox_delete_title {
|
||||
|
Loading…
Reference in New Issue
Block a user