mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 16:38:39 +01:00
* eMail: fix problem regarding the deletion of the last message in list if pagination is switched on
This commit is contained in:
parent
d0f6b40a2b
commit
ec9d6d9806
@ -486,7 +486,6 @@ class ajaxfelamimail
|
||||
$response = new xajaxResponse();
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
return $this->generateMessageList($this->sessionData['mailbox'],($_messageList=='all'?0:(-1*$messageCount)));
|
||||
}
|
||||
|
||||
@ -743,6 +742,8 @@ class ajaxfelamimail
|
||||
$foldestatus = $this->bofelamimail->getMailBoxCounters($_folderName);
|
||||
$headers['info']['total'] = $foldestatus->messages;
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.' Cached FolderInfo:'.array2string($this->sessionData['folderStatus'][$this->imapServerID][$_folderName]['messages']).' WillUse:'.$headers['info']['total']);
|
||||
if ($offset>$headers['info']['total']) $offset = $headers['info']['total']+1-$rowsFetched['rowsFetched'];
|
||||
$headers['info']['first'] = $offset;
|
||||
$headers['info']['last'] = $offset+$rowsFetched['rowsFetched']-1;
|
||||
}
|
||||
@ -1117,7 +1118,7 @@ class ajaxfelamimail
|
||||
$response = new xajaxResponse();
|
||||
$response->addScript("document.getElementById('messageCounter').innerHTML =MessageBuffer;");
|
||||
//$response->addScript("document.getElementById('messageCounter').innerHTML ='';");
|
||||
$response->addScript("fm_previewMessageID=".(empty($_messageID)?'':$headerData['uid']).";");
|
||||
$response->addScript("fm_previewMessageID=".(empty($_messageID)?'null':$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();');
|
||||
|
||||
|
@ -2731,16 +2731,44 @@ class felamimail_bo
|
||||
#_debug_array(array_slice($sortResult, -5, -2));
|
||||
//error_log("REVERSE: $reverse");
|
||||
if($reverse === true) {
|
||||
$startMessage = $_startMessage-1;
|
||||
if ($_startMessage<=$total)
|
||||
{
|
||||
$startMessage = $_startMessage-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.' Start:'.$_startMessage.' NumberOfMessages:'.$_numberOfMessages.' Total:'.$total);
|
||||
if ($_startMessage+$_numberOfMessages>$total)
|
||||
{
|
||||
$numberOfMessages = $total%$_numberOfMessages;
|
||||
//$numberOfMessages = abs($_startMessage-$total-1);
|
||||
if ($numberOfMessages>0 && $numberOfMessages<=$_numberOfMessages) $_numberOfMessages = $numberOfMessages;
|
||||
//error_log(__METHOD__.__LINE__.' Start:'.$_startMessage.' NumberOfMessages:'.$_numberOfMessages.' Total:'.$total);
|
||||
}
|
||||
$startMessage=($total-$_numberOfMessages)-1;
|
||||
//$retValue['info']['first'] = $startMessage;
|
||||
//$retValue['info']['last'] = $total;
|
||||
|
||||
}
|
||||
if ($startMessage+$_numberOfMessages>$total)
|
||||
{
|
||||
$_numberOfMessages = $_numberOfMessages-($total-($startMessage+$_numberOfMessages));
|
||||
//$retValue['info']['first'] = $startMessage;
|
||||
//$retValue['info']['last'] = $total;
|
||||
}
|
||||
if($startMessage > 0) {
|
||||
if (self::$debug) error_log(__METHOD__.__LINE__.' StartMessage:'.(-($_numberOfMessages+$startMessage)).', '.-$startMessage.' Number of Messages:'.count($sortResult));
|
||||
$sortResult = array_slice($sortResult, -($_numberOfMessages+$startMessage), -$startMessage);
|
||||
} else {
|
||||
if (self::$debug) error_log(__METHOD__.__LINE__.' StartMessage:'.(-($_numberOfMessages+($_startMessage-1))).', AllTheRest, Number of Messages:'.count($sortResult));
|
||||
$sortResult = array_slice($sortResult, -($_numberOfMessages+($_startMessage-1)));
|
||||
}
|
||||
$sortResult = array_reverse($sortResult);
|
||||
} else {
|
||||
if (self::$debug) error_log(__METHOD__.__LINE__.' StartMessage:'.($_startMessage-1).', '.$_numberOfMessages.' Number of Messages:'.count($sortResult));
|
||||
$sortResult = array_slice($sortResult, $_startMessage-1, $_numberOfMessages);
|
||||
}
|
||||
if (self::$debug) error_log(__METHOD__.__LINE__.array2string($sortResult));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2799,7 +2827,7 @@ class felamimail_bo
|
||||
//error_log(__METHOD__.__LINE__.' '.$this->decode_subject($headerObject['SUBJECT']).'->'.$headerObject['DATE']);
|
||||
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']);
|
||||
$retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE'];
|
||||
$retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime(($headerObject['DATE']?$headerObject['DATE']:$headerObject['INTERNALDATE']),'ts',true);
|
||||
$retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime(($headerObject['DATE']&&!($headerObject['DATE']=='NIL')?$headerObject['DATE']:$headerObject['INTERNALDATE']),'ts',true);
|
||||
$retValue['header'][$sortOrder[$uid]]['internaldate']= self::_strtotime($headerObject['INTERNALDATE'],'ts',true);
|
||||
$retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE'];
|
||||
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
||||
@ -2881,10 +2909,11 @@ class felamimail_bo
|
||||
//self::$debug=false;
|
||||
// sort the messages to the requested displayorder
|
||||
if(is_array($retValue['header'])) {
|
||||
$countMessages = false;
|
||||
$countMessages = $total;
|
||||
if (isset($_filter['range'])) $countMessages = $this->sessionData['folderStatus'][$this->profileID][$_folderName]['messages'];
|
||||
ksort($retValue['header']);
|
||||
$retValue['info']['total'] = $countMessages ? $countMessages : $total;
|
||||
$retValue['info']['total'] = $total;
|
||||
//if ($_startMessage>$total) $_startMessage = $total-($count-1);
|
||||
$retValue['info']['first'] = $_startMessage;
|
||||
$retValue['info']['last'] = $_startMessage + $count - 1 ;
|
||||
return $retValue;
|
||||
|
@ -59,7 +59,11 @@ function mailGridGetSelected()
|
||||
if (allSelected.length>0) messages['msg'] = [];
|
||||
for (var i=0; i<allSelected.length; i++)
|
||||
{
|
||||
if (allSelected[i].id.length>0) messages['msg'][i] = allSelected[i].id;
|
||||
if (allSelected[i].id.length>0)
|
||||
{
|
||||
messages['msg'][i] = allSelected[i].id;
|
||||
//alert(i+': ID->'+messages['msg'][i]);
|
||||
}
|
||||
}
|
||||
// mailGrid.dataRoot.actionObject.getFocused()
|
||||
return messages;
|
||||
@ -110,6 +114,10 @@ function setStatusMessage(_message,_setPlain) {
|
||||
else document.getElementById('messageCounter').innerHTML = _message;
|
||||
}
|
||||
|
||||
function getStatusMessage() {
|
||||
return document.getElementById('messageCounter').innerHTML;
|
||||
}
|
||||
|
||||
function sendNotifyMS (uid) {
|
||||
ret = confirm(egw_appWindow('felamimail').lang_sendnotify);
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.sendNotify",uid,ret);
|
||||
@ -407,6 +415,7 @@ function mail_deleteMessages(_messageList) {
|
||||
{
|
||||
_messageList = 'all';
|
||||
}
|
||||
var curStatus = egw_appWindow('felamimail').getStatusMessage();
|
||||
if (Check == true) {
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' + egw_appWindow('felamimail').lang_deleting_messages + '</span>');
|
||||
//mail_cleanup();
|
||||
@ -414,6 +423,7 @@ function mail_deleteMessages(_messageList) {
|
||||
//divMessageList.innerHTML = '';
|
||||
for(var i=0;i<_messageList['msg'].length;i++) {
|
||||
_id = _messageList['msg'][i];
|
||||
//alert(i+'->'+_id+': ID->'+messageList['msg'][i]);
|
||||
var dataElem = egw_appWindow('felamimail').mailGrid.dataRoot.getElementById(_id);
|
||||
if (dataElem)
|
||||
{
|
||||
@ -428,6 +438,7 @@ function mail_deleteMessages(_messageList) {
|
||||
}
|
||||
}
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTPsync("felamimail.ajaxfelamimail.deleteMessages",_messageList,false);
|
||||
egw_appWindow('felamimail').setStatusMessage(curStatus,true);
|
||||
egw_appWindow('felamimail').refresh();
|
||||
} else {
|
||||
mailGrid.dataRoot.actionObject.setAllSelected(false);
|
||||
@ -570,66 +581,70 @@ function onNodeSelect(_nodeID) {
|
||||
var actionPending = false;
|
||||
// var formData = new Array();
|
||||
if(top.tree.getUserData(_nodeID, 'folderName')) {
|
||||
/*
|
||||
if(document.getElementsByName("folderAction")[0].value == "moveMessage") {
|
||||
if (prefAskForMove == 1 || prefAskForMove == 2)
|
||||
{
|
||||
//Check = confirm(egw_appWindow('felamimail').lang_askformove + top.tree.getUserData(_nodeID, 'folderName'));
|
||||
title = egw_appWindow('felamimail').lang_MoveCopyTitle;
|
||||
node2call = _nodeID.replace(/&/g,'#ampersand#');
|
||||
message = egw_appWindow('felamimail').lang_askformove + top.tree.getUserData(_nodeID, 'folderName');
|
||||
message = message + "<p><button onclick=\"callNodeSelect('"+node2call+"', 1);hideDialog();\">"+egw_appWindow('felamimail').lang_move+"</button>";
|
||||
if (prefAskForMove == 2) message = message + " <button onclick=\"callNodeSelect('"+node2call+"', 2);hideDialog();\">"+egw_appWindow('felamimail').lang_copy+"</button>";
|
||||
message = message + " <button onclick=\"callNodeSelect('"+node2call+"', 0);hideDialog();\">"+egw_appWindow('felamimail').lang_cancel+"</button>";
|
||||
type = 'prompt';
|
||||
autohide = 0;
|
||||
showDialog(title,message,type,autohide);
|
||||
Check = false;
|
||||
actionPending = true;
|
||||
}
|
||||
if (prefAskForMove==99) actionPending = 'copy';
|
||||
if (Check == true && document.getElementById('selectAllMessagesCheckBox').checked == true) Check = confirm(egw_appWindow('felamimail').lang_confirm_all_messages);
|
||||
if (Check == true)
|
||||
{
|
||||
if (document.getElementById('messageCounter').innerHTML.search(eval('/'+egw_appWindow('felamimail').lang_updating_view+'/'))<0 ) {MessageBuffer = document.getElementById('messageCounter').innerHTML;}
|
||||
if (document.getElementById('selectAllMessagesCheckBox').checked == true) {
|
||||
mail_resetMessageSelect();
|
||||
formData = 'all';
|
||||
if(CopyOrMoveCalled) {
|
||||
//alert('Called onNodeSelect');
|
||||
/*
|
||||
if(document.getElementsByName("folderAction")[0].value == "moveMessage") {
|
||||
if (prefAskForMove == 1 || prefAskForMove == 2)
|
||||
{
|
||||
//Check = confirm(egw_appWindow('felamimail').lang_askformove + top.tree.getUserData(_nodeID, 'folderName'));
|
||||
title = egw_appWindow('felamimail').lang_MoveCopyTitle;
|
||||
node2call = _nodeID.replace(/&/g,'#ampersand#');
|
||||
message = egw_appWindow('felamimail').lang_askformove + top.tree.getUserData(_nodeID, 'folderName');
|
||||
message = message + "<p><button onclick=\"callNodeSelect('"+node2call+"', 1);hideDialog();\">"+egw_appWindow('felamimail').lang_move+"</button>";
|
||||
if (prefAskForMove == 2) message = message + " <button onclick=\"callNodeSelect('"+node2call+"', 2);hideDialog();\">"+egw_appWindow('felamimail').lang_copy+"</button>";
|
||||
message = message + " <button onclick=\"callNodeSelect('"+node2call+"', 0);hideDialog();\">"+egw_appWindow('felamimail').lang_cancel+"</button>";
|
||||
type = 'prompt';
|
||||
autohide = 0;
|
||||
showDialog(title,message,type,autohide);
|
||||
Check = false;
|
||||
actionPending = true;
|
||||
}
|
||||
if (prefAskForMove==99) actionPending = 'copy';
|
||||
if (Check == true && document.getElementById('selectAllMessagesCheckBox').checked == true) Check = confirm(egw_appWindow('felamimail').lang_confirm_all_messages);
|
||||
if (Check == true)
|
||||
{
|
||||
if (document.getElementById('messageCounter').innerHTML.search(eval('/'+egw_appWindow('felamimail').lang_updating_view+'/'))<0 ) {MessageBuffer = document.getElementById('messageCounter').innerHTML;}
|
||||
if (document.getElementById('selectAllMessagesCheckBox').checked == true) {
|
||||
mail_resetMessageSelect();
|
||||
formData = 'all';
|
||||
} else {
|
||||
mail_resetMessageSelect();
|
||||
formData = egw_appWindow('felamimail').mailGridGetSelected();
|
||||
}
|
||||
if (actionPending == 'copy')
|
||||
{
|
||||
egw_appWindow('felamimail').setStatusMessage(egw_appWindow('felamimail').copyingMessages +' <span style="font-weight: bold;">'+ top.tree.getUserData(_nodeID, 'folderName') +'</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.copyMessages", _nodeID, formData);
|
||||
}
|
||||
else
|
||||
{
|
||||
// default: move messages
|
||||
egw_appWindow('felamimail').setStatusMessage(egw_appWindow('felamimail').movingMessages +' <span style="font-weight: bold;">'+ top.tree.getUserData(_nodeID, 'folderName') +'</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.moveMessages", _nodeID, formData);
|
||||
}
|
||||
} else {
|
||||
mail_resetMessageSelect();
|
||||
formData = egw_appWindow('felamimail').mailGridGetSelected();
|
||||
if (actionPending == false)
|
||||
{
|
||||
mail_resetMessageSelect();
|
||||
mailGrid.dataRoot.actionObject.setAllSelected(false);
|
||||
}
|
||||
}
|
||||
if (actionPending == 'copy')
|
||||
{
|
||||
egw_appWindow('felamimail').setStatusMessage(egw_appWindow('felamimail').copyingMessages +' <span style="font-weight: bold;">'+ top.tree.getUserData(_nodeID, 'folderName') +'</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.copyMessages", _nodeID, formData);
|
||||
}
|
||||
else
|
||||
{
|
||||
// default: move messages
|
||||
egw_appWindow('felamimail').setStatusMessage(egw_appWindow('felamimail').movingMessages +' <span style="font-weight: bold;">'+ top.tree.getUserData(_nodeID, 'folderName') +'</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.moveMessages", _nodeID, formData);
|
||||
}
|
||||
} else {
|
||||
if (actionPending == false)
|
||||
{
|
||||
mail_resetMessageSelect();
|
||||
mailGrid.dataRoot.actionObject.setAllSelected(false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
CopyOrMoveCalled = false;
|
||||
} else {
|
||||
*/
|
||||
|
||||
mail_resetMessageSelect();
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' + egw_appWindow('felamimail').lang_loading + ' ' + top.tree.getUserData(_nodeID, 'folderName') + '</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.updateMessageView",_nodeID);
|
||||
egw_appWindow('felamimail').refreshFolderStatus(_nodeID);
|
||||
// }
|
||||
}
|
||||
}
|
||||
CopyOrMove = true;
|
||||
}
|
||||
@ -1528,6 +1543,19 @@ function mail_getFormData(_actionObjects) {
|
||||
return messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move (multiple) messages to a folder to be selected onClick
|
||||
*
|
||||
* @param _action _action.id is 'drop_move_mail' or 'move_'+folder
|
||||
* @param _senders selected messages
|
||||
* @param _target drop-target, if _action.id = 'drop_move_mail'
|
||||
*/
|
||||
var CopyOrMoveCalled = false;
|
||||
function mail_CopyOrMove(_action, _elems) {
|
||||
//alert('Copy or Move Called:'+_action.id);
|
||||
CopyOrMoveCalled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move (multiple) messages to given folder
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user