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
*
* @var calendar
* @var calendar_boupdate
*/
private $calendar;
@ -49,7 +49,7 @@ class calendar_activesync implements activesync_plugin_read
$this->backend = $backend;
}
/**
* This function is analogous to GetMessageList.
*
@ -57,20 +57,20 @@ class calendar_activesync implements activesync_plugin_read
*/
public function GetFolderList()
{
$calendar = new calendar_bo;
foreach ($calendar->list_cals() as $label => $entry)
{
$id = $entry['grantor'];
$folderlist[] = $f = array(
'id' => $this->createID($id,$GLOBALS['egw']->accounts->id2name($id)),
'mod' => $GLOBALS['egw']->accounts->id2name($id),
if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
foreach ($this->calendar->list_cals() as $label => $entry)
{
$folderlist[] = $f = array(
'id' => $this->backend->createID('calendar',$entry['grantor']),
'mod' => $label,
'parent'=> '0',
);
};
);
};
error_log(__METHOD__."() returning ".array2string($folderlist));
return $folderlist;
}
/**
* Get Information about a folder
*
@ -79,27 +79,20 @@ class calendar_activesync implements activesync_plugin_read
*/
public function GetFolder($id)
{
$private;
$owner;
$this->splitID($id, &$private, &$owner);
$this->backend->splitID($id, $type, $owner);
$folderObj = new SyncFolder();
$folderObj->serverid = $id;
$folderObj->parentid = '0';
$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;
}
else
{
$folderObj->type = SYNC_FOLDER_TYPE_APPOINTMENT;
}
return $folderObj;
}
@ -119,8 +112,8 @@ class calendar_activesync implements activesync_plugin_read
public function StatFolder($id)
{
$folder = $this->GetFolder($id);
$this->splitID($id, &$private, &$owner);
$this->backend->splitID($id, $type, $owner);
$stat = array(
'id' => $id,
'mod' => $GLOBALS['egw']->accounts->id2name($owner),
@ -129,20 +122,30 @@ class calendar_activesync implements activesync_plugin_read
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__);
$messagelist = array();
return ($messagelist);
}
/**
* Get specified item from specified folder.
* @param string $folderid
* @param string $id
* @param string $id
* @param int $truncsize
* @param int $bodypreference
* @param bool $mimesupport
@ -171,7 +174,7 @@ class calendar_activesync implements activesync_plugin_read
$message->deleted;
$message->exceptionstarttime;
$message->categories;
if(isset($protocolversion) && $protocolversion < 12.0) {
$message->body;
$message->bodytruncated;
@ -179,51 +182,14 @@ class calendar_activesync implements activesync_plugin_read
}
if(isset($protocolversion) && $protocolversion >= 12.0) {
$message->airsyncbasebody; // SYNC SyncAirSyncBaseBody
}
}
*/
return $message;
}
public function StatMessage($folderid, $id) {
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)");
}
}