Add sorting to match planner view grouping, so pagination gets the top rows first

This commit is contained in:
nathangray 2017-02-24 10:32:40 -07:00
parent 008e16d58d
commit 40dbffe803
2 changed files with 24 additions and 0 deletions

View File

@ -888,6 +888,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)
{

View File

@ -2860,6 +2860,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)