diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index b3baff43d1..8c1de315ca 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -892,6 +892,21 @@ class calendar_so " ON $this->cal_table.cal_id=$this->dates_table.cal_id ".$join; } + // Check for some special sorting, used by planner views + if($params['order'] == 'participants , cal_non_blocking DESC') + { + $order = ($GLOBALS['egw_info']['user']['preferences']['common']['account_display'] == 'lastname' ? 'n_family' : 'n_fileas'); + $cols .= ",egw_addressbook.{$order}"; + $join .= "LEFT JOIN egw_addressbook ON egw_addressbook.account_id = {$this->user_table}.cal_user_id"; + $params['order'] = "$order, cal_non_blocking DESC"; + } + else if ($params['order'] == 'categories , cal_non_blocking DESC') + { + $params['order'] = 'cat_name, cal_non_blocking DESC'; + $cols .= ',egw_categories.cat_name'; + $join .= "LEFT JOIN egw_categories ON egw_categories.cat_id = {$this->cal_table}.cal_category"; + } + //$starttime = microtime(true); if ($useUnionQuery) { diff --git a/calendar/js/app.js b/calendar/js/app.js index dec79f0c26..cd60327944 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -2862,6 +2862,15 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( framework.applications.calendar.sidemenuEntry.showAjaxLoader(); } + if(state.view === 'planner' && state.sortby === 'user') + { + query.order = 'participants'; + } + else if (state.view === 'planner' && state.sortby === 'category') + { + query.order = 'categories'; + } + // Already in progress? var query_string = JSON.stringify(query); if(this._queries_in_progress.indexOf(query_string) != -1)