From ba7184f44fe36669a9f528532ca8d4699c59ad41 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 21 Jan 2014 14:46:00 +0000 Subject: [PATCH] handle flagging of message as seen explizitly on preview --- mail/inc/class.mail_bosieve.inc.php | 11 ++++++----- mail/inc/class.mail_ui.inc.php | 14 +++++++++----- mail/js/app.js | 10 +++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/mail/inc/class.mail_bosieve.inc.php b/mail/inc/class.mail_bosieve.inc.php index 2bf44b903b..2be57d8941 100644 --- a/mail/inc/class.mail_bosieve.inc.php +++ b/mail/inc/class.mail_bosieve.inc.php @@ -25,13 +25,14 @@ class mail_bosieve { if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'('.print_r($_vacation,true).')'); // unset the fm_preferences session object, to force the reload/rebuild - $GLOBALS['egw']->session->appsession('fm_preferences','felamimail',serialize(array())); - $GLOBALS['egw']->session->appsession('session_data','emailadmin',serialize(array())); $_restoreSession = false; // as in async, each call may be for a different user - $bopreferences = CreateObject('felamimail.bopreferences',$_restoreSession); - $mailPreferences = $bopreferences->getPreferences(); - $icServer = $mailPreferences->getIncomingServer(0); + //$bopreferences = CreateObject('felamimail.bopreferences',$_restoreSession); + //$mailPreferences = $bopreferences->getPreferences(); + //$icServer = $mailPreferences->getIncomingServer(0); + $_profile_id=999999; + $icServer = emailadmin_account::read($_profile_id)->imapServer(); + if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'->LoginName:'.$icServer->loginName); //error_log(__METHOD__.__LINE__.array2string($_vacation)); try diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 48228e2066..cf60ed0b9f 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -3837,12 +3837,13 @@ blockquote[type=cite] { * * @param string _flag name of the flag * @param array _messageList list of UID's + * @param bool _sendJsonResponse tell fuction to send the JsonResponse * * @return xajax response */ - function ajax_flagMessages($_flag, $_messageList) + function ajax_flagMessages($_flag, $_messageList, $_sendJsonResponse=true) { - if(mail_bo::$debug) error_log(__METHOD__."->".$_flag.':'.array2string($_messageList)); + if(mail_bo::$debug); error_log(__METHOD__."->".$_flag.':'.array2string($_messageList)); if ($_messageList=='all' || !empty($_messageList['msg'])) { if ($_messageList=='all') @@ -3875,8 +3876,11 @@ blockquote[type=cite] { $this->saveSessionData(); } */ - $response = egw_json_response::get(); - $response->call('egw_message',lang('flagged %1 messages as %2 in %3',count($_messageList['msg']),lang($_flag),$folder)); + if ($_sendJsonResponse) + { + $response = egw_json_response::get(); + $response->call('egw_message',lang('flagged %1 messages as %2 in %3',count($_messageList['msg']),lang($_flag),$folder)); + } } /** @@ -3909,7 +3913,7 @@ blockquote[type=cite] { } try { - //error_log(__METHOD__."->".print_r($messageList,true).' Method:'.$_forceDeleteMethod); + //error_log(__METHOD__."->".print_r($messageList,true).' folder:'.$folder.' Method:'.$_forceDeleteMethod); $this->mail_bo->deleteMessages(($_messageList=='all' ? 'all':$messageList),$folder,(empty($_forceDeleteMethod)?'no':$_forceDeleteMethod)); } catch (egw_exception $e) diff --git a/mail/js/app.js b/mail/js/app.js index f1573dfeb4..070a22f83f 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -646,7 +646,7 @@ app.classes.mail = AppJS.extend( // When body is requested, mail is marked as read by the mail server. Update UI to match. if (typeof dataElem != 'undefined' && typeof dataElem.data != 'undefined' && typeof dataElem.data.flags != 'undefined' && typeof dataElem.data.flags.read != 'undefined') dataElem.data.flags.read = 'read'; this.mail_removeRowClass(messages,'unseen'); - + egw.jsonq('mail.mail_ui.ajax_flagMessages',['read', messages, false]); // Pre-load next email already so user gets it faster // Browser will cache the file for us /* @@ -1060,8 +1060,8 @@ app.classes.mail = AppJS.extend( mail_compressFolder: function(action,_senders) { //console.log(action,_senders,FolderName); egw_message(this.egw.lang('compress folder')); - egw.json('mail.mail_ui.ajax_compressFolder',[_senders[0].iface.id]) - .sendRequest(true); + egw.jsonq('mail.mail_ui.ajax_compressFolder',[_senders[0].iface.id]); + // .sendRequest(true); // since the json reply is using egw_refresh, we should not need to call refreshFolderStatus // as the actions thereof are now bound to run after grid refresh //this.mail_g(); @@ -1269,8 +1269,8 @@ app.classes.mail = AppJS.extend( */ mail_flagMessages: function(_flag, _elems,_isPopup) { - egw.json('mail.mail_ui.ajax_flagMessages',[_flag, _elems]) - .sendRequest(true); + egw.jsonq('mail.mail_ui.ajax_flagMessages',[_flag, _elems]); + // .sendRequest(true); }, /**