mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 18:33:39 +01:00
* eMail: offer last moveTo folder as direct menuaction; try to avoid to access --topfolder--
This commit is contained in:
parent
c6b2086ba0
commit
660976b77f
@ -46,6 +46,14 @@ class ajaxfelamimail
|
||||
function ajaxfelamimail()
|
||||
{
|
||||
if($this->_debug) error_log("ajaxfelamimail::ajaxfelamimail");
|
||||
$folderToSelect = null; // attempt to select the right folder at initialization
|
||||
if (isset($_GET['menuaction']) && $_GET['menuaction']=='felamimail.ajaxfelamimail.updateMessageView')
|
||||
{
|
||||
//error_log("ajaxfelamimail::ajaxfelamimail".array2string(json_decode($_POST['json_data'])));
|
||||
if (isset($_POST['json_data'])) $r = json_decode($_POST['json_data']);
|
||||
if (isset($r->request->parameters[0])) $folderToSelect = $r->request->parameters[0];
|
||||
if ($folderToSelect=="--topfolder--") $folderToSelect = null;
|
||||
}
|
||||
if (isset($GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID']))
|
||||
$this->imapServerID = (int)$GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'];
|
||||
//error_log("ajaxfelamimail::ajaxfelamimail ActiveProfile:".$this->imapServerID );
|
||||
@ -64,6 +72,7 @@ class ajaxfelamimail
|
||||
if(!isset($this->sessionDataAjax['folderName'])) {
|
||||
$this->sessionDataAjax['folderName'] = $this->sessionData['mailbox']?$this->sessionData['mailbox']:'INBOX';
|
||||
}
|
||||
if(isset($this->sessionDataAjax['folderName'])) $this->bofelamimail->reopen((isset($folderToSelect)?$folderToSelect:$this->sessionDataAjax['folderName']));
|
||||
//error_log("ajaxfelamimail::ajaxfelamimail ActiveProfile:".$this->imapServerID.' activeFolder:'.$this->sessionDataAjax['folderName'].'./.'.$this->sessionData['mailbox'].' ConnectionStatus:'.array2string($this->_connectionStatus));
|
||||
}
|
||||
|
||||
@ -982,6 +991,9 @@ class ajaxfelamimail
|
||||
$response->addScript('onNodeSelect("'.$this->sessionData['mailbox'].'");');
|
||||
return $response->getXML();
|
||||
}
|
||||
$lastFolderUsedForMove = egw_cache::getCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1);
|
||||
$lastFolderUsedForMove[$this->imapServerID] = $folderName;
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),$lastFolderUsedForMove,$expiration=60*60*1);
|
||||
} else {
|
||||
if($this->_debug) error_log("ajaxfelamimail::moveMessages-> same folder than current selected");
|
||||
}
|
||||
@ -1704,7 +1716,7 @@ class ajaxfelamimail
|
||||
// unset the previewID, as the Message will not be available on another folder
|
||||
if ($folderName != $this->sessionData['mailbox']) unset($this->sessionData['previewMessage']);
|
||||
|
||||
$this->sessionData['mailbox'] = $folderName;
|
||||
$this->sessionData['mailbox'] = $this->sessionDataAjax['folderName'] = $folderName;
|
||||
$this->sessionData['startMessage'] = 1;
|
||||
$this->saveSessionData();
|
||||
|
||||
|
@ -57,6 +57,7 @@ class uiwidgets
|
||||
|
||||
$this->_connectionStatus = $this->bofelamimail->openConnection($this->profileID);
|
||||
$this->sessionData =& $GLOBALS['egw']->session->appsession('session_data','felamimail');
|
||||
$this->bofelamimail->reopen($this->sessionData['mailbox']);
|
||||
$this->sessionData['folderStatus'] = egw_cache::getCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
|
||||
$previewFrameHeight = -1;
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['felamimail']['PreViewFrameHeight'] &&
|
||||
@ -316,7 +317,23 @@ class uiwidgets
|
||||
'Drafts' => 'Drafts',
|
||||
'Sent' => 'Sent',
|
||||
);
|
||||
$lastFolderUsedForMove = null;
|
||||
$moveaction = 'move_';
|
||||
$lastFolderUsedForMoveCont = egw_cache::getCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1);
|
||||
if (isset($lastFolderUsedForMoveCont[$this->profileID]))
|
||||
{
|
||||
$_folder = $this->bofelamimail->icServer->getCurrentMailbox();
|
||||
//error_log(__METHOD__.__LINE__.' '.$_folder."<->".$lastFolderUsedForMoveCont[$this->profileID].function_backtrace());
|
||||
//if ($_folder!=$lastFolderUsedForMoveCont[$this->profileID]) $this->bofelamimail->icServer->selectMailbox($lastFolderUsedForMoveCont[$this->profileID]);
|
||||
if ($_folder!=$lastFolderUsedForMoveCont[$this->profileID])
|
||||
{
|
||||
$lastFolderUsedForMove = $this->bofelamimail->getFolderStatus($lastFolderUsedForMoveCont[$this->profileID]);
|
||||
//error_log(array2string($lastFolderUsedForMove));
|
||||
$moveaction .= $lastFolderUsedForMoveCont[$this->profileID];
|
||||
}
|
||||
//if ($_folder!=$lastFolderUsedForMoveCont[$this->profileID]) $this->bofelamimail->icServer->selectMailbox($_folder);
|
||||
|
||||
}
|
||||
$actions = array(
|
||||
'open' => array(
|
||||
'caption' => lang('Open'),
|
||||
@ -374,6 +391,13 @@ class uiwidgets
|
||||
'onExecute' => 'javaScript:mail_compose',
|
||||
'allowOnMultiple' => false,
|
||||
),
|
||||
$moveaction => array(
|
||||
'caption' => lang('Move to Folder').' '.(isset($lastFolderUsedForMove['shortDisplayName'])?$lastFolderUsedForMove['shortDisplayName']:''),
|
||||
'icon' => 'move',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:mail_move2folder',
|
||||
'allowOnMultiple' => true,
|
||||
),
|
||||
'infolog' => array(
|
||||
'caption' => 'InfoLog',
|
||||
'hint' => 'Save as InfoLog',
|
||||
@ -630,6 +654,10 @@ class uiwidgets
|
||||
{
|
||||
unset($actions['tracker']);
|
||||
}
|
||||
if (empty($lastFolderUsedForMove))
|
||||
{
|
||||
unset($actions[$moveaction]);
|
||||
}
|
||||
// note this one is NOT a real CAPABILITY reported by the server, but added by selectMailbox
|
||||
if (!$this->bofelamimail->icServer->hasCapability('SUPPORTS_KEYWORDS'))
|
||||
{
|
||||
|
@ -637,7 +637,7 @@ function onNodeSelect(_nodeID) {
|
||||
*/
|
||||
CopyOrMoveCalled = false;
|
||||
//- } else {
|
||||
|
||||
if (_nodeID=='--topfolder--') _nodeID = 'INBOX';
|
||||
mail_resetMessageSelect();
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' + egw_appWindow('felamimail').lang_loading + ' ' + top.tree.getUserData(_nodeID, 'folderName') + '</span>');
|
||||
mail_cleanup();
|
||||
@ -1556,6 +1556,12 @@ function mail_CopyOrMove(_action, _elems) {
|
||||
CopyOrMoveCalled = true;
|
||||
}
|
||||
|
||||
function mail_move2folder(_action, _elems) {
|
||||
//alert('Copy or Move Called:'+_action.id);
|
||||
// _action.id holds folder target information
|
||||
mail_move(_action, _elems, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move (multiple) messages to given folder
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user