Skip to content
Permalink
Browse files

(almost) Fixes #49 : Add user preference wether or not to use auto_ab…

…ook for autocompletion. Now, need localizations updates.
  • Loading branch information...
sblaisot committed Aug 20, 2012
1 parent acaa5d2 commit 6a1528c985f89519c95fadae121b364f52a019b0
Showing with 20 additions and 3 deletions.
  1. +15 −1 automatic_addressbook.php
  2. +5 −2 config/config.inc.php.dist
@@ -48,7 +48,7 @@ public function init()
$config = rcmail::get_instance()->config;
$sources = $config->get('autocomplete_addressbooks', array('sql'));
if (!in_array($this->abook_id, $sources)) {
if (!in_array($this->abook_id, $sources) && $config->get('use_auto_abook', true) && $config->get('use_auto_abook_for_completion', true)) {
$sources[] = $this->abook_id;
$config->set('autocomplete_addressbooks', $sources);
}
@@ -167,6 +167,18 @@ public function settings_table($args)
'title' => html::label($field_id, Q($this->gettext('useautoabook'))),
'content' => $checkbox->show($use_auto_abook?1:0),
);
$use_auto_abook_for_completion = rcmail::get_instance()->config->get('use_auto_abook_for_completion', true);
$field_id2 = 'rcmfd_use_auto_abook_for_completion';
$checkbox2 = new html_checkbox(array(
'name' => '_use_auto_abook_for_completion',
'id' => $field_id2, 'value' => 1
));
$args['blocks']['automaticallycollected']['name'] = $this->gettext('automaticallycollected');
$args['blocks']['automaticallycollected']['options']['use_autocompletion'] = array(
'title' => html::label($field_id2, Q($this->gettext('useforcompletion'))),
'content' => $checkbox2->show($use_auto_abook_for_completion?1:0),
);
}
return $args;
}
@@ -177,6 +189,8 @@ public function save_prefs($args)
$rcmail = rcmail::get_instance();
$use_auto_abook = $rcmail->config->get('use_auto_abook');
$args['prefs']['use_auto_abook'] = isset($_POST['_use_auto_abook']) ? true : false;
$use_auto_abook_for_completion = $rcmail->config->get('use_auto_abook_for_completion');
$args['prefs']['use_auto_abook_for_completion'] = isset($_POST['_use_auto_abook_for_completion']) ? true : false;
}
return $args;
}
@@ -9,7 +9,10 @@ $rcmail_config['on_edit_move_to_default'] = FALSE;
/* database table name */
$rcmail_config['db_table_collected_contacts'] = 'collected_contacts';

/* Is automatic_adressbook enabled or disabled by default for users ? */
/* Is automatic_addressbook enabled or disabled by default for users ? */
$rcmail_config['use_auto_abook'] = TRUE;

?>
/* Should automatic_addressbook be used for completion ? */
$rcmail_config['use_auto_abook_for_completion'] = TRUE;

?>

0 comments on commit 6a1528c

Please sign in to comment.
You can’t perform that action at this time.