From a1d3c7f161589341946d15a7498478fcb4ad5b63 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 15 Jan 2014 11:22:37 +0000 Subject: [PATCH] Remove "prefered email address" from addressbook preferences. Additionally, add an exclusive user preference for business and private mail action checkboxes --- addressbook/inc/class.addressbook_hooks.inc.php | 13 ------------- addressbook/inc/class.addressbook_ui.inc.php | 8 ++++++-- addressbook/js/app.js | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index 30318870de..4e40eced7d 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -126,19 +126,6 @@ class addressbook_hooks 'default'=> 3, ); } - $settings['distributionListPreferredMail'] = array( - 'type' => 'select', - 'label' => 'Preferred email address to use in distribution lists', - 'name' => 'distributionListPreferredMail', - 'values' => array( - 'email' => lang("Work email if given, else home email"), - 'email_home' => lang("Home email if given, else work email"), - ), - 'help' => 'Defines which email address (business or home) to use as the preferred one for distribution lists in mail.', - 'xmlrpc' => True, - 'admin' => False, - 'forced'=> 'email', - ); if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap') { $settings['private_addressbook'] = array( diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 868a478bd3..35a4a1042a 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -580,18 +580,22 @@ class addressbook_ui extends addressbook_bo 'no_lang' => true, 'checkbox' => true, 'group' => $group, - 'onExecute' => 'javaScript:app.addressbook.mailCheckMenu', + 'onExecute' => 'javaScript:app.addressbook.mailCheckbox', + 'checked' => $this->prefs['preferredMail']['business'], ), 'email_home' => array( 'caption' => lang('Add %1',lang('home email')), 'no_lang' => true, 'checkbox' => true, 'group' => $group, - 'onExecute' => 'javaScript:app.addressbook.mailCheckMenu', + 'onExecute' => 'javaScript:app.addressbook.mailCheckbox', + 'checked' => $this->prefs['preferredMail']['private'], ), ), ); + if (!$this->prefs['preferredMail']) + $actions['email']['children']['email_business']['checked'] = true; if ($GLOBALS['egw_info']['user']['apps']['filemanager']) { diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 9df5a0130b..aa12b784fe 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -415,6 +415,20 @@ app.classes.addressbook = AppJS.extend( this.et2.getInstanceManager().submit(this.et2.getWidgetById('button[search]')); return false; }, + + /** + * Action function to set business or private mail checkboxes to user preferences + * + * @param {egwAction} action Action user selected. + */ + mailCheckbox: function(action) + { + var preferences = { + business:(action.getManager().getActionById('email_business').checked?true:false), + private:(action.getManager().getActionById('email_home').checked?true:false), + } + this.egw.set_preference('addressbook','preferredMail', preferences) + }, /** * Action function to add the email address (business or home) of the selected