Revert changes to delete view - exceptions no longer shown

This commit is contained in:
Nathan Gray 2012-11-14 16:25:21 +00:00
parent 94f84ce2b7
commit a0a6e14154
4 changed files with 13 additions and 80 deletions

View File

@ -487,11 +487,7 @@ class calendar_so
$where['cal_public'] = 1;
$where[] = "$this->user_table.cal_status NOT IN ('R','X')"; break;
case 'deleted':
// Change source of recur date to get deleted recurrence exceptions
$cols = str_replace("{$this->user_table}.cal_recur_date","{$this->dates_table}.cal_start AS cal_recur_date",$cols);
$remove_rejected_by_user = false;
$where[] = "$this->user_table.cal_recur_date=0";
$where[] = "($this->cal_table.cal_deleted IS NOT NULL OR (recur_exception=1 AND $this->user_table.cal_recur_date = 0))"; break;
$where[] = 'cal_deleted IS NOT NULL'; break;
case 'unknown':
$where[] = "$this->user_table.cal_status='U'"; break;
case 'not-unknown':
@ -575,11 +571,6 @@ class calendar_so
if ($params['enum_recuring']) // dates table join only needed to enum recuring events
{
$select['join'] = "JOIN $this->dates_table ON $this->cal_table.cal_id=$this->dates_table.cal_id ".$select['join'];
// Add in deleted exceptions to recurring
if($filter == 'deleted')
{
$select['join'] .= "LEFT JOIN (SELECT egw_cal.cal_reference AS ref, egw_cal.cal_recurrence AS rec FROM $this->cal_table) AS cal_exception ON $this->cal_table.cal_id = cal_exception.ref AND $this->dates_table.cal_start = cal_exception.rec ";
}
}
$selects = array();
// we check if there are parts to use for the construction of our UNION query,
@ -592,10 +583,7 @@ class calendar_so
$selects[count($selects)-1]['where'][] = $user_sql;
if ($params['enum_recuring'])
{
if($filter != 'deleted')
{
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
}
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
$selects[] = $select;
$selects[count($selects)-1]['where'][] = $user_sql;
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
@ -608,10 +596,7 @@ class calendar_so
$selects[count($selects)-1]['where'][] = $owner_or;
if ($params['enum_recuring'])
{
if($filter != 'deleted')
{
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
}
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
$selects[] = $select;
$selects[count($selects)-1]['where'][] = $owner_or;
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
@ -624,10 +609,7 @@ class calendar_so
$selects[] = $select;
if ($params['enum_recuring'])
{
if($filter != 'deleted')
{
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
}
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
$selects[] = $select;
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
}
@ -643,10 +625,6 @@ class calendar_so
{
$selects[$key]['cols'] = str_replace('cal_start','MIN(cal_start) AS cal_start',$selects[$key]['cols']);
}
if($filter == 'deleted')
{
$selects[$key]['cols'] = str_replace("{$this->user_table}.cal_recur_date","{$this->dates_table}.cal_start AS cal_recur_date",$selects[$key]['cols']);
}
}
if (!isset($param['cols'])) self::get_union_selects($selects,$start,$end,$users,$cat_id,$filter,$params['query'],$params['users']);

View File

@ -1519,7 +1519,7 @@ function replace_eTemplate_onsubmit()
{
$content['alarm'] = false;
}
$content['msg'] = $msg ? $msg : $_GET['msg'];
$content['msg'] = $msg;
if ($view)
{

View File

@ -364,13 +364,6 @@ class calendar_uilist extends calendar_ui
{
$event['class'] .= 'rowDeleted ';
}
// Disable delete for 'deleted' exceptions - deleting the exception
// would put it back, which you do from the series, not purge it
if($search_params['filter'] == 'deleted' && $event['recur_type'])
{
$event['class'] .= ' rowSeriesDeleted rowDeleted rowNoDelete';
}
// Filemanager disabled for other applications
$readonlys['filemanager['.$event['id'].']'] = !is_numeric($event['id']);
@ -585,12 +578,6 @@ class calendar_uilist extends calendar_ui
}
switch($action)
{
case 'purgeseries':
// Delete an already deleted series
$recur_date = null;
// Make sure entire series is gone
$this->bo->delete($id, $recur_date,false,$skip_notification);
// fall through
case 'delete':
$action_msg = lang('deleted');
if ($id && $this->bo->delete($id, $recur_date,false,$skip_notification))
@ -604,28 +591,14 @@ class calendar_uilist extends calendar_ui
break;
case 'undelete':
$action_msg = lang('recovered');
if ($id && ($event = $this->bo->read($id, $recur_date)) && $this->bo->check_perms(EGW_ACL_EDIT,$id))
if ($id && ($event = $this->bo->read($id, $recur_date)) && $this->bo->check_perms(EGW_ACL_EDIT,$id) &&
is_array($event) && $event['deleted'])
{
if(is_array($event) && $event['deleted'])
$event['deleted'] = null;
if($this->bo->save($event))
{
$event['deleted'] = null;
if($this->bo->save($event))
{
$success++;
break;
}
}
// Undelete an exception by removing it
else if (is_array($event) && $event['recur_type'])
{
$original = $this->bo->read($id);
$key = array_search($recur_date, $original['recur_exception']);
if($key !== false) unset($original['recur_exception'][$key]);
if($key !== false && $this->bo->save($original))
{
$success++;
break;
}
$success++;
break;
}
}
$failed++;
@ -863,25 +836,15 @@ class calendar_uilist extends calendar_ui
'confirm_multiple' => 'Delete these entries',
'group' => $group,
'disableClass' => 'rowNoDelete',
'hideOnDisabled' => true,
);
// Add in deleted for admins
if($GLOBALS['egw_info']['server']['calendar_delete_history'])
{
$actions['purgeseries'] = array(
'caption' => 'Delete series',
'confirm' => 'Delete series',
'icon' => 'delete',
'group' => $group,
'enableClass' => 'rowSeriesDeleted',
'disableClass' => 'rowNoDelete',
'hideOnDisabled' => true,
);
$actions['undelete'] = array(
'caption' => 'Un-delete',
'hint' => 'Recover this event',
'icon' => 'revert',
'group' => $group,
'enabled' => 'javaScript:nm_enableClass',
'enableClass' => 'rowDeleted',
'hideOnDisabled' => true,
);

View File

@ -53,19 +53,11 @@ function cal_open(_action, _senders)
var id = _senders[0].id;
var matches = id.match(/^(?:calendar::)?([0-9]+):([0-9]+)$/);
var backup = _action.data;
var row = _senders[0].iface.node;
if (matches && !$j(row).hasClass("rowDeleted"))
if (matches)
{
edit_series(matches[1],matches[2]);
return;
}
else if (matches && $j(row).hasClass("rowDeleted") && _action.data.url)
{
// Trying to edit a deleted exception, use original event & add a message
_senders[0].id = matches[1];
_action.data.url += '&msg='+encodeURIComponent(egw.lang('Editing series'));
}
else if (matches = id.match(/^([a-z_-]+)([0-9]+)/i))
{
var app = matches[1];