Add implicit preference to remember user's last sort order.

Sort stored in favorites override this when the favorite is used.
This commit is contained in:
nathan 2023-04-14 10:28:16 -06:00
parent 80b99c67ec
commit dcf34dd74c
2 changed files with 18 additions and 8 deletions

View File

@ -4347,6 +4347,10 @@ export class et2_nextmatch_sortheader extends et2_nextmatch_header implements et
{
// Send default sort mode if not sorted, otherwise send undefined to calculate
this.nextmatch.sortBy(this.id, this.sortmode == "none" ? !(this.options.sortmode.toUpperCase() == "DESC") : undefined);
// Update sort preference
this.egw().set_preference(this.nextmatch._get_appname(), this.nextmatch.options.template + "_sort", this.nextmatch.activeFilters["sort"]);
return true;
}

View File

@ -135,6 +135,12 @@ class Nextmatch extends Etemplate\Widget
list($app) = explode('.', $this->attrs['template']);
}
// Check for sort preference. We only apply this on first load so it can be changed
if($GLOBALS['egw_info']['user']['preferences'][$app][$this->attrs['template'] . "_sort"])
{
$send_value['sort'] = $GLOBALS['egw_info']['user']['preferences'][$app][$this->attrs['template'] . "_sort"];
}
// Check for a favorite in URL
if(!empty($_GET['favorite']) && !empty($value['favorites']))
{