mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-23 19:31:53 +02:00
Fix some placeholder dialog bugs:
- Fix user placeholder does not use selected entry, so looks like a bug. Now hiding entry for user placeholders. - Fix user & general showed up in entry app selectbox - Fix insert address dialog was not passing selected entry
This commit is contained in:
parent
dec1276380
commit
96bdcd7c0e
@ -154,6 +154,13 @@ export class et2_placeholder_select extends et2_inputWidget
|
|||||||
data.content.group = data.sel_options.group[0].value;
|
data.content.group = data.sel_options.group[0].value;
|
||||||
data.content.entry = {app: data.content.app};
|
data.content.entry = {app: data.content.app};
|
||||||
data.modifications.outer_box.entry.application_list = Object.keys(_data);
|
data.modifications.outer_box.entry.application_list = Object.keys(_data);
|
||||||
|
// Remove non-app placeholders (user & general)
|
||||||
|
let non_apps = ['user', 'general'];
|
||||||
|
for(let i = 0; i < non_apps.length; i++)
|
||||||
|
{
|
||||||
|
let index = data.modifications.outer_box.entry.application_list.indexOf(non_apps[i]);
|
||||||
|
data.modifications.outer_box.entry.application_list.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// callback for dialog
|
// callback for dialog
|
||||||
this.submit_callback = function(submit_button_id, submit_value)
|
this.submit_callback = function(submit_button_id, submit_value)
|
||||||
@ -213,23 +220,28 @@ export class et2_placeholder_select extends et2_inputWidget
|
|||||||
// Bind some handlers
|
// Bind some handlers
|
||||||
app.onchange = (node, widget) =>
|
app.onchange = (node, widget) =>
|
||||||
{
|
{
|
||||||
let groups = this._get_group_options(widget.get_value());
|
preview.set_value("");
|
||||||
group.set_select_options(groups);
|
|
||||||
group.set_value(groups[0].value);
|
|
||||||
if(['user'].indexOf(widget.get_value()) >= 0)
|
if(['user'].indexOf(widget.get_value()) >= 0)
|
||||||
{
|
{
|
||||||
entry.app_select.val('api-accounts');
|
entry.set_disabled(true);
|
||||||
entry.set_value({app: 'api-accounts', id: '', query: ''});
|
entry.app_select.val('user');
|
||||||
|
entry.set_value({app: 'user', id: '', query: ''});
|
||||||
}
|
}
|
||||||
else if(widget.get_value() == 'general')
|
else if(widget.get_value() == 'general')
|
||||||
{
|
{
|
||||||
// Don't change entry app, leave it
|
// Don't change entry app, leave it
|
||||||
|
entry.set_disabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
entry.set_disabled(false);
|
||||||
entry.app_select.val(widget.get_value());
|
entry.app_select.val(widget.get_value());
|
||||||
entry.set_value({app: widget.get_value(), id: '', query: ''});
|
entry.set_value({app: widget.get_value(), id: '', query: ''});
|
||||||
}
|
}
|
||||||
|
let groups = this._get_group_options(widget.get_value());
|
||||||
|
group.set_select_options(groups);
|
||||||
|
group.set_value(groups[0].value);
|
||||||
|
group.onchange();
|
||||||
}
|
}
|
||||||
group.onchange = (select_node, select_widget) =>
|
group.onchange = (select_node, select_widget) =>
|
||||||
{
|
{
|
||||||
@ -433,7 +445,7 @@ export class et2_placeholder_snippet_select extends et2_placeholder_select
|
|||||||
// Show the selected placeholder replaced with value from the selected entry
|
// Show the selected placeholder replaced with value from the selected entry
|
||||||
this.egw().json(
|
this.egw().json(
|
||||||
'EGroupware\\Api\\Etemplate\\Widget\\Placeholder::ajax_fill_placeholders',
|
'EGroupware\\Api\\Etemplate\\Widget\\Placeholder::ajax_fill_placeholders',
|
||||||
[placeholder_list.get_value(), entry.get_value()],
|
[placeholder_list.get_value(), {app: "addressbook", id: entry.get_value()}],
|
||||||
function(_content)
|
function(_content)
|
||||||
{
|
{
|
||||||
if(!_content)
|
if(!_content)
|
||||||
|
@ -110,7 +110,9 @@ class Placeholder extends Etemplate\Widget
|
|||||||
|
|
||||||
switch($entry['app'])
|
switch($entry['app'])
|
||||||
{
|
{
|
||||||
case 'addressbook':
|
case 'user':
|
||||||
|
$entry = ['id' => $GLOBALS['egw_info']['user']['person_id']];
|
||||||
|
// fall through
|
||||||
default:
|
default:
|
||||||
$merged = $merge->merge_string($content, [$entry['id']], $err, 'text/plain');
|
$merged = $merge->merge_string($content, [$entry['id']], $err, 'text/plain');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user