From e62c980a8f65dd18d6f0f06506a97792c752714c Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 25 Mar 2014 16:53:36 +0000 Subject: [PATCH] Add context menu sub-actions for CRM-View Infolog & Tracker --- addressbook/inc/class.addressbook_ui.inc.php | 32 +++++++++++++++++--- addressbook/js/app.js | 11 ++++++- addressbook/lang/egw_de.lang | 1 + addressbook/lang/egw_en.lang | 1 + 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 51ca74ebca..87d30a8764 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -351,11 +351,13 @@ class addressbook_ui extends addressbook_bo { $actions = array( 'view' => array( - 'caption' => 'View', + 'caption' => 'CRM-View', 'default' => true, 'allowOnMultiple' => false, 'group' => $group=1, 'onExecute' => 'javaScript:app.addressbook.view', + // Children added below + 'children' => array() ), 'open' => array( 'caption' => 'Open', @@ -384,6 +386,23 @@ class addressbook_ui extends addressbook_bo ), ), ); + // CRM view options + $crm_count = 0; + $crm_apps = array('infolog','tracker'); + foreach($crm_apps as $app) + { + if ($GLOBALS['egw_info']['user']['apps'][$app]) $crm_count++; + } + if($crm_count > 1) + { + foreach($crm_apps as $app) + { + $actions['view']['children']["view-$app"] = array( + 'caption' => $app, + 'icon' => "$app/navbar" + ); + } + } } else // org view { @@ -2261,6 +2280,10 @@ window.egw_LAB.wait(function() { */ function view(array $content=null) { + // CRM list comes from content, request, or preference + $crm_list = $content['crm_list'] ? $content['crm_list'] : + ($_GET['crm_list'] ? $_GET['crm_list'] : $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']); + if(is_array($content)) { list($button) = each($content['button']); @@ -2304,7 +2327,7 @@ window.egw_LAB.wait(function() { // List nextmatch is already there, just update the filter if($contact_id && egw_json_request::isJSONRequest()) { - switch($GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']) + switch($crm_list) { case 'infolog': case 'tracker': @@ -2479,11 +2502,12 @@ window.egw_LAB.wait(function() { unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); // need to load list's app.js now, as exec calls header before other app can include it - egw_framework::validate_file('/'.$GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list'].'/js/app.js'); + egw_framework::validate_file('/'.$crm_list.'/js/app.js'); $this->tmpl->exec('addressbook.addressbook_ui.view',$content,$sel_options,$readonlys,array( 'id' => $content['id'], 'index' => $content['index'], + 'crm_list' => $crm_list )); // Only load this on first time - we're using AJAX, so it stays there through submits. @@ -2493,7 +2517,7 @@ window.egw_LAB.wait(function() { $GLOBALS['egw']->hooks->single(array( 'location' => 'addressbook_view', 'ab_id' => $content['id'] - ),$GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']); + ),$crm_list); } } diff --git a/addressbook/js/app.js b/addressbook/js/app.js index d472945da8..e2cbc5f9db 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -88,8 +88,17 @@ app.classes.addressbook = AppJS.extend( { var index = _senders[0]._index; var id = _senders[0].id.split('::').pop(); + var extras = { + index: index + }; - this.egw.open(id, 'addressbook', 'view', {index: index}, '_self', 'addressbook'); + // CRM list + if(_action.id != 'view') + { + extras.crm_list = _action.id.replace('view-',''); + } + + this.egw.open(id, 'addressbook', 'view', extras, '_self', 'addressbook'); }, /** diff --git a/addressbook/lang/egw_de.lang b/addressbook/lang/egw_de.lang index df4ff2cb6e..52b272e031 100644 --- a/addressbook/lang/egw_de.lang +++ b/addressbook/lang/egw_de.lang @@ -147,6 +147,7 @@ country code (private) addressbook de Länderkennung (Privat) create new links addressbook de Neue Verknüpfung erstellen created addressbook de Angelegt credit addressbook de Darlehen +crm-view addressbook de CRM_Ansicht csv-fieldname addressbook de CSV-Feldname csv-filename addressbook de CSV-Dateiname custom addressbook de Benutzerdefiniert diff --git a/addressbook/lang/egw_en.lang b/addressbook/lang/egw_en.lang index 8003de5075..f976bfbec8 100644 --- a/addressbook/lang/egw_en.lang +++ b/addressbook/lang/egw_en.lang @@ -147,6 +147,7 @@ country code (private) addressbook en Country code (private) create new links addressbook en Create new links created addressbook en Created credit addressbook en Credit +crm-view addressbook en CRM-View csv-fieldname addressbook en CSV field name csv-filename addressbook en CSV file name custom addressbook en Custom