*Users can now see and restore their 'deleted' but held contacts, if deletion prevention is turned on. There is now a config setting to allow users to purge their own 'deleted' contacts.

This commit is contained in:
Nathan Gray 2010-11-22 17:10:11 +00:00
parent 65a1f21890
commit 9726db1eaa
4 changed files with 17 additions and 4 deletions

View File

@ -141,7 +141,7 @@ class addressbook_bo extends addressbook_so
/**
* Keep deleted addresses, or really delete them
* Set in Admin -> Addressbook -> Site Configuration
* ''=really delete, 'history'=keep, only admins delete
* ''=really delete, 'history'=keep, only admins delete, 'userpurge'=keep, users delete
*
* @var string
*/

View File

@ -324,8 +324,10 @@ class addressbook_so
)));
}
// Add in deleted type for admins
if($this->is_admin()) {
// Add in deleted type, if holding deleted contacts
$config = config::read('phpgwapi');
if($config['history'])
{
$this->content_types[self::DELETED_TYPE] = array(
'name' => lang('Deleted'),
'options' => array(

View File

@ -282,6 +282,12 @@ class addressbook_ui extends addressbook_bo
$sel_options['action'] += array(
'delete' => lang('Delete'),
);
if($content['nm']['col_filter']['tid'] == 'D' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge')
{
// User not allowed to purge
unset($sel_options['action']['delete']);
}
// check if user is an admin or the export is not generally turned off (contact_export_limit is non-numerical, eg. no)
if (isset($GLOBALS['egw_info']['user']['apps']['admin']) || !$this->config['contact_export_limit'] || (int)$this->config['contact_export_limit'])
{
@ -1089,7 +1095,7 @@ class addressbook_ui extends addressbook_bo
{
$row['tel_prefered'] = $row[$row['tel_prefer']].' ♥';
}
$readonlys["delete[$row[id]]"] = !$this->check_perms(EGW_ACL_DELETE,$row);
$readonlys["delete[$row[id]]"] = !$this->check_perms(EGW_ACL_DELETE,$row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge');
$readonlys["edit[$row[id]]"] = !$this->check_perms(EGW_ACL_EDIT,$row);
if ($row['photo']) $photos = true;
@ -1534,6 +1540,10 @@ class addressbook_ui extends addressbook_bo
if($content['tid'] == addressbook_so::DELETED_TYPE)
{
$content['link_to']['show_deleted'] = true;
if(!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge')
{
$readonlys['button[delete]'] = true;
}
}
// Enable history

View File

@ -82,6 +82,7 @@
<select name="newsettings[history]">
<option value="">{lang_No}</option>
<option value="history"{selected_history_history}>{lang_Yes,_only_admins_can_purge_deleted_items}</option>
<option value="userpurge"{selected_history_userpurge}>{lang_Yes,_users_can_purge_their_deleted_items}</option>
</select>
</td>
<tr class="th">