mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +01:00
switch display of message in popup to load message body in iframe; on message deletion show one message for userinteraction
This commit is contained in:
parent
470a204f85
commit
7510c00e50
@ -480,6 +480,8 @@ class mail_compose
|
||||
$content = (is_array($_content)?$_content:array());
|
||||
if ($_contentHasMimeType)
|
||||
{
|
||||
// mimeType is now a checkbox; convert it here to match expectations
|
||||
// ToDo: match Code to meet checkbox value
|
||||
if ($content['mimeType']==1)
|
||||
{
|
||||
$_content['mimeType'] = $content['mimeType']='html';
|
||||
@ -490,8 +492,6 @@ class mail_compose
|
||||
}
|
||||
|
||||
}
|
||||
// mimeType is now a checkbox; convert it here to match expectations
|
||||
// ToDo: match Code to meet checkbox value
|
||||
// user might have switched desired mimetype, so we should convert
|
||||
if ($content['is_html'] && $content['mimeType']=='plain')
|
||||
{
|
||||
@ -876,7 +876,7 @@ class mail_compose
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$this->addAttachment($formData,($alwaysAttachVCardAtCompose?true:false));
|
||||
$this->addAttachment($formData,$content,($alwaysAttachVCardAtCompose?true:false));
|
||||
}
|
||||
$remember = array();
|
||||
if (isset($_REQUEST['preset']['mailto']) || (isset($_REQUEST['app']) && isset($_REQUEST['method']) && isset($_REQUEST['id'])))
|
||||
@ -937,7 +937,18 @@ class mail_compose
|
||||
//is the MimeType set/requested
|
||||
if (!empty($_REQUEST['mimeType']))
|
||||
{
|
||||
$content['mimeType'] = $_REQUEST['mimeType'];
|
||||
if (($_REQUEST['mimeType']=="text" ||$_REQUEST['mimeType']=="plain") && $content['mimeType'] == 'html')
|
||||
{
|
||||
$_content['mimeType'] = $content['mimeType'] = 'plain';
|
||||
$content['body'] = $this->convertHTMLToText(str_replace(array("\n\r","\n"),' ',$content['body']));
|
||||
}
|
||||
if ($_REQUEST['mimeType']=="html" && $content['mimeType'] != 'html')
|
||||
{
|
||||
$_content['mimeType'] = $content['mimeType'] = 'html';
|
||||
$content['body'] = "<pre>".$content['body']."</pre>";
|
||||
// take care this assumption is made on the creation of the reply header in bocompose::getReplyData
|
||||
if (strpos($content['body'],"<pre> \r\n \r\n---")===0) $content['body'] = substr_replace($content['body']," <br>\r\n<pre>---",0,strlen("<pre> \r\n \r\n---")-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -947,13 +958,13 @@ class mail_compose
|
||||
if (!empty($this->preferencesArray['replyOptions']) && $this->preferencesArray['replyOptions']=="text" &&
|
||||
$content['mimeType'] == 'html')
|
||||
{
|
||||
$content['mimeType'] = 'plain';
|
||||
$_content['mimeType'] = $content['mimeType'] = 'plain';
|
||||
$content['body'] = $this->convertHTMLToText(str_replace(array("\n\r","\n"),' ',$content['body']));
|
||||
}
|
||||
if (!empty($this->preferencesArray['replyOptions']) && $this->preferencesArray['replyOptions']=="html" &&
|
||||
$content['mimeType'] != 'html')
|
||||
{
|
||||
$content['mimeType'] = 'html';
|
||||
$_content['mimeType'] = $content['mimeType'] = 'html';
|
||||
$content['body'] = "<pre>".$content['body']."</pre>";
|
||||
// take care this assumption is made on the creation of the reply header in bocompose::getReplyData
|
||||
if (strpos($content['body'],"<pre> \r\n \r\n---")===0) $content['body'] = substr_replace($content['body']," <br>\r\n<pre>---",0,strlen("<pre> \r\n \r\n---")-1);
|
||||
@ -963,7 +974,7 @@ class mail_compose
|
||||
|
||||
if ($content['mimeType'] == 'html' && html::htmlarea_availible()===false)
|
||||
{
|
||||
$content['mimeType'] = 'plain';
|
||||
$_content['mimeType'] = $content['mimeType'] = 'plain';
|
||||
$content['body'] = $this->convertHTMLToText($content['body']);
|
||||
}
|
||||
|
||||
@ -1491,6 +1502,7 @@ class mail_compose
|
||||
// get message headers for specified message
|
||||
#$headers = $mail_bo->getMessageHeader($_folder, $_uid);
|
||||
$headers = $mail_bo->getMessageEnvelope($_uid, $_partID);
|
||||
//_debug_array($headers); exit;
|
||||
$addHeadInfo = $mail_bo->getMessageHeader($_uid, $_partID);
|
||||
//error_log(__METHOD__.__LINE__.array2string($headers));
|
||||
if (!empty($addHeadInfo['X-MAILFOLDER'])) {
|
||||
@ -1600,7 +1612,7 @@ class mail_compose
|
||||
$foundAddresses[$keyemail] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//_debug_array($this->sessionData);
|
||||
$this->sessionData['subject'] = $mail_bo->decode_header($headers['SUBJECT']);
|
||||
// remove a printview tag if composing
|
||||
$searchfor = '/^\['.lang('printview').':\]/';
|
||||
@ -1722,6 +1734,57 @@ class mail_compose
|
||||
return $this->sessionData;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds uploaded files or files in eGW's temp directory as attachments
|
||||
*
|
||||
* passes the given $_formData representing an attachment to $_content
|
||||
*
|
||||
* @param array $_formData fields of the compose form (to,cc,bcc,reply_to,subject,body,priority,signature), plus data of the file (name,file,size,type)
|
||||
* @param array $_content the content passed to the function and to be modified
|
||||
* @return void
|
||||
*/
|
||||
function addAttachment($_formData,&$_content,$eliminateDoubleAttachments=false)
|
||||
{
|
||||
$attachfailed = false;
|
||||
// to guard against exploits the file must be either uploaded or be in the temp_dir
|
||||
// check if formdata meets basic restrictions (in tmp dir, or vfs, mimetype, etc.)
|
||||
try
|
||||
{
|
||||
$tmpFileName = mail_bo::checkFileBasics($_formData,$this->composeID,false);
|
||||
}
|
||||
catch (egw_exception_wrong_userinput $e)
|
||||
{
|
||||
$attachfailed = true;
|
||||
$alert_msg = $e->getMessage();
|
||||
}
|
||||
|
||||
if ($eliminateDoubleAttachments == true)
|
||||
foreach ((array)$_content['attachments'] as $k =>$attach)
|
||||
if ($attach['name'] && $attach['name'] == $_formData['name'] &&
|
||||
strtolower($_formData['type'])== strtolower($attach['type']) &&
|
||||
stripos($_formData['file'],'vfs://') !== false) return;
|
||||
|
||||
if ($attachfailed === false)
|
||||
{
|
||||
$buffer = array(
|
||||
'name' => $_formData['name'],
|
||||
'type' => $_formData['type'],
|
||||
'file' => $tmpFileName,
|
||||
'size' => $_formData['size']
|
||||
);
|
||||
// trying different ID-ing Method, as getRandomString seems to produce non Random String on certain systems.
|
||||
$attachmentID = md5(time().serialize($buffer));
|
||||
//error_log(__METHOD__." add Attachment with ID:".$attachmentID." (md5 of serialized array)");
|
||||
if (!is_array($_content['attachments'])) $_content['attachments']=array();
|
||||
$_content['attachments'][$attachmentID] = $buffer;
|
||||
unset($buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
error_log(__METHOD__.__LINE__.array2string($alert_msg));
|
||||
}
|
||||
}
|
||||
|
||||
function addMessageAttachment($_uid, $_partID, $_folder, $_name, $_type, $_size)
|
||||
{
|
||||
$this->sessionData['attachments'][]=array (
|
||||
|
@ -640,7 +640,7 @@ class mail_ui
|
||||
if ($_profileID && $acc_id != $_profileID) continue;
|
||||
|
||||
$oA = array('id' => $acc_id,
|
||||
'text' => htmlspecialchars($identity_name),
|
||||
'text' => $identity_name,// htmlspecialchars($identity_name),
|
||||
'tooltip' => '('.$acc_id.') '.htmlspecialchars_decode($identity_name),
|
||||
'im0' => 'thunderbird.png',
|
||||
'im1' => 'thunderbird.png',
|
||||
@ -1787,7 +1787,7 @@ unset($query['actions']);
|
||||
'[\030]','[\031]','[\032]','[\033]','[\034]','[\035]','[\036]','[\037]');
|
||||
|
||||
#print "<pre>";print_r($rawheaders);print"</pre>";exit;
|
||||
$mailBody = $this->get_load_email_data($uid, $partID, $mailbox, $htmlOptions,false);
|
||||
//$mailBody = $this->get_load_email_data($uid, $partID, $mailbox, $htmlOptions,false);
|
||||
//error_log(__METHOD__.__LINE__.$mailBody);
|
||||
$this->mail_bo->closeConnection();
|
||||
//$GLOBALS['egw_info']['flags']['currentapp'] = 'mail';//should not be needed
|
||||
@ -1859,7 +1859,11 @@ unset($query['actions']);
|
||||
$content['mail_id'] = $rowID;
|
||||
$content['mail_displaydate'] = mail_bo::_strtotime($headers['DATE'],'ts',true);
|
||||
$content['mail_displaysubject'] = $subject;
|
||||
$content['mail_displaybody'] = $mailBody;
|
||||
//$content['mail_displaybody'] = $mailBody;
|
||||
$linkData = array('menuaction'=>"mail.mail_ui.loadEmailBody","_messageID"=>$rowID);
|
||||
if (!empty($partID)) $linkData['_partID']=$partID;
|
||||
if ($htmlOptions != $this->mail_bo->htmlOptions) $linkData['_htmloptions']=$htmlOptions;
|
||||
$content['mailDisplayBodySrc'] = egw::link('/index.php',$linkData);
|
||||
//_debug_array($attachments);
|
||||
$content['mail_displayattachments'] = $attachmentHTMLBlock;
|
||||
$content['mail_id']=$rowID;
|
||||
@ -1917,7 +1921,7 @@ unset($query['actions']);
|
||||
'is_winmail' => $value['is_winmail']
|
||||
);
|
||||
$windowName = 'displayMessage_'. $rowID.'_'.$value['partID'];
|
||||
$linkView = "egw_openWindowCentered('".$GLOBALS['egw']->link('/index.php',$linkData)."','$windowName',700,egw_getWindowOuterHeight());";
|
||||
$linkView = "egw_openWindowCentered('".egw::link('/index.php',$linkData)."','$windowName',700,egw_getWindowOuterHeight());";
|
||||
break;
|
||||
case 'IMAGE/JPEG':
|
||||
case 'IMAGE/PNG':
|
||||
@ -1964,7 +1968,7 @@ unset($query['actions']);
|
||||
}
|
||||
// apply to action
|
||||
list($width,$height) = explode('x',(!empty($reg2) ? $reg2 : $reg));
|
||||
$linkView = "egw_openWindowCentered('".$GLOBALS['egw']->link('/index.php',$linkData)."','$windowName',$width,$height);";
|
||||
$linkView = "egw_openWindowCentered('".egw::link('/index.php',$linkData)."','$windowName',$width,$height);";
|
||||
break;
|
||||
default:
|
||||
$linkData = array
|
||||
@ -1975,7 +1979,7 @@ unset($query['actions']);
|
||||
'is_winmail' => $value['is_winmail'],
|
||||
'mailbox' => base64_encode($mailbox),
|
||||
);
|
||||
$linkView = "window.location.href = '".$GLOBALS['egw']->link('/index.php',$linkData)."';";
|
||||
$linkView = "window.location.href = '".egw::link('/index.php',$linkData)."';";
|
||||
break;
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.$linkView);
|
||||
@ -1992,7 +1996,7 @@ unset($query['actions']);
|
||||
'is_winmail' => $value['is_winmail'],
|
||||
'mailbox' => base64_encode($mailbox),
|
||||
);
|
||||
$attachmentHTML[$key]['link_save'] ="<a href='".$GLOBALS['egw']->link('/index.php',$linkData)."' title='".$attachmentHTML[$key]['filename']."'>".html::image('felamimail','fileexport')."</a>";
|
||||
$attachmentHTML[$key]['link_save'] ="<a href='".egw::link('/index.php',$linkData)."' title='".$attachmentHTML[$key]['filename']."'>".html::image('felamimail','fileexport')."</a>";
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
|
||||
{
|
||||
@ -2099,7 +2103,7 @@ unset($query['actions']);
|
||||
'menuaction' => $addAction,
|
||||
'send_to' => base64_encode($newSenderAddress)
|
||||
);
|
||||
$link = $GLOBALS['egw']->link('/index.php',$linkData);
|
||||
$link = egw::link('/index.php',$linkData);
|
||||
|
||||
$newSenderAddress = mail_bo::htmlentities($newSenderAddress);
|
||||
$realName = mail_bo::htmlentities($realName);
|
||||
@ -2151,7 +2155,7 @@ unset($query['actions']);
|
||||
'menuaction' => $addAction,
|
||||
'send_to' => base64_encode($addressData['EMAIL'])
|
||||
);
|
||||
$link = $GLOBALS['egw']->link('/index.php',$linkData);
|
||||
$link = egw::link('/index.php',$linkData);
|
||||
$senderEMail = mail_bo::htmlentities($addrEMail);
|
||||
$senderAddress .= sprintf('<a href="%s">%s</a>',
|
||||
$link,$senderEMail);
|
||||
@ -2314,7 +2318,7 @@ unset($query['actions']);
|
||||
'menuaction' => 'calendar.calendar_uiforms.edit',
|
||||
'cal_id' => $event,
|
||||
);
|
||||
$GLOBALS['egw']->redirect_link('../index.php',$vars);
|
||||
egw::redirect_link('../index.php',$vars);
|
||||
}
|
||||
//Import failed, download content anyway
|
||||
}
|
||||
@ -2343,7 +2347,7 @@ unset($query['actions']);
|
||||
'menuaction' => 'addressbook.addressbook_ui.edit',
|
||||
'contact_id' => $contact,
|
||||
);
|
||||
$GLOBALS['egw']->redirect_link('../index.php',$vars);
|
||||
egw::redirect_link('../index.php',$vars);
|
||||
}
|
||||
//Import failed, download content anyway
|
||||
}
|
||||
@ -2796,7 +2800,7 @@ blockquote[type=cite] {
|
||||
// create links for email addresses
|
||||
if ($modifyURI)
|
||||
{
|
||||
$link = $GLOBALS['egw']->link('/index.php',array('menuaction' => $addAction));
|
||||
$link = egw::link('/index.php',array('menuaction' => $addAction));
|
||||
$newBody = preg_replace("/href=(\"|\')mailto:([\w,\-,\/,\?,\=,\.,&,!\n,\%,@,\*,#,:,~,\+]+)(\"|\')/ie",
|
||||
"'href=\"$link&send_to='.base64_encode('$2').'\"'.' target=\"compose\" onclick=\"window.open(this,this.target,\'dependent=yes,width=700,height=egw_getWindowOuterHeight(),location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\'); return false;\"'", $newBody);
|
||||
//print "<pre>".htmlentities($newBody)."</pre><hr>";
|
||||
@ -2835,7 +2839,7 @@ blockquote[type=cite] {
|
||||
'cid' => base64_encode($matches[2]),
|
||||
'partID' => $this->partID,
|
||||
);
|
||||
$imageURL = $GLOBALS['egw']->link('/index.php', $linkData);
|
||||
$imageURL = egw::link('/index.php', $linkData);
|
||||
|
||||
// to test without data uris, comment the if close incl. it's body
|
||||
if (html::$user_agent != 'msie' || html::$ua_version >= 8)
|
||||
@ -2877,7 +2881,7 @@ blockquote[type=cite] {
|
||||
'cid' => base64_encode($matches[1]),
|
||||
'partID' => $this->partID,
|
||||
);
|
||||
$imageURL = $GLOBALS['egw']->link('/index.php', $linkData);
|
||||
$imageURL = egw::link('/index.php', $linkData);
|
||||
|
||||
// to test without data uris, comment the if close incl. it's body
|
||||
if (html::$user_agent != 'msie' || html::$ua_version >= 8)
|
||||
@ -2919,7 +2923,7 @@ blockquote[type=cite] {
|
||||
'cid' => base64_encode($matches[1]),
|
||||
'partID' => $this->partID,
|
||||
);
|
||||
$imageURL = $GLOBALS['egw']->link('/index.php', $linkData);
|
||||
$imageURL = egw::link('/index.php', $linkData);
|
||||
|
||||
// to test without data uris, comment the if close incl. it's body
|
||||
if (html::$user_agent != 'msie' || html::$ua_version >= 8)
|
||||
@ -2960,7 +2964,7 @@ blockquote[type=cite] {
|
||||
'cid' => base64_encode($matches[2]),
|
||||
'partID' => $this->partID,
|
||||
);
|
||||
$imageURL = $GLOBALS['egw']->link('/index.php', $linkData);
|
||||
$imageURL = egw::link('/index.php', $linkData);
|
||||
|
||||
// to test without data uris, comment the if close incl. it's body
|
||||
if (html::$user_agent != 'msie' || html::$ua_version >= 8)
|
||||
@ -3202,15 +3206,18 @@ blockquote[type=cite] {
|
||||
*
|
||||
* @return xajax response
|
||||
*/
|
||||
function loadEmailBody($_messageID=null)
|
||||
function loadEmailBody($_messageID=null,$_partID=null,$_htmloptions=null,$_fullHeader=true)
|
||||
{
|
||||
if (!$_messageID) $_messageID = $_GET['_messageID'];
|
||||
if(mail_bo::$debug) error_log(__METHOD__."->".$_flag.':'.print_r($_messageID,true));
|
||||
if (!$_messageID && !empty($_GET['_messageID'])) $_messageID = $_GET['_messageID'];
|
||||
if (!$_partID && !empty($_GET['_partID'])) $_partID = $_GET['_partID'];
|
||||
if (!$_htmloptions && !empty($_GET['_htmloptions'])) $_htmloptions = $_GET['_htmloptions'];
|
||||
if (!$_fullHeader && !empty($_GET['_fullHeader'])) $_fullHeader = $_GET['_fullHeader'];
|
||||
if(mail_bo::$debug) error_log(__METHOD__."->".print_r($_messageID,true).",$_partID,$_htmloptions,$_fullHeade");
|
||||
if (empty($_messageID)) return "";
|
||||
$uidA = self::splitRowID($_messageID);
|
||||
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
|
||||
$messageID = $uidA['msgUID'];
|
||||
$bodyResponse = $this->get_load_email_data($messageID,'',$folder);
|
||||
$bodyResponse = $this->get_load_email_data($messageID,'',$folder,$_htmloptions,$_fullHeader);
|
||||
egw_session::cache_control(true);
|
||||
//error_log(array2string($bodyResponse));
|
||||
echo $bodyResponse;
|
||||
|
@ -953,7 +953,6 @@ app.classes.mail = AppJS.extend(
|
||||
}
|
||||
var msg = this.mail_getFormData(_elems);
|
||||
//alert(_action.id+','+ msg);
|
||||
egw_message(this.egw.lang('delete messages'));
|
||||
if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted');
|
||||
this.mail_deleteMessages(msg,'no',calledFromPopup);
|
||||
if (calledFromPopup && this.mail_isMainWindow==false) window.close();
|
||||
@ -967,6 +966,21 @@ app.classes.mail = AppJS.extend(
|
||||
*/
|
||||
mail_deleteMessages: function(_msg,_action,_calledFromPopup)
|
||||
{
|
||||
ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
|
||||
var _foldernode = ftree.getSelectedNode();
|
||||
|
||||
var displayname = _foldernode.label;
|
||||
var inBraket = displayname.indexOf('\(');
|
||||
if (inBraket!=-1)
|
||||
{
|
||||
var outBraket = displayname.indexOf('\)');
|
||||
if (outBraket!=-1)
|
||||
{
|
||||
displayname = displayname.replace(/\((.*?)\)/,"");
|
||||
displayname = displayname.replace(/<b>/,"");
|
||||
displayname = displayname.replace(/<\/b>/,"");
|
||||
}
|
||||
}
|
||||
// Tell server
|
||||
egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)])
|
||||
.sendRequest(true);
|
||||
@ -977,7 +991,7 @@ app.classes.mail = AppJS.extend(
|
||||
{
|
||||
ids.push(_msg['msg'][i].replace(/mail::/,''));
|
||||
}
|
||||
egw_refresh(this.egw.lang('delete messages'),'mail',ids,'delete');
|
||||
egw_refresh(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,displayname),'mail',ids,'delete');
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@
|
||||
</vbox>
|
||||
<vbox class="mailDisplay" width="100%">
|
||||
<box class="$cont[mailDisplayContainerClass]">
|
||||
<html id="mail_displaybody"/>
|
||||
<iframe frameborder="1" class="mail_displaybody" id="mailDisplayBodySrc" name="mailDisplayBodySrc" scrolling="auto" width="100%" height="100%"/>
|
||||
</box>
|
||||
<box class="$cont[mailDisplayAttachmentsClass]">
|
||||
<!-- <html id="mail_displayattachments"/> -->
|
||||
|
Loading…
Reference in New Issue
Block a user