diff --git a/felamimail/inc/class.uidisplay.inc.php b/felamimail/inc/class.uidisplay.inc.php index c56c76c84e..b303742943 100644 --- a/felamimail/inc/class.uidisplay.inc.php +++ b/felamimail/inc/class.uidisplay.inc.php @@ -478,16 +478,10 @@ // --> use it to send the mail as data uri if (!isset($_GET['printable'])) { -/* - $bodyParts = $this->bofelamimail->getMessageBody($this->uid,'',$partID); + $mailData = $this->get_load_email_data($this->uid, $partID); - $frameHtml = base64_encode( - $this->get_email_header(). - $this->showBody($this->getdisplayableBody($bodyParts), false)); - $iframe_url = egw::link('/phpgwapi/js/egw_instant_load.html').'" onload="if (this.contentWindow && typeof this.contentWindow.egw_instant_load != \'undefined\') this.contentWindow.egw_instant_load(\''.$frameHtml.'\', true);'; - - $this->t->set_var('url_displayBody', $iframe_url); -*/ + $this->t->set_var('url_displayBody', $mailData['src']."\" onload=\"".$mailData['onload']); + $this->t->set_var('mail_dataScript', $mailData['script']); } // attachments @@ -989,6 +983,48 @@ '; } + function get_load_email_data($uid, $partID) + { + $bodyParts = $this->bofelamimail->getMessageBody($uid, '', $partID); + + // Compose the content of the frame + $frameHtml = + $this->get_email_header(). + $this->showBody($this->getdisplayableBody($bodyParts), false); + + // Calculate the hash of that E-Mail for function identification + $hash = md5($frameHtml); + + // The JS function name consists of a prefix and the hash suffix + $funcname = "load_email_$hash"; + + // Compose the script code + $script = +""; + + // Compose the code for the onload event + $onload = "if (typeof $funcname != 'undefined'){ $funcname(this); this.onload = function() {return false;}}"; + + // Return all the stuff + return array( + "script" => $script, + "onload" => $onload, + "src" => egw::link("/phpgwapi/js/egw_instant_load.html") + ); + } + static function emailAddressToHTML($_emailAddress, $_organisation='', $allwaysShowMailAddress=false, $showAddToAdrdessbookLink=true, $decode=true) { //_debug_array($_emailAddress); // create some nice formated HTML for senderaddress diff --git a/felamimail/inc/class.uiwidgets.inc.php b/felamimail/inc/class.uiwidgets.inc.php index bae769e215..2aa959a232 100644 --- a/felamimail/inc/class.uiwidgets.inc.php +++ b/felamimail/inc/class.uiwidgets.inc.php @@ -610,7 +610,7 @@ class uiwidgets } else $sent_not = ""; if ( $sent_not != "" && strpos( array2string($flags),'Seen')===false) { - $jscall= " onload='javascript:sendNotifyMS(".$headerData['uid'].")'"; + $jscall= "sendNotifyMS(".$headerData['uid']."); "; } } //if (strpos( array2string($flags),'Seen')===false) $this->bofelamimail->flagMessages('read', $headerData['uid']); @@ -722,19 +722,19 @@ class uiwidgets ); $iframe_url = $GLOBALS['egw']->link('/index.php',$linkData); + $script = ""; // if browser supports data uri: ie<8 does NOT and ie>=8 does NOT support html as content :-( // --> use it to send the mail as data uri if (!isset($_GET['printable'])) { -/* - $bodyParts = $this->bofelamimail->getMessageBody($headerData['uid'],'',$partID); $uidisplay = CreateObject('felamimail.uidisplay'); + $uidisplay->uid = $headerData['uid']; + $uidisplay->mailbox = $_folderName; + $mailData = $uidisplay->get_load_email_data($headerData['uid'], $partID); - $frameHtml = base64_encode( - $uidisplay->get_email_header(). - $uidisplay->showBody($uidisplay->getdisplayableBody($bodyParts), false)); - $iframe_url = egw::link('/phpgwapi/js/egw_instant_load.html').'" onload="if (this.contentWindow && typeof this.contentWindow.egw_instant_load != \'undefined\') this.contentWindow.egw_instant_load(\''.$frameHtml.'\', true);'; -*/ + $iframe_url = $mailData['src']; + $jscall .= $mailData['onload']; + $script = $mailData['script']; } //_debug_array($GLOBALS['egw']->link('/index.php',$linkData)); @@ -757,7 +757,8 @@ class uiwidgets - diff --git a/felamimail/templates/default/view_message.tpl b/felamimail/templates/default/view_message.tpl index 7595402a62..a1a1e4feb1 100644 --- a/felamimail/templates/default/view_message.tpl +++ b/felamimail/templates/default/view_message.tpl @@ -14,6 +14,7 @@ self.focus(); {header}
+ {mail_dataScript}
@@ -37,6 +38,7 @@ self.focus(); {header}
+ {mail_dataScript}
diff --git a/phpgwapi/js/egw_instant_load.html b/phpgwapi/js/egw_instant_load.html index 4e4c8ca4f6..15807c2a96 100644 --- a/phpgwapi/js/egw_instant_load.html +++ b/phpgwapi/js/egw_instant_load.html @@ -1,9 +1,5 @@ - EGroupware [Loading Data] @@ -11,57 +7,8 @@ function in its "onload" event.