What? you want to delete an entry?! (thanks, DB)

This commit is contained in:
Miles Lott 2001-07-12 04:09:12 +00:00
parent 2782b97b35
commit 5ec7e29c20
3 changed files with 79 additions and 19 deletions

View File

@ -57,28 +57,18 @@
$this->start = $start;
}
if($limit) { $this->limit = $limit; }
if(!empty($query)) { $this->query = $query; }
if(!empty($sort)) { $this->sort = $sort; }
if(!empty($order)) { $this->order = $order; }
if(!empty($filter)) { $this->filter = $filter; }
if(isset($query)) { $this->query = $query; }
if(isset($sort)) { $this->sort = $sort; }
if(isset($order)) { $this->order = $order; }
if(isset($filter)) { $this->filter = $filter; }
if(isset($fcat_id)) { $this->cat_id = $fcat_id; }
}
function save_sessiondata()
function save_sessiondata($data)
{
global $phpgw,$start,$limit,$query,$sort,$order,$filter,$cat_id;
if ($this->use_session)
{
$data = array(
'start' => $start,
'limit' => $limit,
'query' => $query,
'sort' => $sort,
'order' => $order,
'filter' => $filter,
'cat_id' => $cat_id
);
global $phpgw;
if($this->debug) { echo '<br>Save:'; _debug_array($data); }
$phpgw->session->appsession('session_data','addressbook',$data);
}
@ -237,5 +227,10 @@
{
return $this->so->update_entry($userid,$fields);
}
function delete_entry($ab_id)
{
return $this->so->delete_entry($ab_id);
}
}
?>

View File

@ -95,5 +95,15 @@
}
return;
}
function delete_entry($ab_id)
{
$this->makeobj();
if ($this->rights & PHPGW_ACL_DELETE)
{
$this->contacts->delete($ab_id);
}
return;
}
}
?>

View File

@ -39,7 +39,8 @@
'add' => True,
'add_email' => True,
'copy' => True,
'edit' => True
'edit' => True,
'delete' => True
);
var $extrafields = array(
@ -92,7 +93,16 @@
/* Called only by get_list(), just prior to page footer. */
function save_sessiondata()
{
$this->bo->save_sessiondata();
$data = array(
'start' => $this->start,
'limit' => $this->limit,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id
);
$this->bo->save_sessiondata($data);
}
function formatted_list($name,$list,$id='',$default=False,$java=False)
@ -1234,7 +1244,7 @@
if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $phpgw_info['user']['account_id'])
{
$this->template->set_var('delete_link','<form method="POST" action="'.$phpgw->link("/addressbook/delete.php") . '">');
$this->template->set_var('delete_link','<form method="POST" action="'.$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.delete') . '">');
$this->template->set_var('delete_button','<input type="submit" name="delete" value="' . lang('Delete') . '">');
}
@ -1482,6 +1492,51 @@
$phpgw->common->phpgw_footer();
}
function delete()
{
global $phpgw,$phpgw_info,$entry,$ab_id,$confirm;
if (!$ab_id)
{
$ab_id = $entry['ab_id'];
}
if (!$ab_id)
{
Header('Location: ' . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
}
$check = $this->bo->read_entry($ab_id,array('owner' => 'owner', 'tid' => 'tid'));
if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
{
Header('Location: ' . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
$phpgw->common->phpgw_exit();
}
$this->template->set_file(array('delete' => 'delete.tpl'));
if ($confirm != 'true')
{
$phpgw->common->phpgw_header();
echo parse_navbar();
$this->template->set_var('lang_sure',lang('Are you sure you want to delete this entry ?'));
$this->template->set_var('no_link',$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
$this->template->set_var('lang_no',lang('NO'));
$this->template->set_var('yes_link',$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.delete&ab_id=' . $ab_id . '&confirm=true'));
$this->template->set_var('lang_yes',lang('YES'));
$this->template->pparse('out','delete');
$phpgw->common->phpgw_footer();
}
else
{
$this->bo->delete_entry($ab_id);
@Header('Location: ' . $phpgw->link('/addressbook/index.php','menuaction=addressbook.uiaddressbook.get_list'));
}
}
function html_input_hidden($vars)
{
if (!is_array($vars)) { return ''; }