diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php
index c863e50924..2019405ffa 100644
--- a/mail/inc/class.mail_compose.inc.php
+++ b/mail/inc/class.mail_compose.inc.php
@@ -2262,7 +2262,7 @@ class mail_compose
#error_log("(re)opened Connection");
}
// if copying mail to folder, or saving mail to infolog, we need to gather the needed information
- if (count($folder) > 0 || $_formData['to_infolog'] == 'on') {
+ if (count($folder) > 0 || $_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on') {
foreach((array)$this->sessionData['bcc'] as $address) {
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
foreach((array)$address_array as $addressObject) {
diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php
index 096de617b2..1ece95788e 100644
--- a/mail/inc/class.mail_ui.inc.php
+++ b/mail/inc/class.mail_ui.inc.php
@@ -1422,14 +1422,14 @@ unset($query['actions']);
}
if (count($attachments)==1)
{
- $imageHTMLBlock = self::createAttachmentBlock($attachments, $datarowid, $header['uid'], $_folder);
+ $imageHTMLBlock = self::createAttachmentBlock($attachments, $datarowid, $header['uid'], $_folder,true);
$imageTag = json_encode($attachments);
$image = html::image('mail','attach',$attachments[0]['name'].(!empty($attachments[0]['mimeType'])?' ('.$attachments[0]['mimeType'].')':''));
}
}
if (count($attachments)>1)
{
- $imageHTMLBlock = self::createAttachmentBlock($attachments, $datarowid, $header['uid'], $_folder);
+ $imageHTMLBlock = self::createAttachmentBlock($attachments, $datarowid, $header['uid'], $_folder,true);
$imageTag = json_encode($attachments);
$image = html::image('mail','attach',lang('%1 attachments',count($attachments)));
}
@@ -1721,9 +1721,10 @@ unset($query['actions']);
* @param string $rowID, rowid of the message
* @param int $uid, uid of the message
* @param string $mailbox, the mailbox identifier
- * @return string html or empty string
+ * @param boolean $_returnFullHTML, flag wether to return HTML or data array
+ * @return mixed array/string data array or html or empty string
*/
- static function createAttachmentBlock($attachments, $rowID, $uid, $mailbox)
+ static function createAttachmentBlock($attachments, $rowID, $uid, $mailbox,$_returnFullHTML=false)
{
$attachmentHTMLBlock='';
if (is_array($attachments) && count($attachments) > 0) {
@@ -1739,11 +1740,14 @@ unset($query['actions']);
//if (mb_convert_variables("ISO-8859-1","UTF-8",$value['name'])){echo "Juhu utf8 2 ISO\n";};
//echo $value['name']."\n";
$filename=htmlentities($value['name'], ENT_QUOTES, $detectedCharSet);
-
$attachmentHTML[$key]['filename']= ($value['name'] ? ( $filename ? $filename : $value['name'] ) : lang('(no subject)'));
+ $attachmentHTML[$key]['type']=$value['mimeType'];
$attachmentHTML[$key]['mimetype']=mime_magic::mime2label($value['mimeType']);
$attachmentHTML[$key]['size']=egw_vfs::hsize($value['size']);
$attachmentHTML[$key]['attachment_number']=$key;
+ $attachmentHTML[$key]['partID']=$value['partID'];
+ $attachmentHTML[$key]['winmailFlag']=$value['is_winmail'];
+ $attachmentHTML[$key]['classSaveAllPossiblyDisabled'] = "mail_DisplayNone";
switch(strtoupper($value['mimeType']))
{
@@ -1753,7 +1757,6 @@ unset($query['actions']);
'menuaction' => 'mail.mail_ui.displayMessage',
'id' => $rowID,
'part' => $value['partID'],
- 'mailbox' => base64_encode($mailbox),
'is_winmail' => $value['is_winmail']
);
$windowName = 'displayMessage_'. $rowID.'_'.$value['partID'];
@@ -1849,6 +1852,7 @@ unset($query['actions']);
// add save-all icon for first attachment
if (!$key && count($attachments) > 1)
{
+ $attachmentHTML[$key]['classSaveAllPossiblyDisabled'] = "";
foreach ($attachments as $ikey => $value)
{
//$rowID
@@ -1876,7 +1880,7 @@ unset($query['actions']);
}
$attachmentHTMLBlock .= "";
}
- return $attachmentHTMLBlock;
+ return ($_returnFullHTML?$attachmentHTMLBlock:$attachmentHTML);
}
/**
@@ -2807,18 +2811,25 @@ blockquote[type=cite] {
if (!empty($content))
{
error_log(__METHOD__.__LINE__.array2string($content));
- $content['divImportArea']['vfsfile'] = array(
- 'name' => egw_vfs::basename($content['divImportArea']['vfsfile']),
- 'type' => egw_vfs::mime_content_type($content['divImportArea']['vfsfile']),
- 'file' => egw_vfs::PREFIX.$content['divImportArea']['vfsfile'],
- 'size' => filesize(egw_vfs::PREFIX.$content['divImportArea']['vfsfile']),
- );
+ if ($content['divImportArea']['vfsfile'])
+ {
+ $file = $content['divImportArea']['vfsfile'] = array(
+ 'name' => egw_vfs::basename($content['divImportArea']['vfsfile']),
+ 'type' => egw_vfs::mime_content_type($content['divImportArea']['vfsfile']),
+ 'file' => egw_vfs::PREFIX.$content['divImportArea']['vfsfile'],
+ 'size' => filesize(egw_vfs::PREFIX.$content['divImportArea']['vfsfile']),
+ );
+ }
+ else
+ {
+ $file = $content['divImportArea']['uploadForImport'];
+ }
$destination = $content['divImportArea']['FOLDER'][0];
$importID = mail_bo::getRandomString();
$importFailed = false;
try
{
- $messageUid = $this->importMessageToFolder($content['divImportArea']['vfsfile'],$destination,$importID);
+ $messageUid = $this->importMessageToFolder($file,$destination,$importID);
$linkData = array
(
'id' => $this->createRowID($destination, $messageUid, true),
diff --git a/mail/js/app.js b/mail/js/app.js
index 7b80d82f53..665c695a86 100644
--- a/mail/js/app.js
+++ b/mail/js/app.js
@@ -1133,6 +1133,156 @@ app.mail = AppJS.extend(
console.log(this, arguments);
},
+ /**
+ *
+ */
+ displayAttachment: function(tag_info, widget)
+ {
+ //console.log(this, arguments, widget);
+ var mailid = this.et2.getArrayMgr("content").getEntry('mail_id');
+ var attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[filename\]/,'')];
+ //console.log(mailid,attgrid.partID,attgrid.filename,attgrid.mimetype);
+ var url = window.egw_webserverUrl+'/index.php?';
+ var width;
+ var height;
+ var windowName ='mail';
+ switch(attgrid.type.toUpperCase())
+ {
+ case 'MESSAGE/RFC822':
+ url += 'menuaction=mail.mail_ui.displayMessage'; // todo compose for Draft folder
+ url += '&id='+mailid;
+ url += '&part='+attgrid.partID;
+ url += '&is_winmail='+attgrid.winmailFlag;
+ windowName = windowName+'displayMessage_'+mailid+'_'+attgrid.partID;
+ width = 870;
+ height = egw_getWindowOuterHeight();
+ break;
+ case 'IMAGE/JPEG':
+ case 'IMAGE/PNG':
+ case 'IMAGE/GIF':
+ case 'IMAGE/BMP':
+ case 'APPLICATION/PDF':
+ case 'TEXT/PLAIN':
+ case 'TEXT/HTML':
+ case 'TEXT/DIRECTORY':
+/*
+ $sfxMimeType = $value['mimeType'];
+ $buff = explode('.',$value['name']);
+ $suffix = '';
+ if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
+ if (!empty($suffix)) $sfxMimeType = mime_magic::ext2mime($suffix);
+ if (strtoupper($sfxMimeType) == 'TEXT/VCARD' || strtoupper($sfxMimeType) == 'TEXT/X-VCARD')
+ {
+ $attachments[$key]['mimeType'] = $sfxMimeType;
+ $value['mimeType'] = strtoupper($sfxMimeType);
+ }
+*/
+ case 'TEXT/X-VCARD':
+ case 'TEXT/VCARD':
+ case 'TEXT/CALENDAR':
+ case 'TEXT/X-VCALENDAR':
+ url += 'menuaction=mail.mail_ui.getAttachment'; // todo compose for Draft folder
+ url += '&id='+mailid;
+ url += '&part='+attgrid.partID;
+ url += '&is_winmail='+attgrid.winmailFlag;
+ windowName = windowName+'displayAttachment_'+mailid+'_'+attgrid.partID;
+ var reg = '800x600';
+ var reg2;
+ // handle calendar/vcard
+ if (attgrid.type.toUpperCase()=='TEXT/CALENDAR')
+ {
+ windowName = 'maildisplayEvent_'+mailid+'_'+attgrid.partID;
+ reg2 = egw.link_get_registry('calendar');
+ if (typeof app_registry['view'] != 'undefined' && typeof app_registry['view_popup'] != 'undefined' )
+ {
+ reg = app_registry['view_popup'];
+ }
+ }
+ if (attgrid.type.toUpperCase()=='TEXT/X-VCARD' || attgrid.type.toUpperCase()=='TEXT/VCARD')
+ {
+ windowName = 'maildisplayContact_'+mailid+'_'+attgrid.partID;
+ reg2 = egw.link_get_registry('addressbook');
+ if (typeof app_registry['add'] != 'undefined' && typeof app_registry['add_popup'] != 'undefined' )
+ {
+ reg = app_registry['add_popup'];
+ }
+ }
+ var w_h =reg.split('x');
+ width = w_h[0];
+ height = w_h[1];
+ break;
+ default:
+ url += 'menuaction=mail.mail_ui.getAttachment'; // todo compose for Draft folder
+ url += '&id='+mailid;
+ url += '&part='+attgrid.partID;
+ url += '&is_winmail='+attgrid.winmailFlag;
+ windowName = windowName+'displayAttachment_'+mailid+'_'+attgrid.partID;
+ width = 870;
+ height = 600;
+ //document.location = url;
+ //return;
+ }
+ egw_openWindowCentered(url,windowName,width,height);
+ },
+
+ saveAttachment: function(tag_info, widget)
+ {
+ //console.log(this, arguments);
+ var mailid = this.et2.getArrayMgr("content").getEntry('mail_id');
+ var attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[save\]/,'')];
+ //console.log(mailid,attgrid.partID,attgrid.filename,attgrid.mimetype);
+ var url = window.egw_webserverUrl+'/index.php?';
+ var width;
+ var height;
+ var windowName ='mail';
+ url += 'menuaction=mail.mail_ui.getAttachment'; // todo compose for Draft folder
+ url += '&mode=save';
+ url += '&id='+mailid;
+ url += '&part='+attgrid.partID;
+ url += '&is_winmail='+attgrid.winmailFlag;
+ document.location = url;
+ },
+
+ saveAttachmentToVFS: function(tag_info, widget)
+ {
+ //console.log(this, arguments);
+ var mailid = this.et2.getArrayMgr("content").getEntry('mail_id');
+ var attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[saveAsVFS\]/,'')];
+ //console.log(mailid,attgrid.partID,attgrid.filename,attgrid.mimetype);
+ var url = window.egw_webserverUrl+'/index.php?';
+ var width=640;
+ var height=570;
+ var windowName ='mail';
+ url += 'menuaction=filemanager.filemanager_select.select'; // todo compose for Draft folder
+ url += '&mode=saveas';
+ url += '&id='+mailid+'::'+attgrid.partID+'::'+attgrid.winmailFlag;
+ url += '&name='+attgrid.filename;
+ url += '&type='+attgrid.type.toLowerCase();
+ url += '&method=mail.mail_ui.vfsSaveAttachment';
+ url += '&label='+egw.lang('Save');
+ egw_openWindowCentered(url,windowName,width,height);
+ },
+
+ saveAllAttachmentsToVFS: function(tag_info, widget)
+ {
+ var mailid = this.et2.getArrayMgr("content").getEntry('mail_id');
+ var attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments');
+ console.log(mailid,attgrid);
+ var url = window.egw_webserverUrl+'/index.php?';
+ var width=640;
+ var height=570;
+ var windowName ='mail';
+ url += 'menuaction=filemanager.filemanager_select.select'; // todo compose for Draft folder
+ url += '&mode=select-dir';
+ url += '&method=mail.mail_ui.vfsSaveAttachment';
+ url += '&label='+egw.lang('Save all');
+ for (i=0;i
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+