diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php
index a5a034bd6d..199f1a8c44 100644
--- a/mail/inc/class.mail_bo.inc.php
+++ b/mail/inc/class.mail_bo.inc.php
@@ -3066,6 +3066,7 @@ class mail_bo
$_uids = explode(',', $queryString);
$uidsCached = (is_array($summary[$this->icServer->ImapServerId][$_folder])?array_keys($summary[$this->icServer->ImapServerId][$_folder]):array());
$toFetch = array_diff($_uids,(array)$uidsCached);
+ $saveNeeded = false;
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])));
@@ -3078,6 +3079,7 @@ class mail_bo
//error_log(__METHOD__.__LINE__.'::'.$sum['UID'].':'.$sum['SUBJECT']);
$summary[$this->icServer->ImapServerId][$_folder][$sum['UID']]=$sum;
}
+ $saveNeeded = true;
}
foreach ($_uids as $_uid)
{
@@ -3100,9 +3102,10 @@ class mail_bo
$result = $this->icServer->getSummary($_uid, $byUid);
$summary[$this->icServer->ImapServerId][$_folder][$_uid] = $result[0];
$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]));
return $rv;
}
@@ -3523,6 +3526,10 @@ class mail_bo
if($_htmlOptions != '') {
$this->htmlOptions = $_htmlOptions;
}
+ if ($_folder=='')
+ {
+ $_folder = $this->sessionData['mailbox'];
+ }
if(is_object($_structure)) {
$structure = $_structure;
} 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);
$cachemodified = false;
- if (isset($summary[$this->icServer->ImapServerId][$this->sessionData['mailbox']][$_uid]))
+ if (isset($summary[$this->icServer->ImapServerId][$_folder][$_uid]))
{
$cachemodified = true;
- unset($summary[$this->icServer->ImapServerId][$this->sessionData['mailbox']][$_uid]);
+ unset($summary[$this->icServer->ImapServerId][$_folder][$_uid]);
}
if ($cachemodified)
{
@@ -3609,7 +3616,7 @@ class mail_bo
case 'RFC822':
$newStructure = array_shift($structure->subParts);
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;
diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php
index 88f4304d7d..87b81890d9 100644
--- a/mail/inc/class.mail_hooks.inc.php
+++ b/mail/inc/class.mail_hooks.inc.php
@@ -728,7 +728,7 @@ class mail_hooks
$profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID;
$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) {
$linkData = array
@@ -829,7 +829,7 @@ class mail_hooks
#$mailPreferences = ExecMethod('mail.bopreferences.getPreferences');
$menu_title = lang('Preferences');
$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) {
diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php
index 2d868d1d20..93d94fa6b9 100644
--- a/mail/inc/class.mail_ui.inc.php
+++ b/mail/inc/class.mail_ui.inc.php
@@ -1509,6 +1509,160 @@ unset($query['actions']);
if ($htmlOptions !='always_display') $fetchEmbeddedImages = true;
$attachments = $this->mail_bo->getMessageAttachments($uid, $partID, '',$fetchEmbeddedImages);
//_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 = "$url_img_vfs";
+ // 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$url_img_vfs_save_all";
+ }
+ //$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'];
$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),
mail_bo::$displayCharset);
if (empty($subject)) $subject = lang('no subject');
-
-$content['msg'] = (is_array($error_msg)?implode("
",$error_msg):$error_msg);
+$content['msg'] = $subject.(is_array($error_msg)?implode("
",$error_msg):$error_msg);
$content['mail_displaysubject'] = $subject;
$content['mail_displaybody'] = $mailBody;
+//_debug_array($attachments);
+$content['mail_displayattachments'] = array2string($attachments);
$readonlys = $preserv = $content;
echo $etpl->exec('mail.mail_ui.displayMessage',$content,$sel_options,$readonlys,$preserv,2);
}
diff --git a/mail/templates/default/app.css b/mail/templates/default/app.css
index c686dbd043..67a2bf19e0 100644
--- a/mail/templates/default/app.css
+++ b/mail/templates/default/app.css
@@ -305,6 +305,7 @@ input[type=button] {
}
.mailDisplay, #mailPreview {
+ overflow: hidden;
position: relative;
margin-top: 3px;
}
@@ -313,14 +314,67 @@ input[type=button] {
right: 0;
top: 0;
}
-.mailDisplayContainer, #mailPreviewContainer {
+#mailPreviewContainer {
position: absolute;
border: 1px solid silver;
top: 55px;
bottom: 0;
- left: 0;
+ left: 3px;
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 {
width: 5em;
display: inline-block;
diff --git a/mail/templates/default/display.xet b/mail/templates/default/display.xet
index 2f4412863e..92b8e58bf9 100644
--- a/mail/templates/default/display.xet
+++ b/mail/templates/default/display.xet
@@ -3,7 +3,7 @@
-
+
+
+
+
+