Allow children for paste actions automatically pulled from drop actions

This commit is contained in:
nathangray 2016-08-24 14:27:45 -06:00
parent 1088278b37
commit 286c730d08

View File

@ -848,7 +848,7 @@ function egwPopupActionImplementation()
} }
// Add into links so it's included in menu // Add into links so it's included in menu
if(paste_action && paste_action.enabled.exec()) if(paste_action && paste_action.enabled.exec(paste_action, clipboard.selected, _selected[0]))
{ {
if(typeof _links[paste_action.id] == 'undefined') if(typeof _links[paste_action.id] == 'undefined')
{ {
@ -876,11 +876,13 @@ function egwPopupActionImplementation()
// Add some choices - need to be a copy, or they interfere with // Add some choices - need to be a copy, or they interfere with
// the original // the original
var drop_clone = jQuery.extend({},drop[k].actionObj); var drop_clone = jQuery.extend({},drop[k].actionObj);
drop_clone.parent = paste_action; var parent = paste_action.parent === drop_clone.parent ? paste_action : (paste_action.getActionById(drop_clone.parent.id) || paste_action);
drop_clone.parent = parent;
drop_clone.onExecute = new egwFnct(this, null, []); drop_clone.onExecute = new egwFnct(this, null, []);
drop_clone.children = [];
drop_clone.set_onExecute(paste_exec); drop_clone.set_onExecute(paste_exec);
paste_action.children.push(drop_clone); parent.children.push(drop_clone);
paste_action.allowOnMultiple = paste_action.allowOnMultiple && drop_clone.allowOnMultiple; parent.allowOnMultiple = paste_action.allowOnMultiple && drop_clone.allowOnMultiple;
_links[k] = jQuery.extend({},drop[k]); _links[k] = jQuery.extend({},drop[k]);
_links[k].actionObj = drop_clone; _links[k].actionObj = drop_clone;