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;
@ -57,17 +57,17 @@ 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 ($this->calendar->list_cals() as $label => $entry)
foreach ($calendar->list_cals() as $label => $entry)
{ {
$id = $entry['grantor'];
$folderlist[] = $f = array( $folderlist[] = $f = array(
'id' => $this->createID($id,$GLOBALS['egw']->accounts->id2name($id)), 'id' => $this->backend->createID('calendar',$entry['grantor']),
'mod' => $GLOBALS['egw']->accounts->id2name($id), 'mod' => $label,
'parent'=> '0', 'parent'=> '0',
); );
}; };
error_log(__METHOD__."() returning ".array2string($folderlist));
return $folderlist; return $folderlist;
} }
@ -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,7 +112,7 @@ 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,
@ -130,7 +123,17 @@ 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();
@ -189,41 +192,4 @@ class calendar_activesync implements activesync_plugin_read
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)");
}
} }