}
/**
+ * Returns ability of the backend to add new contacts.
+ *
+ * @return boolean
+ */
+ function canAdd()
+ {
+ return $this->_canAdd();
+ }
+
+ function _canAdd()
+ {
+ return false;
+ }
+
+ /**
* Deletes the specified entry from the contact source.
*
* @param string $object_id The ID of the object to delete.
* return them in the user's preferred order.
*
* @param integer $permission The PERMS_* constant to filter on.
+ * @param array $options Any additional options.
*
* @return array The filtered, ordered $cfgSources entries.
*/
- function getAddressBooks($permission = PERMS_READ)
+ function getAddressBooks($permission = PERMS_READ, $options = array())
{
$addressbooks = array();
foreach (array_keys(Turba::getAddressBookOrder()) as $addressbook) {
$addressbooks = $GLOBALS['cfgSources'];
}
- return Turba::permissionsFilter($addressbooks, $permission);
+ return Turba::permissionsFilter($addressbooks, $permission, $options);
}
/**
* @param array $in The data we want filtered.
* @param string $filter What type of data we are filtering.
* @param integer $permission The PERMS_* constant we will filter on.
+ * @param array $options Additional options.
*
* @return array The filtered data.
*/
- function permissionsFilter($in, $permission = PERMS_READ)
+ function permissionsFilter($in, $permission = PERMS_READ, $options = array())
{
$out = array();
}
if ($driver->hasPermission($permission)) {
+ if (!empty($options['require_add']) && !$driver->canAdd()) {
+ continue;
+ }
$out[$sourceId] = $source;
}
}
// Only set $add_source_options if there is at least one editable address book
// that is not the current address book.
-$addSources = Turba::getAddressBooks(PERMS_EDIT);
+$addSources = Turba::getAddressBooks(PERMS_EDIT, array('require_add' => true));
$copymove_source_options = '';
$copymoveSources = $addSources;
unset($copymoveSources[$default_source]);