mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 16:38:39 +01:00
use app_refresh now, for part of the refresh when deleting a message: e.g. cleanup of previewed message
This commit is contained in:
parent
165d11a695
commit
344a618ac1
@ -1016,6 +1016,8 @@ class ajaxfelamimail
|
||||
function refreshMessagePreview($_messageID,$_folderType)
|
||||
{
|
||||
if ($this->_debug) error_log(__METHOD__.__LINE__.' MessageId:'.$_messageID.', FolderType:'.$_folderType);
|
||||
if (!empty($_messageID))
|
||||
{
|
||||
$this->bofelamimail->restoreSessionData();
|
||||
$headerData = $this->bofelamimail->getHeaders(
|
||||
$this->sessionData['mailbox'],
|
||||
@ -1056,12 +1058,29 @@ class ajaxfelamimail
|
||||
$headerData['subject'] = $this->bofelamimail->decode_subject($headerData['subject'],false);
|
||||
$this->sessionData['previewMessage'] = $headerData['uid'];
|
||||
$this->saveSessionData();
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.print_r($headerData,true));
|
||||
$previewFrameHeight = $GLOBALS['egw_info']['user']['preferences']['felamimail']['PreViewFrameHeight'];
|
||||
$IFRAMEBody = "<TABLE BORDER=\"1\" rules=\"rows\" style=\"table-layout:fixed;width:100%;\">
|
||||
<TR class=\"th\" style=\"width:100%;\">
|
||||
<TD nowrap valign=\"top\">
|
||||
".'<b><br> '.
|
||||
"<center><font color='red'>".(!($_folderType == 2 || $_folderType == 3)?lang("Select a message to switch on its preview (click on subject)"):lang("Preview disabled for Folder: ").$_folderName)."</font></center><br>
|
||||
</b>"."
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD nowrap id=\"tdmessageIFRAME\" valign=\"top\" height=\"".$previewFrameHeight."\">
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>";
|
||||
|
||||
$response = new xajaxResponse();
|
||||
$response->addScript("document.getElementById('messageCounter').innerHTML =MessageBuffer;");
|
||||
//$response->addScript("document.getElementById('messageCounter').innerHTML ='';");
|
||||
$response->addScript("fm_previewMessageID=".$headerData['uid'].";");
|
||||
$response->addAssign('spanMessagePreview', 'innerHTML', $this->uiwidgets->updateMessagePreview($headerData,$_folderType, $this->sessionData['mailbox'],$this->imapServerID));
|
||||
$response->addScript("fm_previewMessageID=".(empty($_messageID)?'':$headerData['uid']).";");
|
||||
$response->addAssign('spanMessagePreview', 'innerHTML', (empty($_messageID)?$IFRAMEBody:$this->uiwidgets->updateMessagePreview($headerData,$_folderType, $this->sessionData['mailbox'],$this->imapServerID)));
|
||||
$response->addScript('if (typeof handleResize != "undefined") handleResize();');
|
||||
|
||||
// Also refresh the folder status
|
||||
|
@ -15,16 +15,22 @@ function app_refresh(_msg, _app, _id, _type)
|
||||
window.clearInterval(doStatus); // whatever message was up to be activated
|
||||
//alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
|
||||
if (document.getElementById('messageCounter').innerHTML.search(eval('/'+egw_appWindow('felamimail').lang_updating_view+'/'))<0 ) {
|
||||
MessageBuffer = document.getElementById('messageCounter').innerHTML;
|
||||
myMessageBuffer = document.getElementById('messageCounter').innerHTML;
|
||||
bufferExists = true;
|
||||
}
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' +_msg+ '</span>');
|
||||
if (_app=='felamimail')
|
||||
{
|
||||
//we may want to trigger some actions, like modifying the grid, disable preview and stuff
|
||||
// TODO:
|
||||
// refreshMessagePreview now also refreshes the folder state, a deleted message should not stay with preview
|
||||
if (!isNaN(egw_appWindow('felamimail').felamimail_iframe_height)) {
|
||||
if (_type=='delete' && _id==fm_previewMessageID) egw_appWindow('felamimail').xajax_doXMLHTTP(
|
||||
"felamimail.ajaxfelamimail.refreshMessagePreview",''
|
||||
, egw_appWindow('felamimail').fm_previewMessageFolderType);
|
||||
}
|
||||
if (bufferExists) doStatus = window.setInterval("egw_appWindow('felamimail').setStatusMessage(MessageBuffer,true);", 5000);
|
||||
// TODO: more actions
|
||||
}
|
||||
if (bufferExists) doStatus = window.setInterval("egw_appWindow('felamimail').setStatusMessage(myMessageBuffer,true);", 10000);
|
||||
}
|
||||
|
||||
function egw_email_fetchDataProc(_elems, _columns, _callback, _context)
|
||||
@ -97,7 +103,7 @@ function mail_parentRefreshListRowStyle(oldID, newID)
|
||||
}
|
||||
|
||||
function setStatusMessage(_message,_setPlain) {
|
||||
if (typeof _setPlain == 'undefined') _setPlain==false;
|
||||
if (typeof _setPlain == 'undefined') _setPlain=false;
|
||||
if (_setPlain == false) document.getElementById('messageCounter').innerHTML = '<table cellpadding="0" cellspacing="0"><tr><td><img src="'+ activityImagePath +'"></td><td> ' + _message + '</td></tr></table>';
|
||||
else document.getElementById('messageCounter').innerHTML = _message;
|
||||
}
|
||||
@ -401,9 +407,26 @@ function mail_deleteMessages(_messageList) {
|
||||
}
|
||||
if (Check == true) {
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' + egw_appWindow('felamimail').lang_deleting_messages + '</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.deleteMessages",_messageList);
|
||||
//mail_cleanup();
|
||||
//document.getElementById('divMessageList').innerHTML = '';
|
||||
//divMessageList.innerHTML = '';
|
||||
for(var i=0;i<_messageList['msg'].length;i++) {
|
||||
_id = _messageList['msg'][i];
|
||||
var dataElem = egw_appWindow('felamimail').mailGrid.dataRoot.getElementById(_id);
|
||||
if (dataElem)
|
||||
{
|
||||
//dataElem.clearData();
|
||||
dataElem.addClass('deleted');
|
||||
// if this is for multiple ids, we may implement that for app_refresh too
|
||||
if (!isNaN(egw_appWindow('felamimail').felamimail_iframe_height)) {
|
||||
if (_id==fm_previewMessageID) egw_appWindow('felamimail').xajax_doXMLHTTP(
|
||||
"felamimail.ajaxfelamimail.refreshMessagePreview",''
|
||||
, egw_appWindow('felamimail').fm_previewMessageFolderType);
|
||||
}
|
||||
}
|
||||
}
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTPsync("felamimail.ajaxfelamimail.deleteMessages",_messageList,false);
|
||||
egw_appWindow('felamimail').refresh();
|
||||
} else {
|
||||
mailGrid.dataRoot.actionObject.setAllSelected(false);
|
||||
}
|
||||
@ -422,9 +445,19 @@ function mail_undeleteMessages(_messageList) {
|
||||
}
|
||||
if (Check == true) {
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' + egw_appWindow('felamimail').lang_deleting_messages + '</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.undeleteMessages",_messageList);
|
||||
//mail_cleanup();
|
||||
//document.getElementById('divMessageList').innerHTML = '';
|
||||
for(var i=0;i<_messageList['msg'].length;i++) {
|
||||
_id = _messageList['msg'][i];
|
||||
var dataElem = egw_appWindow('felamimail').mailGrid.dataRoot.getElementById(_id);
|
||||
if (dataElem)
|
||||
{
|
||||
//dataElem.clearData();
|
||||
dataElem.removeClass('deleted');
|
||||
}
|
||||
}
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTPsync("felamimail.ajaxfelamimail.undeleteMessages",_messageList);
|
||||
egw_appWindow('felamimail').refresh();
|
||||
} else {
|
||||
mailGrid.dataRoot.actionObject.setAllSelected(false);
|
||||
}
|
||||
@ -1055,7 +1088,7 @@ function fm_readMessage(_url, _windowName, _node) {
|
||||
// refreshMessagePreview now also refreshes the folder state
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP(
|
||||
"felamimail.ajaxfelamimail.refreshMessagePreview",
|
||||
windowArray[1], windowArray[2]);
|
||||
windowArray[1], fm_previewMessageFolderType);
|
||||
|
||||
// Mark the message as read
|
||||
fm_msg_removeClass(windowArray[1], 'unseen');
|
||||
|
@ -130,6 +130,7 @@ function mailview_deleteMessages(_messageList) {
|
||||
//dataElem.clearData();
|
||||
dataElem.addClass('deleted');
|
||||
//dataElem.parentActionObject.remove();
|
||||
opener.app_refresh(opener.lang_deleting_messages,'felamimail',_id,'delete');
|
||||
}
|
||||
}
|
||||
opener.refresh();
|
||||
@ -154,6 +155,6 @@ function mailview_undeleteMessages(_messageList) {
|
||||
}
|
||||
}
|
||||
}
|
||||
xajax_doXMLHTTPsync("felamimail.ajaxfelamimail.undeleteMessages",_messageList,false);
|
||||
xajax_doXMLHTTP("felamimail.ajaxfelamimail.undeleteMessages",_messageList,false);
|
||||
//egw_appWindow('felamimail').
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user