diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 42e8424a8a..e795267d7b 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -587,7 +587,16 @@ class addressbook_ui extends addressbook_bo 'id' => 'writable', 'caption' => 'Share writable', 'checkbox' => true, - ]] + $share2addressbooks, + ]] + $share2addressbooks + [ + 'unshare' => [ + 'icon' => 'delete', + 'caption' => 'Unshare', + 'group' => $group, + 'enableClass' => 'unshare_contact', + 'hideOnDisabled' => true, + 'hideOnMobile' => true + ] + ], 'prefix' => 'shared_with_', 'group' => $group, 'hideOnMobile' => true @@ -1210,7 +1219,7 @@ class addressbook_ui extends addressbook_bo { //echo "
uicontacts::action('$action',".print_r($checked,true).','.(int)$use_all.",...)
\n"; $success = $failed = 0; - if ($use_all || in_array($action,array('remove_from_list','delete_list'))) + if ($use_all || in_array($action,array('remove_from_list','delete_list','unshare'))) { // get the whole selection $query = is_array($session_name) ? $session_name : Api\Cache::getSession('addressbook', $session_name); @@ -1467,6 +1476,30 @@ class addressbook_ui extends addressbook_bo } break; case 'shared_with': + // as "unshare" is in "shared_with" submenu/children it uses "shared_with_unshare" + if ($shared_with === 'unshare') + { + $action_msg = lang('unshared'); + if (($Ok = !!($contact = $this->read($id)))) + { + $need_save = false; + foreach($contact['shared'] as $key => $shared) + { + // only unshare contacts shared by current user + if ($shared['shared_by'] == $this->user && + // only unshare from given addressbook, or all + (empty($query['filter']) || $shared['shared_with'] == (int)$query['filter'])) + { + $need_save = true; + unset($contact['shared'][$key]); + } + } + // we might need to ignore acl, as we are allowed to share with just read-rights + // setting user and update-time is explicitly desired for sync(-collection)! + $Ok = !$need_save || $this->save($contact, true); + } + break; + } $action_msg = lang('shared into addressbook %1', Accounts::username($shared_with)); if (($Ok = !!($contact = $this->read($id)))) { @@ -2025,6 +2058,11 @@ class addressbook_ui extends addressbook_bo { $row['cat_id'] = $this->categories->check_list(Acl::READ,$row['cat_id']); } + + if ($query['col_filter']['shared_by'] == $this->user) + { + $row['class'] .= 'unshare_contact '; + } } $rows['no_distribution_list'] = (bool)$query['filter2']; diff --git a/addressbook/lang/egw_de.lang b/addressbook/lang/egw_de.lang index 03b6e999d1..53724700f1 100644 --- a/addressbook/lang/egw_de.lang +++ b/addressbook/lang/egw_de.lang @@ -512,6 +512,8 @@ unable to import into %1, using %2 addressbook de Import nach %1 ist nicht mögl unique id (uid) addressbook de Eindeutige ID (UID) unique id