From f76e832c36dfd50b2f0e570dd1dc0fa5ad9d81aa Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 2 Dec 2014 22:15:44 +0000 Subject: [PATCH] Fix a bug in automatic drag and drop -> link support detection that gave DnD to apps that couldn't handle it. --- .../js/et2_extension_nextmatch_controller.js | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_extension_nextmatch_controller.js b/etemplate/js/et2_extension_nextmatch_controller.js index 2058344f72..adaa589019 100644 --- a/etemplate/js/et2_extension_nextmatch_controller.js +++ b/etemplate/js/et2_extension_nextmatch_controller.js @@ -266,8 +266,22 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider, if(!egw.link_get_registry(this.dataStorePrefix || this.egw.appName, 'query') || egw.link_get_registry(this.dataStorePrefix || this.egw.appName, 'title')) { - if(drop_action) drop_action.remove(); - if(drag_action) drag_action.remove(); + if(drop_action) + { + drop_action.remove(); + if(this._actionLinks.indexOf(drop_action.id) >= 0) + { + this._actionLinks.splice(this._actionLinks.indexOf(drop_action.id),1); + } + } + if(drag_action) + { + drag_action.remove(); + if(this._actionLinks.indexOf(drag_action.id) >= 0) + { + this._actionLinks.splice(this._actionLinks.indexOf(drag_action.id),1); + } + } return; } @@ -348,6 +362,17 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider, drag_action.set_dragType('link'); }, + /** + * Set the data cache prefix + * Overridden from the parent to re-check automatically the added link dnd + * since the prefix is used in support detection. + */ + setPrefix: function(prefix) { + this._super.apply(this, arguments) + + this._init_links_dnd(this._actionManager); + }, + /** * Overwrites the inherited _destroyCallback function in order to be able * to free the "rowWidget".