- Fix add popup with extras to handle multiple infolog nextmatches

- Fix setting primary link
This commit is contained in:
Nathan Gray 2013-11-28 17:34:28 +00:00
parent f5b02ccc21
commit 1bace180cf
3 changed files with 17 additions and 21 deletions

View File

@ -1610,10 +1610,9 @@ class infolog_ui
if ($content['info_contact'])
{
$old_link_id = (int)$content['info_link_id'];
list($app,$id) = is_array($content['info_contact']) ? $content['info_contact'] : explode(':',$content['info_contact'], 2);
// eTemplate2 returns the array all ready
if(!$app && is_array($content['info_contact']))
if(is_array($content['info_contact']))
{
// eTemplate2 returns the array all ready
$app = $content['info_contact']['app'];
$id = $content['info_contact']['id'];
}

View File

@ -315,30 +315,27 @@ app.classes.infolog = AppJS.extend(
* standard locations. Done with a function instead of hardcoding so
* the values can be updated if user changes them in UI.
*
* @param {et2_widget} widget Originating/calling widget
* @param _type string Type of infolog entry
* @param _action string Special action for new infolog entry
* @param _action_id string ID for special action
*/
add_with_extras: function(_type, _action, _action_id)
add_with_extras: function(widget,_type, _action, _action_id)
{
var nm = this.et2.getWidgetById('nm');
// We use widget.getRoot() instead of this.et2 for the case when the
// addressbook tab is viewing a contact + infolog list, there's 2 infolog
// etemplates
var nm = widget.getRoot().getWidgetById('nm');
var nm_value = nm.getValue() || {};
// It's important that all these keys are here, they override the link
// registry.
var extras = {
type: _type || nm_value.filter || null,
cat_id: nm_value.cat_id || null,
action: _action || null,
action_id: _action_id != '0' ? _action_id : null || null
type: _type || nm_value.filter || "",
cat_id: nm_value.cat_id || "",
action: _action || "",
action_id: _action_id != '0' ? _action_id : "" || ""
};
// Remove any missing values
for(var key in extras)
{
if(extras[key] == null)
{
delete extras[key];
}
}
egw.open('','infolog','add',extras);
}
});

View File

@ -8,9 +8,9 @@
<template id="infolog.index.header_right" template="" lang="" group="0" version="1.9.001">
<hbox>
<description value="Add:" class="infolog_headertext"/>
<button statustext="Add a new ToDo" label="ToDo" id="add[task]" onclick="app.infolog.add_with_extras('task','$cont[action]','$cont[action_id]');" image="task"/>
<button statustext="Add a new Phonecall" label="Phonecall" id="add[phone]" onclick="app.infolog.add_with_extras('phone','$cont[action]','$cont[action_id]');" image="phone"/>
<button statustext="Add a new Note" label="Note" id="add[note]" onclick="app.infolog.add_with_extras('note','$cont[action]','$cont[action_id]');" image="note"/>
<button statustext="Add a new ToDo" label="ToDo" id="add[task]" onclick="app.infolog.add_with_extras(widget,'task','$cont[action]','$cont[action_id]');" image="task"/>
<button statustext="Add a new Phonecall" label="Phonecall" id="add[phone]" onclick="app.infolog.add_with_extras(widget,'phone','$cont[action]','$cont[action_id]');" image="phone"/>
<button statustext="Add a new Note" label="Note" id="add[note]" onclick="app.infolog.add_with_extras(widget,'note','$cont[action]','$cont[action_id]');" image="note"/>
</hbox>
</template>
<template id="infolog.index.rows" template="" lang="" group="0" version="1.9.005">