forked from extern/egroupware
Etemplate: Fix selectAccount deprecated legacy option of putting account type in empty label
This commit is contained in:
parent
6c170beef2
commit
c88bf4851b
@ -55,10 +55,10 @@ var et2_selectAccount = /** @class */ (function (_super) {
|
|||||||
function et2_selectAccount(_parent, _attrs, _child) {
|
function et2_selectAccount(_parent, _attrs, _child) {
|
||||||
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_selectAccount._attributes, _child || {})) || this;
|
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_selectAccount._attributes, _child || {})) || this;
|
||||||
// Type in rows or somewhere else?
|
// Type in rows or somewhere else?
|
||||||
if (jQuery.inArray(_attrs['empty_label'], et2_selectAccount.account_types) > 0 && (jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0 ||
|
if (et2_selectAccount.account_types.indexOf(_this.options.empty_label) >= 0 && (et2_selectAccount.account_types.indexOf(_this.options.account_type) < 0 ||
|
||||||
_attrs['account_type'] == et2_selectAccount._attributes.account_type['default'])) {
|
_this.options.account_type == et2_selectAccount._attributes.account_type.default)) {
|
||||||
_attrs['account_type'] = _attrs['empty_label'];
|
_this.options.account_type = _attrs['empty_label'];
|
||||||
_attrs['empty_label'] = '';
|
_this.options.empty_label = '';
|
||||||
}
|
}
|
||||||
if (jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0) {
|
if (jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0) {
|
||||||
_this.egw().debug("warn", "Invalid account_type: %s Valid options:", _attrs['account_type'], et2_selectAccount.account_types);
|
_this.egw().debug("warn", "Invalid account_type: %s Valid options:", _attrs['account_type'], et2_selectAccount.account_types);
|
||||||
@ -69,8 +69,8 @@ var et2_selectAccount = /** @class */ (function (_super) {
|
|||||||
_this.dialog = null;
|
_this.dialog = null;
|
||||||
// Reference to widget within dialog
|
// Reference to widget within dialog
|
||||||
_this.widgets = null;
|
_this.widgets = null;
|
||||||
if (!_attrs.empty_label && !_attrs.readonly && _attrs.multiple) {
|
if (!_this.options.empty_label && !_this.options.readonly && _this.options.multiple) {
|
||||||
_attrs.empty_label = _this.egw().lang('Select user or group');
|
_this.options.empty_label = _this.egw().lang('Select user or group');
|
||||||
}
|
}
|
||||||
// Allow certain widgets inside this one
|
// Allow certain widgets inside this one
|
||||||
_this.supportedWidgetClasses = [et2_widget_link_1.et2_link_entry];
|
_this.supportedWidgetClasses = [et2_widget_link_1.et2_link_entry];
|
||||||
|
@ -62,13 +62,13 @@ export class et2_selectAccount extends et2_selectbox
|
|||||||
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_selectAccount._attributes, _child || {}));
|
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_selectAccount._attributes, _child || {}));
|
||||||
|
|
||||||
// Type in rows or somewhere else?
|
// Type in rows or somewhere else?
|
||||||
if(jQuery.inArray(_attrs['empty_label'], et2_selectAccount.account_types) > 0 && (
|
if(et2_selectAccount.account_types.indexOf(this.options.empty_label) >= 0 && (
|
||||||
jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0 ||
|
et2_selectAccount.account_types.indexOf(this.options.account_type) < 0 ||
|
||||||
_attrs['account_type'] == et2_selectAccount._attributes.account_type['default'])
|
this.options.account_type == et2_selectAccount._attributes.account_type.default)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_attrs['account_type'] = _attrs['empty_label'];
|
this.options.account_type = _attrs['empty_label'];
|
||||||
_attrs['empty_label'] = '';
|
this.options.empty_label = '';
|
||||||
}
|
}
|
||||||
if(jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0)
|
if(jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0)
|
||||||
{
|
{
|
||||||
@ -84,9 +84,9 @@ export class et2_selectAccount extends et2_selectbox
|
|||||||
// Reference to widget within dialog
|
// Reference to widget within dialog
|
||||||
this.widgets = null;
|
this.widgets = null;
|
||||||
|
|
||||||
if(!_attrs.empty_label && !_attrs.readonly && _attrs.multiple)
|
if(!this.options.empty_label && !this.options.readonly && this.options.multiple)
|
||||||
{
|
{
|
||||||
_attrs.empty_label = this.egw().lang('Select user or group');
|
this.options.empty_label = this.egw().lang('Select user or group');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow certain widgets inside this one
|
// Allow certain widgets inside this one
|
||||||
|
Loading…
Reference in New Issue
Block a user