working folderlist for calendar

This commit is contained in:
Ralf Becker 2010-11-26 11:13:00 +00:00
parent e43136c6ff
commit 240e09440f

View File

@ -28,7 +28,7 @@ class calendar_activesync implements activesync_plugin_read
/** /**
* Instance of calendar_bo * Instance of calendar_bo
* *
* @var calendar * @var calendar_boupdate
*/ */
private $calendar; private $calendar;
@ -49,7 +49,7 @@ class calendar_activesync implements activesync_plugin_read
$this->backend = $backend; $this->backend = $backend;
} }
/** /**
* This function is analogous to GetMessageList. * This function is analogous to GetMessageList.
* *
@ -57,20 +57,20 @@ class calendar_activesync implements activesync_plugin_read
*/ */
public function GetFolderList() public function GetFolderList()
{ {
if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
$calendar = new calendar_bo;
foreach ($calendar->list_cals() as $label => $entry) foreach ($this->calendar->list_cals() as $label => $entry)
{ {
$id = $entry['grantor']; $folderlist[] = $f = array(
$folderlist[] = $f = array( 'id' => $this->backend->createID('calendar',$entry['grantor']),
'id' => $this->createID($id,$GLOBALS['egw']->accounts->id2name($id)), 'mod' => $label,
'mod' => $GLOBALS['egw']->accounts->id2name($id),
'parent'=> '0', 'parent'=> '0',
); );
}; };
error_log(__METHOD__."() returning ".array2string($folderlist));
return $folderlist; return $folderlist;
} }
/** /**
* Get Information about a folder * Get Information about a folder
* *
@ -79,27 +79,20 @@ class calendar_activesync implements activesync_plugin_read
*/ */
public function GetFolder($id) public function GetFolder($id)
{ {
$this->backend->splitID($id, $type, $owner);
$private;
$owner;
$this->splitID($id, &$private, &$owner);
$folderObj = new SyncFolder(); $folderObj = new SyncFolder();
$folderObj->serverid = $id; $folderObj->serverid = $id;
$folderObj->parentid = '0'; $folderObj->parentid = '0';
$folderObj->displayname = $GLOBALS['egw']->accounts->id2name($owner); $folderObj->displayname = $GLOBALS['egw']->accounts->id2name($owner);
if ($owner == $GLOBALS['egw_info']->users->account_id) { if ($owner == $GLOBALS['egw_info']['user']['account_id'])
{
$folderObj->type = SYNC_FOLDER_TYPE_USER_APPOINTMENT; $folderObj->type = SYNC_FOLDER_TYPE_USER_APPOINTMENT;
} }
else else
{ {
$folderObj->type = SYNC_FOLDER_TYPE_APPOINTMENT; $folderObj->type = SYNC_FOLDER_TYPE_APPOINTMENT;
} }
return $folderObj; return $folderObj;
} }
@ -119,8 +112,8 @@ class calendar_activesync implements activesync_plugin_read
public function StatFolder($id) public function StatFolder($id)
{ {
$folder = $this->GetFolder($id); $folder = $this->GetFolder($id);
$this->splitID($id, &$private, &$owner); $this->backend->splitID($id, $type, $owner);
$stat = array( $stat = array(
'id' => $id, 'id' => $id,
'mod' => $GLOBALS['egw']->accounts->id2name($owner), 'mod' => $GLOBALS['egw']->accounts->id2name($owner),
@ -129,20 +122,30 @@ class calendar_activesync implements activesync_plugin_read
return $stat; return $stat;
} }
public function getMessageList($folderID) /* Should return a list (array) of messages, each entry being an associative array
* with the same entries as StatMessage(). This function should return stable information; ie
* if nothing has changed, the items in the array must be exactly the same. The order of
* the items within the array is not important though.
*
* The cutoffdate is a date in the past, representing the date since which items should be shown.
* This cutoffdate is determined by the user's setting of getting 'Last 3 days' of e-mail, etc. If
* you ignore the cutoffdate, the user will not be able to select their own cutoffdate, but all
* will work OK apart from that.
*/
function GetMessageList($id, $cutoffdate=NULL)
{ {
error_log (__METHOD__); error_log (__METHOD__);
$messagelist = array(); $messagelist = array();
return ($messagelist); return ($messagelist);
} }
/** /**
* Get specified item from specified folder. * Get specified item from specified folder.
* @param string $folderid * @param string $folderid
* @param string $id * @param string $id
* @param int $truncsize * @param int $truncsize
* @param int $bodypreference * @param int $bodypreference
* @param bool $mimesupport * @param bool $mimesupport
@ -171,7 +174,7 @@ class calendar_activesync implements activesync_plugin_read
$message->deleted; $message->deleted;
$message->exceptionstarttime; $message->exceptionstarttime;
$message->categories; $message->categories;
if(isset($protocolversion) && $protocolversion < 12.0) { if(isset($protocolversion) && $protocolversion < 12.0) {
$message->body; $message->body;
$message->bodytruncated; $message->bodytruncated;
@ -179,51 +182,14 @@ class calendar_activesync implements activesync_plugin_read
} }
if(isset($protocolversion) && $protocolversion >= 12.0) { if(isset($protocolversion) && $protocolversion >= 12.0) {
$message->airsyncbasebody; // SYNC SyncAirSyncBaseBody $message->airsyncbasebody; // SYNC SyncAirSyncBaseBody
} }
*/ */
return $message; return $message;
} }
public function StatMessage($folderid, $id) { public function StatMessage($folderid, $id) {
debugLog (__METHOD__); debugLog (__METHOD__);
} }
/**
* Create a max. 32 hex letter ID, current 20 chars are used
*
* @param int $owner
* @param bool $private=false
* @return string
* @throws egw_exception_wrong_parameter
*/
private function createID($owner,$private=false)
{
$str = $this->backend->createID('calendar', (int)$private, $owner);
//debugLog(__METHOD__."($owner,'$f',$id) type=$account, folder=$folder --> '$str'");
return $str;
}
/**
* Split an ID string into $app, $folder and $id
*
* @param string $str
* @param string &$folder
* @param int &$id=null
* @throws egw_exception_wrong_parameter
*/
private function splitID($str,&$private,&$owner)
{
$this->backend->splitID($str, $app, $private, $owner);
$pivate = (bool)$private;
//debugLog(__METHOD__."('$str','$account','$folder',$id)");
}
} }