diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 81d0ed1b2c..84d7d6cfa4 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -21,7 +21,8 @@ if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded('mcal') } // The following line can be removed when vCalendar is implemented.... $phpgw_info['server']['calendar_type'] = 'sql'; -include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar__.inc.php'); +//CreateObject('calendar.vCalendar'); +CreateObject('calendar.calendar__'); include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php'); class calendar extends calendar_ @@ -198,7 +199,7 @@ class calendar extends calendar_ $p->set_unknowns('remove'); $p->set_file(array('link_pict' => 'link_pict.tpl')); // $p->set_block('link_pict','link_pict'); - $p->set_var('link_link',$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/view.php','id='.$id.'&owner='.$this->owner)); + $p->set_var('link_link',$phpgw->link('/calendar/view.php','id='.$id.'&owner='.$this->owner)); $p->set_var('lang_view',lang('View this entry')); $p->set_var('pic_image',$this->image_dir.'/'.$pic); $p->set_var('description',$description); @@ -246,7 +247,8 @@ class calendar extends calendar_ $str = $event->$field; } - $str .= ' ('.$this->get_long_status($this->users_status).')'; +// $str .= ' ('.$this->get_long_status($this->users_status).')'; +// $str .= ' ('.$this->users_status.')'; return $str; } @@ -875,7 +877,7 @@ class calendar extends calendar_ 'link_link' => $phpgw->link('/calendar/view.php','id='.$lr_events->id.'&owner='.$owner), 'lang_view' => lang('View this entry'), 'pic_image' => $this->image_dir.'/'.$pict, - 'description' => $description + 'description' => $description.(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' ('.$lr_events->users_status.')':'') ); $p->set_var($var); $p->parse('link_entry','link_pict'); @@ -935,7 +937,7 @@ class calendar extends calendar_ 'start_time' => $start_time, 'end_time' => $end_time, 'close_view_link' => $close_link, - 'name' => $this->is_private($lr_events,$owner,'name') + 'name' => $this->is_private($lr_events,$owner,'name').(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' ('.$lr_events->users_status.')':'') ); $p->set_var($var); $p->parse('events','week_day_event',True); @@ -1142,7 +1144,7 @@ class calendar extends calendar_ $time[$ind] .= ''; } - $time[$ind] .= $this->is_private($event,$this->owner,'name'); + $time[$ind] .= $this->is_private($event,$this->owner,'name').(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' ('.$event->users_status.')':''); if ($event->priority == 3) { @@ -1746,6 +1748,10 @@ class calendar extends calendar_ $time_slice[$index]['marker'] = '-'; $time_slice[$index]['color'] = $phpgw_info['theme']['bg01']; $time_slice[$index]['description'] = $this->is_private($event,$participants[$i],'title'); + if(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True) + { + $time_slice[$index]['description'] .= ' ('.$event->users_status.')'; + } } } } diff --git a/calendar/inc/class.calendar_icap.inc.php b/calendar/inc/class.calendar_icap.inc.php index c5fb156e49..7daf70f11f 100755 --- a/calendar/inc/class.calendar_icap.inc.php +++ b/calendar/inc/class.calendar_icap.inc.php @@ -12,6 +12,13 @@ /* $Id$ */ +if ($phpgw_info['flags']['included_classes']['calendar_'] == True) +{ + return; +} + +$phpgw_info['flags']['included_classes']['calendar_'] = True; + class calendar_ extends calendar__ { function open($calendar='',$user='',$passwd='',$options='') diff --git a/calendar/inc/class.calendar_item.inc.php b/calendar/inc/class.calendar_item.inc.php index 6eb71e43d3..c8b7f5ad2d 100755 --- a/calendar/inc/class.calendar_item.inc.php +++ b/calendar/inc/class.calendar_item.inc.php @@ -39,6 +39,7 @@ var $recur_enddate; var $recur_data = 0; + var $users_status = 'U'; // Legacy Support var $owner; var $name = "Unnamed Event"; diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index 5549e95cc7..b38aaff70a 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -14,6 +14,13 @@ /* $Id$ */ +if ($phpgw_info['flags']['included_classes']['calendar_'] == True) +{ + return; +} + +$phpgw_info['flags']['included_classes']['calendar_'] = True; + class calendar_ extends calendar__ { var $deleted_events = Array(); @@ -348,7 +355,7 @@ class calendar_ extends calendar__ { if($this->stream->f('cal_login') == $this->user) { - $this->users_status = $this->stream->f('cal_status'); + $this->event->users_status = $this->stream->f('cal_status'); } $this->event->participants[] = $this->stream->f('cal_login'); $this->event->status[] = $this->stream->f('cal_status'); diff --git a/calendar/inc/class.vCalendar.inc.php b/calendar/inc/class.vCalendar.inc.php new file mode 100755 index 0000000000..43e028d453 --- /dev/null +++ b/calendar/inc/class.vCalendar.inc.php @@ -0,0 +1,192 @@ + * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ + + /* $Id$ */ + +class mailto +{ + var $user; + var $host; +} + +class attendee +{ + var $cn = 'Unknown'; + var $role = 0; + var $rsvp = False; + var $mailto; + var $sent_by; +} + +class organizer +{ + var $mailto; + var $sent_by; +} + +class vCalendar_time { + var $year; + var $month; + var $mday; + var $hour; + var $min; + var $sec; + var $date; + var $allday = False; +} + +class vCalendar +{ + var $prodid; + var $version; + var $method; + var $type; + var $attendee = Array(); + var $organizer; + var $dtstart; + var $dtend; + var $location; + var $transp; + var $sequence; + var $uid; + var $dtstamp; + var $description; + var $summary; + var $priority; + var $class; + + function read($vcal_text) + { + $role = Array( + 'NONE' => 0, + 'OPT-PARTICIPANT' => 1, + 'REQ-PARTICIPANT' => 2 + ); + + while(strtoupper($text) != 'END:VCALENDAR') + { + $element = strtolower($this->find_element($text,Array(':',';'))); + switch($element) + { + case 'begin': + $value = strtolower($this->find_element(substr($text,7,strlen($text)),Array(''))); + if($value != 'VCALENDAR') + { + $this->type = $value; + } + break; + case 'prodid': + $this->prodid = strtolower($this->find_element(substr($text,7,strlen($text)),Array(''))); + break; + case 'version': + $this->version = strtolower($this->find_element(substr($text,8,strlen($text)),Array(''))); + break; + case 'attendee': + $attendee = new attendee; + $i = 9; + while($i < strlen($text)) + { + $value = strtolower($this->find_element(substr($text,$i,strlen($text)),Array('='))); + switch($value) + { + case 'cn': + $i += 4; + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(';'))); + if(substr($data,1,1) == '"') + { + $attendee->$value=substr($data,1,strlen($data) - 2); + } + else + { + $attendee->$value=$data; + } + $i += strlen($data) + 1; + break; + case 'role': + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(';'))); + $attendee->$value=$role[$data]; + $i += strlen($data) + 1; + break; + case 'rsvp': + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':'))); + $attendee->$value=$data; + $i += strlen($data) + 1; + $value = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':'))); + $i += strlen($value) + 1; + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(''))); + $attendee->$value=$data; + $i += strlen($data) + 1; + break; + case 'sent-by': + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':',';'))); + $organizer = each('@',$data); + $attendee->sent_by->user = $organizer[0]; + $attendee->sent_by->host = $organizer[1]; + $i += strlen($data) + 1; + break; + } + } + $this->attendee[] = $attendee; + unset($attendee); + break; + case 'organizer': + $i = 10; + $value = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':'))); + $i += strlen($value) + 1; + switch($value) + { + case 'mailto': + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':'))); + $organizer = each('@',$data); + $this->organizer->mailto->user = $organizer[0]; + $this->organizer->mailto->host = $organizer[1]; + break; + case 'sent-by': + $data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':',';'))); + $organizer = each('@',$data); + $this->organizer->sent_by->user = $organizer[0]; + $this->organizer->sent_by->host = $organizer[1]; + $i += strlen($data) + 1; + break; + otherwise: + $data = $value; + if(strpos(' '.$data.' ','@') > 0) + { + $organizer = each('@',$data); + $this->organizer->mailto->user = $organizer[0]; + $this->organizer->mailto->host = $organizer[1]; + } + break; + } + break; + case 'dtstart': + break; + } + } + } + + function find_element($text,$stop_chars) + { + $element = ''; + $i=0; + $char = ''; + while(!ereg('['.explode($stop_chars,'').']',$char) && ($i + +