mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:18:57 +01:00
Calendar: Add users & groups (according to preference) to owner options
This commit is contained in:
parent
ef58242afe
commit
7bad1b0290
@ -11,13 +11,15 @@
|
||||
import {Et2Select} from "../../api/js/etemplate/Et2Select/Et2Select";
|
||||
import {css, html, nothing} from "@lion/core";
|
||||
import {IsEmail} from "../../api/js/etemplate/Validators/IsEmail";
|
||||
import {cleanSelectOptions} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
|
||||
import {Et2StaticSelectMixin} from "../../api/js/etemplate/Et2Select/StaticOptions";
|
||||
|
||||
/**
|
||||
* Select widget customised for calendar owner, which can be a user
|
||||
* account or group, or an entry from almost any app, or an email address
|
||||
*
|
||||
*/
|
||||
export class CalendarOwner extends Et2Select
|
||||
export class CalendarOwner extends Et2StaticSelectMixin(Et2Select)
|
||||
{
|
||||
|
||||
static get styles()
|
||||
@ -43,6 +45,31 @@ export class CalendarOwner extends Et2Select
|
||||
this.searchOptions['checkgrants'] = true;
|
||||
}
|
||||
|
||||
connectedCallback()
|
||||
{
|
||||
super.connectedCallback();
|
||||
|
||||
// Start fetch of users
|
||||
const type = this.egw().preference('account_selection', 'common');
|
||||
if(!type || type == "none" || type == "selectbox")
|
||||
{
|
||||
return;
|
||||
}
|
||||
let fetch = [];
|
||||
// for primary_group we only display owngroups == own memberships, not other groups
|
||||
if(type === 'primary_group')
|
||||
{
|
||||
fetch.push(this.egw().accounts('accounts').then(options => {this.static_options = this.static_options.concat(cleanSelectOptions(options))}));
|
||||
fetch.push(this.egw().accounts('owngroups').then(options => {this.static_options = this.static_options.concat(cleanSelectOptions(options))}));
|
||||
}
|
||||
else
|
||||
{
|
||||
fetch.push(this.egw().accounts('accounts').then(options => {this.static_options = this.static_options.concat(cleanSelectOptions(options))}));
|
||||
}
|
||||
this.fetchComplete = Promise.all(fetch)
|
||||
.then(() => this._renderOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override parent to handle our special additional data types (c#,r#,etc.) when they
|
||||
* are not available client side.
|
||||
|
Loading…
Reference in New Issue
Block a user