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 * Formats a date given as timestamp or array
* *
* @param mixed $date integer timestamp or array with ('year','month',..,'second') to convert * @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) * @return string the formated date (incl. time)
*/ */
function format_date($date,$format='') 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)); return adodb_date($format,$this->date2ts($date,False));
} }
@ -1647,6 +1656,10 @@ class bocal
$default_prefs =& $GLOBALS['egw']->preferences->default['calendar']; $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"; $subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
$defaults = array( $defaults = array(
'defaultcalendar' => 'week', 'defaultcalendar' => 'week',
@ -1667,13 +1680,13 @@ class bocal
'workdayends' => '17', 'workdayends' => '17',
'interval' => '30', 'interval' => '30',
'defaultlength' => '60', 'defaultlength' => '60',
'planner_start_with_group' => $GLOBALS['egw']->accounts->name2id('Default'), 'planner_start_with_group' => $planner_start_with_group,
'defaultfilter' => 'all', 'defaultfilter' => 'all',
'default_private' => '0', 'default_private' => '0',
); );
foreach($defaults as $var => $default) 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'); $GLOBALS['egw']->preferences->add('calendar',$var,$default,'default');
$this->cal_prefs[$var] = $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','event_tooltip');
$tpl->set_block('event_widget_t','planner_event'); $tpl->set_block('event_widget_t','planner_event');
} }
if (($return_array || $event['start_m'] == 0) && $event['end_m'] >= 24*60-1)
if ($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 else
{ {
@ -1006,7 +1012,7 @@ class uiviews extends uical
$small_trigger_width = 120 + 20*count($icons); $small_trigger_width = 120 + 20*count($icons);
$corner_radius=$width > $small_trigger_width ? 10 : 5; $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 ! $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); //$body_height = max(0,$height - $header_height - $corner_radius);
$border=1; $border=1;
$headerbgcolor = $color ? $color : '#808080'; $headerbgcolor = $color ? $color : '#808080';
@ -1046,7 +1052,7 @@ class uiviews extends uical
'timespan' => $timespan, 'timespan' => $timespan,
'title' => ($title = !$is_private ? $this->html->htmlspecialchars($event['title']) : lang('private')), 'title' => ($title = !$is_private ? $this->html->htmlspecialchars($event['title']) : lang('private')),
'header' => $small_height ? $title : $timespan, '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')) : '', 'location' => !$is_private ? $this->add_nonempty($event['location'],lang('Location')) : '',
'participants' => $participants, 'participants' => $participants,
'times' => !$event['multiday'] ? $this->add_nonempty($this->bo->timespan($event['start_m'],$event['end_m'],true),lang('Time')) : '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='') 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'); $data = $this->eventWidget($event,200,$indent,true,'planner_event');
$left = $this->_planner_pos($event['start'],$start,$end); $left = $this->_planner_pos($event['start'],$start,$end);

View File

@ -105,7 +105,7 @@
60 => '60' 60 => '60'
); );
$groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']); $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)) if (is_array($groups))
{ {
foreach($groups as $group) 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{ .calEvent:hover{
cursor: pointer; cursor: pointer;
cursor: hand;
} }
.calEventTooltip{ .calEventTooltip{
@ -228,7 +227,6 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
.calAddEvent:hover{ .calAddEvent:hover{
background-color: #D2D7FF; background-color: #D2D7FF;
cursor: pointer; cursor: pointer;
cursor: hand;
} }
/* header-row of the event /* 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; font-size: 8pt;
line-height: 10pt; line-height: 10pt;
} }
.calEventIcons{ .calEventIcons{
position: absolute; position: absolute;
right: 0px; right: 0px;
@ -433,5 +430,4 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
} }
.plannerEvent:hover{ .plannerEvent:hover{
cursor: pointer; cursor: pointer;
cursor: hand;
} }