derived from the object. This also fixes permission checking for Vbooks.
Adds 2 more lines per subclass, but is necessary for drivers that are composed with
another driver (like the Share driver or Vbook driver) since they call the composed
driver's non-public _save method.
*/
function save($object)
{
- list($object_key, $object_id) = each($this->toDriverKeys(array('__key' => $object->getValue('__key'))));
-
- $object_id = $this->_save($object_key, $object_id,
- $this->toDriverKeys($object->getAttributes()),
- $this->toDriverKeys($this->getBlobs()));
+ $object_id = $this->_save($object);
if (is_a($object_id, 'PEAR_Error')) {
return $object_id;
}
*
* @return string The object id, possibly updated.
*/
- function _save($object_key, $object_id, $attributes)
+ function _save($object)
{
return PEAR::raiseError(_("Saving contacts is not available."));
}
/**
* Saves the specified object to the IMSP server.
*
- * @param string $object_key (Ignored) name of the field
- * in $attributes[] to treat as key.
- * @param string $object_id The value of the key field.
- * @param array $attributes Contains the field names and values of the entry.
+ * @param Turba_Object $object The object to save/update.
*
* @return string The object id, possibly updated.
*/
- function _save($object_key, $object_id, $attributes)
+ function _save($object)
{
+ list($object_key, $object_id) = each($this->toDriverKeys(array('__key' => $object->getValue('__key'))));
+ $attributes = $this->toDriverKeys($object->getAttributes());
+
/* Check if the key changed, because IMSP will just write out
* a new entry without removing the previous one. */
if ($attributes['name'] != $this->_makeKey($attributes)) {
*
* @return string The object id, possibly updated.
*/
- function _save($object_key, $object_id, $attributes)
+ function _save($object)
{
+ list($object_key, $object_id) = each($this->toDriverKeys(array('__key' => $object->getValue('__key'))));
+ $attributes = $this->toDriverKeys($object->getAttributes());
+
return $this->_wrapper->_save($object_key, $object_id, $attributes);
}
foreach ($ids as $id) {
if (in_array($id, array_keys($this->_contacts_cache))) {
$object = $this->_contacts_cache[$id];
-
+
$object_type = $this->_contacts_cache[$id]['__type'];
if (!isset($object['__type']) || $object['__type'] == 'Object') {
if ($count) {
unset($attributes['__members']);
}
}
-
+
/**
* Removes the specified object from the Kolab message store.
}
$group = false;
- if (isset($this->_contacts_cache[$object_id]['__type'])
+ if (isset($this->_contacts_cache[$object_id]['__type'])
&& $this->_contacts_cache[$object_id]['__type'] == 'Group') {
$group = true;
}
if (is_a($result, 'PEAR_Error')) {
return $result;
}
-
+
/* Delete groups */
$result = $this->_store->setObjectType('distribution-list');
if (is_a($result, 'PEAR_Error')) {
*
* @return string The object id, possibly updated.
*/
- function _save($object_key, $object_id, $attributes)
+ function _save($object)
{
+ list($object_key, $object_id) = each($this->toDriverKeys(array('__key' => $object->getValue('__key'))));
+ $attributes = $this->toDriverKeys($object->getAttributes());
+
/* Get the old entry so that we can access the old
* values. These are needed so that we can delete any
* attributes that have been removed by using ldap_mod_del. */
/**
* Saves the specified object in the preferences.
*/
- function _save($object_key, $object_id, $attributes)
+ function _save($object)
{
+ list($object_key, $object_id) = each($this->toDriverKeys(array('__key' => $object->getValue('__key'))));
+ $attributes = $this->toDriverKeys($object->getAttributes());
+
$book = $this->_getAddressBook();
$book[$object_id] = $attributes;
$this->_setAddressBook($book);
*
* @return string The object id, possibly updated.
*/
- function _save($object_key, $object_id, $attributes, $blob_fields = array())
+ function _save($object)
{
- return $this->_driver->_save($object_key, $object_id, $attributes, $blob_fields);
+ return $this->_driver->_save($object);
}
/**
*
* @return string The object id, possibly updated.
*/
- function _save($object_key, $object_id, $attributes, $blob_fields = array())
+ function _save($object)
{
+ list($object_key, $object_id) = each($this->toDriverKeys(array('__key' => $object->getValue('__key'))));
+ $attributes = $this->toDriverKeys($object->getAttributes());
+ $blob_fields = $this->toDriverKeys($this->getBlobs());
+
$where = $object_key . ' = ?';
unset($attributes[$object_key]);
/**
* Not supported for virtual address books.
*/
- function _save($object_key, $object_id, $attributes)
+ function _save($object)
{
- return PEAR::raiseError(_("You cannot add an entry to a virtual address book."));
+ return $this->_driver->save($object);
}
/**