mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 06:51:14 +01:00
* EMail: speed improvments backported from Trunk
- use a single bofelamimail instance (not backported but hack in CreateObject to get the same result) - queue refresh folder calls, to send only a single one - difference between click and doubleclick on mails to speed up doubleclick (opening mail in popup)
This commit is contained in:
parent
667f304018
commit
765864c89b
@ -809,6 +809,10 @@ class ajaxfelamimail
|
|||||||
$response->addScript("fm_previewMessageID=".$headerData['uid'].";");
|
$response->addScript("fm_previewMessageID=".$headerData['uid'].";");
|
||||||
$response->addAssign('spanMessagePreview', 'innerHTML', $this->uiwidgets->updateMessagePreview($headerData,$_folderType, $this->sessionData['mailbox']));
|
$response->addAssign('spanMessagePreview', 'innerHTML', $this->uiwidgets->updateMessagePreview($headerData,$_folderType, $this->sessionData['mailbox']));
|
||||||
$response->addScript('if (typeof handleResize != "undefined") handleResize();');
|
$response->addScript('if (typeof handleResize != "undefined") handleResize();');
|
||||||
|
|
||||||
|
// Also refresh the folder status
|
||||||
|
$this->refreshFolder($response);
|
||||||
|
|
||||||
return $response->getXML();
|
return $response->getXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,12 +821,19 @@ class ajaxfelamimail
|
|||||||
return $this->generateMessageList($this->sessionData['mailbox']);
|
return $this->generateMessageList($this->sessionData['mailbox']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshFolder()
|
function refreshFolder($injectIntoResponse = false)
|
||||||
{
|
{
|
||||||
if ($this->_debug) error_log("ajaxfelamimail::refreshFolder");
|
if ($this->_debug) error_log("ajaxfelamimail::refreshFolder");
|
||||||
$GLOBALS['egw']->session->commit_session();
|
$GLOBALS['egw']->session->commit_session();
|
||||||
|
|
||||||
|
if (!$injectIntoResponse)
|
||||||
|
{
|
||||||
$response = new xajaxResponse();
|
$response = new xajaxResponse();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$response = $injectIntoResponse;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->_connectionStatus === true) {
|
if ($this->_connectionStatus === true) {
|
||||||
$folderName = $this->sessionData['mailbox'];
|
$folderName = $this->sessionData['mailbox'];
|
||||||
@ -836,8 +847,11 @@ class ajaxfelamimail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$injectIntoResponse)
|
||||||
|
{
|
||||||
return $response->getXML();
|
return $response->getXML();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function refreshFolderList($activeFolderList ='')
|
function refreshFolderList($activeFolderList ='')
|
||||||
{
|
{
|
||||||
|
@ -472,7 +472,8 @@ function refreshFolderStatus(_nodeID,mode) {
|
|||||||
if (mode == "forced") {mode2use = mode;}
|
if (mode == "forced") {mode2use = mode;}
|
||||||
}
|
}
|
||||||
var activeFolders = getTreeNodeOpenItems(nodeToRefresh,mode2use);
|
var activeFolders = getTreeNodeOpenItems(nodeToRefresh,mode2use);
|
||||||
egw_appWindow('felamimail').xajax_doXMLHTTP('felamimail.ajaxfelamimail.refreshFolderList', activeFolders);
|
queueRefreshFolderList(activeFolders);
|
||||||
|
// egw_appWindow('felamimail').xajax_doXMLHTTP('felamimail.ajaxfelamimail.refreshFolderList', activeFolders);
|
||||||
// if (fm_previewMessageID>0)
|
// if (fm_previewMessageID>0)
|
||||||
// {
|
// {
|
||||||
// //setStatusMessage('<span style="font-weight: bold;">'+ egw_appWindow('felamimail').lang_updating_view +'</span>');
|
// //setStatusMessage('<span style="font-weight: bold;">'+ egw_appWindow('felamimail').lang_updating_view +'</span>');
|
||||||
@ -480,6 +481,33 @@ function refreshFolderStatus(_nodeID,mode) {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var felamimail_queuedFolders = [];
|
||||||
|
var felamimail_queuedFoldersIndex = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues a refreshFolderList request for 1ms. Actually this will just execute the
|
||||||
|
* code after the calling script has finished.
|
||||||
|
*/
|
||||||
|
function queueRefreshFolderList(_folders)
|
||||||
|
{
|
||||||
|
felamimail_queuedFolders.push(_folders);
|
||||||
|
felamimail_queuedFoldersIndex++;
|
||||||
|
|
||||||
|
// Copy idx onto the anonymous function scope
|
||||||
|
var idx = felamimail_queuedFoldersIndex;
|
||||||
|
window.setTimeout(function() {
|
||||||
|
if (idx == felamimail_queuedFoldersIndex)
|
||||||
|
{
|
||||||
|
var folders = felamimail_queuedFolders.join(",");
|
||||||
|
felamimail_queuedFoldersIndex = 0;
|
||||||
|
felamimail_queuedFolders = [];
|
||||||
|
|
||||||
|
egw_appWindow('felamimail').xajax_doXMLHTTP('felamimail.ajaxfelamimail.refreshFolderList', folders);
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
|
||||||
function refreshView() {
|
function refreshView() {
|
||||||
if (document.getElementById('messageCounter').innerHTML.search(eval('/'+egw_appWindow('felamimail').lang_updating_view+'/'))<0 ) {MessageBuffer = document.getElementById('messageCounter').innerHTML;}
|
if (document.getElementById('messageCounter').innerHTML.search(eval('/'+egw_appWindow('felamimail').lang_updating_view+'/'))<0 ) {MessageBuffer = document.getElementById('messageCounter').innerHTML;}
|
||||||
document.mainView.submit();
|
document.mainView.submit();
|
||||||
@ -562,6 +590,44 @@ function fm_startTimerMessageListUpdate(_refreshTimeOut) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var felamimail_messageUrls = {};
|
||||||
|
var felamimail_dblclick_speed = 300;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles message clicks and distinguishes between double clicks and single clicks
|
||||||
|
*/
|
||||||
|
function fm_handleMessageClick(_double, _url, _windowName, _node)
|
||||||
|
{
|
||||||
|
if (_double)
|
||||||
|
{
|
||||||
|
// Unset the given message url - the timeout which was triggered in the
|
||||||
|
// click handler will now no longer call the fm_readMessage function
|
||||||
|
delete (felamimail_messageUrls[_url]);
|
||||||
|
|
||||||
|
fm_readMessage(_url, _windowName, _node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check whether the given url is already queued. Only continue if this
|
||||||
|
// is not the case
|
||||||
|
if (typeof felamimail_messageUrls[_url] == "undefined")
|
||||||
|
{
|
||||||
|
// Queue the url
|
||||||
|
felamimail_messageUrls[_url] = true;
|
||||||
|
|
||||||
|
// Wait "felamimail_dblclick_speed" milliseconds. Only if the doubleclick
|
||||||
|
// event doesn't occur in this time, trigger the single click function
|
||||||
|
window.setTimeout(function () {
|
||||||
|
if (typeof felamimail_messageUrls[_url] == "boolean")
|
||||||
|
{
|
||||||
|
fm_readMessage(_url, _windowName, _node);
|
||||||
|
delete (felamimail_messageUrls[_url]);
|
||||||
|
}
|
||||||
|
}, felamimail_dblclick_speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function fm_readMessage(_url, _windowName, _node) {
|
function fm_readMessage(_url, _windowName, _node) {
|
||||||
var windowArray = _windowName.split('_');
|
var windowArray = _windowName.split('_');
|
||||||
var tableElement =_node.parentNode.parentNode.parentNode.parentNode;
|
var tableElement =_node.parentNode.parentNode.parentNode.parentNode;
|
||||||
@ -576,9 +642,13 @@ function fm_readMessage(_url, _windowName, _node) {
|
|||||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">'+ egw_appWindow('felamimail').lang_updating_view +'</span>');
|
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">'+ egw_appWindow('felamimail').lang_updating_view +'</span>');
|
||||||
fm_previewMessageID = windowArray[1];
|
fm_previewMessageID = windowArray[1];
|
||||||
fm_previewMessageFolderType = windowArray[2];
|
fm_previewMessageFolderType = windowArray[2];
|
||||||
|
// refreshMessagePreview now also refreshes the folder state
|
||||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshMessagePreview",windowArray[1],windowArray[2]);
|
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshMessagePreview",windowArray[1],windowArray[2]);
|
||||||
} else {
|
} else {
|
||||||
egw_openWindowCentered(_url, _windowName, 750, egw_getWindowOuterHeight());
|
egw_openWindowCentered(_url, _windowName, 750, egw_getWindowOuterHeight());
|
||||||
|
|
||||||
|
// Refresh the folder state (count of unread emails)
|
||||||
|
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshFolder");
|
||||||
}
|
}
|
||||||
trElement = _node.parentNode.parentNode.parentNode;
|
trElement = _node.parentNode.parentNode.parentNode;
|
||||||
trElement.style.fontWeight='normal';
|
trElement.style.fontWeight='normal';
|
||||||
@ -587,7 +657,6 @@ function fm_readMessage(_url, _windowName, _node) {
|
|||||||
aElements = trElement.getElementsByTagName("a");
|
aElements = trElement.getElementsByTagName("a");
|
||||||
aElements[0].style.fontWeight='normal';
|
aElements[0].style.fontWeight='normal';
|
||||||
aElements[1].style.fontWeight='normal';
|
aElements[1].style.fontWeight='normal';
|
||||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshFolder");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fm_readAttachments(_url, _windowName, _node) {
|
function fm_readAttachments(_url, _windowName, _node) {
|
||||||
|
@ -275,8 +275,8 @@ fm_startTimerMessageListUpdate(refreshTimeOut);
|
|||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
||||||
<a class="{row_css_class}" name="subject_url" href="#"
|
<a class="{row_css_class}" name="subject_url" href="#"
|
||||||
onclick="fm_readMessage('{url_read_message}', '{preview_message_windowName}', this); return false;"
|
onclick="fm_handleMessageClick(false, '{url_read_message}', '{preview_message_windowName}', this); return false;"
|
||||||
ondblclick="fm_readMessage('{url_read_message}', '{read_message_windowName}', this); return false;"
|
ondblclick="fm_handleMessageClick(true, '{url_read_message}', '{read_message_windowName}', this); return false;"
|
||||||
title="{full_subject}">{header_subject}</a>
|
title="{full_subject}">{header_subject}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" width="95px" align="center">
|
<td class="mainscreenRow" width="95px" align="center">
|
||||||
@ -311,8 +311,8 @@ fm_startTimerMessageListUpdate(refreshTimeOut);
|
|||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
||||||
<a class="{row_css_class}" name="subject_url" href="#"
|
<a class="{row_css_class}" name="subject_url" href="#"
|
||||||
onclick="fm_readMessage('{url_read_message}', '{preview_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
onclick="fm_handleMessageClick(false, '{url_read_message}', '{preview_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
||||||
ondblclick="fm_readMessage('{url_read_message}', '{read_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
ondblclick="fm_handleMessageClick(true, '{url_read_message}', '{read_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
||||||
title="{full_subject}">{header_subject}</a>
|
title="{full_subject}">{header_subject}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" width="95px" align="center">
|
<td class="mainscreenRow" width="95px" align="center">
|
||||||
|
@ -280,8 +280,8 @@ fm_startTimerMessageListUpdate(refreshTimeOut);
|
|||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
||||||
<a class="{row_css_class}" name="subject_url" href="#"
|
<a class="{row_css_class}" name="subject_url" href="#"
|
||||||
onclick="fm_readMessage('{url_read_message}', '{preview_message_windowName}', this); return false;"
|
onclick="fm_handleMessageClick(false, '{url_read_message}', '{preview_message_windowName}', this); return false;"
|
||||||
ondblclick="fm_readMessage('{url_read_message}', '{read_message_windowName}', this); return false;"
|
ondblclick="fm_handleMessageClick(true, '{url_read_message}', '{read_message_windowName}', this); return false;"
|
||||||
title="{full_subject}">{header_subject}</a>
|
title="{full_subject}">{header_subject}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" width="95px" align="center">
|
<td class="mainscreenRow" width="95px" align="center">
|
||||||
@ -316,8 +316,8 @@ fm_startTimerMessageListUpdate(refreshTimeOut);
|
|||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
<td class="mainscreenRow" style="overflow:hidden; white-space:nowrap;"><nobr>
|
||||||
<a class="{row_css_class}" name="subject_url" href="#"
|
<a class="{row_css_class}" name="subject_url" href="#"
|
||||||
onclick="fm_readMessage('{url_read_message}', '{preview_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
onclick="fm_handleMessageClick(false, '{url_read_message}', '{preview_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
||||||
ondblclick="fm_readMessage('{url_read_message}', '{read_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
ondblclick="fm_handleMessageClick(true, '{url_read_message}', '{read_message_windowName}', this); parentNode.parentNode.parentNode.style.fontWeight='normal'; return false;"
|
||||||
title="{full_subject}">{header_subject}</a>
|
title="{full_subject}">{header_subject}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="mainscreenRow" width="95px" align="center">
|
<td class="mainscreenRow" width="95px" align="center">
|
||||||
|
@ -731,6 +731,13 @@ function get_var($variable,$method='any',$default_value='')
|
|||||||
*/
|
*/
|
||||||
function &CreateObject($class)
|
function &CreateObject($class)
|
||||||
{
|
{
|
||||||
|
$useSingleton = $class == 'felamimail.bofelamimail';
|
||||||
|
static $classReferences = array();
|
||||||
|
if ($useSingleton && isset($classReferences[$class]))
|
||||||
|
{
|
||||||
|
return $classReferences[$class];
|
||||||
|
}
|
||||||
|
|
||||||
list($appname,$classname) = explode('.',$class);
|
list($appname,$classname) = explode('.',$class);
|
||||||
|
|
||||||
if (!class_exists($classname))
|
if (!class_exists($classname))
|
||||||
@ -795,6 +802,10 @@ function &CreateObject($class)
|
|||||||
{
|
{
|
||||||
echo "<p>CreateObject('$class'): Cant instanciate class!!!<br />\n".function_backtrace(1)."</p>\n";
|
echo "<p>CreateObject('$class'): Cant instanciate class!!!<br />\n".function_backtrace(1)."</p>\n";
|
||||||
}
|
}
|
||||||
|
if ($useSingleton)
|
||||||
|
{
|
||||||
|
$classReferences[$class] = $obj;
|
||||||
|
}
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user