2005-06-20 11:51:54 +02:00
|
|
|
<?php
|
2007-05-22 15:40:35 +02:00
|
|
|
/**
|
|
|
|
* InfoLog - iCalendar Parser
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Lars Kneschke <lkneschke@egroupware.org>
|
|
|
|
* @package infolog
|
|
|
|
* @subpackage syncml
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
2005-06-20 11:51:54 +02:00
|
|
|
|
2006-03-17 21:53:26 +01:00
|
|
|
require_once EGW_SERVER_ROOT.'/infolog/inc/class.boinfolog.inc.php';
|
|
|
|
require_once EGW_SERVER_ROOT.'/phpgwapi/inc/horde/Horde/iCalendar.php';
|
2005-06-20 11:51:54 +02:00
|
|
|
|
|
|
|
class vcalinfolog extends boinfolog
|
|
|
|
{
|
2006-03-17 21:53:26 +01:00
|
|
|
var $status2vtodo = array(
|
|
|
|
'offer' => 'NEEDS-ACTION',
|
|
|
|
'not-started' => 'NEEDS-ACTION',
|
|
|
|
'ongoing' => 'IN-PROCESS',
|
|
|
|
'done' => 'COMPLETED',
|
|
|
|
'cancelled' => 'CANCELLED',
|
|
|
|
'billed' => 'DONE',
|
|
|
|
'call' => 'NEEDS-ACTION',
|
|
|
|
'will-call' => 'IN-PROCESS',
|
|
|
|
);
|
2006-08-15 16:29:56 +02:00
|
|
|
|
2006-03-17 21:53:26 +01:00
|
|
|
var $vtodo2status = array(
|
|
|
|
'NEEDS-ACTION' => 'not-started',
|
|
|
|
'IN-PROCESS' => 'ongoing',
|
|
|
|
'COMPLETED' => 'done',
|
|
|
|
'CANCELLED' => 'cancelled',
|
|
|
|
);
|
2006-08-15 16:29:56 +02:00
|
|
|
|
2006-08-24 11:48:29 +02:00
|
|
|
var $egw_priority2vcal_priority = array(
|
|
|
|
0 => 3,
|
|
|
|
1 => 2,
|
|
|
|
2 => 1,
|
|
|
|
3 => 1,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
var $vcal_priority2egw_priority = array(
|
|
|
|
1 => 2,
|
|
|
|
2 => 1,
|
|
|
|
3 => 0,
|
|
|
|
);
|
|
|
|
|
2005-06-20 11:51:54 +02:00
|
|
|
function exportVTODO($_taskID, $_version)
|
|
|
|
{
|
|
|
|
$taskData = $this->read($_taskID);
|
2005-07-20 14:09:32 +02:00
|
|
|
|
2006-08-15 16:29:56 +02:00
|
|
|
$taskData = $GLOBALS['egw']->translation->convert($taskData, $GLOBALS['egw']->translation->charset(), 'UTF-8');
|
2005-06-20 11:51:54 +02:00
|
|
|
|
2005-07-14 19:21:01 +02:00
|
|
|
//_debug_array($taskData);
|
2005-06-20 11:51:54 +02:00
|
|
|
|
2006-08-15 16:29:56 +02:00
|
|
|
$taskGUID = $GLOBALS['egw']->common->generate_uid('infolog_task',$_taskID);
|
2005-06-20 11:51:54 +02:00
|
|
|
#print "<br>";
|
2006-08-15 16:29:56 +02:00
|
|
|
#print $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add');
|
2005-06-20 11:51:54 +02:00
|
|
|
#print "<br>";
|
|
|
|
|
|
|
|
$vcal = &new Horde_iCalendar;
|
|
|
|
$vcal->setAttribute('VERSION',$_version);
|
|
|
|
$vcal->setAttribute('METHOD','PUBLISH');
|
|
|
|
|
|
|
|
$vevent = Horde_iCalendar::newComponent('VTODO',$vcal);
|
|
|
|
|
|
|
|
$options = array();
|
|
|
|
|
|
|
|
$vevent->setAttribute('SUMMARY',$taskData['info_subject']);
|
|
|
|
$vevent->setAttribute('DESCRIPTION',$taskData['info_des']);
|
2006-03-17 21:53:26 +01:00
|
|
|
$vevent->setAttribute('LOCATION',$taskData['info_location']);
|
2005-06-20 11:51:54 +02:00
|
|
|
if($taskData['info_startdate'])
|
|
|
|
$vevent->setAttribute('DTSTART',$taskData['info_startdate']);
|
|
|
|
if($taskData['info_enddate'])
|
|
|
|
$vevent->setAttribute('DUE',$taskData['info_enddate']);
|
2006-03-17 21:53:26 +01:00
|
|
|
if($taskData['info_datecompleted'])
|
|
|
|
$vevent->setAttribute('COMPLETED',$taskData['info_datecompleted']);
|
2005-06-20 11:51:54 +02:00
|
|
|
$vevent->setAttribute('DTSTAMP',time());
|
2006-08-15 16:29:56 +02:00
|
|
|
$vevent->setAttribute('CREATED',$GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add'));
|
|
|
|
$vevent->setAttribute('LAST-MODIFIED',$GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'modify'));
|
2005-06-20 11:51:54 +02:00
|
|
|
$vevent->setAttribute('UID',$taskGUID);
|
2006-03-17 21:53:26 +01:00
|
|
|
$vevent->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE');
|
|
|
|
$vevent->setAttribute('STATUS',isset($this->status2vtodo[$taskData['info_status']]) ?
|
|
|
|
$this->status2vtodo[$taskData['info_status']] : 'NEEDS-ACTION');
|
2006-08-24 11:48:29 +02:00
|
|
|
$vevent->setAttribute('PRIORITY',$this->egw_priority2vcal_priority[$taskData['info_priority']]);
|
2005-07-14 19:21:01 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
if (!empty($taskData['info_cat']))
|
|
|
|
{
|
|
|
|
$cats = $this->get_categories(array($taskData['info_cat']));
|
|
|
|
$vevent->setAttribute('CATEGORIES', $cats[0]);
|
|
|
|
}
|
|
|
|
|
2005-06-20 11:51:54 +02:00
|
|
|
#$vevent->setAttribute('TRANSP','OPAQUE');
|
|
|
|
# status
|
|
|
|
# ATTENDEE
|
|
|
|
|
|
|
|
$options = array('CHARSET' => 'UTF-8','ENCODING' => 'QUOTED-PRINTABLE');
|
|
|
|
$vevent->setParameter('SUMMARY', $options);
|
|
|
|
$vevent->setParameter('DESCRIPTION', $options);
|
|
|
|
|
|
|
|
$vcal->addComponent($vevent);
|
|
|
|
|
|
|
|
#print "<pre>";
|
|
|
|
#print $vcal->exportvCalendar();
|
|
|
|
#print "</pre>";
|
2006-06-01 18:27:49 +02:00
|
|
|
|
2005-06-20 11:51:54 +02:00
|
|
|
return $vcal->exportvCalendar();
|
|
|
|
}
|
|
|
|
|
|
|
|
function importVTODO(&$_vcalData, $_taskID=-1)
|
|
|
|
{
|
2006-03-21 14:19:38 +01:00
|
|
|
if(!$taskData = $this->vtodotoegw($_vcalData)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-08-15 16:29:56 +02:00
|
|
|
if($_taskID > 0) {
|
2006-03-21 14:19:38 +01:00
|
|
|
$taskData['info_id'] = $_taskID;
|
2006-08-15 16:29:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// we suppose that a not set status in a vtodo means that the task did not started yet
|
|
|
|
if(empty($taskData['info_status'])) {
|
|
|
|
$taskData['info_status'] = 'not-started';
|
|
|
|
}
|
2006-03-21 14:19:38 +01:00
|
|
|
|
|
|
|
#_debug_array($taskData);exit;
|
|
|
|
return $this->write($taskData);
|
|
|
|
}
|
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
function searchVTODO($_vcalData)
|
|
|
|
{
|
2006-06-01 18:27:49 +02:00
|
|
|
if(!$egwData = $this->vtodotoegw($_vcalData)) {
|
2006-03-21 14:19:38 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-08-15 16:29:56 +02:00
|
|
|
#unset($egwData['info_priority']);
|
|
|
|
|
2006-03-21 14:19:38 +01:00
|
|
|
$filter = array('col_filter' => $egwData);
|
|
|
|
if($foundItems = $this->search($filter)) {
|
|
|
|
if(count($foundItems) > 0) {
|
|
|
|
$itemIDs = array_keys($foundItems);
|
|
|
|
return $itemIDs[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2006-08-15 16:29:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
function vtodotoegw($_vcalData)
|
|
|
|
{
|
2005-06-20 11:51:54 +02:00
|
|
|
$vcal = &new Horde_iCalendar;
|
2006-08-15 16:29:56 +02:00
|
|
|
if(!$vcal->parsevCalendar($_vcalData)) {
|
2005-06-20 11:51:54 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-03-21 14:19:38 +01:00
|
|
|
|
2005-06-20 11:51:54 +02:00
|
|
|
$components = $vcal->getComponents();
|
2006-03-21 14:19:38 +01:00
|
|
|
|
2005-06-20 11:51:54 +02:00
|
|
|
if(count($components) > 0)
|
|
|
|
{
|
|
|
|
$component = $components[0];
|
|
|
|
if(is_a($component, 'Horde_iCalendar_vtodo'))
|
|
|
|
{
|
|
|
|
if($_taskID>0)
|
|
|
|
$taskData['info_id'] = $_taskID;
|
2006-03-17 21:53:26 +01:00
|
|
|
|
2005-06-20 11:51:54 +02:00
|
|
|
foreach($component->_attributes as $attributes)
|
|
|
|
{
|
|
|
|
#print $attributes['name'].' - '.$attributes['value'].'<br>';
|
|
|
|
switch($attributes['name'])
|
|
|
|
{
|
|
|
|
case 'CLASS':
|
2005-07-20 14:09:32 +02:00
|
|
|
$taskData['info_access'] = strtolower($attributes['value']);
|
2005-06-20 11:51:54 +02:00
|
|
|
break;
|
|
|
|
case 'DESCRIPTION':
|
2005-07-20 14:09:32 +02:00
|
|
|
$taskData['info_des'] = $attributes['value'];
|
2005-06-20 11:51:54 +02:00
|
|
|
break;
|
2006-03-17 21:53:26 +01:00
|
|
|
case 'LOCATION':
|
|
|
|
$taskData['info_location'] = $attributes['value'];
|
|
|
|
break;
|
2005-06-20 11:51:54 +02:00
|
|
|
case 'DUE':
|
|
|
|
$taskData['info_enddate'] = $attributes['value'];
|
|
|
|
break;
|
2006-03-17 21:53:26 +01:00
|
|
|
case 'COMPLETED':
|
|
|
|
$taskData['info_datecompleted'] = $attributes['value'];
|
|
|
|
break;
|
2005-06-20 11:51:54 +02:00
|
|
|
case 'DTSTART':
|
|
|
|
$taskData['info_startdate'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'PRIORITY':
|
2006-08-24 11:48:29 +02:00
|
|
|
if (1 <= $attributes['value'] && $attributes['value'] <= 3)
|
2005-07-14 19:21:01 +02:00
|
|
|
{
|
2006-08-24 11:48:29 +02:00
|
|
|
$taskData['info_priority'] = $this->vcal_priority2egw_priority[$attributes['value']];
|
2005-07-14 19:21:01 +02:00
|
|
|
}
|
|
|
|
else
|
2005-06-20 11:51:54 +02:00
|
|
|
{
|
2005-07-14 19:21:01 +02:00
|
|
|
$taskData['info_priority'] = 1; // default = normal
|
2005-06-20 11:51:54 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'STATUS':
|
2006-03-17 21:53:26 +01:00
|
|
|
$taskData['info_status'] = isset($this->vtodo2status[strtoupper($attributes['value'])]) ?
|
|
|
|
$this->vtodo2status[strtoupper($attributes['value'])] : 'ongoing';
|
2005-06-20 11:51:54 +02:00
|
|
|
break;
|
|
|
|
case 'SUMMARY':
|
|
|
|
$taskData['info_subject'] = $attributes['value'];
|
|
|
|
break;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
case 'CATEGORIES':
|
|
|
|
{
|
|
|
|
$cats = $this->find_or_add_categories(explode(',', $attributes['value']));
|
|
|
|
$taskData['info_cat'] = $cats[0];
|
|
|
|
}
|
|
|
|
break;
|
2005-06-20 11:51:54 +02:00
|
|
|
}
|
|
|
|
}
|
2006-08-15 16:29:56 +02:00
|
|
|
# the horde ical class does already convert in parsevCalendar
|
|
|
|
# do NOT convert here
|
2006-08-17 05:32:18 +02:00
|
|
|
#$taskData = $GLOBALS['egw']->translation->convert($taskData, 'UTF-8');
|
2006-03-17 21:53:26 +01:00
|
|
|
|
2006-03-21 14:19:38 +01:00
|
|
|
return $taskData;
|
2005-06-20 11:51:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
function exportVNOTE($_noteID, $_type)
|
|
|
|
{
|
|
|
|
$note = $this->read($_noteID);
|
|
|
|
$note = $GLOBALS['egw']->translation->convert($note, $GLOBALS['egw']->translation->charset(), 'UTF-8');
|
|
|
|
|
|
|
|
switch($_type)
|
|
|
|
{
|
|
|
|
case 'text/plain':
|
|
|
|
$txt = $note['info_subject']."\n\n".$note['info_des'];
|
|
|
|
return $txt;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'text/x-vnote':
|
|
|
|
$noteGUID = $GLOBALS['egw']->common->generate_uid('infolog_note',$_noteID);
|
|
|
|
$vnote = &new Horde_iCalendar_vnote();
|
|
|
|
$vNote->setAttribute('VERSION', '1.1');
|
|
|
|
$vnote->setAttribute('SUMMARY',$note['info_subject']);
|
|
|
|
$vnote->setAttribute('BODY',$note['info_des']);
|
|
|
|
if($note['info_startdate'])
|
|
|
|
$vnote->setAttribute('DCREATED',$note['info_startdate']);
|
|
|
|
$vnote->setAttribute('DCREATED',$GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add'));
|
|
|
|
$vnote->setAttribute('LAST-MODIFIED',$GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'modify'));
|
|
|
|
if (!empty($note['info_cat']))
|
|
|
|
{
|
|
|
|
$cats = $this->get_categories(array($note['info_cat']));
|
|
|
|
$vnote->setAttribute('CATEGORIES', $cats[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#$vnote->setAttribute('UID',$noteGUID);
|
|
|
|
#$vnote->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE');
|
|
|
|
|
|
|
|
#$options = array('CHARSET' => 'UTF-8','ENCODING' => 'QUOTED-PRINTABLE');
|
|
|
|
#$vnote->setParameter('SUMMARY', $options);
|
|
|
|
#$vnote->setParameter('DESCRIPTION', $options);
|
|
|
|
|
|
|
|
return $vnote->exportvCalendar();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function importVNOTE(&$_vcalData, $_type, $_noteID = -1)
|
|
|
|
{
|
|
|
|
if(!$note = $this->vnotetoegw($_vcalData, $_type))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($_noteID > 0)
|
|
|
|
{
|
|
|
|
$note['info_id'] = $_noteID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($note['info_status'])) {
|
|
|
|
$note['info_status'] = 'done';
|
|
|
|
}
|
|
|
|
|
|
|
|
#_debug_array($taskData);exit;
|
|
|
|
return $this->write($note);
|
|
|
|
}
|
|
|
|
|
|
|
|
function searchVNOTE($_vcalData, $_type)
|
|
|
|
{
|
|
|
|
if(!$note = $this->vnotetoegw($_vcalData)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$filter = array('col_filter' => $egwData);
|
|
|
|
if($foundItems = $this->search($filter)) {
|
|
|
|
if(count($foundItems) > 0) {
|
|
|
|
$itemIDs = array_keys($foundItems);
|
|
|
|
return $itemIDs[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function vnotetoegw($_data, $_type)
|
|
|
|
{
|
|
|
|
switch($_type)
|
|
|
|
{
|
|
|
|
case 'text/plain':
|
|
|
|
$note = array();
|
|
|
|
$note['info_type'] = 'note';
|
|
|
|
$botranslation =& CreateObject('phpgwapi.translation');
|
|
|
|
$txt = $botranslation->convert($_data, 'utf-8');
|
|
|
|
$txt = str_replace("\r\n", "\n", $txt);
|
|
|
|
|
|
|
|
if (preg_match("/^(^\n)\n\n(.*)$/", $txt, $match))
|
|
|
|
{
|
|
|
|
$note['info_subject'] = $match[0];
|
|
|
|
$note['info_des'] = $match[1];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$note['info_des'] = $txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $note;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'text/x-vnote':
|
|
|
|
$vnote = &new Horde_iCalendar;
|
|
|
|
if (!$vcal->parsevCalendar($_data))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
$components = $vnote->getComponent();
|
|
|
|
if(count($components) > 0)
|
|
|
|
{
|
|
|
|
$component = $components[0];
|
|
|
|
if(is_a($component, 'Horde_iCalendar_vnote'))
|
|
|
|
{
|
|
|
|
$note = array();
|
|
|
|
$note['info_type'] = 'note';
|
|
|
|
|
|
|
|
foreach($component->_attributes as $attribute)
|
|
|
|
{
|
|
|
|
switch ($attribute['name'])
|
|
|
|
{
|
|
|
|
case 'BODY':
|
|
|
|
$note['info_des'] = $attribute['value'];
|
|
|
|
break;
|
|
|
|
case 'SUMMARY':
|
|
|
|
$note['info_subject'] = $attribute['value'];
|
|
|
|
break;
|
|
|
|
case 'CATEGORIES':
|
|
|
|
{
|
|
|
|
$cats = $this->find_or_add_categories(explode(',', $attribute['value']));
|
|
|
|
$note['info_cat'] = $cats[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $note;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-06-20 11:51:54 +02:00
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|