forked from extern/egroupware
Change context menu delegation prompt widget to match edit dialog and load current value for single selection
This commit is contained in:
parent
05e5c6181f
commit
25049f9504
@ -1159,6 +1159,7 @@ class infolog_ui
|
||||
'group' => $group,
|
||||
'icon' => 'users',
|
||||
'nm_action' => 'open_popup',
|
||||
'onExecute' => 'javaScript:app.infolog.change_responsible'
|
||||
),
|
||||
'link' => array(
|
||||
'caption' => 'Links',
|
||||
@ -1499,7 +1500,7 @@ class infolog_ui
|
||||
|
||||
case 'responsible':
|
||||
list($add_remove, $user_str) = explode('_', $settings, 2);
|
||||
$action_msg = ($add_remove == 'add' ? lang('added') : lang('removed')) . ' ';
|
||||
$action_msg = ($add_remove == 'ok' ? lang('changed') : ($add_remove == 'add' ? lang('added') : lang('removed'))) . ' ';
|
||||
$names = array();
|
||||
$users = explode(',', $user_str);
|
||||
foreach($users as $account_id)
|
||||
@ -1507,8 +1508,15 @@ class infolog_ui
|
||||
$names[] = Api\Accounts::username($account_id);
|
||||
}
|
||||
$action_msg .= implode(', ', $names);
|
||||
$function = $add_remove == 'add' ? 'array_merge' : 'array_diff';
|
||||
$entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users));
|
||||
if($add_remove == 'ok')
|
||||
{
|
||||
$entry['info_responsible'] = (array)$users;
|
||||
}
|
||||
else
|
||||
{
|
||||
$function = $add_remove == 'add' ? 'array_merge' : 'array_diff';
|
||||
$entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users));
|
||||
}
|
||||
if($this->bo->write($entry, true,true,true,$skip_notifications))
|
||||
{
|
||||
$success++;
|
||||
|
@ -803,6 +803,43 @@ app.classes.infolog = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Action handler for context menu change responsible action
|
||||
*
|
||||
* We populate the dialog with the current value.
|
||||
*
|
||||
* @param {egwAction} _action
|
||||
* @param {egwActionObject[]} _selected
|
||||
*/
|
||||
change_responsible: function(_action, _selected)
|
||||
{
|
||||
var et2 = _selected[0].manager.data.nextmatch.getInstanceManager();
|
||||
var responsible = et2.widgetContainer.getWidgetById('responsible');
|
||||
if(responsible)
|
||||
{
|
||||
responsible.set_value([]);
|
||||
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value('');
|
||||
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class('');
|
||||
et2.widgetContainer.getWidgetById('responsible_action[ok]').set_disabled(_selected.length !== 1);
|
||||
et2.widgetContainer.getWidgetById('responsible_action[add]').set_disabled(_selected.length === 1)
|
||||
et2.widgetContainer.getWidgetById('responsible_action[delete]').set_disabled(_selected.length === 1)
|
||||
}
|
||||
|
||||
if(_selected.length === 1)
|
||||
{
|
||||
var data = egw.dataGetUIDdata(_selected[0].id);
|
||||
|
||||
if(responsible && data && data.data)
|
||||
{
|
||||
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value(data.data.info_subject);
|
||||
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class(data.data.sub_class)
|
||||
responsible.set_value(data.data.info_responsible);
|
||||
}
|
||||
}
|
||||
|
||||
nm_open_popup(_action, _selected);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle encrypted info_desc for print purpose
|
||||
* and triggers print action after decryption
|
||||
|
@ -159,9 +159,13 @@
|
||||
<box id="responsible_popup" class="action_popup prompt">
|
||||
<vbox>
|
||||
<description value="Change responsible" class="promptheader"/>
|
||||
<description value="Select users or groups"/>
|
||||
<listbox type="select-account" id="responsible" rows="5" account_type="both" class="action_popup-content"/>
|
||||
<vbox class="action_popup-content">
|
||||
<description id="responsible_action[title]"/>
|
||||
<description value="Select users or groups"/>
|
||||
<taglist-account id="responsible" rows="5" account_type="both" class=" et2_fullWidth" empty_label="Delegation"/>
|
||||
</vbox>
|
||||
<hbox>
|
||||
<button label="Ok" id="responsible_action[ok]" onclick="nm_submit_popup(this); return false;"/>
|
||||
<button label="Add" id="responsible_action[add]" onclick="nm_submit_popup(this); return false;"/>
|
||||
<button label="Delete" id="responsible_action[delete]" onclick="nm_submit_popup(this); return false;"/>
|
||||
<buttononly label="Cancel" onclick="nm_hide_popup(this,'responsible_popup');"/>
|
||||
|
Loading…
Reference in New Issue
Block a user