mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
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,
|
'group' => $group,
|
||||||
'icon' => 'users',
|
'icon' => 'users',
|
||||||
'nm_action' => 'open_popup',
|
'nm_action' => 'open_popup',
|
||||||
|
'onExecute' => 'javaScript:app.infolog.change_responsible'
|
||||||
),
|
),
|
||||||
'link' => array(
|
'link' => array(
|
||||||
'caption' => 'Links',
|
'caption' => 'Links',
|
||||||
@ -1499,7 +1500,7 @@ class infolog_ui
|
|||||||
|
|
||||||
case 'responsible':
|
case 'responsible':
|
||||||
list($add_remove, $user_str) = explode('_', $settings, 2);
|
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();
|
$names = array();
|
||||||
$users = explode(',', $user_str);
|
$users = explode(',', $user_str);
|
||||||
foreach($users as $account_id)
|
foreach($users as $account_id)
|
||||||
@ -1507,8 +1508,15 @@ class infolog_ui
|
|||||||
$names[] = Api\Accounts::username($account_id);
|
$names[] = Api\Accounts::username($account_id);
|
||||||
}
|
}
|
||||||
$action_msg .= implode(', ', $names);
|
$action_msg .= implode(', ', $names);
|
||||||
$function = $add_remove == 'add' ? 'array_merge' : 'array_diff';
|
if($add_remove == 'ok')
|
||||||
$entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users));
|
{
|
||||||
|
$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))
|
if($this->bo->write($entry, true,true,true,$skip_notifications))
|
||||||
{
|
{
|
||||||
$success++;
|
$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
|
* Handle encrypted info_desc for print purpose
|
||||||
* and triggers print action after decryption
|
* and triggers print action after decryption
|
||||||
|
@ -159,9 +159,13 @@
|
|||||||
<box id="responsible_popup" class="action_popup prompt">
|
<box id="responsible_popup" class="action_popup prompt">
|
||||||
<vbox>
|
<vbox>
|
||||||
<description value="Change responsible" class="promptheader"/>
|
<description value="Change responsible" class="promptheader"/>
|
||||||
<description value="Select users or groups"/>
|
<vbox class="action_popup-content">
|
||||||
<listbox type="select-account" id="responsible" rows="5" account_type="both" 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>
|
<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="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;"/>
|
<button label="Delete" id="responsible_action[delete]" onclick="nm_submit_popup(this); return false;"/>
|
||||||
<buttononly label="Cancel" onclick="nm_hide_popup(this,'responsible_popup');"/>
|
<buttononly label="Cancel" onclick="nm_hide_popup(this,'responsible_popup');"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user