* InfoLog: fixed selection over multiple hierarchy levels (eg. deleting a child from an opened InfoLog also deleted previously selected top-level entry!)

This commit is contained in:
Ralf Becker 2014-09-02 10:34:05 +00:00
parent 4355db9d85
commit 146febd692
2 changed files with 34 additions and 29 deletions

View File

@ -181,6 +181,10 @@ var et2_dataview_selectionManager = Class.extend(
{
this.setSelected(key, false);
}
for(var i = 0; i < this._children.length; i++)
{
this._children[i].resetSelection();
}
},
setSelected: function (_uid, _selected) {
@ -453,7 +457,12 @@ var et2_dataview_selectionManager = Class.extend(
// If not "_ctrl" is set, reset the selection
if (!_ctrl)
{
this.resetSelection();
var top = this;
while(top._parent !== null)
{
top = top._parent;
}
top.resetSelection();
this._actionObjectManager.setAllSelected(false); // needed for hirachical stuff
}

View File

@ -45,24 +45,18 @@ function nm_action(_action, _senders, _target, _ids)
_action.data.nextmatch = nm;
}
}
// default action when doubleclicked contains (previous selected) ids of other hierarchy levels
// same is true (and fixable here) for right-click in sub for actions allowing no multiple entries
if (_action.default || !_action.allowOnMultiple)
{
_ids.ids = [_senders[0].id];
}
// Translate the internal uids back to server uids
var idsArr = _ids.ids;
for (var i = 0; i < idsArr.length; i++)
{
idsArr[i] = idsArr[i].split("::").pop();
// empty placeholder gets reported --> ignore it
if (!idsArr[i])
{
delete idsArr[i];
i--;
idsArr.splice(i,1);
continue;
}
idsArr[i] = idsArr[i].split("::").pop();
}
// Calculate the ids parameters
@ -337,34 +331,30 @@ var nm_popup_action, nm_popup_ids = null;
*
* Popup needs to have eTemplate name of action id plus "_popup"
*
* @param _action
* @param _ids
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
function nm_open_popup(_action, _ids)
function nm_open_popup(_action, _selected)
{
//Check if there is nextmatch on _action otherwise gets the uniqueid from _ids
var uid;
if (typeof _action.data.nextmatch !== 'undefined')
uid = _action.data.nextmatch.getInstanceManager().uniqueId;
else if(typeof _ids[0] !== 'undefined')
uid = _ids[0].manager.data.nextmatch.getInstanceManager().uniqueId;
else if(typeof _selected[0] !== 'undefined')
uid = _selected[0].manager.data.nextmatch.getInstanceManager().uniqueId;
// Find the popup div
var popup = jQuery("#"+(uid||"") + "_"+_action.id+"_popup").first() || jQuery("[id*='" + _action.id + "_popup']").first();
if (popup) {
nm_popup_action = _action;
if(_ids.length && typeof _ids[0] == 'object')
if(_selected.length && typeof _selected[0] == 'object')
{
egw().debug("warn", 'Not proper format for IDs, should be array',_ids);
_action.data.nextmatch = _ids[0]._context._widget;
nm_popup_ids = [];
for(var i = 0; i < _ids.length; i++)
{
nm_popup_ids.push(_ids[i].id);
}
_action.data.nextmatch = _selected[0]._context._widget;
nm_popup_ids = _selected
}
else
{
nm_popup_ids = _ids;
egw().debug("warn", 'Not proper format for IDs, should be array of egwActionObject',_ids);
nm_popup_ids = _selected;
}
var dialog = jQuery('.action_popup-content',popup);
@ -451,16 +441,22 @@ function nm_submit_popup(button)
}
// Mangle senders to get IDs where nm_action() wants them
// No idea why this is needed
var ids = {ids:[]};
for(var i in nm_popup_ids)
if(nm_popup_ids.length && typeof nm_popup_ids[0] != 'object')
{
ids.ids.push(nm_popup_ids[i]);
// Legacy ID just as string
var ids = {ids:[]};
for(var i in nm_popup_ids)
{
if(nm_popup_ids[i])
ids.ids.push(nm_popup_ids[i]);
}
}
// call regular nm_action to transmit action and senders correct
nm_action(nm_popup_action,nm_popup_ids, button, ids);
nm_action(nm_popup_action,nm_popup_ids, button, ids );
nm_hide_popup(button, null);
nm_popup_ids = null;
}
/**