It now displays a possible 2 icons. One is either a dot for a normal event, or a cyclic circle for a repeating event. The second is to indiciate that multiple participants/group are scheduled. Also, a few cleanups on the time display under NS.

This commit is contained in:
skeeter 2001-05-06 00:11:12 +00:00
parent 797d6e913d
commit b765f4bab3
11 changed files with 169 additions and 144 deletions

View File

@ -244,7 +244,14 @@
} }
else 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; $over_start = mktime($over->start->hour,$over->start->min,$over->start->sec,$over->start->month,$over->start->mday,$over->start->year) - $tz_offset;

View File

@ -255,7 +255,7 @@ class calendar extends calendar_
return $sday; return $sday;
} }
function link_to_entry($id, $pic, $description) function link_to_entry($id, $description, $pic1, $size1, $pic2='', $size2='')
{ {
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
@ -264,13 +264,28 @@ class calendar extends calendar_
{ {
$p = CreateObject('phpgwapi.Template',$this->template_dir); $p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_unknowns('remove'); $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('link_link',$phpgw->link('/calendar/view.php','id='.$id.'&owner='.$this->owner));
$p->set_var('lang_view',lang('View this entry')); $p->set_var('lang_view',lang('View this entry'));
$p->set_var('pic_image',$this->image_dir.'/'.$pic); $str = $p->fp('out','link_pict');
$p->set_var('pic_size',' width="5" height="7"');
$p->set_var('description',$description);
$str = $p->finish($p->parse('out','link_pict'));
unset($p); unset($p);
} }
return $str; return $str;
@ -918,6 +933,7 @@ class calendar extends calendar_
'month_day' => 'month_day.tpl', 'month_day' => 'month_day.tpl',
'week_day_event' => 'week_day_event.tpl', 'week_day_event' => 'week_day_event.tpl',
'week_day_events' => 'week_day_events.tpl', 'week_day_events' => 'week_day_events.tpl',
'pict' => 'pict.tpl',
'link_pict' => 'link_pict.tpl', 'link_pict' => 'link_pict.tpl',
'month_filler' => 'month_filler.tpl' 'month_filler' => 'month_filler.tpl'
); );
@ -978,7 +994,7 @@ class calendar extends calendar_
{ {
if((!!($grants[$owner] & PHPGW_ACL_ADD) == True)) if((!!($grants[$owner] & PHPGW_ACL_ADD) == True))
{ {
$new_event_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date_year.'&month='.$date['month'].'&day='.$date['day'].'&owner='.$owner).'">'; $new_event_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&owner='.$owner).'">';
$new_event_link .= '<img src="'.$this->image_dir.'/new.gif" width="10" height="10" alt="'.lang('New Entry').'" border="0" align="center">'; $new_event_link .= '<img src="'.$this->image_dir.'/new.gif" width="10" height="10" alt="'.lang('New Entry').'" border="0" align="center">';
$new_event_link .= '</a>'; $new_event_link .= '</a>';
} }
@ -1021,37 +1037,51 @@ class calendar extends calendar_
for ($k=0;$k<$this->sorted_events_matching;$k++) for ($k=0;$k<$this->sorted_events_matching;$k++)
{ {
$lr_events = $rep_events[$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) && if (($this->printer_friendly == False) &&
(($description == 'private' && (!!($grants[$owner] & PHPGW_ACL_PRIVATE) == True)) || ($description != 'private')) && (($description == 'private' && (!!($grants[$owner] & PHPGW_ACL_PRIVATE) == True)) || ($description != 'private')) &&
(!!($grants[$owner] & PHPGW_ACL_EDIT) == True)) (!!($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( $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_image' => $this->image_dir.'/'.$pict,
'pic_size' => $pic_size, 'pic_size' => $pic_size,
'description' => $description.$this->display_status($lr_events->users_status) '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->set_var($var);
$p->parse('link_entry','link_pict'); $p->parse('link_entry','link_pict');
$p->set_var('picture','');
} }
else else
{ {
$p->set_var('picture','');
$p->set_var('link_entry',''); $p->set_var('link_entry','');
} }
@ -1373,7 +1403,7 @@ class calendar extends calendar_
{ {
if($t_format == '12') if($t_format == '12')
{ {
$time_width=11; $time_width=10;
} }
else else
{ {
@ -1381,7 +1411,6 @@ class calendar extends calendar_
} }
} }
$var = Array( $var = Array(
'event_width' => (100 - $time_width),
'time_width' => $time_width, 'time_width' => $time_width,
'time_bgcolor' => $phpgw_info['theme']['cal_dayview'], 'time_bgcolor' => $phpgw_info['theme']['cal_dayview'],
'bg_time_image' => $this->phpgwapi_template_dir.'/navbar_filler.jpg', 'bg_time_image' => $this->phpgwapi_template_dir.'/navbar_filler.jpg',
@ -1558,8 +1587,7 @@ class calendar extends calendar_
$open_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php', $open_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php',
'year='.$date['year'].'&month='.$date['month'] 'year='.$date['year'].'&month='.$date['month']
. '&day='.$date['day'] . '&day='.$date['day'].'&hour='.$new_hour
. '&hour='.$new_hour
. '&minute='.$new_minute.'&owner='.$this->owner).'">'; . '&minute='.$new_minute.'&owner='.$this->owner).'">';
$close_link = '</a>'; $close_link = '</a>';

View File

@ -12,6 +12,10 @@
/* $Id$ */ /* $Id$ */
define('NONE',0);
define('OPT-PARTICIPANT',1);
define('REQ-PARTICIPANT',2);
class mailto class mailto
{ {
var $user; var $user;
@ -44,7 +48,7 @@ class vCalendar_time {
var $allday = False; var $allday = False;
} }
class vCalendar class vCalendar_event
{ {
var $prodid; var $prodid;
var $version; var $version;
@ -63,130 +67,116 @@ class vCalendar
var $summary; var $summary;
var $priority; var $priority;
var $class; 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) 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(':',';'))); if($vcal_text[$i] == 'END:VCALENDAR')
switch($element)
{ {
case 'begin': continue;
$value = strtolower($this->find_element(substr($text,7,strlen($text)),Array(''))); }
if($value != 'VCALENDAR') $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; $type = $temp_array[0];
} if(isset($temp_array[1]))
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': $value = $temp_array[1];
$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; else
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': $parameter = $temp_array[0];
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':'))); $type = $temp_array[1];
$organizer = each('@',$data); $value = $temp_array[2];
$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': else
break; {
$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<strlen($text)))
{
$char = substr($text,$i++,1);
$element .= $char;
}
return $element;
}
} }
?> ?>

View File

@ -4,7 +4,6 @@
<!-- <!--
.event .event
{ {
width: {event_width}%;
color: #{font_color}; color: #{font_color};
font-family: {font}; font-family: {font};
font-weight: 100; font-weight: 100;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,4 +1,4 @@
<!-- $Id$ link_pict --> <!-- $Id$ link_pict -->
<a href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;"> <a href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;">
<img src="{pic_image}"{pic_size} alt="{description}" border="0"> {picture}

View File

@ -0,0 +1 @@
<img src="{pic_image}"{pic_size} alt="{description}" border="0">

View File

@ -4,7 +4,6 @@
<!-- <!--
.event .event
{ {
width: {event_width}%;
color: #{font_color}; color: #{font_color};
font-family: {font}; font-family: {font};
font-weight: 100; font-weight: 100;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,4 +1,4 @@
<!-- $Id$ link_pict --> <!-- $Id$ link_pict -->
<a href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;"> <a href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;">
<img src="{pic_image}"{pic_size} alt="{description}" border="0"> {picture}

View File

@ -0,0 +1 @@
<img src="{pic_image}"{pic_size} alt="{description}" border="0">