* eMail: feature to attach the VCard of the current user to every new mail sent via UI

This commit is contained in:
Klaus Leithoff 2011-12-12 17:24:52 +00:00
parent eb131f6123
commit 4431a978f5
5 changed files with 28 additions and 3 deletions

View File

@ -68,7 +68,7 @@
*
* @param array $_formData fields of the compose form (to,cc,bcc,reply_to,subject,body,priority,signature), plus data of the file (name,file,size,type)
*/
function addAttachment($_formData)
function addAttachment($_formData,$eliminateDoubleAttachments=false)
{
$attachfailed = false;
// to gard against exploits the file must be either uploaded or be in the temp_dir
@ -83,6 +83,12 @@
$alert_msg = $e->getMessage();
}
if ($eliminateDoubleAttachments == true)
foreach ((array)$this->sessionData['attachments'] as $k =>$attach)
if ($attach['name'] && $attach['name'] == $_formData['name'] &&
strtolower($_formData['type'])== strtolower($attach['type']) &&
stripos($_formData['file'],'vfs://') !== false) return;
if ($attachfailed === false)
{
$buffer = array(

View File

@ -537,6 +537,15 @@ class felamimail_hooks
'default'=> 0,
'admin' => False,
),
'attachVCardAtCompose' => array(
'type' => 'select',
'label' => 'attach users VCard at compose to every new mail',
'name' => 'attachVCardAtCompose',
'values' => $no_yes,
'xmlrpc' => True,
'default'=> 0,
'admin' => False,
),
'sieveScriptName' => array(
'type' => 'input',
'label' => 'sieve script name',

View File

@ -221,6 +221,13 @@
// read the data from session
// all values are empty for a new compose window
$sessionData = $this->bocompose->getSessionData();
$alwaysAttachVCardAtCompose = false; // we use this to eliminate double attachments, if users VCard is already present/attached
if ((isset($this->bocompose->preferencesArray['attachVCardAtCompose']) &&
$this->bocompose->preferencesArray['attachVCardAtCompose']))
{
$alwaysAttachVCardAtCompose = true;
$_REQUEST['preset']['file'][] = "vfs://default/apps/addressbook/".$GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')."/.entry";
}
if (is_array($_REQUEST['preset']))
{
//_debug_array($_REQUEST);
@ -251,7 +258,8 @@
{
$names = (array)$_REQUEST['preset']['name'];
$types = (array)$_REQUEST['preset']['type'];
foreach((array)$_REQUEST['preset']['file'] as $k => $path)
$files = (array)$_REQUEST['preset']['file'];
foreach($files as $k => $path)
{
if (parse_url($path,PHP_URL_SCHEME == 'vfs'))
{
@ -288,7 +296,7 @@
{
continue;
}
$this->bocompose->addAttachment($formData);
$this->bocompose->addAttachment($formData,($alwaysAttachVCardAtCompose?true:false));
}
$sessionData = $this->bocompose->getSessionData();
}

View File

@ -20,6 +20,7 @@ additional info felamimail de Zusätzliche Info
address book felamimail de Adressbuch
address book search felamimail de Adressbuch durchsuchen
after message body felamimail de nach dem Editorfenster
attach users VCard at compose to every new mail felamimail de füge die VCard des aktiven Benutzers an jede neue eMail an
all address books felamimail de Alle Adressbücher
all folders felamimail de Alle Ordner
all messages in folder felamimail de Alle Nachrichten im Ordner

View File

@ -20,6 +20,7 @@ additional info felamimail en Additional info
address book felamimail en Address Book
address book search felamimail en Address Book search
after message body felamimail en After message body
attach users VCard at compose to every new mail felamimail en attach users VCard at compose to every new mail
all address books felamimail en All address books
all folders felamimail en All folders
all messages in folder felamimail en All messages in folder