More fixes for HTML IFRAME display
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 6 Oct 2009 20:33:41 +0000 (14:33 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 6 Oct 2009 21:16:34 +0000 (15:16 -0600)
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
imp/lib/Mime/Viewer/Html.php
imp/themes/screen-dimp.css
imp/themes/screen.css

index 76c1bb8..b503d52 100644 (file)
@@ -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.
index 23a9a7f..de27806 100644 (file)
@@ -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'] = '<IFRAME class="htmlMsgData" id="' . $uid . '" src="javascript:false" frameborder="0"></IFRAME>' .
+        $data['data'] = '<DIV class="htmlMsgData"><IFRAME id="' . $uid . '" src="javascript:false" frameborder="0"></IFRAME></DIV>' .
             Horde_Util::bufferOutput(array('Horde', 'addScriptFile'), 'imp.js', 'imp');
         $data['type'] = 'text/html; charset=UTF-8';
 
index 6063131..bfd5f19 100644 (file)
@@ -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;
index 138219d..080614e 100644 (file)
@@ -231,6 +231,10 @@ span.trashImg {
     width: 100%;
     overflow: hidden;
 }
+.htmlMsgData IFRAME {
+    width: 100%;
+    height: 100%;
+}
 
 /* Compose view */
 .composebody {