disable history log tab, if it is not applicable (LDAP or new entries)

This commit is contained in:
Ralf Becker 2010-11-13 09:10:11 +00:00
parent a66cb42789
commit 76038568fc

View File

@ -1500,7 +1500,8 @@ class addressbook_ui extends addressbook_bo
$readonlys['tabs']['custom'] = !$this->customfields; $readonlys['tabs']['custom'] = !$this->customfields;
$readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab']; $readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab'];
$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false; $readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
$readonlys['tabs']['history'] = $this->account_repository == 'ldap' && $content['account_id']; $readonlys['tabs']['history'] = $this->contact_repository == 'ldap' || !$content['id'] ||
$this->account_repository == 'ldap' && $content['account_id'];
$readonlys['button[delete]'] = !$content['id']; $readonlys['button[delete]'] = !$content['id'];
if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
@ -1719,6 +1720,8 @@ class addressbook_ui extends addressbook_bo
$readonlys['tabs']['custom'] = !$this->customfields; $readonlys['tabs']['custom'] = !$this->customfields;
$readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab']; $readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab'];
$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false; $readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
$readonlys['tabs']['history'] = $this->contact_repository == 'ldap' || !$content['id'] ||
$this->account_repository == 'ldap' && $content['account_id'];
if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
// last and next calendar date // last and next calendar date
@ -2221,7 +2224,13 @@ class addressbook_ui extends addressbook_bo
/** /**
* Set up history log widget * Set up history log widget
*/ */
protected function setup_history(&$content, &$sel_options) { protected function setup_history(&$content, &$sel_options)
{
if ($this->contact_repository == 'ldap' || !$content['id'] ||
$this->account_repository == 'ldap' && $content['account_id'])
{
return; // no history for ldap as history table only allows integer id's
}
$content['history'] = array( $content['history'] = array(
'id' => $content['id'], 'id' => $content['id'],
'app' => 'addressbook', 'app' => 'addressbook',
@ -2231,23 +2240,32 @@ class addressbook_ui extends addressbook_bo
), ),
); );
foreach($this->content_types as $id => $settings) { foreach($this->content_types as $id => $settings)
{
$content['history']['status-widgets']['tid'][$id] = $settings['name']; $content['history']['status-widgets']['tid'][$id] = $settings['name'];
} }
$sel_options['status'] = $this->contact_fields; $sel_options['status'] = $this->contact_fields;
foreach($this->tracking->field2label as $field => $label) { foreach($this->tracking->field2label as $field => $label)
{
$sel_options['status'][$field] = lang($label); $sel_options['status'][$field] = lang($label);
} }
// Get custom field options // Get custom field options
$custom = config::get_customfields('addressbook', true); $custom = config::get_customfields('addressbook', true);
if(is_array($custom)) { if(is_array($custom))
foreach($custom as $name => $settings) { {
if(!is_array($settings['values'])) { foreach($custom as $name => $settings)
{
if(!is_array($settings['values']))
{
$content['history']['status-widgets']['#'.$name] = $settings['type']; $content['history']['status-widgets']['#'.$name] = $settings['type'];
} elseif($settings['values']['@']) { }
elseif($settings['values']['@'])
{
$content['history']['status-widgets']['#'.$name] = customfields_widget::_get_options_from_file($settings['values']['@']); $content['history']['status-widgets']['#'.$name] = customfields_widget::_get_options_from_file($settings['values']['@']);
} elseif(count($settings['values'])) { }
elseif(count($settings['values']))
{
$content['history']['status-widgets']['#'.$name] = $settings['values']; $content['history']['status-widgets']['#'.$name] = $settings['values'];
} }
} }