Fix re-positioning mail preview content according to its visible sibilings

This commit is contained in:
Hadi Nategh 2014-10-31 10:49:22 +00:00
parent f3dd3c2c0b
commit 795131df35
3 changed files with 24 additions and 30 deletions

View File

@ -758,31 +758,37 @@ app.classes.mail = AppJS.extend(
//dataElem.data is populated, when available with fromaddress(string),toaddress(string),additionaltoaddress(array),ccaddress (array)
var dataElem = {data:{subject:"",fromaddress:"",toaddress:"",ccaddress:"",date:"",attachmentsBlock:""}};
var attachmentArea = this.et2.getWidgetById('previewAttachmentArea');
var previewContainer = this.et2.getWidgetById('mailPreviewContainer');
if(typeof selected != 'undefined' && selected.length == 1)
{
var _id = this.mail_fetchCurrentlyFocussed(selected);
dataElem = jQuery.extend(dataElem, egw.dataGetUIDdata(_id));
}
var $preview_iframe = jQuery('#mail-index_mailPreviewContainer');
// Re calculate the position of preview iframe according to its visible sibilings
var set_prev_iframe_top = function ()
{
// Need to make sure that the iframe is fullyLoad before calculation
window.setTimeout(function(){
var lastEl = $preview_iframe.prev().prev();
// Top offset of preview iframe calculated from top level
var iframeTop = $preview_iframe.offset().top;
while (lastEl.css('display') === "none")
{
lastEl = lastEl.prev();
}
var offset = iframeTop - (lastEl.offset().top + lastEl.height()) || 130; // fallback to 130 px if can not calculate new top
// preview iframe parent has position absolute, therefore need to calculate the top via position
$preview_iframe.css ('top', $preview_iframe.position().top - offset + 10);
}, 50);
}
if (attachmentArea && typeof _id != 'undefined' && _id !='' && typeof dataElem !== 'undefined')
{
this.et2.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea');
if (!dataElem.data.attachmentsBlock)
{
if (!dataElem.data.ccaddress)
{
previewContainer.set_class('previewNoAttachment');
}
else
{
previewContainer.set_class('previewNoAttachmentButCC');
}
}
else
{
jQuery(previewContainer.node).removeClass('previewNoAttachment previewNoAttachmentButCC');
}
// If there is content to show recalculate the size
set_prev_iframe_top();
}
else
{

View File

@ -502,12 +502,6 @@ div.mail-compose_fileselector {
left: 3px;
right: 0;
}
#mail-index_mailPreviewContainer.previewNoAttachment {
top: 51px;
}
#mail-index_mailPreviewContainer.previewNoAttachmentButCC{
top: 67px;
}
#mail-index_previewAttachmentArea {
background-color:#f0f0f0;
max-height: 1.6em;

View File

@ -502,12 +502,6 @@ div.mail-compose_fileselector {
left: 3px;
right: 0;
}
#mail-index_mailPreviewContainer.previewNoAttachment {
top: 51px;
}
#mail-index_mailPreviewContainer.previewNoAttachmentButCC {
top: 67px;
}
#mail-index_previewAttachmentArea {
background-color: #f0f0f0;
max-height: 1.6em;