diff --git a/calendar/edit_entry_handler.php b/calendar/edit_entry_handler.php index df049b2ee6..2b87ec1413 100755 --- a/calendar/edit_entry_handler.php +++ b/calendar/edit_entry_handler.php @@ -244,7 +244,14 @@ } else { - $overlap .= $phpgw->calendar->link_to_entry($over->id,'circle.gif',$over->description).$over->title; + if($over->rpt_type == RPT_NONE) + { + $overlap .= $phpgw->calendar->link_to_entry($over->id,$over->description,'circle.gif',' width="5" height="7"').$over->title; + } + else + { + $overlap .= $phpgw->calendar->link_to_entry($over->id,$over->description,'circle.gif',' width="5" height="7"','multi_1.gif',' width="5" height="7"').$over->title; + } } $over_start = mktime($over->start->hour,$over->start->min,$over->start->sec,$over->start->month,$over->start->mday,$over->start->year) - $tz_offset; diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 41b9a5d3ee..529bb1ee63 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -255,7 +255,7 @@ class calendar extends calendar_ return $sday; } - function link_to_entry($id, $pic, $description) + function link_to_entry($id, $description, $pic1, $size1, $pic2='', $size2='') { global $phpgw, $phpgw_info; @@ -264,13 +264,28 @@ class calendar extends calendar_ { $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('remove'); - $p->set_file(array('link_pict' => 'link_pict.tpl')); + $templates = Array( + 'link_pict' => 'link_pict.tpl', + 'pict' => 'pict.tpl' + ); + $p->set_file($templates); + + $p->set_var('description',$description); + + $p->set_var('pic_image',$this->image_dir.'/'.$pic1); + $p->set_var('pic_size',$size1); + $p->parse('picture','pict',True); + + if($pic2 != '') + { + $p->set_var('pic_image',$this->image_dir.'/'.$pic2); + $p->set_var('pic_size',$size2); + $p->parse('picture','pict',True); + } + $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('pic_size',' width="5" height="7"'); - $p->set_var('description',$description); - $str = $p->finish($p->parse('out','link_pict')); + $str = $p->fp('out','link_pict'); unset($p); } return $str; @@ -918,6 +933,7 @@ class calendar extends calendar_ 'month_day' => 'month_day.tpl', 'week_day_event' => 'week_day_event.tpl', 'week_day_events' => 'week_day_events.tpl', + 'pict' => 'pict.tpl', 'link_pict' => 'link_pict.tpl', 'month_filler' => 'month_filler.tpl' ); @@ -978,7 +994,7 @@ class calendar extends calendar_ { if((!!($grants[$owner] & PHPGW_ACL_ADD) == True)) { - $new_event_link .= ''; + $new_event_link .= ''; $new_event_link .= ''.lang('New Entry').''; $new_event_link .= ''; } @@ -1021,37 +1037,51 @@ class calendar extends calendar_ for ($k=0;$k<$this->sorted_events_matching;$k++) { $lr_events = $rep_events[$k]; - $pict = 'circle.gif'; - $pic_size = ' width="5" height="7"'; - if($lr_events->recur_type != RECUR_NONE) - { - $pict = 'rpt.gif'; - $pic_size = ' width="10" height="10"'; - } - if(count($lr_events->participants) > 1) - { - $pict = 'multi_1.gif'; - $pic_size = ' width="12" height="16"'; - } - $description = $this->is_private($lr_events,$owner,'description'); - if (($this->printer_friendly == False) && (($description == 'private' && (!!($grants[$owner] & PHPGW_ACL_PRIVATE) == True)) || ($description != 'private')) && (!!($grants[$owner] & PHPGW_ACL_EDIT) == True)) { + $pict = 'circle.gif'; + $pic_size = ' width="5" height="7"'; + if($lr_events->recur_type != RECUR_NONE) + { + $pict = 'rpt.gif'; + $pic_size = ' width="10" height="10"'; + } + + $description = $this->is_private($lr_events,$owner,'description'); + $var = Array( - '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, 'pic_size' => $pic_size, 'description' => $description.$this->display_status($lr_events->users_status) ); + + $p->set_var($var); + $p->parse('picture','pict',True); + + if(count($lr_events->participants) > 1) + { + $var = Array( + 'pic_image' => $this->image_dir.'/multi_1.gif', + 'pic_size' => ' width="12" height="16"' + ); + $p->set_var($var); + $p->parse('picture','pict',True); + } + + $var = Array( + 'link_link' => $phpgw->link('/calendar/view.php','id='.$lr_events->id.'&owner='.$owner), + 'lang_view' => lang('View this entry') + ); $p->set_var($var); $p->parse('link_entry','link_pict'); + $p->set_var('picture',''); } else { + $p->set_var('picture',''); $p->set_var('link_entry',''); } @@ -1373,7 +1403,7 @@ class calendar extends calendar_ { if($t_format == '12') { - $time_width=11; + $time_width=10; } else { @@ -1381,7 +1411,6 @@ class calendar extends calendar_ } } $var = Array( - 'event_width' => (100 - $time_width), 'time_width' => $time_width, 'time_bgcolor' => $phpgw_info['theme']['cal_dayview'], 'bg_time_image' => $this->phpgwapi_template_dir.'/navbar_filler.jpg', @@ -1558,8 +1587,7 @@ class calendar extends calendar_ $open_link .= ''; $close_link = ''; diff --git a/calendar/inc/class.vCalendar.inc.php b/calendar/inc/class.vCalendar.inc.php index 43e028d453..dd272ae24a 100755 --- a/calendar/inc/class.vCalendar.inc.php +++ b/calendar/inc/class.vCalendar.inc.php @@ -12,6 +12,10 @@ /* $Id$ */ +define('NONE',0); +define('OPT-PARTICIPANT',1); +define('REQ-PARTICIPANT',2); + class mailto { var $user; @@ -44,7 +48,7 @@ class vCalendar_time { var $allday = False; } -class vCalendar +class vCalendar_event { var $prodid; var $version; @@ -63,130 +67,116 @@ class vCalendar var $summary; var $priority; var $class; +} + +class vCalendar +{ + var $event; + + function splitdate($value) + { + $dtime = new vCalendar_time; + $dtime->year = intval(substr($value,0,4)); + $dtime->month = intval(substr($value,5,2)); + $dtime->mday = intval(substr($value,7,2)); + $dtime->hour = intval(substr($value,10,2)); + $dtime->min = intval(substr($value,12,2)); + $dtime->sec = intval(substr($value,14,2)); + return $dtime; + } function read($vcal_text) { - $role = Array( - 'NONE' => 0, - 'OPT-PARTICIPANT' => 1, - 'REQ-PARTICIPANT' => 2 - ); - - while(strtoupper($text) != 'END:VCALENDAR') + + $c_vcal_text = count($vcal_text); + for($i=0;$i<$c_val_text;$i++) { - $element = strtolower($this->find_element($text,Array(':',';'))); - switch($element) + if($vcal_text[$i] == 'END:VCALENDAR') { - case 'begin': - $value = strtolower($this->find_element(substr($text,7,strlen($text)),Array(''))); - if($value != 'VCALENDAR') + continue; + } + $element = explode(';',$vcal_text[$i]); + $c_element = count($element); + for($j=0;$j<$c_element;$j++) + { + $temp_array = explode(':',$element[$j]); + $c_temp_array = count($temp_array); + if($c_temp_array > 1) + { + if(strpos($temp_array[0],'=') == 0) { - $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) + $type = $temp_array[0]; + if(isset($temp_array[1])) { - 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; + $value = $temp_array[1]; } } - $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) + else { - 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; + $parameter = $temp_array[0]; + $type = $temp_array[1]; + $value = $temp_array[2]; } - break; - case 'dtstart': - break; + } + else + { + $type = $element[$j]; + } + switch(strtolower($type)) + { + case 'begin': + $event = new vCalendar_event; + if($value != 'VCALENDAR') + { + $event->type = $value; + } + break; +/* + case 'attendee': + $attendee = new attendee; + $j++; + $att_data = explode(';',substr($vcal_text[$i],9,strlen($vcal_text[$i]))); + $c_att_data = count($att_data); + for($k=0;$k<$c_att_data;$k++) + { + if(strpos($att_data[$k],':')) + { + } + elseif(strpos($att_data[$k],'=')) + { + $att_att = explode('=',$att_data[$k]) + } + } + $event->attendee[] = $attendee; + unset($attendee); + break; + case 'organizer': + break; +*/ + case 'end': + switch(strtolower($value)) + { + case 'vevent': + $this->event[] = $event; + break; + case 'vcalendar': + break; + } + break; + default: + if(strtolower(substr($type,0,2)) == 'DT') + { + $this->$type = new vCalendar_time; + $this->$type = $this->splitdate($value); + } + else + { + $this->$type = $value; + } + break; + } } } } - - function find_element($text,$stop_chars) - { - $element = ''; - $i=0; - $char = ''; - while(!ereg('['.explode($stop_chars,'').']',$char) && ($i - - diff --git a/calendar/templates/default/day_cal.tpl b/calendar/templates/default/day_cal.tpl index f639ff949e..a71e562fa1 100755 --- a/calendar/templates/default/day_cal.tpl +++ b/calendar/templates/default/day_cal.tpl @@ -4,7 +4,6 @@ - {description} + {picture} diff --git a/calendar/templates/default/pict.tpl b/calendar/templates/default/pict.tpl new file mode 100755 index 0000000000..b4bf4f1058 --- /dev/null +++ b/calendar/templates/default/pict.tpl @@ -0,0 +1 @@ +{description} diff --git a/calendar/templates/idsociety/day_cal.tpl b/calendar/templates/idsociety/day_cal.tpl index f639ff949e..a71e562fa1 100755 --- a/calendar/templates/idsociety/day_cal.tpl +++ b/calendar/templates/idsociety/day_cal.tpl @@ -4,7 +4,6 @@ - {description} + {picture} diff --git a/calendar/templates/idsociety/pict.tpl b/calendar/templates/idsociety/pict.tpl new file mode 100755 index 0000000000..b4bf4f1058 --- /dev/null +++ b/calendar/templates/idsociety/pict.tpl @@ -0,0 +1 @@ +{description}