various syncml fixes

This commit is contained in:
Lars Kneschke 2006-08-15 14:29:45 +00:00
parent 215bf8f305
commit b3dbb91d80

View File

@ -235,7 +235,7 @@
$rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY']; $rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY'];
break; break;
} }
$rrule['UNTIL'] = ($event['recur_enddate']) ? date('Ymd',$event['recur_enddate']) : '#0'; $rrule['UNTIL'] = ($event['recur_enddate']) ? date('Ymd',$event['recur_enddate']).'T'.date('His',$event['start']) : '#0';
$attributes['RRULE'] = $rrule['FREQ'].' '.$rrule['UNTIL']; $attributes['RRULE'] = $rrule['FREQ'].' '.$rrule['UNTIL'];
} else { } else {
@ -395,8 +395,14 @@
$alarms[$alarmTime] = array( $alarms[$alarmTime] = array(
'time' => $alarmTime 'time' => $alarmTime
); );
} elseif (preg_match('/(........T......);;;$/',$attributes['value'],$matches)) { } elseif (preg_match('/(........T......);;(\d*);$/',$attributes['value'],$matches)) {
#error_log(print_r($matches,true)); //error_log(print_r($matches,true));
$alarmTime = $vcal->_parseDateTime($matches[1]);
$alarms[$alarmTime] = array(
'time' => $alarmTime
);
} elseif (preg_match('/(........T......Z);;(\d*);$/',$attributes['value'],$matches)) {
//error_log(print_r($matches,true));
$alarmTime = $vcal->_parseDateTime($matches[1]); $alarmTime = $vcal->_parseDateTime($matches[1]);
$alarms[$alarmTime] = array( $alarms[$alarmTime] = array(
'time' => $alarmTime 'time' => $alarmTime
@ -727,20 +733,27 @@
$this->productManufacturere = $_productManufacturer; $this->productManufacturere = $_productManufacturer;
$this->productName = $_productName; $this->productName = $_productName;
$defaultFields = array('public' => 'public', 'description' => 'description', 'end' => 'end', $defaultFields[0] = array('public' => 'public', 'description' => 'description', 'end' => 'end',
'start' => 'start', 'location' => 'location', 'recur_type' => 'recur_type', 'start' => 'start', 'location' => 'location', 'recur_type' => 'recur_type',
'recur_interval' => 'recur_interval', 'recur_data' => 'recur_data', 'recur_enddate' => 'recur_enddate', 'recur_interval' => 'recur_interval', 'recur_data' => 'recur_data', 'recur_enddate' => 'recur_enddate',
'title' => 'title', 'priority' => 'priority', 'alarms' => 'alarms', 'title' => 'title', 'priority' => 'priority', 'alarms' => 'alarms',
); );
$defaultFields[1] = array('public' => 'public', 'description' => 'description', 'end' => 'end',
'start' => 'start', 'location' => 'location', 'recur_type' => 'recur_type',
'recur_interval' => 'recur_interval', 'recur_data' => 'recur_data', 'recur_enddate' => 'recur_enddate',
'title' => 'title', 'alarms' => 'alarms',
);
switch(strtolower($_productManufacturer)) switch(strtolower($_productManufacturer))
{ {
case 'nexthaus corporation': case 'nexthaus corporation':
switch(strtolower($_productName)) switch(strtolower($_productName))
{ {
default: default:
$this->supportedFields = $defaultFields + array('participants' => 'participants'); $this->supportedFields = $defaultFields[0] + array('participants' => 'participants');
#$this->supportedFields = $defaultFields; #$this->supportedFields = $defaultFields;
break; break;
} }
@ -752,7 +765,17 @@
switch(strtolower($_productName)) switch(strtolower($_productName))
{ {
default: default:
$this->supportedFields = $defaultFields; $this->supportedFields = $defaultFields[0];
break;
}
break;
case 'nokia':
switch(strtolower($_productName))
{
case 'e61':
default:
$this->supportedFields = $defaultFields[1];
break; break;
} }
break; break;
@ -762,7 +785,7 @@
{ {
case 'd750i': case 'd750i':
default: default:
$this->supportedFields = $defaultFields; $this->supportedFields = $defaultFields[0];
break; break;
} }
break; break;
@ -771,13 +794,13 @@
switch(strtolower($_productName)) switch(strtolower($_productName))
{ {
default: default:
$this->supportedFields = $defaultFields; $this->supportedFields = $defaultFields[0];
break; break;
} }
break; break;
case 'file': // used outside of SyncML, eg. by the calendar itself ==> all possible fields case 'file': // used outside of SyncML, eg. by the calendar itself ==> all possible fields
$this->supportedFields = $defaultFields + array( $this->supportedFields = $defaultFields[0] + array(
'participants' => 'participants', 'participants' => 'participants',
'owner' => 'owner', 'owner' => 'owner',
'non_blocking' => 'non_blocking', 'non_blocking' => 'non_blocking',
@ -1024,12 +1047,6 @@
} }
//echo "event=";_debug_array($vcardData); //echo "event=";_debug_array($vcardData);
// now that we know what the vard provides, we merge that data with the information we have about the device
$event['priority'] = 2;
if($cal_id > 0)
{
$event['id'] = $cal_id;
}
while(($fieldName = array_shift($supportedFields))) while(($fieldName = array_shift($supportedFields)))
{ {
switch($fieldName) switch($fieldName)
@ -1071,15 +1088,19 @@
return false; return false;
} }
function search($_vcalData) { function search($_vcalData)
{
if(!$event = $this->icaltoegw($_vcalData)) { if(!$event = $this->icaltoegw($_vcalData)) {
return false; return false;
} }
$query = array( $query = array(
'cal_start='.$this->date2ts($event['start'],true), // true = Server-time 'cal_start='.$this->date2ts($event['start'],true), // true = Server-time
'cal_end='.$this->date2ts($event['end'],true), 'cal_end='.$this->date2ts($event['end'],true),
); );
foreach(array('title','location','priority','public','non_blocking') as $name) {
#foreach(array('title','location','priority','public','non_blocking') as $name) {
foreach(array('title','location','public','non_blocking') as $name) {
if (isset($event[$name])) $query['cal_'.$name] = $event[$name]; if (isset($event[$name])) $query['cal_'.$name] = $event[$name];
} }