* Calendar: fixed planner by category view was showing all categories under "None"

This commit is contained in:
Ralf Becker 2014-10-20 09:14:24 +00:00
parent 8a827671b8
commit d0208328bc

View File

@ -613,7 +613,7 @@ class calendar_uiviews extends calendar_ui
if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date);
$this->use_time_grid = !$this->cal_prefs['use_time_grid'] || $this->cal_prefs['use_time_grid'] == 'all'; // all views $this->use_time_grid = !$this->cal_prefs['use_time_grid'] || $this->cal_prefs['use_time_grid'] == 'all'; // all views
// Merge print // Merge print
if($weeks) if($weeks)
{ {
@ -657,7 +657,7 @@ class calendar_uiviews extends calendar_ui
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year;
$navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; $navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year;
$days =& $this->bo->search(array( $days =& $this->bo->search(array(
'start' => $this->first, 'start' => $this->first,
'end' => $this->last, 'end' => $this->last,
@ -684,13 +684,13 @@ class calendar_uiviews extends calendar_ui
$content .= $this->timeGridWidget($this->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $this->last); $content .= $this->timeGridWidget($this->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $this->last);
} }
$navHeader = '<div class="calendar_calMonthNavHeader calendar_calMonth">' $navHeader = '<div class="calendar_calMonthNavHeader calendar_calMonth">'
.html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array(
'menuaction' => $this->view_menuaction, 'menuaction' => $this->view_menuaction,
'date' => date('Ymd',strtotime("-".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))), 'date' => date('Ymd',strtotime("-".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))),
)). ' <span>'.$navHeader; )). ' <span>'.$navHeader;
$navHeader = $navHeader.'</span> '.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( $navHeader = $navHeader.'</span> '.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array(
'menuaction' => $this->view_menuaction, 'menuaction' => $this->view_menuaction,
'date' => date('Ymd',strtotime("+".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))), 'date' => date('Ymd',strtotime("+".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))),
@ -813,7 +813,7 @@ class calendar_uiviews extends calendar_ui
$this->last = strtotime("+$days days",$this->first) - 1; $this->last = strtotime("+$days days",$this->first) - 1;
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Four days view').' '.$this->bo->long_date($this->first,$this->last);
$navHeader =lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); $navHeader =lang('Four days view').' '.$this->bo->long_date($this->first,$this->last);
} }
else else
{ {
$wd_start = $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); $wd_start = $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day);
@ -850,18 +850,18 @@ class calendar_uiviews extends calendar_ui
# #
# $class = $class == 'row_on' ? 'th' : 'row_on'; # $class = $class == 'row_on' ? 'th' : 'row_on';
//echo "<p>weekdaystarts='".$this->cal_prefs['weekdaystarts']."', get_weekday_start($this->year,$this->month,$this->day)=".date('l Y-m-d',$wd_start).", first=".date('l Y-m-d',$this->first)."</p>\n"; //echo "<p>weekdaystarts='".$this->cal_prefs['weekdaystarts']."', get_weekday_start($this->year,$this->month,$this->day)=".date('l Y-m-d',$wd_start).", first=".date('l Y-m-d',$this->first)."</p>\n";
$navHeader = '<div class="calendar_calWeek calendar_calWeekNavHeader">' $navHeader = '<div class="calendar_calWeek calendar_calWeekNavHeader">'
.html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array(
'menuaction' => $this->view_menuaction, 'menuaction' => $this->view_menuaction,
'date' => date('Ymd',$this->first-$days*DAY_s), 'date' => date('Ymd',$this->first-$days*DAY_s),
)). '<span>'.$navHeader; )). '<span>'.$navHeader;
$navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( $navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array(
'menuaction' => $this->view_menuaction, 'menuaction' => $this->view_menuaction,
'date' => date('Ymd',$this->last+$days*DAY_s), 'date' => date('Ymd',$this->last+$days*DAY_s),
)).'</div>'; )).'</div>';
$merge = $this->merge(); $merge = $this->merge();
if($merge) if($merge)
{ {
@ -898,12 +898,12 @@ class calendar_uiviews extends calendar_ui
if (count($users) > $headerCounter) if (count($users) > $headerCounter)
{ {
$content .= $navHeader; $content .= $navHeader;
} }
} }
} }
$content = $navHeader.$content; $content = $navHeader.$content;
if (!$home) if (!$home)
{ {
$this->do_header(); $this->do_header();
@ -984,7 +984,7 @@ class calendar_uiviews extends calendar_ui
unset($holidays); unset($holidays);
$cols[0] =& $this->timeGridWidget($this->tagWholeDayOnTop($dayEvents),$this->cal_prefs['interval'],450,'','',$owner); $cols[0] =& $this->timeGridWidget($this->tagWholeDayOnTop($dayEvents),$this->cal_prefs['interval'],450,'','',$owner);
if (count($users) > 1) if (count($users) > 1)
{ {
$navHeader = '<div class="calendar_calWeek calendar_calWeekNavHeader">' $navHeader = '<div class="calendar_calWeek calendar_calWeekNavHeader">'
@ -992,13 +992,13 @@ class calendar_uiviews extends calendar_ui
'menuaction' => $this->view_menuaction, 'menuaction' => $this->view_menuaction,
'date' => date('Ymd',$this->first-1), 'date' => date('Ymd',$this->first-1),
)). '<span>'.$this->bo->long_date($this->first,0,false,true); )). '<span>'.$this->bo->long_date($this->first,0,false,true);
$navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( $navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array(
'menuaction' => $this->view_menuaction, 'menuaction' => $this->view_menuaction,
'date' => date('Ymd',$this->last+1), 'date' => date('Ymd',$this->last+1),
)).'</div>'; )).'</div>';
} }
// only show todo's for a single user // only show todo's for a single user
if (count($users) == 1 && ($todos = $this->get_todos($todo_label)) !== false) if (count($users) == 1 && ($todos = $this->get_todos($todo_label)) !== false)
{ {
@ -1026,7 +1026,7 @@ class calendar_uiviews extends calendar_ui
$cols[0] = $navHeader . $cols[0]; $cols[0] = $navHeader . $cols[0];
echo $cols[0]; echo $cols[0];
} }
} }
else else
{ {
@ -1903,7 +1903,7 @@ class calendar_uiviews extends calendar_ui
} }
// Helps client-side to bind handler to events with specific types tag // Helps client-side to bind handler to events with specific types tag
$resizableHelper = $this->bo->date2string($event['start']). '|' .$this->bo->format_date($event['start'],false) . '|' . $this->cal_prefs['interval'].'|'.$eventTypeTag; $resizableHelper = $this->bo->date2string($event['start']). '|' .$this->bo->format_date($event['start'],false) . '|' . $this->cal_prefs['interval'].'|'.$eventTypeTag;
$html = $indent.'<div id="'.$draggableID.'" data-tooltip ="'.$tooltip .'" data-resize="'.$resizableHelper.'" class="calendar_calEvent'.($is_private ? 'Private' : '').' '.$status_class. $html = $indent.'<div id="'.$draggableID.'" data-tooltip ="'.$tooltip .'" data-resize="'.$resizableHelper.'" class="calendar_calEvent'.($is_private ? 'Private' : '').' '.$status_class.
'" style="'.$style.' border-color: '.$headerbgcolor.'; background: '.$background.'; z-index: '.$z_index.';"'. '" style="'.$style.' border-color: '.$headerbgcolor.'; background: '.$background.'; z-index: '.$z_index.';"'.
'>'.$prefix_icon."\n".$html."\n". '>'.$prefix_icon."\n".$html."\n".
@ -2296,9 +2296,11 @@ class calendar_uiviews extends calendar_ui
if (!is_array($cat2sort)) if (!is_array($cat2sort))
{ {
$cat2sort = array(); $cat2sort = array();
$cat_filter = $this->cat_id ? (array)$this->cat_id : array();
foreach((array)$this->categories->return_sorted_array(0,false,'','','',true) as $data) foreach((array)$this->categories->return_sorted_array(0,false,'','','',true) as $data)
{ {
if (in_array($data['parent'], (array)$this->cat_id) || in_array($data['id'], (array)$this->cat_id)) // cat is a direct sub of $this->cat_id if (in_array($data['parent'], $cat_filter) || in_array($data['id'], $cat_filter) ||
!$data['parent'] && !$cat_filter) // cat is a direct sub of $this->cat_id
{ {
$cat2sort[$data['id']] = $data['id']; $cat2sort[$data['id']] = $data['id'];
$sort2label[$data['id']] = stripslashes($data['name']); $sort2label[$data['id']] = stripslashes($data['name']);