From 286c730d0857844786c71b5e98973d9b08ccb862 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 24 Aug 2016 14:27:45 -0600 Subject: [PATCH] Allow children for paste actions automatically pulled from drop actions --- api/js/egw_action/egw_action_popup.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/js/egw_action/egw_action_popup.js b/api/js/egw_action/egw_action_popup.js index 1c9e7cd0bb..e7652a9ab8 100644 --- a/api/js/egw_action/egw_action_popup.js +++ b/api/js/egw_action/egw_action_popup.js @@ -848,7 +848,7 @@ function egwPopupActionImplementation() } // 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') { @@ -876,11 +876,13 @@ function egwPopupActionImplementation() // Add some choices - need to be a copy, or they interfere with // the original 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.children = []; drop_clone.set_onExecute(paste_exec); - paste_action.children.push(drop_clone); - paste_action.allowOnMultiple = paste_action.allowOnMultiple && drop_clone.allowOnMultiple; + parent.children.push(drop_clone); + parent.allowOnMultiple = paste_action.allowOnMultiple && drop_clone.allowOnMultiple; _links[k] = jQuery.extend({},drop[k]); _links[k].actionObj = drop_clone;