diff --git a/felamimail/inc/class.ajaxfelamimail.inc.php b/felamimail/inc/class.ajaxfelamimail.inc.php
index 5d59d50126..ee0f2cdf33 100644
--- a/felamimail/inc/class.ajaxfelamimail.inc.php
+++ b/felamimail/inc/class.ajaxfelamimail.inc.php
@@ -397,8 +397,15 @@
*/
function flagMessages($_flag, $_messageList)
{
- if($this->_debug) error_log("ajaxfelamimail::flagMessages");
- $this->bofelamimail->flagMessages($_flag, $_messageList);
+ if($this->_debug) error_log(__METHOD__."->".$_flag.':'.print_r($_messageList,true));
+ if (!empty($_messageList['msg']))
+ {
+ $this->bofelamimail->flagMessages($_flag, $_messageList['msg']);
+ }
+ else
+ {
+ if($this->_debug) error_log(__METHOD__."-> No messages selected.");
+ }
return $this->generateMessageList($this->sessionData['mailbox']);
}
diff --git a/felamimail/inc/class.uidisplay.inc.php b/felamimail/inc/class.uidisplay.inc.php
index e2c8279a10..19cab33f25 100644
--- a/felamimail/inc/class.uidisplay.inc.php
+++ b/felamimail/inc/class.uidisplay.inc.php
@@ -209,6 +209,8 @@
$uiWidgets =& CreateObject('felamimail.uiwidgets');
// (regis) seems to be necessary to reopen...
$this->bofelamimail->reopen($this->mailbox);
+ // retrieve the flags of the message, before touching it.
+ if (!empty($this->uid)) $flags = $this->bofelamimail->getFlags($this->uid);
#print "$this->mailbox, $this->uid, $partID
";
$headers = $this->bofelamimail->getMessageHeader($this->uid, $partID);
if (PEAR::isError($headers)) {
@@ -232,8 +234,8 @@
#_debug_array($bodyParts); exit;
#_debug_array($this->uid);
#_debug_array($this->bofelamimail->getFlags($this->uid)); #exit;
- // flag the message as read/seen
- if (!empty($this->uid)) $this->bofelamimail->flagMessages('read', $this->uid);
+ // flag the message as read/seen (if not already flagged)
+ if (!empty($this->uid) && strpos( array2string($flags),'Seen')===false) $this->bofelamimail->flagMessages('read', $this->uid);
$nextMessage = $this->bofelamimail->getNextMessage($this->mailbox, $this->uid);
@@ -276,7 +278,8 @@
$this->t->set_file(array("displayMsg" => "view_message_printable.tpl"));
$this->t->set_var('charset',$GLOBALS['egw']->translation->charset());
}
- if ( $sent_not != "" && $this->bofelamimail->getNotifyFlags($this->uid) === null ) {
+ // only notify when requested, notify flag (MDNSent/MDNnotSent) not set, and message not already seen (some servers do not support the MDNSent/MDNnotSent flag)
+ if ( $sent_not != "" && $this->bofelamimail->getNotifyFlags($this->uid) === null && strpos( array2string($flags),'Seen')===false) {
$this->t->set_var('sentNotify','sendNotify("'.$this->uid.'");');
$this->t->set_var('lang_sendnotify',lang('The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?'));
} else {
diff --git a/felamimail/js/jscode/viewMainScreen.js b/felamimail/js/jscode/viewMainScreen.js
index bc4b43c076..19171655e4 100644
--- a/felamimail/js/jscode/viewMainScreen.js
+++ b/felamimail/js/jscode/viewMainScreen.js
@@ -220,37 +220,15 @@ function extendedSearch(_selectBox) {
function flagMessages(_flag)
{
- var selectedMessages = new Array();
- var selectedCheckBoxes = new Array();
-
- resetMessageSelect();
-
+ var _messageList;
+ resetMessageSelect();
+ _messageList = xajax.getFormValues('formMessageList');
+
//alert(_messageList);
- for(i=0; i< document.forms.formMessageList.elements.length; i++) {
- if(document.forms.formMessageList.elements[i].checked) {
- selectedMessages.push(document.forms.formMessageList.elements[i].value);
- selectedCheckBoxes.push(document.forms.formMessageList.elements[i]);
- }
- }
-// alert(_flag);
-// switch(_flag) {
-// case 'read':
-// for(i=0; i< selectedMessages.length; i++) {
-// document.getElementById('row_' + selectedMessages[i]).style.fontWeight='normal';
-// selectedCheckBoxes[i].checked = false;
-// }
-// break;
-// case 'unread':
-// for(i=0; i< selectedMessages.length; i++) {
-// document.getElementById('row_' + selectedMessages[i]).style.fontWeight='bold';
-// selectedCheckBoxes[i].checked = false;
-// }
-// break;
-// }
setStatusMessage('' + lang_updating_message_status + '');
document.getElementById('divMessageList').innerHTML = '';
- xajax_doXMLHTTP("felamimail.ajaxfelamimail.flagMessages", _flag, selectedMessages);
+ xajax_doXMLHTTP("felamimail.ajaxfelamimail.flagMessages", _flag, _messageList);
fm_startTimerMessageListUpdate(refreshTimeOut);
}