From 2c680eb0963d5b71d79b4561b8b6352dfff7b1b0 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 6 Oct 2009 14:33:41 -0600 Subject: [PATCH] More fixes for HTML IFRAME display Heights are not correctly calculated for some HTML messages - this appears to be a browser issue. Adjusting the iframe size causes a re-render of the internal contents which causes the internal contents height to increase. This prevents display of content at the very bottom of the data - thus, we need to display scrollbars for these messages. Ugly, but necessary. Also, fix a few annoying IE issues with display heights/widths. --- imp/js/imp.js | 10 +++++++--- imp/lib/Mime/Viewer/Html.php | 2 +- imp/themes/screen-dimp.css | 1 + imp/themes/screen.css | 4 ++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/imp/js/imp.js b/imp/js/imp.js index 76c1bb883..b503d5255 100644 --- a/imp/js/imp.js +++ b/imp/js/imp.js @@ -30,7 +30,7 @@ document.observe('dom:loaded', function() { { var callback, imgs, elt = e.element().up('TABLE.mimeStatusMessage'), - iframe = elt.up().next('.htmlMsgData'), + iframe = elt.up().next('.htmlMsgData').down('IFRAME'), iframeid = iframe.readAttribute('id'), s = new Selector('[htmlimgblocked]'); @@ -91,10 +91,14 @@ document.observe('dom:loaded', function() { this.iframeResize(id); }; - IMP.iframeResize = function(id) + IMP.iframeResize = function(id, defer) { id = $(id); - id.setStyle({ height: id.contentWindow.document.lastChild.scrollHeight + 'px' }); + if (!defer && Prototype.Browser.IE) { + this.iframeResize.bind(this, id, true).defer(); + } else { + id.up().setStyle({ height: Math.max(id.contentWindow.document.body.scrollHeight, id.contentWindow.document.lastChild.scrollHeight) + 'px' }); + } }; // If menu is present, attach event handlers to folder switcher. diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 23a9a7f16..de2780680 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -118,7 +118,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html $uid = 'htmldata_' . uniqid(mt_rand()); $data['js'] = array('IMP.iframeInject("' . $uid . '", ' . Horde_Serialize::serialize($data['data'], Horde_Serialize::JSON, $this->_mimepart->getCharset()) . ')'); - $data['data'] = '' . + $data['data'] = '
' . Horde_Util::bufferOutput(array('Horde', 'addScriptFile'), 'imp.js', 'imp'); $data['type'] = 'text/html; charset=UTF-8'; diff --git a/imp/themes/screen-dimp.css b/imp/themes/screen-dimp.css index 606313124..bfd5f190e 100644 --- a/imp/themes/screen-dimp.css +++ b/imp/themes/screen-dimp.css @@ -591,6 +591,7 @@ div.dimpActionsCompose, div.dimpActionsMsg { .msgBody { background: #fff url("graphics/backhead_shadow.png") top repeat-x; padding: 7px 5px 5px; + overflow-x: auto; } .msgBody table td { padding: 0; diff --git a/imp/themes/screen.css b/imp/themes/screen.css index 138219dce..080614eb6 100644 --- a/imp/themes/screen.css +++ b/imp/themes/screen.css @@ -231,6 +231,10 @@ span.trashImg { width: 100%; overflow: hidden; } +.htmlMsgData IFRAME { + width: 100%; + height: 100%; +} /* Compose view */ .composebody { -- 2.11.0