From 7c28c6c016c7e1d26a6017facc5984947ea63903 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 31 Jan 2014 10:21:58 +0000 Subject: [PATCH] make mailattachments of type message/rfc822 clickable on compose --- mail/inc/class.mail_bo.inc.php | 2 +- mail/inc/class.mail_compose.inc.php | 8 ++++++-- mail/js/app.js | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index c0d54ccb14..be177425b7 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -3999,7 +3999,7 @@ class mail_bo //error_log(__METHOD__.__LINE__.":$_uid,$_partID,$decode,$_folder".function_backtrace()); if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox()); //error_log(__METHOD__.__LINE__.":$_uid,$_partID,$decode,$_folder"); - if(empty($_partID)) { + if(empty($_partID)||$_partID=='null') { $uidsToFetch = new Horde_Imap_Client_Ids(); if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid; $uidsToFetch->add($_uid); diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index af2a6ed9f8..c3cf0cb680 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -328,6 +328,9 @@ class mail_compose $keysToDelete = array(); if (!empty($_content['attachments']['delete'])) { + //error_log(__METHOD__.__LINE__.':'.array2string($_content['attachments'])); + //error_log(__METHOD__.__LINE__.':'.array2string($_content['attachments']['delete'])); + $suppressSigOnTop = true; $toDelete = $_content['attachments']['delete']; unset($_content['attachments']['delete']); @@ -1723,7 +1726,8 @@ class mail_compose 'name' => $_name, 'type' => $_type, 'size' => $_size, - 'folder' => $_folder + 'folder' => $_folder, + 'tmp_name' => mail_ui::generateRowID($this->mail_bo->profileID, $_folder, $_uid), ); } @@ -1735,7 +1739,7 @@ class mail_compose //if(isset($_GET['size'])) $attachment['size'] = $_GET['size']; if(isset($_GET['type'])) $attachment['type'] = $_GET['type']; - error_log(__METHOD__.__LINE__.array2string($_GET)); + //error_log(__METHOD__.__LINE__.array2string($_GET)); if (isset($attachment['filename']) && parse_url($attachment['filename'],PHP_URL_SCHEME) == 'vfs') { egw_vfs::load_wrapper('vfs'); diff --git a/mail/js/app.js b/mail/js/app.js index e79cbdb17c..08f3e7c458 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1443,8 +1443,18 @@ app.classes.mail = AppJS.extend( } else { + // CALLED FOR COMPOSE; processedmail_id could hold several IDs seperated by comma attgrid = this.et2.getArrayMgr("content").getEntry('attachments')[widget.id.replace(/\[name\]/,'')]; - mailid = this.et2.getArrayMgr("content").getEntry('processedmail_id'); + var mailids = this.et2.getArrayMgr("content").getEntry('processedmail_id'); + var mailida = mailids.split(','); + mailid = mailida[widget.id.replace(/\[name\]/,'')]; + if (typeof attgrid.uid != 'undefined' && attgrid.uid && mailid.indexOf(attgrid.uid)==-1) + { + for (i=0; i-1) mailid = mailida[i]; + } + } } //console.log(mailid,attgrid.partID,attgrid.filename,attgrid.mimetype); var url = window.egw_webserverUrl+'/index.php?'; @@ -1539,7 +1549,7 @@ app.classes.mail = AppJS.extend( var attgrid; attgrid = this.et2.getArrayMgr("content").getEntry('attachments')[widget.id.replace(/\[name\]/,'')]; //console.log(attgrid); - if (attgrid.uid && attgrid.partID) + if (attgrid.uid && (attgrid.partID||attgrid.folder)) { this.displayAttachment(tag_info, widget, true); return;