From 1bace180cfbd0d0f5676a3d8d77215789d451819 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 28 Nov 2013 17:34:28 +0000 Subject: [PATCH] - Fix add popup with extras to handle multiple infolog nextmatches - Fix setting primary link --- infolog/inc/class.infolog_ui.inc.php | 5 ++--- infolog/js/app.js | 27 ++++++++++++--------------- infolog/templates/default/index.xet | 6 +++--- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index f4a5a48fe8..041e3323fd 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -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']; } diff --git a/infolog/js/app.js b/infolog/js/app.js index f17f9d1cf2..634c07c6f5 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -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); } }); diff --git a/infolog/templates/default/index.xet b/infolog/templates/default/index.xet index e6006340da..bcf57048f2 100644 --- a/infolog/templates/default/index.xet +++ b/infolog/templates/default/index.xet @@ -8,9 +8,9 @@