mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
* Mail: take opened compose dialogs into account when trying to forward attachment, share files into mail or vcard attachment from addressbook
This commit is contained in:
parent
7ca4b49878
commit
0fb8c47238
@ -770,7 +770,7 @@ app.classes.addressbook = AppJS.extend(
|
|||||||
adb_mail_vcard: function(_action, _elems)
|
adb_mail_vcard: function(_action, _elems)
|
||||||
{
|
{
|
||||||
var link = {'preset[type]':[], 'preset[file]':[]};
|
var link = {'preset[type]':[], 'preset[file]':[]};
|
||||||
var content = {vcard:{file:[], type:[]}};
|
var content = {data:{files:{file:[], type:[]}}};
|
||||||
var nm = this.et2.getWidgetById('nm');
|
var nm = this.et2.getWidgetById('nm');
|
||||||
if(fetchAll(_elems, nm, jQuery.proxy(function(ids) {
|
if(fetchAll(_elems, nm, jQuery.proxy(function(ids) {
|
||||||
this.adb_mail_vcard(_action, ids.map(function(num) {return {id:'addressbook::'+num};}));
|
this.adb_mail_vcard(_action, ids.map(function(num) {return {id:'addressbook::'+num};}));
|
||||||
@ -786,8 +786,8 @@ app.classes.addressbook = AppJS.extend(
|
|||||||
idToUse = idToUseArray[1];
|
idToUse = idToUseArray[1];
|
||||||
link['preset[type]'].push("text/vcard; charset="+(egw.preference('vcard_charset', 'addressbook') || 'utf-8'));
|
link['preset[type]'].push("text/vcard; charset="+(egw.preference('vcard_charset', 'addressbook') || 'utf-8'));
|
||||||
link['preset[file]'].push("vfs://default/apps/addressbook/"+idToUse+"/.entry");
|
link['preset[file]'].push("vfs://default/apps/addressbook/"+idToUse+"/.entry");
|
||||||
content.vcard.file.push("vfs://default/apps/addressbook/"+idToUse+"/.entry");
|
content.data.files.file.push("vfs://default/apps/addressbook/"+idToUse+"/.entry");
|
||||||
content.vcard.type.push("text/vcard; charset="+(egw.preference('vcard_charset', 'addressbook') || 'utf-8'));
|
content.data.files.type.push("text/vcard; charset="+(egw.preference('vcard_charset', 'addressbook') || 'utf-8'));
|
||||||
}
|
}
|
||||||
egw.openWithinWindow("mail", "setCompose", content, link, /mail.mail_compose.compose/);
|
egw.openWithinWindow("mail", "setCompose", content, link, /mail.mail_compose.compose/);
|
||||||
|
|
||||||
@ -854,7 +854,7 @@ app.classes.addressbook = AppJS.extend(
|
|||||||
|
|
||||||
//remove comma in personal as it will confilict with mail content comma seperator in the process
|
//remove comma in personal as it will confilict with mail content comma seperator in the process
|
||||||
personal = personal.replace(/,/g,'');
|
personal = personal.replace(/,/g,'');
|
||||||
|
|
||||||
if(email_business)
|
if(email_business)
|
||||||
{
|
{
|
||||||
emails.push((personal?personal+' <':'')+email_business+(personal?'>':''));
|
emails.push((personal?personal+' <':'')+email_business+(personal?'>':''));
|
||||||
|
@ -482,7 +482,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
|||||||
}
|
}
|
||||||
len += tmp.length;
|
len += tmp.length;
|
||||||
}
|
}
|
||||||
else
|
else if(_extra[i])
|
||||||
{
|
{
|
||||||
len += _extra[i].length;
|
len += _extra[i].length;
|
||||||
}
|
}
|
||||||
|
@ -260,13 +260,15 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
if (typeof attachments == 'undefined') attachments = this.get_clipboard_files();
|
if (typeof attachments == 'undefined') attachments = this.get_clipboard_files();
|
||||||
if (!params || typeof params != 'object') params = {};
|
if (!params || typeof params != 'object') params = {};
|
||||||
if (!(attachments instanceof Array)) attachments = [ attachments ];
|
if (!(attachments instanceof Array)) attachments = [ attachments ];
|
||||||
|
var content = {data:{files:{file:[]}}};
|
||||||
for(var i=0; i < attachments.length; i++)
|
for(var i=0; i < attachments.length; i++)
|
||||||
{
|
{
|
||||||
params['preset[file]['+i+']'] = 'vfs://default'+attachments[i];
|
params['preset[file]['+i+']'] = 'vfs://default'+attachments[i];
|
||||||
|
content.data.files.file.push('vfs://default'+attachments[i]);
|
||||||
}
|
}
|
||||||
// always open compose in html mode, as attachment links look a lot nicer in html
|
// always open compose in html mode, as attachment links look a lot nicer in html
|
||||||
params.mimeType = 'html';
|
params.mimeType = 'html';
|
||||||
egw.open('', 'mail', 'add', params);
|
return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,6 +313,29 @@ class mail_compose
|
|||||||
//error_log(__METHOD__.__LINE__.array2string($_content).function_backtrace());
|
//error_log(__METHOD__.__LINE__.array2string($_content).function_backtrace());
|
||||||
$_contentHasSigID = $_content?array_key_exists('mailidentity',(array)$_content):false;
|
$_contentHasSigID = $_content?array_key_exists('mailidentity',(array)$_content):false;
|
||||||
$_contentHasMimeType = $_content? array_key_exists('mimeType',(array)$_content):false;
|
$_contentHasMimeType = $_content? array_key_exists('mimeType',(array)$_content):false;
|
||||||
|
|
||||||
|
// fetch appendix data which is an assistance input value consisiting of json data
|
||||||
|
if ($_content['appendix_data'])
|
||||||
|
{
|
||||||
|
$appendix_data = json_decode($_content['appendix_data'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($appendix_data['emails'])
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$attched_uids = $this->_get_uids_as_attachments($appendix_data['emails']['ids'], $_content['serverID']);
|
||||||
|
if (is_array($attched_uids))
|
||||||
|
{
|
||||||
|
$_content['attachments'] = array_merge_recursive((array)$_content['attachments'], $attched_uids);
|
||||||
|
}
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
Framework::message($ex->getMessage(), 'error');
|
||||||
|
}
|
||||||
|
$suppressSigOnTop = true;
|
||||||
|
unset($appendix_data);
|
||||||
|
$_content['appendix_data'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['reply_id'])) $replyID = $_GET['reply_id'];
|
if (isset($_GET['reply_id'])) $replyID = $_GET['reply_id'];
|
||||||
if (!$replyID && isset($_GET['id'])) $replyID = $_GET['id'];
|
if (!$replyID && isset($_GET['id'])) $replyID = $_GET['id'];
|
||||||
|
|
||||||
@ -782,14 +805,13 @@ class mail_compose
|
|||||||
// do not double insert a signature on a server roundtrip
|
// do not double insert a signature on a server roundtrip
|
||||||
if ($buttonClicked) $suppressSigOnTop = true;
|
if ($buttonClicked) $suppressSigOnTop = true;
|
||||||
|
|
||||||
// On submit reads vcard_from_ab widget's value and addes them as attachments.
|
// On submit reads external_vcard widget's value and addes them as attachments.
|
||||||
// this happens when we send vcards from addressbook to an opened compose
|
// this happens when we send vcards from addressbook to an opened compose
|
||||||
// dialog.
|
// dialog.
|
||||||
if ($_content['vcard_from_ab'])
|
if ($appendix_data['files'])
|
||||||
{
|
{
|
||||||
$vcard = json_decode($_content['vcard_from_ab'], true);
|
$_REQUEST['preset']['file'] = $appendix_data['files']['file'];
|
||||||
$_REQUEST['preset']['file'] = $vcard['file'];
|
$_REQUEST['preset']['type'] = $appendix_data['files']['type'];
|
||||||
$_REQUEST['preset']['type'] = $vcard['type'];
|
|
||||||
$suppressSigOnTop = true;
|
$suppressSigOnTop = true;
|
||||||
unset($_content['attachments']);
|
unset($_content['attachments']);
|
||||||
$this->addPresetFiles($content, $insertSigOnTop, true);
|
$this->addPresetFiles($content, $insertSigOnTop, true);
|
||||||
@ -3810,4 +3832,40 @@ class mail_compose
|
|||||||
throw new $e;
|
throw new $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds attachments from provided UIDs and add them to sessionData
|
||||||
|
*
|
||||||
|
* @param string|array $_ids series of message ids
|
||||||
|
* @param int $_serverID compose current profileID
|
||||||
|
*
|
||||||
|
* @return array returns an array of attachments
|
||||||
|
*
|
||||||
|
* @throws Exception throws exception on cross account attempt
|
||||||
|
*/
|
||||||
|
function _get_uids_as_attachments ($_ids, $_serverID)
|
||||||
|
{
|
||||||
|
$ids = is_array($_ids) ? $_ids : explode(',', $_ids);
|
||||||
|
if (is_array($ids) && $_serverID)
|
||||||
|
{
|
||||||
|
$parts = mail_ui::splitRowID($ids[0]);
|
||||||
|
if ($_serverID != $parts['profileID'])
|
||||||
|
{
|
||||||
|
throw new Exception(lang('Cross account forward attachment is not allowed!'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($ids as &$id)
|
||||||
|
{
|
||||||
|
$parts = mail_ui::splitRowID($id);
|
||||||
|
$mail_bo = $this->mail_bo;
|
||||||
|
$mail_bo->openConnection();
|
||||||
|
$mail_bo->reopen($parts['folder']);
|
||||||
|
$headers = $mail_bo->getMessageEnvelope($parts['msgUID'], null,false,$parts['folder']);
|
||||||
|
$this->addMessageAttachment($parts['msgUID'], null, $parts['folder'],
|
||||||
|
$mail_bo->decode_header(($headers['SUBJECT']?$headers['SUBJECT']:lang('no subject'))).'.eml',
|
||||||
|
'MESSAGE/RFC822', $headers['SIZE'] ? $headers['SIZE'] : lang('unknown'));
|
||||||
|
$mail_bo->closeConnection();
|
||||||
|
}
|
||||||
|
return $this->sessionData['attachments'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,6 +638,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
for(var j = 1; j < _elems.length; j++)
|
for(var j = 1; j < _elems.length; j++)
|
||||||
settings.id = settings.id + ',' + _elems[j].id;
|
settings.id = settings.id + ',' + _elems[j].id;
|
||||||
}
|
}
|
||||||
|
return egw.openWithinWindow("mail", "setCompose", {data:{emails:{ids:settings.id}}}, settings, /mail.mail_compose.compose/);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -689,10 +690,10 @@ app.classes.mail = AppJS.extend(
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (field == 'vcard')
|
if (field == 'data')
|
||||||
{
|
{
|
||||||
var vcard_from_ab = compose_et2[0].widgetContainer.getWidgetById('vcard_from_ab');
|
var w = compose_et2[0].widgetContainer.getWidgetById('appendix_data');
|
||||||
vcard_from_ab.set_value(JSON.stringify(content.vcard));
|
w.set_value(JSON.stringify(content[field]));
|
||||||
return compose_et2[0].widgetContainer._inst.submit();
|
return compose_et2[0].widgetContainer._inst.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<checkbox statustext="check to receive a notification when the message is read (note: not all clients support this and/or the receiver may not authorize the notification)" id="disposition" options="on,off"/>
|
<checkbox statustext="check to receive a notification when the message is read (note: not all clients support this and/or the receiver may not authorize the notification)" id="disposition" options="on,off"/>
|
||||||
<checkbox statustext="check to sign the message on send" id="smime_sign" options="on,off"/>
|
<checkbox statustext="check to sign the message on send" id="smime_sign" options="on,off"/>
|
||||||
<checkbox statustext="check to encrypt the message on send" id="smime_encrypt" options="on,off"/>
|
<checkbox statustext="check to encrypt the message on send" id="smime_encrypt" options="on,off"/>
|
||||||
<textbox id="vcard_from_ab"/>
|
<textbox id="appendix_data"/>
|
||||||
<passwd id="smime_passphrase"/>
|
<passwd id="smime_passphrase"/>
|
||||||
<taglist id="to_integrate_ids"/>
|
<taglist id="to_integrate_ids"/>
|
||||||
<menulist>
|
<menulist>
|
||||||
|
Loading…
Reference in New Issue
Block a user