forked from extern/egroupware
some improvements when selecting a distribution list in mail: -users can switch between email and email_home (the default behaviour can be set via user-prefs), -auto-fallback to email_home if email not present and vice versa
This commit is contained in:
parent
90f39cef39
commit
875fe14219
@ -224,6 +224,18 @@ class contacts_admin_prefs
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
);
|
||||
$GLOBALS['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
|
||||
);
|
||||
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
|
||||
{
|
||||
$link = $GLOBALS['egw']->link('/index.php','menuaction=addressbook.addressbook_merge.show_replacements');
|
||||
|
@ -199,7 +199,7 @@ class uicontacts extends bocontacts
|
||||
if ($do_email)
|
||||
{
|
||||
$content['nm']['filter2_onchange'] = str_replace('this.form.submit();',
|
||||
"{ if (this.value && confirm('Add business email of whole distribution list?')) add_whole_list(this.value); else this.form.submit(); }",
|
||||
"{ if (this.value && confirm('".lang('Add emails of whole distribution list?')."')) add_whole_list(this.value); else this.form.submit(); }",
|
||||
$content['nm']['filter2_onchange']);
|
||||
}
|
||||
// use the state of the last session stored in the user prefs
|
||||
@ -218,11 +218,13 @@ class uicontacts extends bocontacts
|
||||
if (!$re_submit)
|
||||
{
|
||||
$content['nm']['to'] = 'to';
|
||||
$content['nm']['email_type'] = $this->prefs['distributionListPreferredMail'] ? $this->prefs['distributionListPreferredMail'] : 'email';
|
||||
$content['nm']['search'] = '@';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content['nm']['to'] = $to;
|
||||
$content['nm']['email_type'] = $this->prefs['distributionListPreferredMail'] ? $this->prefs['distributionListPreferredMail'] : 'email';
|
||||
}
|
||||
$content['nm']['header_left'] = 'addressbook.email.left';
|
||||
}
|
||||
@ -394,12 +396,11 @@ class uicontacts extends bocontacts
|
||||
));
|
||||
}
|
||||
|
||||
function ajax_add_whole_list($list)
|
||||
function ajax_add_whole_list($list, $email_type = 'email')
|
||||
{
|
||||
$query = $GLOBALS['egw']->session->appsession('email','addressbook');
|
||||
$query['filter2'] = (int)$list;
|
||||
$action_msg = lang('%1 added',lang('Business email'));
|
||||
$this->action('email',array(),true,$success,$failed,$action_msg,$query,$msg);
|
||||
$this->action($email_type,array(),true,$success,$failed,$action_msg,$query,$msg);
|
||||
|
||||
$response =& new xajaxResponse();
|
||||
|
||||
@ -417,6 +418,8 @@ class uicontacts extends bocontacts
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$msg) $msg = lang('%1 contact(s) %2',$success,$action_msg);
|
||||
$response->addScript("alert('".addslashes($msg)."')");
|
||||
$response->addScript('window.close();');
|
||||
}
|
||||
return $response->getXML();
|
||||
@ -591,13 +594,29 @@ class uicontacts extends bocontacts
|
||||
|
||||
case 'email':
|
||||
case 'email_home':
|
||||
$action_msg = lang('%1 added',$action=='email'?lang('Business email') : lang('Home email'));
|
||||
if (($Ok = !!($contact = $this->read($id)) && strpos($contact[$action],'@') !== false))
|
||||
$action == 'email' ? $action_fallback = 'email_home' : $action_fallback = 'email';
|
||||
$action_msg = lang('added');
|
||||
if($contact = $this->read($id))
|
||||
{
|
||||
if(!@is_object($GLOBALS['egw']->js)) $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
|
||||
|
||||
$GLOBALS['egw']->js->set_onload("addEmail('".addslashes(
|
||||
$contact['n_fn'] ? $contact['n_fn'].' <'.$contact[$action].'>' : $contact[$action])."');");
|
||||
if(strpos($contact[$action],'@') !== false)
|
||||
{
|
||||
$email = $contact[$action];
|
||||
}
|
||||
elseif(strpos($contact[$action_fallback],'@') !== false)
|
||||
{
|
||||
$email = $contact[$action_fallback];
|
||||
}
|
||||
else
|
||||
{
|
||||
$Ok = $email = false;
|
||||
}
|
||||
if($email)
|
||||
{
|
||||
if(!@is_object($GLOBALS['egw']->js)) $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
|
||||
$GLOBALS['egw']->js->set_onload("addEmail('".addslashes(
|
||||
$contact['n_fn'] ? $contact['n_fn'].' <'.$email.'>' : $email)."');");
|
||||
$Ok = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1824,7 +1843,15 @@ $readonlys['button[vcard]'] = true;
|
||||
|
||||
function add_whole_list(list)
|
||||
{
|
||||
xajax_doXMLHTTP("addressbook.uicontacts.ajax_add_whole_list",list);
|
||||
if (document.getElementById("exec[nm][email_type][email_home]").checked == true)
|
||||
{
|
||||
email_type = "email_home";
|
||||
}
|
||||
else
|
||||
{
|
||||
email_type = "email";
|
||||
}
|
||||
xajax_doXMLHTTP("addressbook.uicontacts.ajax_add_whole_list",list,email_type);
|
||||
}
|
||||
|
||||
function setOptions(options_str)
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application addressbook
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2007-10-31 12:31
|
||||
* generated by soetemplate::dump4setup() 2007-11-06 16:12
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package addressbook
|
||||
@ -128,6 +128,8 @@ $templ_data[] = array('name' => 'addressbook.email','template' => '','lang' => '
|
||||
|
||||
$templ_data[] = array('name' => 'addressbook.email.left','template' => '','lang' => '','group' => '0','version' => '1.3.001','data' => 'a:1:{i:0;a:11:{s:4:"type";s:4:"hbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:7:"no_lang";s:1:"1";s:4:"span";s:5:",bold";s:8:"onchange";i:1;s:4:"size";s:1:"3";i:1;a:10:{s:4:"type";s:5:"radio";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"name";s:2:"to";s:7:"no_lang";s:1:"1";s:4:"help";s:30:"where to add the email address";s:4:"span";s:5:",bold";s:4:"size";s:2:"to";s:5:"label";s:2:"To";}i:2;a:10:{s:4:"type";s:5:"radio";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"name";s:2:"to";s:7:"no_lang";s:1:"1";s:4:"help";s:30:"where to add the email address";s:4:"span";s:5:",bold";s:4:"size";s:2:"cc";s:5:"label";s:2:"Cc";}i:3;a:10:{s:4:"type";s:5:"radio";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"name";s:2:"to";s:7:"no_lang";s:1:"1";s:4:"help";s:30:"where to add the email address";s:4:"span";s:5:",bold";s:4:"size";s:3:"bcc";s:5:"label";s:3:"Bcc";}}}','size' => '','style' => '','modified' => '1150425286',);
|
||||
|
||||
$templ_data[] = array('name' => 'addressbook.email.left','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:2:{i:0;a:10:{s:4:"rows";s:1:"1";s:4:"cols";s:1:"1";s:7:"no_lang";s:1:"1";s:5:"class";s:4:"bold";s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:9:{s:4:"rows";s:1:"1";s:4:"cols";s:1:"1";s:7:"no_lang";s:1:"1";s:5:"label";s:2:"To";s:4:"name";s:2:"to";s:4:"size";s:2:"to";s:4:"type";s:5:"radio";s:4:"help";s:30:"where to add the email address";s:4:"span";s:5:",bold";}i:2;a:9:{s:4:"rows";s:1:"1";s:4:"cols";s:1:"1";s:7:"no_lang";s:1:"1";s:5:"label";s:2:"Cc";s:4:"name";s:2:"to";s:4:"size";s:2:"cc";s:4:"type";s:5:"radio";s:4:"help";s:30:"where to add the email address";s:4:"span";s:5:",bold";}i:3;a:9:{s:4:"rows";s:1:"1";s:4:"cols";s:1:"1";s:7:"no_lang";s:1:"1";s:5:"label";s:3:"Bcc";s:4:"name";s:2:"to";s:4:"size";s:3:"bcc";s:4:"type";s:5:"radio";s:4:"help";s:30:"where to add the email address";s:4:"span";s:5:",bold";}i:4;a:1:{s:4:"type";s:5:"label";}}i:1;a:6:{s:5:"class";s:4:"bold";s:7:"no_lang";s:1:"1";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:7:{s:5:"label";s:14:"Business email";s:7:"no_lang";s:1:"1";s:4:"name";s:10:"email_type";s:4:"size";s:5:"email";s:4:"type";s:5:"radio";s:4:"help";s:61:"preferred type of email address to add for distribution lists";s:4:"span";s:5:",bold";}i:2;a:7:{s:5:"label";s:10:"Home email";s:7:"no_lang";s:1:"1";s:4:"name";s:10:"email_type";s:4:"size";s:10:"email_home";s:4:"type";s:5:"radio";s:4:"help";s:61:"preferred type of email address to add for distribution lists";s:4:"span";s:5:",bold";}}}','size' => '','style' => '','modified' => '1194360774',);
|
||||
|
||||
$templ_data[] = array('name' => 'addressbook.email.rows','template' => '','lang' => '','group' => '0','version' => '1.3.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:5:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";s:1:"C";s:17:",!@order=n_family";s:1:"B";s:16:",!@order=n_given";s:1:"E";s:32:",!@order=/^(org_name|n_fileas)$/";}i:1;a:8:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"n_given";s:5:"label";s:9:"Firstname";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"Name";s:4:"name";s:8:"n_family";}}s:1:"C";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"Name";s:4:"name";s:8:"n_family";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"n_given";s:5:"label";s:9:"Firstname";}}s:1:"D";a:3:{s:4:"name";s:8:"org_name";s:5:"label";s:7:"Company";s:4:"type";s:20:"nextmatch-sortheader";}s:1:"E";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"Name";s:4:"name";s:8:"n_family";}i:2;a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"n_given";s:5:"label";s:9:"Firstname";s:4:"span";s:9:",leftPad5";}}s:1:"F";a:3:{s:4:"type";s:5:"label";s:5:"label";s:14:"Business email";s:4:"name";s:5:"email";}s:1:"G";a:3:{s:4:"type";s:5:"label";s:4:"name";s:10:"email_home";s:5:"label";s:10:"Home email";}s:1:"H";a:6:{s:4:"type";s:4:"hbox";s:5:"align";s:6:"center";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";s:5:"align";s:6:"center";}i:2;a:8:{s:4:"type";s:6:"button";s:4:"size";s:5:"check";s:5:"label";s:9:"Check all";s:4:"name";s:9:"check_all";s:4:"help";s:9:"Check all";s:7:"onclick";s:60:"toggle_all(this.form,form::name(\'checked[]\')); return false;";s:6:"needed";s:1:"1";s:5:"align";s:5:"right";}s:4:"span";s:8:",noPrint";}}i:2;a:8:{s:1:"A";a:5:{s:4:"type";s:5:"image";s:5:"label";s:21:"$row_cont[type_label]";s:4:"name";s:12:"${row}[type]";s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:4:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[n_given]";s:5:"label";s:1:" ";s:7:"no_lang";s:1:"1";}i:2;a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:16:"${row}[n_family]";s:4:"span";s:9:",leftPad5";}}s:1:"C";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:7:"2,0,0,0";i:1;a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:16:"${row}[n_family]";}i:2;a:5:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[n_given]";s:4:"span";s:9:",leftPad5";s:5:"label";s:1:" ";s:7:"no_lang";s:1:"1";}}s:1:"D";a:3:{s:4:"type";s:5:"label";s:4:"name";s:16:"${row}[org_name]";s:7:"no_lang";s:1:"1";}s:1:"E";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:16:"${row}[n_family]";}i:2;a:5:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[n_given]";s:4:"span";s:9:",leftPad5";s:5:"label";s:1:" ";s:7:"no_lang";s:1:"1";}}s:1:"F";a:5:{s:4:"type";s:3:"box";s:4:"size";s:6:"1,,0,0";s:7:"no_lang";s:1:"1";s:4:"span";s:9:",emailCol";i:1;a:4:{s:4:"type";s:5:"label";s:4:"size";s:80:",javascript:addEmail(\'$row_cont[n_fn] <$row_cont[email]>\');,,,,,$row_cont[email]";s:4:"name";s:13:"${row}[email]";s:7:"no_lang";s:1:"1";}}s:1:"G";a:5:{s:4:"type";s:3:"box";s:4:"size";s:6:"1,,0,0";s:7:"no_lang";s:1:"1";s:4:"span";s:9:",emailCol";i:1;a:4:{s:4:"type";s:5:"label";s:4:"size";s:90:",javascript:addEmail(\'$row_cont[n_fn] <$row_cont[email_home]>\');,,,,,$row_cont[email_home]";s:4:"name";s:18:"${row}[email_home]";s:7:"no_lang";s:1:"1";}}s:1:"H";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:5:"3,0,0";i:1;a:5:{s:4:"type";s:6:"button";s:4:"size";s:4:"edit";s:5:"label";s:4:"Edit";s:7:"onclick";s:189:"window.open(egw::link(\'/index.php\',\'menuaction=addressbook.uicontacts.edit&contact_id=$row_cont[id]\'),\'_blank\',\'dependent=yes,width=850,height=440,scrollbars=yes,status=yes\'); return false;";s:4:"name";s:19:"edit[$row_cont[id]]";}i:2;a:6:{s:4:"type";s:6:"button";s:4:"name";s:21:"delete[$row_cont[id]]";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:4:"help";s:19:"Delete this contact";s:7:"onclick";s:38:"return confirm(\'Delete this contact\');";}i:3;a:5:{s:4:"type";s:8:"checkbox";s:4:"name";s:9:"checked[]";s:4:"size";s:13:"$row_cont[id]";s:4:"help";s:45:"Select multiple contacts for a further action";s:5:"align";s:5:"right";}s:4:"span";s:8:",noPrint";}}}s:4:"rows";i:2;s:4:"cols";i:8;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '','modified' => '1150326789',);
|
||||
|
||||
$templ_data[] = array('name' => 'addressbook.export_csv_options','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Seperator";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"size";s:1:"1";s:4:"name";s:9:"seperator";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Enclosure";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"size";s:1:"1";s:4:"name";s:9:"enclosure";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1160148382',);
|
||||
|
Loading…
Reference in New Issue
Block a user