forked from extern/egroupware
some fixes and improvments around the distribution lists:
- to, cc, bcc is working again in the email-selection-popup - shortcut to directly add the whole list in the email-popup - error message that a list already exist - javascript only get's loaded if not already loaded - fix for bug #588: content of emailpopup to wide - fix for bug #713: wrong redirect creating distrib.list via popup from fmail
This commit is contained in:
parent
ca496bed5e
commit
0d1dbaa6e1
@ -416,7 +416,7 @@ class socontacts_sql extends so_sql
|
||||
* @param string $name list-name
|
||||
* @param int $owner user- or group-id
|
||||
* @param array $contacts=array() contacts to add
|
||||
* @return list_id or false on error
|
||||
* @return int/boolean integer list_id, true if the list already exists or false on error
|
||||
*/
|
||||
function add_list($name,$owner,$contacts=array())
|
||||
{
|
||||
@ -427,7 +427,7 @@ class socontacts_sql extends so_sql
|
||||
'list_owner' => $owner,
|
||||
),__LINE__,__FILE__) && $this->db->next_record())
|
||||
{
|
||||
return $this->db->f('list_id'); // return existing list-id
|
||||
return true; // return existing list-id
|
||||
}
|
||||
if (!$this->db->insert($this->lists_table,array(
|
||||
'list_name' => $name,
|
||||
|
@ -80,8 +80,10 @@ class uicontacts extends bocontacts
|
||||
|
||||
// our javascript
|
||||
// to be moved in a seperate file if rewrite is over
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .= $this->js();
|
||||
|
||||
if (strpos($GLOBALS['egw_info']['flags']['java_script'],'add_new_list') === false)
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['java_script'].= $this->js();
|
||||
}
|
||||
$this->config =& $GLOBALS['egw_info']['server'];
|
||||
}
|
||||
|
||||
@ -140,7 +142,12 @@ class uicontacts extends bocontacts
|
||||
}
|
||||
elseif($_GET['add_list'])
|
||||
{
|
||||
if (($list = $this->add_list($_GET['add_list'],$_GET['owner']?$_GET['owner']:$this->user)))
|
||||
$list = $this->add_list($_GET['add_list'],$_GET['owner']?$_GET['owner']:$this->user);
|
||||
if ($list === true)
|
||||
{
|
||||
$msg = lang('List already exists!');
|
||||
}
|
||||
elseif ($list)
|
||||
{
|
||||
$msg = lang('List created');
|
||||
}
|
||||
@ -152,6 +159,7 @@ class uicontacts extends bocontacts
|
||||
$preserv = array(
|
||||
'do_email' => $do_email,
|
||||
);
|
||||
$to = $content['nm']['to'];
|
||||
$content = array(
|
||||
'msg' => $msg ? $msg : $_GET['msg'],
|
||||
);
|
||||
@ -180,7 +188,14 @@ class uicontacts extends bocontacts
|
||||
'do_email' => $do_email,
|
||||
'default_cols' => '!cat_id,contact_created_contact_modified',
|
||||
'filter2_onchange' => "if(this.value=='add') { add_new_list(document.getElementById(form::name('filter')).value); this.value='';} else this.form.submit();",
|
||||
'manual' => $do_email ? ' ' : false, // space for the manual icon
|
||||
);
|
||||
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(); }",
|
||||
$content['nm']['filter2_onchange']);
|
||||
}
|
||||
// use the state of the last session stored in the user prefs
|
||||
if (($state = @unserialize($this->prefs[$do_email ? 'email_state' : 'index_state'])))
|
||||
{
|
||||
@ -199,6 +214,10 @@ class uicontacts extends bocontacts
|
||||
$content['nm']['to'] = 'to';
|
||||
$content['nm']['search'] = '@';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content['nm']['to'] = $to;
|
||||
}
|
||||
$content['nm']['header_left'] = 'addressbook.email.left';
|
||||
}
|
||||
// Organisation stuff is not (yet) availible with ldap
|
||||
@ -215,6 +234,7 @@ class uicontacts extends bocontacts
|
||||
$sel_options['action'] = array();
|
||||
if ($do_email)
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
|
||||
$sel_options['action'] = array(
|
||||
'email' => lang('Add %1',lang('business email')),
|
||||
'email_home' => lang('Add %1',lang('home email')),
|
||||
@ -290,53 +310,43 @@ class uicontacts extends bocontacts
|
||||
*/
|
||||
function emailpopup($content=null,$msg=null)
|
||||
{
|
||||
switch($_POST['exec']['nm']['to']) {
|
||||
case 'to':
|
||||
case 'bcc':
|
||||
case 'cc':
|
||||
$to = $_POST['exec']['nm']['to'];
|
||||
break;
|
||||
default:
|
||||
$to = 'to';
|
||||
}
|
||||
|
||||
if ($_GET['compat']) // 1.2 felamimail or old email
|
||||
if (strpos($GLOBALS['egw_info']['flags']['java_script'],'addEmail') === false)
|
||||
{
|
||||
$handler = "if (opener.document.doit[to].value != '')
|
||||
if ($_GET['compat']) // 1.2 felamimail or old email
|
||||
{
|
||||
$handler = "if (opener.document.doit[to].value != '')
|
||||
{
|
||||
opener.document.doit[to].value += ',';
|
||||
}
|
||||
opener.document.doit[to].value += email";
|
||||
}
|
||||
else // 1.3+ felamimail
|
||||
{
|
||||
$handler = 'opener.addEmail(to,email)';
|
||||
}
|
||||
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .= "
|
||||
}
|
||||
else // 1.3+ felamimail
|
||||
{
|
||||
$handler = 'opener.addEmail(to,email)';
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['java_script'].= "
|
||||
<script>
|
||||
window.focus();
|
||||
|
||||
function addEmail(email)
|
||||
{
|
||||
var to = '$to';
|
||||
// this does not work, as always to is selected after page reload
|
||||
//if (document.getElementById('exec[nm][to][cc]').checked == true)
|
||||
//{
|
||||
// to = 'cc';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (document.getElementById('exec[nm][to][bcc]').checked == true)
|
||||
// {
|
||||
// to = 'bcc';
|
||||
// }
|
||||
//}
|
||||
//alert(to+': '+email);
|
||||
var to = 'to';
|
||||
if (document.getElementById('exec[nm][to][cc]').checked == true)
|
||||
{
|
||||
to = 'cc';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (document.getElementById('exec[nm][to][bcc]').checked == true)
|
||||
{
|
||||
to = 'bcc';
|
||||
}
|
||||
}
|
||||
$handler;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
";
|
||||
}
|
||||
return $this->index($content,$msg,true);
|
||||
}
|
||||
|
||||
@ -375,6 +385,34 @@ class uicontacts extends bocontacts
|
||||
));
|
||||
}
|
||||
|
||||
function ajax_add_whole_list($list)
|
||||
{
|
||||
$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);
|
||||
|
||||
$response =& new xajaxResponse();
|
||||
|
||||
if ($success) $response->addScript($GLOBALS['egw']->js->body['onLoad']);
|
||||
|
||||
// close window only if no errors AND something added
|
||||
if ($failed || !$success)
|
||||
{
|
||||
if (!$msg) $msg = $failed ? lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed) :
|
||||
lang('%1 contact(s) %2',$success,$action_msg);
|
||||
|
||||
$response->addScript("alert('".addslashes($msg)."')");
|
||||
// reset the filter
|
||||
$response->addScript("document.getElementById('exec[nm][filter2]').value='';");
|
||||
}
|
||||
else
|
||||
{
|
||||
$response->addScript('window.close();');
|
||||
}
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* apply an action to multiple contacts
|
||||
*
|
||||
@ -384,7 +422,7 @@ class uicontacts extends bocontacts
|
||||
* @param int &$success number of succeded actions
|
||||
* @param int &$failed number of failed actions (not enought permissions)
|
||||
* @param string &$action_msg translated verb for the actions, to be used in a message like %1 contacts 'deleted'
|
||||
* @param string $session_name 'index' or 'email' depending if we are in the main list or the popup
|
||||
* @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
|
||||
* @return boolean true if all actions succeded, false otherwise
|
||||
*/
|
||||
function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
|
||||
@ -395,7 +433,7 @@ class uicontacts extends bocontacts
|
||||
if ($use_all || in_array($action,array('remove_from_list','delete_list')))
|
||||
{
|
||||
// get the whole selection
|
||||
$query = $GLOBALS['egw']->session->appsession($session_name,'addressbook');
|
||||
$query = is_array($session_name) ? $session_name : $GLOBALS['egw']->session->appsession($session_name,'addressbook');
|
||||
|
||||
if ($use_all)
|
||||
{
|
||||
@ -1519,7 +1557,6 @@ $readonlys['button[vcard]'] = true;
|
||||
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .= $this->js();
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .= "<script>window.focus()</script>";
|
||||
$GLOBALS['egw_info']['etemplate']['advanced_search'] = true;
|
||||
|
||||
@ -1681,6 +1718,11 @@ $readonlys['button[vcard]'] = true;
|
||||
xajax_doXMLHTTP("addressbook.uicontacts.ajax_setFileasOptions",prefix,given,middle,family,suffix,org);
|
||||
}
|
||||
|
||||
function add_whole_list(list)
|
||||
{
|
||||
xajax_doXMLHTTP("addressbook.uicontacts.ajax_add_whole_list",list);
|
||||
}
|
||||
|
||||
function setOptions(options_str)
|
||||
{
|
||||
var options = options_str.split("\\\\b");
|
||||
@ -1711,7 +1753,7 @@ $readonlys['button[vcard]'] = true;
|
||||
if (name)
|
||||
{
|
||||
document.location.href = "'.$GLOBALS['egw']->link('/index.php',array(
|
||||
'menuaction'=>'addressbook.uicontacts.index',
|
||||
'menuaction'=>$_GET['menuaction'],//'addressbook.uicontacts.index',
|
||||
'add_list'=>'',
|
||||
)).'"+encodeURIComponent(name)+"&owner="+owner;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -16,6 +16,7 @@ add a contact to this organisation addressbook de Einen Kontakt zu dieser Organi
|
||||
add a new contact addressbook de Neuen Kontakt anlegen
|
||||
add a new list addressbook de Neuen Verteiler hinzufügen
|
||||
add a single entry by passing the fields. addressbook de Hinzufügen eines einzelnen Eintrags durch Übergeben der Felder.
|
||||
add business email of whole distribution list? addressbook de E-Mail geschäftl. der kompletten Liste hinzufügen?
|
||||
add custom field addressbook de Benutzerdefiniertes Feld hinzufügen
|
||||
add to distribution list: addressbook de Hinzufügen zu Verteiler:
|
||||
added by synchronisation addressbook de Hinzugefügt über die Synchronisation
|
||||
|
@ -16,6 +16,7 @@ add a contact to this organisation addressbook en Add a contact to this organisa
|
||||
add a new contact addressbook en Add a new contact
|
||||
add a new list addressbook en Add a new list
|
||||
add a single entry by passing the fields. addressbook en Add a single entry by passing the fields.
|
||||
add business email of whole distribution list? addressbook en Add business email of whole distribution list?
|
||||
add custom field addressbook en Add Custom Field
|
||||
add to distribution list: addressbook en Add to distribution list:
|
||||
added by synchronisation addressbook en added by synchronisation
|
||||
@ -196,6 +197,7 @@ link title for contacts show addressbook en Link title for contacts show
|
||||
links addressbook en Links
|
||||
list all categories addressbook en List all categories
|
||||
list all customfields addressbook en List all customfields
|
||||
list already exists! addressbook en List already exists!
|
||||
list created addressbook en List created
|
||||
list creation failed, no rights! addressbook en List creation failed, no rights!
|
||||
load vcard addressbook en Load VCard
|
||||
|
@ -6,10 +6,14 @@
|
||||
<menupopup rows="1" cols="1" id="org_view" no_lang="1" statustext="Select a view" onchange="1" options="All contacts"/>
|
||||
</menulist>
|
||||
</template>
|
||||
<template id="addressbook.index.right" template="" lang="" group="0" version="1.3.001">
|
||||
<menulist>
|
||||
<menupopup label="Type" id="col_filter[tid]" statustext="Select addressbook type" onchange="1"/>
|
||||
</menulist>
|
||||
<template id="addressbook.index.right_add" template="" lang="" group="0" version="1.3.005">
|
||||
<hbox>
|
||||
<buttononly id="search" label="Advanced search" onclick="window.open(egw::link('/index.php','menuaction=addressbook.uicontacts.search'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;"/>
|
||||
<buttononly id="add" label="Add" statustext="Add a new contact" onclick="window.open(egw::link('/index.php','menuaction=addressbook.uicontacts.edit'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;" class="rightPadAdd"/>
|
||||
</hbox>
|
||||
<styles>
|
||||
.rightPadAdd { padding-right: 40px; }
|
||||
</styles>
|
||||
</template>
|
||||
<template id="addressbook.index.rows" template="" lang="" group="0" version="1.3.002">
|
||||
<grid width="100%">
|
||||
@ -185,7 +189,7 @@
|
||||
</row>
|
||||
<row disabled="1">
|
||||
<template id="addressbook.index.left"/>
|
||||
<template align="right" id="addressbook.index.right"/>
|
||||
<template align="right" id="addressbook.index.right_add"/>
|
||||
</row>
|
||||
<row>
|
||||
<nextmatch options="addressbook.index.rows" id="nm" span="all"/>
|
||||
|
Loading…
Reference in New Issue
Block a user