diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 369dfdfdc7..d83fcf8c03 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1160,7 +1160,10 @@ class calendar_boupdate extends calendar_bo if (!$recur_date || $event['recur_type'] == MCAL_RECUR_NONE) { - $this->so->delete($cal_id); + $config = config::read('phpgwapi'); + if(!$config['calendar_delete_history'] || $GLOBALS['egw']->contenthistory->getTSforAction('calendar', $cal_id, 'delete')) { + $this->so->delete($cal_id); + } $GLOBALS['egw']->contenthistory->updateTimeStamp('calendar',$cal_id,'delete',time()); // delete all links to the event diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index 001aed31d3..1330459c9b 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -380,8 +380,13 @@ class calendar_so } $where[] = '('.implode(' OR ',$to_or).')'; + if($filter != 'deleted') { + $where[] = "sync_deleted IS NULL"; + } switch($filter) { + case 'deleted': + $where[] = "sync_deleted IS NOT NULL"; break; case 'unknown': $where[] = "cal_status='U'"; break; case 'accepted': @@ -417,7 +422,7 @@ class calendar_so // changed the original OR in the query into a union, to speed up the query execution under MySQL 5 $select = array( 'table' => $this->cal_table, - 'join' => "JOIN $this->dates_table ON $this->cal_table.cal_id=$this->dates_table.cal_id JOIN $this->user_table ON $this->cal_table.cal_id=$this->user_table.cal_id LEFT JOIN $this->repeats_table ON $this->cal_table.cal_id=$this->repeats_table.cal_id", + 'join' => "JOIN $this->dates_table ON $this->cal_table.cal_id=$this->dates_table.cal_id JOIN $this->user_table ON $this->cal_table.cal_id=$this->user_table.cal_id LEFT JOIN $this->repeats_table ON $this->cal_table.cal_id=$this->repeats_table.cal_id JOIN egw_api_content_history ON egw_api_content_history.sync_appname = 'calendar' AND egw_api_content_history.sync_contentid=$this->cal_table.cal_id", 'cols' => $cols, 'where' => $where, 'app' => 'calendar', diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index e9346b659d..ce67665d56 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -719,6 +719,13 @@ class calendar_ui list($label,$title) = $label; $options .= 'filter == $value ? ' selected="selected"' : '').' title="'.$title.'">'.$label.''."\n"; } + + // Add in deleted for admins + $config = config::read('phpgwapi'); + if($config['calendar_delete_history'] && $GLOBALS['egw_info']['user']['apps']['admin']) { + $options .= 'filter == 'deleted' ? ' selected="selected"' : '').' title="'.lang('Show events that have been deleted').'">'.lang('Deleted').''."\n"; + } + $file[] = $this->_select_box('Filter','filter',$options,$baseurl ? $baseurl.'&filter=' : ''); // Calendarselection: User or Group diff --git a/calendar/templates/default/config.tpl b/calendar/templates/default/config.tpl index 873d47fcf3..79105dfe57 100644 --- a/calendar/templates/default/config.tpl +++ b/calendar/templates/default/config.tpl @@ -56,6 +56,18 @@ + + {lang_History_logging} + + + {lang_Prevent_deleting_of_entries} + + + {lang_No} + {lang_Yes,_only_admins_can_purge_deleted_items} + + + {lang_Birthdays}