Combination fixes to the iCal, or more fields added for the export. A single iCal is being generated correctly. Still Need to work on the rrule.

This commit is contained in:
skeeter 2001-08-30 03:12:38 +00:00
parent 8353d7e678
commit cf7ef7bdc7
2 changed files with 96 additions and 24 deletions

View File

@ -1629,7 +1629,7 @@
case MSG_TENTATIVE:
case MSG_ACCEPTED:
$action_date = $old_event_date;
$body = 'On '.$phpgw->common->show_date(time() - $new_tz_offset).' '.$phpgw->common->grab_owner_name($phpgw_info['user']['account_id']).' '.$action.' your meeting request for '.$old_event_date;
$body = 'On '.$GLOBALS['phpgw']->common->show_date(time() - $new_tz_offset).' '.$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']).' '.$action.' your meeting request for '.$old_event_date;
break;
}
$subject = 'Calendar Event ('.$action.') #'.$event_id.': '.$action_date.' (L)';
@ -1649,6 +1649,25 @@
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
}
function switch_status($status)
{
switch($status)
{
case 'U':
return 0;
break;
case 'A':
return 1;
break;
case 'R':
return 2;
break;
case 'T':
return 3;
break;
}
}
function export_event($l_event_id=0)
{
$event_id = ($l_event_id?$l_event_id:$GLOBALS['HTTP_GET_VARS']['cal_id']);
@ -1676,13 +1695,48 @@
$event = $this->so->read_entry($event_id);
$icalendar->set_var($ical_event['uid'],'value','phpGW/'.$event['id']);
$ical_event['priority'] = $event['priority'];
$ical_event['class'] = intval($event['public']);
// $ical_event['class']['value'] = 1;
$icalendar->set_var($ical_event['description'],'value',$event['title']);
$icalendar->set_var($ical_event['summary'],'value',$event['description']);
$dtstart_mktime = $this->maketime($event['start']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'event');
$icalendar->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
$dtend_mktime = $this->maketime($event['end']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'event');
$icalendar->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
$mod_mktime = $this->maketime($event['modtime']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
if(count($event['participants']) > 1)
{
$db = $GLOBALS['phpgw']->db;
@reset($event['participants']);
while(list($part,$status) = each($event['participants']))
{
$db->query('select account_firstname,account_lastname from phpgw_accounts where account_id='.$part,__LINE__,__FILE__);
$db->next_record();
$name = $db->f('account_firstname').' '.$db->f('account_lastname');
$owner_status = $icalendar->switch_partstat(intval($this->switch_status($event['participants'][$part])));
$owner_mailto = 'mpeters@satx.rr.com';
$str = 'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$owner_mailto;
if($part == $event['owner'])
{
$str = 'ROLE=CHAIR;'.$str;
}
else
{
$str = 'ROLE=REQ-PARTICIPANT;'.$str;
}
$icalendar->parse_value($ical_event,'attendee',$str,'vevent');
if($part == $event['owner'])
{
$icalendar->parse_value($ical_event,'organizer',$str,'vevent');
}
}
}
if(!$event['recur_type'])
{
}
$ical_events[] = $ical_event;
}

View File

@ -169,7 +169,7 @@ class boicalendar
'class' => Array(
'type' => 'text',
'to_text' => True,
'vevent' => Array(
'vevent' => Array(
'state' => 'optional',
'multiples' => False
),
@ -1020,6 +1020,15 @@ class boicalendar
'x-type' => True
)
),
'last_modified' => Array(
'type' => 'function',
'function' => 'switch_date',
'quoted' => False,
'to_text' => False,
'properties' => Array(
'last_modified' => True
)
),
'mailto' => Array(
'type' => 'function',
'function' => 'switch_mailto',
@ -1045,7 +1054,8 @@ class boicalendar
'quoted' => False,
'to_text' => False,
'properties' => Array(
'attendee' => True
'attendee' => True,
'organizer' => True
)
),
'range' => Array(
@ -1072,7 +1082,8 @@ class boicalendar
'quoted' => False,
'to_text' => False,
'properties' => Array(
'attendee' => True
'attendee' => True,
'organizer' => True
)
),
'rsvp' => Array(
@ -1286,7 +1297,7 @@ class boicalendar
$str = str_replace("\\N","\n",$str);
$str = str_replace("\\n","\n",$str);
$str = str_replace("\\\\","\\",$str);
return $str;
return "$str";
}
function to_text($str)
@ -1295,7 +1306,7 @@ class boicalendar
$str = str_replace(",","\\,",$str);
$str = str_replace(";","\\;",$str);
$str = str_replace("\n","\\n",$str);
return $str;
return "$str";
}
function from_dir($str)
@ -1401,9 +1412,9 @@ class boicalendar
'param' => $majortype,
'value' => $temp[3]
);
$value = $temp[1];
$value = str_replace(':MAILTO','',$temp[1]);
}
while(ereg('(([A-Z\-]*)[=]([[:alnum:] \_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&\@\-]*))([\;]?)(.*)',$value,$temp))
while(ereg('(([A-Z\-]*)[=]([[:alnum:] \_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&\@\<\>\-]*))([\;]?)(.*)',$value,$temp))
{
$this->debug('Value : '._debug_array($temp));
$this->debug('Param '.$temp[2].' Value : '.$temp[3]);
@ -1418,7 +1429,7 @@ class boicalendar
}
else
{
while(ereg('(([A-Z\-]*)[=]([[:alnum:] \_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&\@\-]*))([\;]?)(.*)',$value,$temp))
while(ereg('(([A-Z\-]*)[=]([[:alnum:] \_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&\@\<\>\-]*))([\;]?)(.*)',$value,$temp))
{
$this->debug('Value : '._debug_array($temp));
$this->debug('Param '.$temp[2].' Value : '.$temp[3]);
@ -1513,11 +1524,11 @@ class boicalendar
}
else
{
$this->debug('Majortype : '.$majortype);
$this->debug('Property : '.$this->property[$majortype]['type']);
$this->debug('Majortype : '.$majortype);
$this->debug('Property : '.$this->property[$majortype]['type']);
if($this->property[$majortype]['type'] == 'date-time')
{
$this->debug('Got a DATE-TIME type!');
$this->debug('Got a DATE-TIME type!');
$t_var = $var[$majortype];
unset($var[$majortype]);
reset($t_var);
@ -1574,16 +1585,16 @@ class boicalendar
continue;
}
$param_array = @$this->parameter[$key];
$type = @$param_array['type'];
$type = @$this->parameter[$key]['type'];
if($type == 'date-time')
{
$include_datetime = True;
continue;
}
$quote = (@$param_array['quoted']?'"':'');
if(!empty($event[$key]) && @$param_array['properties'][$property])
$quote = (@$this->parameter[$key]['quoted']?'"':'');
if(isset($event[$key]) && @$this->parameter[$key]['properties'][$property])
{
$change_text = @$param_array['to_text'];
$change_text = @$this->parameter[$key]['to_text'];
$value = $event[$key];
if($change_text && $type == 'text')
{
@ -1595,9 +1606,12 @@ class boicalendar
$str .= ';'.str_replace('_','-',strtoupper($key)).'='.$quote.$this->to_dir($value).$quote;
break;
case 'function':
// $this->debug_str = True;
$str .= ';'.str_replace('_','-',strtoupper($key)).'=';
$function = @$param_array['function'];
$function = $this->parameter[$key]['function'];
$this->debug($key.' Function Param : '.$value);
$str .= $quote.$this->$function($value).$quote;
// $this->debug_str = False;
break;
case 'text':
case 'string':
@ -1759,7 +1773,7 @@ class boicalendar
}
break;
case 'text':
if(!empty($event[$value]))
if(isset($event[$value]))
{
if(@$this->parameter[$key]['type'] != 'function')
{
@ -1870,7 +1884,7 @@ class boicalendar
}
elseif(is_int($var))
{
switch($var)
switch(intval($var))
{
case PRIVATE:
return 'PRIVATE';
@ -2207,12 +2221,16 @@ class boicalendar
}
elseif(is_array($var))
{
return 'MAILTO:'.$var['user'].'@'.$var['host'];
// return 'MAILTO:'.$var['user'].'@'.$var['host'];
return $var['user'].'@'.$var['host'];
}
}
function switch_partstat($var)
{
// $this->debug_str = True;
$this->debug('PARTSTAT = '.$var);
// $this->debug_str = False;
if(is_string($var))
{
switch($var)
@ -2245,7 +2263,7 @@ class boicalendar
}
elseif(is_int($var))
{
switch($var)
switch(intval($var))
{
case NEEDS_ACTION:
return 'NEEDS-ACTION';