some fixed layout for mail-display in popup

This commit is contained in:
Klaus Leithoff 2013-06-07 13:58:17 +00:00
parent 1b9c105198
commit 69665af373
5 changed files with 232 additions and 11 deletions

View File

@ -3066,6 +3066,7 @@ class mail_bo
$_uids = explode(',', $queryString); $_uids = explode(',', $queryString);
$uidsCached = (is_array($summary[$this->icServer->ImapServerId][$_folder])?array_keys($summary[$this->icServer->ImapServerId][$_folder]):array()); $uidsCached = (is_array($summary[$this->icServer->ImapServerId][$_folder])?array_keys($summary[$this->icServer->ImapServerId][$_folder]):array());
$toFetch = array_diff($_uids,(array)$uidsCached); $toFetch = array_diff($_uids,(array)$uidsCached);
$saveNeeded = false;
if (!empty($toFetch)) if (!empty($toFetch))
{ {
//error_log(__METHOD__.__LINE__.':'.$GLOBALS['egw_info']['user']['account_id'].'::'.$this->icServer->ImapServerId.'::'. $_folder.':QS:'.$queryString.'->'.array2string(array_keys((array)$summary[$this->icServer->ImapServerId][$_folder]))); //error_log(__METHOD__.__LINE__.':'.$GLOBALS['egw_info']['user']['account_id'].'::'.$this->icServer->ImapServerId.'::'. $_folder.':QS:'.$queryString.'->'.array2string(array_keys((array)$summary[$this->icServer->ImapServerId][$_folder])));
@ -3078,6 +3079,7 @@ class mail_bo
//error_log(__METHOD__.__LINE__.'::'.$sum['UID'].':'.$sum['SUBJECT']); //error_log(__METHOD__.__LINE__.'::'.$sum['UID'].':'.$sum['SUBJECT']);
$summary[$this->icServer->ImapServerId][$_folder][$sum['UID']]=$sum; $summary[$this->icServer->ImapServerId][$_folder][$sum['UID']]=$sum;
} }
$saveNeeded = true;
} }
foreach ($_uids as $_uid) foreach ($_uids as $_uid)
{ {
@ -3100,9 +3102,10 @@ class mail_bo
$result = $this->icServer->getSummary($_uid, $byUid); $result = $this->icServer->getSummary($_uid, $byUid);
$summary[$this->icServer->ImapServerId][$_folder][$_uid] = $result[0]; $summary[$this->icServer->ImapServerId][$_folder][$_uid] = $result[0];
$rv[] = $summary[$this->icServer->ImapServerId][$_folder][$_uid]; $rv[] = $summary[$this->icServer->ImapServerId][$_folder][$_uid];
$saveNeeded = true;
} }
} }
egw_cache::setCache(egw_cache::INSTANCE,'email','summaryCache'.trim($GLOBALS['egw_info']['user']['account_id']),$summary,$expiration=60*60*1); if ( $saveNeeded ) egw_cache::setCache(egw_cache::INSTANCE,'email','summaryCache'.trim($GLOBALS['egw_info']['user']['account_id']),$summary,$expiration=60*60*1);
//error_log(__METHOD__.__LINE__.' Using query for summary on Server:'.$this->icServer->ImapServerId.' for uid:'.$_uid." in Folder:".$_folder.'->'.array2string($structure[$this->icServer->ImapServerId][$_folder][$_uid])); //error_log(__METHOD__.__LINE__.' Using query for summary on Server:'.$this->icServer->ImapServerId.' for uid:'.$_uid." in Folder:".$_folder.'->'.array2string($structure[$this->icServer->ImapServerId][$_folder][$_uid]));
return $rv; return $rv;
} }
@ -3523,6 +3526,10 @@ class mail_bo
if($_htmlOptions != '') { if($_htmlOptions != '') {
$this->htmlOptions = $_htmlOptions; $this->htmlOptions = $_htmlOptions;
} }
if ($_folder=='')
{
$_folder = $this->sessionData['mailbox'];
}
if(is_object($_structure)) { if(is_object($_structure)) {
$structure = $_structure; $structure = $_structure;
} else { } else {
@ -3537,10 +3544,10 @@ class mail_bo
{ {
$summary = egw_cache::getCache(egw_cache::INSTANCE,'email','summaryCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1); $summary = egw_cache::getCache(egw_cache::INSTANCE,'email','summaryCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
$cachemodified = false; $cachemodified = false;
if (isset($summary[$this->icServer->ImapServerId][$this->sessionData['mailbox']][$_uid])) if (isset($summary[$this->icServer->ImapServerId][$_folder][$_uid]))
{ {
$cachemodified = true; $cachemodified = true;
unset($summary[$this->icServer->ImapServerId][$this->sessionData['mailbox']][$_uid]); unset($summary[$this->icServer->ImapServerId][$_folder][$_uid]);
} }
if ($cachemodified) if ($cachemodified)
{ {
@ -3609,7 +3616,7 @@ class mail_bo
case 'RFC822': case 'RFC822':
$newStructure = array_shift($structure->subParts); $newStructure = array_shift($structure->subParts);
if (self::$debug) {echo __METHOD__." Message -> RFC -> NewStructure:"; _debug_array($newStructure);} if (self::$debug) {echo __METHOD__." Message -> RFC -> NewStructure:"; _debug_array($newStructure);}
return self::normalizeBodyParts($this->getMessageBody($_uid, $_htmlOptions, $newStructure->partID, $newStructure)); return self::normalizeBodyParts($this->getMessageBody($_uid, $_htmlOptions, $newStructure->partID, $newStructure, $_preserveSeen, $_folder));
break; break;
} }
break; break;

View File

@ -728,7 +728,7 @@ class mail_hooks
$profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID; $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID;
$mailPreferences =& $mail_bo->mailPreferences; $mailPreferences =& $mail_bo->mailPreferences;
$file['Preferences'] = egw::link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname); $file['Preferences'] = egw::link('/index.php','menuaction=preferences.preferences_settings.index&appname=' . $appname);
/* /*
if($mailPreferences->userDefinedAccounts) { if($mailPreferences->userDefinedAccounts) {
$linkData = array $linkData = array
@ -829,7 +829,7 @@ class mail_hooks
#$mailPreferences = ExecMethod('mail.bopreferences.getPreferences'); #$mailPreferences = ExecMethod('mail.bopreferences.getPreferences');
$menu_title = lang('Preferences'); $menu_title = lang('Preferences');
$file = array( $file = array(
'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname=mail'), 'Preferences' => egw::link('/index.php','menuaction=preferences.preferences_settings.index&appname=mail'),
); );
/* /*
if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) { if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) {

View File

@ -1509,6 +1509,160 @@ unset($query['actions']);
if ($htmlOptions !='always_display') $fetchEmbeddedImages = true; if ($htmlOptions !='always_display') $fetchEmbeddedImages = true;
$attachments = $this->mail_bo->getMessageAttachments($uid, $partID, '',$fetchEmbeddedImages); $attachments = $this->mail_bo->getMessageAttachments($uid, $partID, '',$fetchEmbeddedImages);
//_debug_array($headers); //_debug_array($headers);
// attachments
/* if(is_array($attachments) && count($attachments) > 0 && count($attachments) > 4) {
// this is to account for maxheight minheight of the attachment div
$this->t->set_var('attachment_div_height',' bottom:'.(count($attachments)>4?(count($attachments)*20<=240?count($attachments)*20:240):80).'px');
} else {
$this->t->set_var('attachment_div_height',''); // app.css bodyDIVAttachment
}
*/
if (is_array($attachments) && count($attachments) > 0) {
$url_img_vfs = html::image('filemanager','navbar', lang('Filemanager'), ' height="16"');
$url_img_vfs_save_all = html::image('felamimail','save_all', lang('Save all'));
$detectedCharSet=$charset2use=mail_bo::$displayCharset;
foreach ($attachments as $key => $value)
{
#$detectedCharSet = mb_detect_encoding($value['name'].'a',strtoupper($this->displayCharset).",UTF-8, ISO-8559-1");
if (function_exists('mb_convert_variables')) mb_convert_variables("UTF-8","ISO-8559-1",$value['name']); # iso 2 UTF8
//if (mb_convert_variables("ISO-8859-1","UTF-8",$value['name'])){echo "Juhu utf8 2 ISO\n";};
//echo $value['name']."\n";
$filename=htmlentities($value['name'], ENT_QUOTES, $detectedCharSet);
/*
$this->t->set_var('row_color',$this->rowColor[($key+1)%2]);
$this->t->set_var('filename',($value['name'] ? ( $filename ? $filename : $value['name'] ) : lang('(no subject)')));
$this->t->set_var('mimetype',mime_magic::mime2label($value['mimeType']));
$this->t->set_var('size',egw_vfs::hsize($value['size']));
$this->t->set_var('attachment_number',$key);
*/
switch(strtoupper($value['mimeType']))
{
case 'MESSAGE/RFC822':
$linkData = array
(
'menuaction' => 'mail.mail_ui.displayMessage',
'id' => $rowID,
'part' => $value['partID'],
'mailbox' => base64_encode($mailbox),
'is_winmail' => $value['is_winmail']
);
$windowName = 'displayMessage_'. $rowID.'_'.$value['partID'];
$linkView = "egw_openWindowCentered('".$GLOBALS['egw']->link('/index.php',$linkData)."','$windowName',700,egw_getWindowOuterHeight());";
break;
case 'IMAGE/JPEG':
case 'IMAGE/PNG':
case 'IMAGE/GIF':
case 'IMAGE/BMP':
case 'APPLICATION/PDF':
case 'TEXT/PLAIN':
case 'TEXT/HTML':
case 'TEXT/DIRECTORY':
$sfxMimeType = $value['mimeType'];
$buff = explode('.',$value['name']);
$suffix = '';
if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
if (!empty($suffix)) $sfxMimeType = mime_magic::ext2mime($suffix);
if (strtoupper($sfxMimeType) == 'TEXT/VCARD' || strtoupper($sfxMimeType) == 'TEXT/X-VCARD')
{
$attachments[$key]['mimeType'] = $sfxMimeType;
$value['mimeType'] = strtoupper($sfxMimeType);
}
case 'TEXT/X-VCARD':
case 'TEXT/VCARD':
case 'TEXT/CALENDAR':
case 'TEXT/X-VCALENDAR':
$linkData = array
(
'menuaction' => 'mail.mail_ui.getAttachment',
'uid' => $rowID,
'part' => $value['partID'],
'is_winmail' => $value['is_winmail'],
'mailbox' => base64_encode($mailbox),
);
$windowName = 'displayAttachment_'. $uid;
$reg = '800x600';
// handle calendar/vcard
if (strtoupper($value['mimeType'])=='TEXT/CALENDAR')
{
$windowName = 'displayEvent_'. $rowID;
$reg2 = egw_link::get_registry('calendar','view_popup');
}
if (strtoupper($value['mimeType'])=='TEXT/X-VCARD' || strtoupper($value['mimeType'])=='TEXT/VCARD')
{
$windowName = 'displayContact_'. $rowID;
$reg2 = egw_link::get_registry('addressbook','add_popup');
}
// apply to action
list($width,$height) = explode('x',(!empty($reg2) ? $reg2 : $reg));
$linkView = "egw_openWindowCentered('".$GLOBALS['egw']->link('/index.php',$linkData)."','$windowName',$width,$height);";
break;
default:
$linkData = array
(
'menuaction' => 'mail.mail_ui.getAttachment',
'uid' => $rowID,
'part' => $value['partID'],
'is_winmail' => $value['is_winmail'],
'mailbox' => base64_encode($mailbox),
);
$linkView = "window.location.href = '".$GLOBALS['egw']->link('/index.php',$linkData)."';";
break;
}
// $this->t->set_var("link_view",$linkView);
// $this->t->set_var("target",$target);
$linkData = array
(
'menuaction' => 'mail.mail_ui.getAttachment',
'mode' => 'save',
'uid' => $rowID,
'part' => $value['partID'],
'is_winmail' => $value['is_winmail'],
'mailbox' => base64_encode($mailbox),
);
//$this->t->set_var("link_save",$GLOBALS['egw']->link('/index.php',$linkData));
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
{
$link_vfs_save = egw::link('/index.php',array(
'menuaction' => 'filemanager.filemanager_select.select',
'mode' => 'saveas',
'name' => $value['name'],
'mime' => strtolower($value['mimeType']),
'method' => 'felamimail.uidisplay.vfsSaveAttachment',
'id' => $mailbox.'::'.$uid.'::'.$value['partID'].'::'.$value['is_winmail'],
'label' => lang('Save'),
));
$vfs_save = "<a href='#' onclick=\"egw_openWindowCentered('$link_vfs_save','vfs_save_attachment','640','570',window.outerWidth/2,window.outerHeight/2); return false;\">$url_img_vfs</a>";
// add save-all icon for first attachment
if (!$key && count($attachments) > 1)
{
foreach ($attachments as $key => $value)
{
//$rowID
$ids["id[$key]"] = $rowID.'::'.$value['partID'].'::'.$value['is_winmail'].'::'.$value['name'];
}
$link_vfs_save = egw::link('/index.php',array(
'menuaction' => 'filemanager.filemanager_select.select',
'mode' => 'select-dir',
'method' => 'mail.mail_ui.vfsSaveAttachment',
'label' => lang('Save all'),
)+$ids);
$vfs_save .= "\n<a href='#' onclick=\"egw_openWindowCentered('$link_vfs_save','vfs_save_attachment','640','530',window.outerWidth/2,window.outerHeight/2); return false;\">$url_img_vfs_save_all</a>";
}
//$this->t->set_var('vfs_save',$vfs_save);
}
else
{
//$this->t->set_var('vfs_save','');
}
//$this->t->parse('attachment_rows','message_attachement_row',True);
}
} else {
//$this->t->set_var('attachment_rows','');
}
$webserverURL = $GLOBALS['egw_info']['server']['webserver_url']; $webserverURL = $GLOBALS['egw_info']['server']['webserver_url'];
$nonDisplayAbleCharacters = array('[\016]','[\017]', $nonDisplayAbleCharacters = array('[\016]','[\017]',
@ -1535,10 +1689,11 @@ unset($query['actions']);
$subject = mail_bo::htmlspecialchars($this->mail_bo->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false), $subject = mail_bo::htmlspecialchars($this->mail_bo->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false),
mail_bo::$displayCharset); mail_bo::$displayCharset);
if (empty($subject)) $subject = lang('no subject'); if (empty($subject)) $subject = lang('no subject');
$content['msg'] = $subject.(is_array($error_msg)?implode("<br>",$error_msg):$error_msg);
$content['msg'] = (is_array($error_msg)?implode("<br>",$error_msg):$error_msg);
$content['mail_displaysubject'] = $subject; $content['mail_displaysubject'] = $subject;
$content['mail_displaybody'] = $mailBody; $content['mail_displaybody'] = $mailBody;
//_debug_array($attachments);
$content['mail_displayattachments'] = array2string($attachments);
$readonlys = $preserv = $content; $readonlys = $preserv = $content;
echo $etpl->exec('mail.mail_ui.displayMessage',$content,$sel_options,$readonlys,$preserv,2); echo $etpl->exec('mail.mail_ui.displayMessage',$content,$sel_options,$readonlys,$preserv,2);
} }

View File

@ -305,6 +305,7 @@ input[type=button] {
} }
.mailDisplay, #mailPreview { .mailDisplay, #mailPreview {
overflow: hidden;
position: relative; position: relative;
margin-top: 3px; margin-top: 3px;
} }
@ -313,14 +314,67 @@ input[type=button] {
right: 0; right: 0;
top: 0; top: 0;
} }
.mailDisplayContainer, #mailPreviewContainer { #mailPreviewContainer {
position: absolute; position: absolute;
border: 1px solid silver; border: 1px solid silver;
top: 55px; top: 55px;
bottom: 0; bottom: 0;
left: 0; left: 3px;
right: 0; right: 0;
} }
.mailDisplayContainer, .mailDisplayAttachments {
display: block;
display: -moz-inline-stack;
display: -moz-box;
width: 99%;
overflow: hidden;
overflow-x: auto;
left: 3px;
right: 3px;
}
.mailDisplayContainer {
position: fixed;
overflow: hidden;
overflow-y: auto;
border: 1px solid silver;
top: 60px;
bottom: 100px;
}
.mailDisplayAttachments {
background-color:#efefdf;
max-height: 10%;
position: fixed;
bottom: 26px;
border: 1px solid red;
border-bottom: 0px;
opacity: 1;
-moz-opacity:1:
filter: Alpha(opacity=100);
}
#divGenTime {
background-color:#efefdf;
max-height: 10%;
position: fixed;
bottom: 1px;
border: 1px solid red;
border-top: 1px solid black;
left: 3px;
right: 3px;
opacity: 1;
-moz-opacity:1:
filter: Alpha(opacity=100);
}
.mailDisplayHeaders {
overflow: hidden;
}
.mailDisplayHeaderSection {
position: absolute;
top: 0px;
}
div.mailDisplayHeaders > div:first-parent {
overflow: hidden;
}
div.mailDisplayHeaders > span:first-child, div.mailPreviewHeaders > span:first-child { div.mailDisplayHeaders > span:first-child, div.mailPreviewHeaders > span:first-child {
width: 5em; width: 5em;
display: inline-block; display: inline-block;

View File

@ -3,7 +3,7 @@
<overlay> <overlay>
<template id="mail.display" template="" lang="" group="0" version="1.9.001"> <template id="mail.display" template="" lang="" group="0" version="1.9.001">
<html id="msg"/> <html id="msg"/>
<vbox class="mailDisplay" width="100%"> <vbox class="mailDisplay mailDisplayHeaderSection" width="100%">
<hbox class="mailDisplayHeaders" width="100%"> <hbox class="mailDisplayHeaders" width="100%">
<description value="From"/> <description value="From"/>
<url-email id="mail_displayfromaddress" readonly="true"/> <url-email id="mail_displayfromaddress" readonly="true"/>
@ -23,9 +23,14 @@
<hbox class="mail_displayicons"> <hbox class="mail_displayicons">
<html id="mail_displayicons"/> <html id="mail_displayicons"/>
</hbox> </hbox>
</vbox>
<vbox class="mailDisplay" width="100%">
<box class="mailDisplayContainer"> <box class="mailDisplayContainer">
<html id="mail_displaybody"/> <html id="mail_displaybody"/>
</box> </box>
<box class="mailDisplayAttachments">
<html id="mail_displayattachments"/>
</box>
</vbox> </vbox>
</template> </template>
</overlay> </overlay>