Add context menu sub-actions for CRM-View Infolog & Tracker

This commit is contained in:
Nathan Gray 2014-03-25 16:53:36 +00:00
parent 42272cf2e2
commit e62c980a8f
4 changed files with 40 additions and 5 deletions

View File

@ -351,11 +351,13 @@ class addressbook_ui extends addressbook_bo
{ {
$actions = array( $actions = array(
'view' => array( 'view' => array(
'caption' => 'View', 'caption' => 'CRM-View',
'default' => true, 'default' => true,
'allowOnMultiple' => false, 'allowOnMultiple' => false,
'group' => $group=1, 'group' => $group=1,
'onExecute' => 'javaScript:app.addressbook.view', 'onExecute' => 'javaScript:app.addressbook.view',
// Children added below
'children' => array()
), ),
'open' => array( 'open' => array(
'caption' => 'Open', '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 else // org view
{ {
@ -2261,6 +2280,10 @@ window.egw_LAB.wait(function() {
*/ */
function view(array $content=null) 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)) if(is_array($content))
{ {
list($button) = each($content['button']); list($button) = each($content['button']);
@ -2304,7 +2327,7 @@ window.egw_LAB.wait(function() {
// List nextmatch is already there, just update the filter // List nextmatch is already there, just update the filter
if($contact_id && egw_json_request::isJSONRequest()) if($contact_id && egw_json_request::isJSONRequest())
{ {
switch($GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']) switch($crm_list)
{ {
case 'infolog': case 'infolog':
case 'tracker': case 'tracker':
@ -2479,11 +2502,12 @@ window.egw_LAB.wait(function() {
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); 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 // 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( $this->tmpl->exec('addressbook.addressbook_ui.view',$content,$sel_options,$readonlys,array(
'id' => $content['id'], 'id' => $content['id'],
'index' => $content['index'], 'index' => $content['index'],
'crm_list' => $crm_list
)); ));
// Only load this on first time - we're using AJAX, so it stays there through submits. // 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( $GLOBALS['egw']->hooks->single(array(
'location' => 'addressbook_view', 'location' => 'addressbook_view',
'ab_id' => $content['id'] 'ab_id' => $content['id']
),$GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']); ),$crm_list);
} }
} }

View File

@ -88,8 +88,17 @@ app.classes.addressbook = AppJS.extend(
{ {
var index = _senders[0]._index; var index = _senders[0]._index;
var id = _senders[0].id.split('::').pop(); 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');
}, },
/** /**

View File

@ -147,6 +147,7 @@ country code (private) addressbook de Länderkennung (Privat)
create new links addressbook de Neue Verknüpfung erstellen create new links addressbook de Neue Verknüpfung erstellen
created addressbook de Angelegt created addressbook de Angelegt
credit addressbook de Darlehen credit addressbook de Darlehen
crm-view addressbook de CRM_Ansicht
csv-fieldname addressbook de CSV-Feldname csv-fieldname addressbook de CSV-Feldname
csv-filename addressbook de CSV-Dateiname csv-filename addressbook de CSV-Dateiname
custom addressbook de Benutzerdefiniert custom addressbook de Benutzerdefiniert

View File

@ -147,6 +147,7 @@ country code (private) addressbook en Country code (private)
create new links addressbook en Create new links create new links addressbook en Create new links
created addressbook en Created created addressbook en Created
credit addressbook en Credit credit addressbook en Credit
crm-view addressbook en CRM-View
csv-fieldname addressbook en CSV field name csv-fieldname addressbook en CSV field name
csv-filename addressbook en CSV file name csv-filename addressbook en CSV file name
custom addressbook en Custom custom addressbook en Custom