Pre-set contact in new infologs opened from context menu.

Contact taken from link filter, or current contact when in CRM view.
This commit is contained in:
Nathan Gray 2015-05-11 21:05:38 +00:00
parent 439e32e750
commit 5b002b4b0b
2 changed files with 33 additions and 2 deletions

View File

@ -1045,8 +1045,7 @@ class infolog_ui
'icon' => $type,
);
$types_add[$type] = $data + array(
'url' => 'menuaction=infolog.infolog_ui.edit&type='.$type,
'popup' => egw_link::get_registry('infolog', 'add_popup'),
'onExecute' => "javaScript:app.infolog.add_action_handler"
);
}

View File

@ -481,6 +481,27 @@ app.classes.infolog = AppJS.extend(
egw.open('','infolog','add');
},
/**
* Wrapper so add -> New actions in the context menu can pass current
* filter values into new edit dialog
*
* @see add_with_extras
*
* @param {egwAction} action
* @param {egwActionObject[]} selected
*/
add_action_handler: function(action, selected)
{
var nm = action.getManager().data.nextmatch || false;
if(nm)
{
this.add_with_extras(nm,action.id,
nm.getArrayMgr('content').getEntry('action'),
nm.getArrayMgr('content').getEntry('action_id')
);
}
},
/**
* Opens a new edit dialog with some extra url parameters pulled from
* standard locations. Done with a function instead of hardcoding so
@ -507,6 +528,17 @@ app.classes.infolog = AppJS.extend(
// Need a real array here
action_id = jQuery.map(action_id,function(val) {return val;});
}
// No action? Try the linked filter, in case it's set
if(!_action && !_action_id)
{
if(nm_value.col_filter && nm_value.col_filter.linked)
{
var split = nm_value.col_filter.linked.split(':') || '';
_action = split[0] || '';
action_id = split[1] || '';
}
}
var extras = {
type: _type || nm_value.filter || "",
cat_id: nm_value.cat_id || "",