fixed tooltip for planner (allways showed 0:00, 0h in header)

This commit is contained in:
Ralf Becker 2006-08-25 08:17:40 +00:00
parent 47d18e092a
commit 96f0c4a199
4 changed files with 36 additions and 16 deletions

View File

@ -1109,14 +1109,23 @@ class bocal
* Formats a date given as timestamp or array
*
* @param mixed $date integer timestamp or array with ('year','month',..,'second') to convert
* @param string $format='' default common_prefs[dateformat], common_prefs[timeformat]
* @param string/boolean $format='' default common_prefs[dateformat], common_prefs[timeformat], false=time only, true=date only
* @return string the formated date (incl. time)
*/
function format_date($date,$format='')
{
if (!$format)
$timeformat = $this->common_prefs['timeformat'] != '12' ? 'H:i' : 'h:i a';
if ($format === '') // date+time wanted
{
$format = $this->common_prefs['dateformat'].', '.($this->common_prefs['timeformat'] != '12' ? 'H:i' : 'h:i a');
$format = $this->common_prefs['dateformat'].', '.$timeformat;
}
elseif ($format === false) // time wanted
{
$format = $timeformat;
}
elseif ($format === true)
{
$format = $this->common_prefs['dateformat'];
}
return adodb_date($format,$this->date2ts($date,False));
}
@ -1647,6 +1656,10 @@ class bocal
$default_prefs =& $GLOBALS['egw']->preferences->default['calendar'];
if (!($planner_start_with_group = $GLOBALS['egw']->accounts->name2id('Default')))
{
$planner_start_with_group = '0';
}
$subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
$defaults = array(
'defaultcalendar' => 'week',
@ -1667,13 +1680,13 @@ class bocal
'workdayends' => '17',
'interval' => '30',
'defaultlength' => '60',
'planner_start_with_group' => $GLOBALS['egw']->accounts->name2id('Default'),
'planner_start_with_group' => $planner_start_with_group,
'defaultfilter' => 'all',
'default_private' => '0',
);
foreach($defaults as $var => $default)
{
if (!isset($default_prefs[$var]) || $default_prefs[$var] == '')
if (!isset($default_prefs[$var]) || (string)$default_prefs[$var] == '')
{
$GLOBALS['egw']->preferences->add('calendar',$var,$default,'default');
$this->cal_prefs[$var] = $default;

View File

@ -988,10 +988,16 @@ class uiviews extends uical
$tpl->set_block('event_widget_t','event_tooltip');
$tpl->set_block('event_widget_t','planner_event');
}
if ($event['start_m'] == 0 && $event['end_m'] >= 24*60-1)
if (($return_array || $event['start_m'] == 0) && $event['end_m'] >= 24*60-1)
{
$timespan = lang('all day');
if ($return_array && $event['end_m'] > 24*60)
{
$timespan = $this->bo->format_date($event['start'],false).' - '.$this->bo->format_date($event['end']);
}
else
{
$timespan = lang('all day');
}
}
else
{
@ -1006,7 +1012,7 @@ class uiviews extends uical
$small_trigger_width = 120 + 20*count($icons);
$corner_radius=$width > $small_trigger_width ? 10 : 5;
$header_height=$width > $small_trigger_width ? 19 : 12; // multi_3 icon has a height of 19=16+2*1padding+1border !
$height = $this->times2height($event['start_m'],$event['end_m'],$header_height);
if (!$return_array) $height = $this->times2height($event['start_m'],$event['end_m'],$header_height);
//$body_height = max(0,$height - $header_height - $corner_radius);
$border=1;
$headerbgcolor = $color ? $color : '#808080';
@ -1046,7 +1052,7 @@ class uiviews extends uical
'timespan' => $timespan,
'title' => ($title = !$is_private ? $this->html->htmlspecialchars($event['title']) : lang('private')),
'header' => $small_height ? $title : $timespan,
'description' => !$is_private ? nl2br($this->html->htmlspecialchars($event['description'])) : '',
'description' => !$is_private ? nl2br($this->html->htmlspecialchars($event['description'])."\nInstensity: $intensity") : '',
'location' => !$is_private ? $this->add_nonempty($event['location'],lang('Location')) : '',
'participants' => $participants,
'times' => !$event['multiday'] ? $this->add_nonempty($this->bo->timespan($event['start_m'],$event['end_m'],true),lang('Time')) :
@ -1702,7 +1708,12 @@ class uiviews extends uical
*/
function plannerEventWidget($event,$start,$end,$indent='')
{
$event['multiday'] = true; // otherwise eventWidgets displays only the time and expects start_m to be set
// some fields set by the dayColWidget for the other views
$day_start = $this->bo->date2ts((string)$this->bo->date2string($event['start']));
$event['start_m'] = ($event['start'] - $day_start) / 60;
$event['end_m'] = round(($event['end'] - $day_start) / 60);
$event['multiday'] = true;
$data = $this->eventWidget($event,200,$indent,true,'planner_event');
$left = $this->_planner_pos($event['start'],$start,$end);

View File

@ -105,7 +105,7 @@
60 => '60'
);
$groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']);
$options = array(-1 => lang('none'));
$options = array('0' => lang('none'));
if (is_array($groups))
{
foreach($groups as $group)

View File

@ -209,7 +209,6 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
}
.calEvent:hover{
cursor: pointer;
cursor: hand;
}
.calEventTooltip{
@ -228,7 +227,6 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
.calAddEvent:hover{
background-color: #D2D7FF;
cursor: pointer;
cursor: hand;
}
/* header-row of the event
@ -250,7 +248,6 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
font-size: 8pt;
line-height: 10pt;
}
.calEventIcons{
position: absolute;
right: 0px;
@ -433,5 +430,4 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
}
.plannerEvent:hover{
cursor: pointer;
cursor: hand;
}