summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-27 11:22:56 +0000
committeralecpl <alec@alec.pl>2011-05-27 11:22:56 +0000
commitd7344819834e469c2e5875f756f1ad973b2e06d9 (patch)
tree67eb614932f12ea756b0cd390b23253cfc095c50
parentf5a55bf173be2378db79860ced8486374971e72f (diff)
- Added option to specify to which address book add new contacts
-rw-r--r--CHANGELOG1
-rw-r--r--config/main.inc.php.dist5
-rw-r--r--program/localization/en_US/labels.inc1
-rw-r--r--program/localization/pl_PL/labels.inc1
-rw-r--r--program/steps/mail/addcontact.inc12
-rw-r--r--program/steps/settings/func.inc27
-rw-r--r--program/steps/settings/save_prefs.inc12
7 files changed, 57 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 64c0ad341..807cd8288 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Added option to specify to which address book add new contacts
- Added plugin hook for keep-alive requests
- Store user preferences in session when write-master is not available and session is stored in memcache, write them later
- Improve performence of folder manager operations
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 29af28457..ddb1eda1b 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -698,4 +698,9 @@ $rcmail_config['reply_same_folder'] = false;
// Sets default mode of Forward feature to "forward as attachment"
$rcmail_config['forward_attachment'] = false;
+// Defines address book (internal index) to which new contacts will be added
+// By default it is the first writeable addressbook.
+// Note: Use '0' for built-in address book.
+$rcmail_config['default_addressbook'] = null;
+
// end of config file
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index e9d6b6b14..3e88d09a0 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -412,6 +412,7 @@ $labels['afternseconds'] = 'after $n seconds';
$labels['reqmdn'] = 'Always request a return receipt';
$labels['reqdsn'] = 'Always request a delivery status notification';
$labels['replysamefolder'] = 'Place replies in the folder of the message being replied to';
+$labels['defaultaddressbook'] = 'Add new contacts to the selected addressbook';
$labels['folder'] = 'Folder';
$labels['folders'] = 'Folders';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index d51b59e77..652b3027e 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -406,5 +406,6 @@ $labels['foldertype'] = 'Typ folderu';
$labels['personalfolder'] = 'Folder prywatny';
$labels['otherfolder'] = 'Folder innego użytkownika';
$labels['sharedfolder'] = 'Folder współdzielony';
+$labels['defaultaddressbook'] = 'Nowe kontakty dodawaj do wybranej książki adresowej';
?>
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 0baf6cd63..57bc2a1c6 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -23,8 +23,16 @@
if (!$OUTPUT->ajax_call)
return;
-$done = false;
-$CONTACTS = $RCMAIL->get_address_book(null, true);
+$abook = $RCMAIL->config->get('default_addressbook');
+
+// Get configured addressbook
+$CONTACTS = $RCMAIL->get_address_book($abook, true);
+
+// Get first writeable addressbook if the configured doesn't exist
+// This can happen when user deleted the addressbook (e.g. Kolab folder)
+if ($abook !== null && !is_object($CONTACTS)) {
+ $CONTACTS = $RCMAIL->get_address_book(null, true);
+}
if (!empty($_POST['_address']) && is_object($CONTACTS))
{
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index a44d6c8ff..280185e76 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -131,6 +131,7 @@ function rcmail_user_prefs($current=null)
$sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview'));
$sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition'));
$sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying'));
+ $sections['addressbook'] = array('id' => 'addressbook','section' => rcube_label('addressbook'));
$sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders'));
$sections['server'] = array('id' => 'server', 'section' => rcube_label('serversettings'));
@@ -582,6 +583,32 @@ function rcmail_user_prefs($current=null)
break;
+
+ // Addressbook config
+ case 'addressbook':
+
+ $blocks = array(
+ 'main' => array('name' => Q(rcube_label('mainoptions'))),
+ );
+
+ if (!isset($no_override['default_addressbook'])
+ && ($books = $RCMAIL->get_address_sources(true))
+ ) {
+ $field_id = 'rcmfd_default_addressbook';
+ $select_abook = new html_select(array('name' => '_default_addressbook', 'id' => $field_id));
+
+ foreach ($books as $book) {
+ $select_abook->add($book['name'], $book['id']);
+ }
+
+ $blocks['main']['options']['default_addressbook'] = array(
+ 'title' => html::label($field_id, Q(rcube_label('defaultaddressbook'))),
+ 'content' => $select_abook->show($config['default_addressbook']),
+ );
+ }
+
+ break;
+
// Special IMAP folders
case 'folders':
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 42ad0b952..031e0d3e4 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -37,6 +37,7 @@ switch ($CURR_SECTION)
);
break;
+
case 'mailbox':
$a_user_prefs = array(
'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
@@ -48,6 +49,7 @@ switch ($CURR_SECTION)
);
break;
+
case 'mailview':
$a_user_prefs = array(
'prefer_html' => isset($_POST['_prefer_html']) ? TRUE : FALSE,
@@ -58,6 +60,7 @@ switch ($CURR_SECTION)
);
break;
+
case 'compose':
$a_user_prefs = array(
'htmleditor' => intval($_POST['_htmleditor']),
@@ -74,6 +77,14 @@ switch ($CURR_SECTION)
);
break;
+
+ case 'addressbook':
+ $a_user_prefs = array(
+ 'default_addressbook' => get_input_value('_default_addressbook', RCUBE_INPUT_POST),
+ );
+
+ break;
+
case 'server':
$a_user_prefs = array(
'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
@@ -85,6 +96,7 @@ switch ($CURR_SECTION)
);
break;
+
case 'folders':
$a_user_prefs = array(
'drafts_mbox' => get_input_value('_drafts_mbox', RCUBE_INPUT_POST),