one tooltip for all calendar view (including title, time, description, location and participants)

This commit is contained in:
Ralf Becker 2004-07-19 15:17:02 +00:00
parent 3539b02f59
commit 16fad86115
2 changed files with 36 additions and 23 deletions

View File

@ -1782,6 +1782,31 @@
} }
return $hdr; return $hdr;
} }
/**
* tooltip for all calendar views
*
* displays title, time, description, location and participants, should be composed via a template in the next version
*
* @param $event array containing the event
* @return the onmouseover attribute (incl. onmouseover=) to be included in an html-element, eg. div or table-cell
*/
function event_tooltip($event,$always_show_time=False)
{
$start = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset);
$end = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset);
$multiday = substr($start,0,10) != substr($end,0,10); // start and end on same day?
return $this->html->tooltip(
($always_show_time || $multiday ? '<p style="margin: 0px;"><b>'.$start.(!$multiday ? substr($end,10) : ' -- '.$end).'</b></p>' : '').
'<p style="margin: 0px;">'.$event['description'].'</p>'.
($event['location']?'<p style="background: silver; margin: 0px; padding: 1px;">'.$event['location'].'</p>':'').
(count($event['participants']) > 1 || !isset($event['participants'][$this->bo->owner]) ? '<p style="margin: 0px;">'.$this->planner_participants($event['participants']).'</p>':''),
False,array(
'TITLE' => $event['title'],
'WIDTH' => 250,
));
}
/** /**
* planner_update_row - update a row of the planner view * planner_update_row - update a row of the planner view
@ -1886,49 +1911,37 @@
{ {
$opt .= ' bgcolor="'.$bgcolor.'"'; $opt .= ' bgcolor="'.$bgcolor.'"';
} }
if (!$is_private) if (!$is_private)
{ {
$opt .= ' title="'.lang('Title').": ".$event['title']; $opt .= $this->event_tooltip($event,True);
if ($event['description'])
{
$opt .= "\n".lang('Description').": ".$event['description'];
}
} }
else else
{ {
$opt .= ' title="'.lang('You do not have permission to read this record!'); $opt .= ' title="'.lang('You do not have permission to read this record!').'"';
}
$start = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset);
$end = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset);
$opt .= "\n".lang('Start Date/Time').": ".$start."\n".lang('End Date/Time').": ".$end;
if ($event['location'] && !$is_private)
{
$opt .= " \n".lang('Location').": ".$event['location'];
} }
if (!$is_private) if (!$is_private)
{ {
$opt .= '" onClick="location=\''.$view.'\'"'; $opt .= ' onClick="location=\''.$view.'\'"';
$cel = '<a href="'.$view.'">'; $cel = '<a href="'.$view.'">';
} }
else else
{ {
$opt .= '"'; $opt .= '';
$cel = ''; $cel = '';
} }
$opt .= ' class="planner-cell"'; $opt .= ' class="planner-cell"';
if ($event['priority'] == 3) if ($event['priority'] == 3)
{ {
$cel .= $this->html->image('calendar','mini-calendar-bar.gif','','border="0"'); $cel .= $this->html->image('calendar','high.gif','','border="0"');
} }
if ($event['recur_type']) if ($event['recur_type'])
{ {
$cel .= $this->html->image('calendar','recur.gif','','border="0"'); $cel .= $this->html->image('calendar','recur.gif','','border="0"');
} }
$cel .= $this->html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border="0"'); $cel .= $this->html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif','','border="0"');
$cel .= '</a>'; $cel .= '</a>';
if (isset($event['print_title']) && $event['print_title'] == 'yes') if (isset($event['print_title']) && $event['print_title'] == 'yes')
@ -2864,8 +2877,8 @@
$date = sprintf('%04d%02d%02d',$year,$month,$day); $date = sprintf('%04d%02d%02d',$year,$month,$day);
$this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); $this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date));
$this->link_tpl->set_var('lang_view',lang('View this entry')); $this->link_tpl->set_var('lang_view',lang('View this entry'));
$this->link_tpl->set_var('desc', $textdesc); $this->link_tpl->set_var('tooltip',$this->event_tooltip($event));
$this->link_tpl->set_var('location', $textlocation); // quoting title, describtion and location for wz_tooltips
$this->link_tpl->parse('picture','link_open',True); $this->link_tpl->parse('picture','link_open',True);
} }
if (!$is_private) if (!$is_private)

View File

@ -5,7 +5,7 @@
<!-- END link_pict --> <!-- END link_pict -->
<!-- BEGIN link_open --> <!-- BEGIN link_open -->
<div id="calendar_event_entry" style="overflow:hidden;" onmouseover="this.T_STATIC=true; this.T_OFFSETX=-2; this.T_OFFSETY=36; return escape('{desc}');"> <div id="calendar_event_entry" style="overflow:hidden;" {tooltip}>
<a class="event_entry" href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;"><br> <a class="event_entry" href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;"><br>
<!-- removed for favour of tooltip (NDEE) title="{desc}" --> <!-- removed for favour of tooltip (NDEE) title="{desc}" -->
<!-- END link_open --> <!-- END link_open -->
@ -19,7 +19,7 @@
<!-- END link_text_old --> <!-- END link_text_old -->
<!-- BEGIN link_text --> <!-- BEGIN link_text -->
<nobr>&nbsp;<span style="color: black">{time}</span> {users_status}</nobr><br><b>{title}</b><br><i>{desc}</i><br><b>{location}</b> <nobr>&nbsp;<span style="color: black">{time}</span> {users_status}</nobr><br><b>{title}</b>
<!-- END link_text --> <!-- END link_text -->
<!-- BEGIN link_close --> <!-- BEGIN link_close -->