forked from extern/egroupware
Set up addressbook CRM view to display infolog or tracker, by preference.
Tracker list filtering not yet implemented.
This commit is contained in:
parent
d373541456
commit
a4113da328
@ -206,6 +206,23 @@ class addressbook_hooks
|
||||
'admin' => false,
|
||||
'default'=> 'org_name: n_family, n_given',
|
||||
);
|
||||
$crm_list_options = array(
|
||||
'infolog' => lang('infolog')
|
||||
);
|
||||
if($GLOBALS['egw_info']['user']['apps']['tracker'])
|
||||
{
|
||||
$crm_list_options['tracker'] = lang('tracker');
|
||||
}
|
||||
$settings['crm_list'] = array(
|
||||
'type' => 'select',
|
||||
'label' => 'CRM view list',
|
||||
'name' => 'crm_list',
|
||||
'values' => $crm_list_options,
|
||||
'help' => 'When viewing a contact, show linked entries from the selected application',
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
'default'=> 'infolog',
|
||||
);
|
||||
$settings[] = array(
|
||||
'type' => 'section',
|
||||
'title' => lang('Data exchange settings'),
|
||||
|
@ -2163,12 +2163,21 @@ window.egw_LAB.wait(function() {
|
||||
}
|
||||
$content['index'] = $query['start'];
|
||||
|
||||
// Infolog nextmatch is already there, just update the filter
|
||||
// List nextmatch is already there, just update the filter
|
||||
if($contact_id && egw_json_request::isJSONRequest())
|
||||
{
|
||||
egw_json_response::get()->apply('app.addressbook.view_set_infolog',Array($contact_id));
|
||||
switch($GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list'])
|
||||
{
|
||||
case 'infolog':
|
||||
egw_json_response::get()->apply('app.addressbook.view_set_list',Array('linked',$contact_id));
|
||||
break;
|
||||
case 'tracker':
|
||||
// TODO - what's the filter?
|
||||
//egw_json_response::get()->apply('app.addressbook.view_set_list',Array('linked',$contact_id));
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear contact_id, it's used as a flag to send infolog
|
||||
// Clear contact_id, it's used as a flag to send the list
|
||||
unset($contact_id);
|
||||
}
|
||||
break;
|
||||
@ -2345,10 +2354,10 @@ window.egw_LAB.wait(function() {
|
||||
// Sending it again (via ajax) will break the addressbook.view etemplate2
|
||||
if($contact_id)
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
$GLOBALS['egw']->hooks->single(array(
|
||||
'location' => 'addressbook_view',
|
||||
'ab_id' => $content['id']
|
||||
));
|
||||
),$GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,21 +93,24 @@ app.classes.addressbook = AppJS.extend(
|
||||
},
|
||||
|
||||
/**
|
||||
* Set link filter for the already open & rendered infolog list
|
||||
* Set link filter for the already open & rendered list
|
||||
*
|
||||
* @param {string} col_filter_name Name of the column filter to set
|
||||
* @param {string} contact_id New contact ID
|
||||
*/
|
||||
view_set_infolog: function(contact_id)
|
||||
view_set_list: function(col_filter_name, contact_id)
|
||||
{
|
||||
// Find the infolog list
|
||||
var infolog = etemplate2.getById(
|
||||
var list = etemplate2.getById(
|
||||
$j(this.et2.getInstanceManager().DOMContainer).nextAll('.et2_container').attr('id')
|
||||
);
|
||||
var nm = infolog ? infolog.widgetContainer.getWidgetById('nm') : null;
|
||||
if(nm)
|
||||
var nm = null;
|
||||
if(list != null && (nm = list.widgetContainer.getWidgetById('nm')))
|
||||
{
|
||||
// Update the link filter to new contact
|
||||
nm.applyFilters({col_filter: {linked: 'addressbook:'+contact_id}});
|
||||
var filter = {col_filter:{}};
|
||||
filter.col_filter[col_filter_name] = 'addressbook:'+contact_id;
|
||||
nm.applyFilters(filter);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user