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['cal_public'] = 1;
$where[] = "$this->user_table.cal_status NOT IN ('R','X')"; break; $where[] = "$this->user_table.cal_status NOT IN ('R','X')"; break;
case 'deleted': case 'deleted':
// Change source of recur date to get deleted recurrence exceptions $where[] = 'cal_deleted IS NOT NULL'; break;
$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;
case 'unknown': case 'unknown':
$where[] = "$this->user_table.cal_status='U'"; break; $where[] = "$this->user_table.cal_status='U'"; break;
case 'not-unknown': case 'not-unknown':
@ -575,11 +571,6 @@ class calendar_so
if ($params['enum_recuring']) // dates table join only needed to enum recuring events 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']; $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(); $selects = array();
// we check if there are parts to use for the construction of our UNION query, // we check if there are parts to use for the construction of our UNION query,
@ -591,11 +582,8 @@ class calendar_so
$selects[] = $select; $selects[] = $select;
$selects[count($selects)-1]['where'][] = $user_sql; $selects[count($selects)-1]['where'][] = $user_sql;
if ($params['enum_recuring']) 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[] = $select;
$selects[count($selects)-1]['where'][] = $user_sql; $selects[count($selects)-1]['where'][] = $user_sql;
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start"; $selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
@ -607,11 +595,8 @@ class calendar_so
$selects[] = $select; $selects[] = $select;
$selects[count($selects)-1]['where'][] = $owner_or; $selects[count($selects)-1]['where'][] = $owner_or;
if ($params['enum_recuring']) 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[] = $select;
$selects[count($selects)-1]['where'][] = $owner_or; $selects[count($selects)-1]['where'][] = $owner_or;
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start"; $selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
@ -623,11 +608,8 @@ class calendar_so
// if the query is to be filtered by neither by user nor owner (should not happen?) we need 2 selects for the union // if the query is to be filtered by neither by user nor owner (should not happen?) we need 2 selects for the union
$selects[] = $select; $selects[] = $select;
if ($params['enum_recuring']) 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[] = $select;
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start"; $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']); $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']); 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['alarm'] = false;
} }
$content['msg'] = $msg ? $msg : $_GET['msg']; $content['msg'] = $msg;
if ($view) if ($view)
{ {

View File

@ -364,13 +364,6 @@ class calendar_uilist extends calendar_ui
{ {
$event['class'] .= 'rowDeleted '; $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 // Filemanager disabled for other applications
$readonlys['filemanager['.$event['id'].']'] = !is_numeric($event['id']); $readonlys['filemanager['.$event['id'].']'] = !is_numeric($event['id']);
@ -585,12 +578,6 @@ class calendar_uilist extends calendar_ui
} }
switch($action) 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': case 'delete':
$action_msg = lang('deleted'); $action_msg = lang('deleted');
if ($id && $this->bo->delete($id, $recur_date,false,$skip_notification)) if ($id && $this->bo->delete($id, $recur_date,false,$skip_notification))
@ -604,9 +591,8 @@ class calendar_uilist extends calendar_ui
break; break;
case 'undelete': case 'undelete':
$action_msg = lang('recovered'); $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; $event['deleted'] = null;
if($this->bo->save($event)) if($this->bo->save($event))
@ -615,19 +601,6 @@ class calendar_uilist extends calendar_ui
break; 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;
}
}
}
$failed++; $failed++;
break; break;
case 'status': case 'status':
@ -863,25 +836,15 @@ class calendar_uilist extends calendar_ui
'confirm_multiple' => 'Delete these entries', 'confirm_multiple' => 'Delete these entries',
'group' => $group, 'group' => $group,
'disableClass' => 'rowNoDelete', 'disableClass' => 'rowNoDelete',
'hideOnDisabled' => true,
); );
// Add in deleted for admins // Add in deleted for admins
if($GLOBALS['egw_info']['server']['calendar_delete_history']) 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( $actions['undelete'] = array(
'caption' => 'Un-delete', 'caption' => 'Un-delete',
'hint' => 'Recover this event', 'hint' => 'Recover this event',
'icon' => 'revert',
'group' => $group, 'group' => $group,
'enabled' => 'javaScript:nm_enableClass',
'enableClass' => 'rowDeleted', 'enableClass' => 'rowDeleted',
'hideOnDisabled' => true, 'hideOnDisabled' => true,
); );

View File

@ -53,19 +53,11 @@ function cal_open(_action, _senders)
var id = _senders[0].id; var id = _senders[0].id;
var matches = id.match(/^(?:calendar::)?([0-9]+):([0-9]+)$/); var matches = id.match(/^(?:calendar::)?([0-9]+):([0-9]+)$/);
var backup = _action.data; var backup = _action.data;
var row = _senders[0].iface.node; if (matches)
if (matches && !$j(row).hasClass("rowDeleted"))
{ {
edit_series(matches[1],matches[2]); edit_series(matches[1],matches[2]);
return; 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)) else if (matches = id.match(/^([a-z_-]+)([0-9]+)/i))
{ {
var app = matches[1]; var app = matches[1];