From 5a1fe439c5e2b58549791dc5360af4c9299b3513 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 16 Jan 2014 15:15:50 +0000 Subject: [PATCH] Handle context action view infolog entries in JS, previously opened infolog list into addressbook tab --- addressbook/inc/class.addressbook_ui.inc.php | 12 ++---------- addressbook/js/app.js | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index abe856562c..db5cd545cc 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -516,6 +516,8 @@ class addressbook_ui extends addressbook_bo 'infolog' => array( 'caption' => lang('View linked InfoLog entries'), 'icon' => 'infolog/navbar', + 'onExecute' => 'javaScript:app.addressbook.view_infolog', + 'allowOnMultiple' => false ), 'infolog_add' => array( 'caption' => 'Add a new Infolog', @@ -895,16 +897,6 @@ window.egw_LAB.wait(function() { $Ok = false; break; - case 'infolog': - egw::redirect_link('/index.php',array( - 'menuaction' => 'infolog.infolog_ui.index', - 'action' => 'addressbook', - 'action_id' => implode(',',$checked), - 'action_title' => count($checked) > 1 ? lang('selected contacts') : '', - 'ajax' => 'true' - )); - break; - case 'merge': $success = $this->merge($checked,$error_msg); $failed = count($checked) - (int)$success; diff --git a/addressbook/js/app.js b/addressbook/js/app.js index aa12b784fe..64bb8a3086 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -109,6 +109,25 @@ app.classes.addressbook = AppJS.extend( } }, + /** + * View infolog entries linked to selected contact - just one, infolog fails with multiple + * @param {egwAction} _action Select action + * @param {egwActionObject[]} _senders Selected contact(s) + */ + view_infolog: function(_action, _senders) + { + var extras = { + action: 'addressbook', + action_id: [], + action_title: _senders.length > 1 ? this.egw.lang('selected contacts') : '' + } + // Remove UID prefix for just contact_id + var id = _senders[0].id.split('::'); + extras.action_id = id[1]; + + egw.open('', 'infolog', 'list', extras, 'infolog'); + }, + /** * Add task for selected contacts, call default nm_action after some checks *