mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 13:22:06 +02:00
allow to pass a JSON filter object to application-type custom-fields:
adressbook: '{"owner":5,"cat_id":[1,3]}' will only return contacts from personal AB of user #5 with either cat_id 1 or 2
This commit is contained in:
parent
ae32afa232
commit
86c76a434a
@ -377,6 +377,13 @@ class admin_customfields
|
|||||||
{
|
{
|
||||||
$values['@'] = substr($content['cf_values'], $content['cf_values'][1] === '=' ? 2:1);
|
$values['@'] = substr($content['cf_values'], $content['cf_values'][1] === '=' ? 2:1);
|
||||||
}
|
}
|
||||||
|
elseif (isset($GLOBALS['egw_info']['apps'][$content['cf_type']]))
|
||||||
|
{
|
||||||
|
if (!empty($content['cf_values']) && ($content['cf_values'][0] !== '{' || ($values=json_decode($content['cf_values'])) === null))
|
||||||
|
{
|
||||||
|
Api\Etemplate::set_validation_error('cf_values', lang('Invalid JSON object!'));
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach(explode("\n",trim($content['cf_values'])) as $idx => $line)
|
foreach(explode("\n",trim($content['cf_values'])) as $idx => $line)
|
||||||
@ -459,8 +466,11 @@ class admin_customfields
|
|||||||
{
|
{
|
||||||
$readonlys['cf_name'] = true;
|
$readonlys['cf_name'] = true;
|
||||||
}
|
}
|
||||||
|
if (!isset($GLOBALS['egw_info']['apps'][$content['cf_type']]))
|
||||||
|
{
|
||||||
$content['cf_values'] = json_decode($content['cf_values'], true);
|
$content['cf_values'] = json_decode($content['cf_values'], true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$readonlys['button[delete]'] = true;
|
$readonlys['button[delete]'] = true;
|
||||||
|
@ -73,7 +73,13 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(SlotMixin(LitE
|
|||||||
/**
|
/**
|
||||||
* Displayed in the search / select when no value is selected
|
* Displayed in the search / select when no value is selected
|
||||||
*/
|
*/
|
||||||
placeholder: {type: String}
|
placeholder: {type: String},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional search parameters that are passed to the server
|
||||||
|
* when we query searchUrl
|
||||||
|
*/
|
||||||
|
searchOptions: {type: Object}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,6 +225,19 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(SlotMixin(LitE
|
|||||||
return this._appNode?.value || "";
|
return this._appNode?.value || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set searchOptions(options)
|
||||||
|
{
|
||||||
|
this.updateComplete.then(() =>
|
||||||
|
{
|
||||||
|
this._searchNode.searchOptions = options;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get searchOptions()
|
||||||
|
{
|
||||||
|
return this._searchNode.searchOptions;
|
||||||
|
}
|
||||||
|
|
||||||
get _appNode() : Et2LinkAppSelect
|
get _appNode() : Et2LinkAppSelect
|
||||||
{
|
{
|
||||||
return this.querySelector("[slot='app']");
|
return this.querySelector("[slot='app']");
|
||||||
|
@ -284,7 +284,8 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
|||||||
|
|
||||||
const type = attrs.type ? attrs.type : field.type;
|
const type = attrs.type ? attrs.type : field.type;
|
||||||
// Set any additional attributes set in options, but not for widgets that pass actual options
|
// Set any additional attributes set in options, but not for widgets that pass actual options
|
||||||
if(['select','radio','radiogroup','checkbox','button'].indexOf(field.type) == -1 && !jQuery.isEmptyObject(field.values))
|
if(['select','radio','radiogroup','checkbox','button'].indexOf(field.type) == -1 &&
|
||||||
|
setup_function !== '_setup_link_entry' && !jQuery.isEmptyObject(field.values))
|
||||||
{
|
{
|
||||||
const w = et2_registry[type];
|
const w = et2_registry[type];
|
||||||
const wc = window.customElements.get('et2-' + type);
|
const wc = window.customElements.get('et2-' + type);
|
||||||
@ -769,6 +770,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
|||||||
|
|
||||||
attrs.type = "link-entry";
|
attrs.type = "link-entry";
|
||||||
attrs[attrs.readonly ? "app" : "only_app"] = typeof field.only_app == "undefined" ? field.type : field.only_app;
|
attrs[attrs.readonly ? "app" : "only_app"] = typeof field.only_app == "undefined" ? field.type : field.only_app;
|
||||||
|
attrs.searchOptions = {filter: field.values || {}};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user