Skip to content

Commit

Permalink
Start adding support for moving items between collections client side.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 7, 2014
1 parent f649b39 commit d49bca5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
25 changes: 25 additions & 0 deletions framework/Core/lib/Horde/Core/ActiveSync/Connector.php
Expand Up @@ -232,6 +232,31 @@ public function calendar_getActionTimestamp($uid, $action, $calendar = null)
$uid, $action, $calendar, $this->hasFeature('modseq', 'calendar'));
}

/**
* Move a calendar event.
*
* @param string $uid The event UID.
* @param string $source The source calendar's id.
* @param string $target The target calendar's id.
*
* @return string|boolean The UID if successfully moved otherwise false.
* @since 2.15.0
*/
public function calendar_move($uid, $source, $target)
{
if (!$this->_registry->hasMethod('move', $this->_registry->hasInterface('calendar'))) {
return false;
}

try {
$this->_registry->calendar->move($uid, $source, $target);
} catch (Horde_Exception $e) {
return false;
}

return $uid;
}

/**
* Get a list of all contacts a user can see
*
Expand Down
13 changes: 11 additions & 2 deletions framework/Core/lib/Horde/Core/ActiveSync/Driver.php
Expand Up @@ -1585,10 +1585,14 @@ public function deleteMessage($folderid, array $ids)
* Move message
*
* @param string $folderid Existing folder id.
* @param array $ids Message UIDs to move.
* @param array $ids Message UIDs to move. @todo For H6 this
* should take a single id. We can't bulk
* move them for other reasons.
* @param string $newfolderid The new folder id to move to.
*
* @return array An array of successfully moved messages.
* @return array An array of successfully moved messages with
* the old UIDs as keys and new UIDs as values.
*
* @throws Horde_ActiveSync_Exception
*/
public function moveMessage($folderid, array $ids, $newfolderid)
Expand All @@ -1609,9 +1613,14 @@ public function moveMessage($folderid, array $ids, $newfolderid)
$folder_id = null;
}

$move_res = array();
ob_start();
switch ($folder_class) {
case Horde_ActiveSync::CLASS_CALENDAR:
if ($res = $this->_connector->calendar_move()) {
$move_res[$res] = $res;
}
break;
case Horde_ActiveSync::CLASS_CONTACTS:
case Horde_ActiveSync::CLASS_TASKS:
case Horde_ActiveSync::CLASS_NOTES:
Expand Down

0 comments on commit d49bca5

Please sign in to comment.