mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 11:23:54 +01:00
first steps to change profile by click on profileNode
This commit is contained in:
parent
3bce17e854
commit
c8d6d4b436
@ -207,7 +207,8 @@ class mail_bo
|
|||||||
$loadfailed = false;
|
$loadfailed = false;
|
||||||
self::$instances[$_profileID]->mailPreferences = self::$instances[$_profileID]->bopreferences->getPreferences(true,$_profileID);
|
self::$instances[$_profileID]->mailPreferences = self::$instances[$_profileID]->bopreferences->getPreferences(true,$_profileID);
|
||||||
//error_log(__METHOD__.__LINE__." ReRead the Prefs for ProfileID ".$_profileID.' called from:'.function_backtrace());
|
//error_log(__METHOD__.__LINE__." ReRead the Prefs for ProfileID ".$_profileID.' called from:'.function_backtrace());
|
||||||
if (self::$instances[$_profileID]->mailPreferences) {
|
if (self::$instances[$_profileID]->mailPreferences)
|
||||||
|
{
|
||||||
self::$instances[$_profileID]->icServer = self::$instances[$_profileID]->mailPreferences->getIncomingServer($_profileID);
|
self::$instances[$_profileID]->icServer = self::$instances[$_profileID]->mailPreferences->getIncomingServer($_profileID);
|
||||||
// if we do not get an icServer object, session restore failed on bopreferences->getPreferences
|
// if we do not get an icServer object, session restore failed on bopreferences->getPreferences
|
||||||
if (!self::$instances[$_profileID]->icServer) $loadfailed=true;
|
if (!self::$instances[$_profileID]->icServer) $loadfailed=true;
|
||||||
@ -289,6 +290,7 @@ class mail_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self::$debug) error_log(__METHOD__.'::'.__LINE__.' ProfileSelected:'.$_profileID.' -> '.$identities[$_profileID]);
|
if (self::$debug) error_log(__METHOD__.'::'.__LINE__.' ProfileSelected:'.$_profileID.' -> '.$identities[$_profileID]);
|
||||||
|
|
||||||
return $_profileID;
|
return $_profileID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2536,7 +2538,7 @@ class mail_bo
|
|||||||
*/
|
*/
|
||||||
function getMessageAttachments($_uid, $_partID='', $_structure='', $fetchEmbeddedImages=true, $fetchTextCalendar=false, $resolveTNEF=true)
|
function getMessageAttachments($_uid, $_partID='', $_structure='', $fetchEmbeddedImages=true, $fetchTextCalendar=false, $resolveTNEF=true)
|
||||||
{
|
{
|
||||||
if (self::$debug) echo __METHOD__."$_uid, $_partID<br>";
|
if (self::$debug) error_log( __METHOD__.":$_uid, $_partID");
|
||||||
|
|
||||||
if(is_object($_structure)) {
|
if(is_object($_structure)) {
|
||||||
$structure = $_structure;
|
$structure = $_structure;
|
||||||
@ -2547,7 +2549,7 @@ class mail_bo
|
|||||||
$structure = $this->_getSubStructure($structure, $_partID);
|
$structure = $this->_getSubStructure($structure, $_partID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self::$debug) _debug_array($structure);
|
if (self::$debug) error_log(__METHOD__.__LINE__.array2string($structure));
|
||||||
$attachments = array();
|
$attachments = array();
|
||||||
// this kind of messages contain only the attachment and no body
|
// this kind of messages contain only the attachment and no body
|
||||||
if($structure->type == 'APPLICATION' || $structure->type == 'AUDIO' || $structure->type == 'VIDEO' || $structure->type == 'IMAGE' || ($structure->type == 'TEXT' && $structure->disposition == 'ATTACHMENT') )
|
if($structure->type == 'APPLICATION' || $structure->type == 'AUDIO' || $structure->type == 'VIDEO' || $structure->type == 'IMAGE' || ($structure->type == 'TEXT' && $structure->disposition == 'ATTACHMENT') )
|
||||||
|
@ -45,8 +45,11 @@ class mail_ui
|
|||||||
if (!empty($_GET["resetConnection"])) $connectionReset = html::purify($_GET["resetConnection"]);
|
if (!empty($_GET["resetConnection"])) $connectionReset = html::purify($_GET["resetConnection"]);
|
||||||
unset($_GET["resetConnection"]);
|
unset($_GET["resetConnection"]);
|
||||||
|
|
||||||
$icServerID =& egw_cache::getSession('mail','activeProfileID');
|
//$icServerID =& egw_cache::getSession('mail','activeProfileID');
|
||||||
|
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']) && !empty($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
|
||||||
|
{
|
||||||
|
$icServerID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
|
||||||
|
}
|
||||||
if ($connectionReset)
|
if ($connectionReset)
|
||||||
{
|
{
|
||||||
error_log(__METHOD__.__LINE__.' Connection Reset triggered:'.$connectionReset.' for Profile with ID:'.$icServerID);
|
error_log(__METHOD__.__LINE__.' Connection Reset triggered:'.$connectionReset.' for Profile with ID:'.$icServerID);
|
||||||
@ -54,13 +57,36 @@ class mail_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->mail_bo = mail_bo::getInstance(false,$icServerID);
|
$this->mail_bo = mail_bo::getInstance(false,$icServerID);
|
||||||
error_log(__METHOD__.__LINE__.' Fetched IC Server:'.$icServerID.function_backtrace());
|
error_log(__METHOD__.__LINE__.' Fetched IC Server:'.$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace());
|
||||||
// no icServer Object: something failed big time
|
// no icServer Object: something failed big time
|
||||||
if (!isset($this->mail_bo->icServer)) exit; // ToDo: Exception or the dialog for setting up a server config
|
if (!isset($this->mail_bo->icServer)) exit; // ToDo: Exception or the dialog for setting up a server config
|
||||||
if (!($this->mail_bo->icServer->_connected == 1)) $this->mail_bo->openConnection($icServerID);
|
if (!($this->mail_bo->icServer->_connected == 1)) $this->mail_bo->openConnection($icServerID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* changeProfile
|
||||||
|
*
|
||||||
|
* @param int $icServerID
|
||||||
|
*/
|
||||||
|
function changeProfile($icServerID)
|
||||||
|
{
|
||||||
|
error_log(__METHOD__.__LINE__.'->'.$icServerID);
|
||||||
|
emailadmin_bo::unsetCachedObjects($icServerID);
|
||||||
|
$this->mail_bo = mail_bo::getInstance(false,$icServerID);
|
||||||
|
error_log(__METHOD__.__LINE__.' Fetched IC Server:'.$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace());
|
||||||
|
// no icServer Object: something failed big time
|
||||||
|
if (!isset($this->mail_bo->icServer)) exit; // ToDo: Exception or the dialog for setting up a server config
|
||||||
|
/*if (!($this->mail_bo->icServer->_connected == 1))*/ $this->mail_bo->openConnection($icServerID);
|
||||||
|
// save session varchar
|
||||||
|
$oldicServerID =& egw_cache::getSession('mail','activeProfileID');
|
||||||
|
$oldicServerID = $icServerID;
|
||||||
|
// save pref
|
||||||
|
$GLOBALS['egw']->preferences->add('mail','ActiveProfileID',$icServerID,'user');
|
||||||
|
$GLOBALS['egw']->preferences->save_repository(true);
|
||||||
|
$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $icServerID;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main mail page
|
* Main mail page
|
||||||
*
|
*
|
||||||
@ -328,8 +354,12 @@ class mail_ui
|
|||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
*/
|
*/
|
||||||
function getFolderTree($_fetchCounters=false)
|
function getFolderTree($_fetchCounters=false, $_profileID=null)
|
||||||
{
|
{
|
||||||
|
if ($_profileID && $_profileID != $this->mail_bo->profileID)
|
||||||
|
{
|
||||||
|
$this->changeProfile($_profileID);
|
||||||
|
}
|
||||||
$folderObjects = $this->mail_bo->getFolderObjects(true,false,true);
|
$folderObjects = $this->mail_bo->getFolderObjects(true,false,true);
|
||||||
$trashFolder = $this->mail_bo->getTrashFolder();
|
$trashFolder = $this->mail_bo->getTrashFolder();
|
||||||
$templateFolder = $this->mail_bo->getTemplateFolder();
|
$templateFolder = $this->mail_bo->getTemplateFolder();
|
||||||
@ -1303,6 +1333,18 @@ error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Star
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* empty changeProfile - its called via json, so the function must start with ajax (or the class-name must contain ajax)
|
||||||
|
*
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
function ajax_changeProfile($icServerID)
|
||||||
|
{
|
||||||
|
$this->changeProfile($icServerID);
|
||||||
|
$response = egw_json_response::get();
|
||||||
|
$response->call('egw_refresh',lang('changed profile'),'mail');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* empty trash folder - its called via json, so the function must start with ajax (or the class-name must contain ajax)
|
* empty trash folder - its called via json, so the function must start with ajax (or the class-name must contain ajax)
|
||||||
*
|
*
|
||||||
|
@ -30,6 +30,12 @@ function mail_startTimerFolderStatusUpdate(_refreshTimeOut) {
|
|||||||
if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds (our initial call)
|
if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds (our initial call)
|
||||||
mail_doTimedRefresh = window.setInterval("mail_refreshFolderStatus()", _refreshTimeOut);
|
mail_doTimedRefresh = window.setInterval("mail_refreshFolderStatus()", _refreshTimeOut);
|
||||||
}
|
}
|
||||||
|
// initial call done -> now set the timeout to the timeout defined by pref
|
||||||
|
if(_refreshTimeOut == 10000)
|
||||||
|
{
|
||||||
|
var minutes = egw.preference('refreshTime','mail');
|
||||||
|
mail_refreshTimeOut = _refreshTimeOut= 1000*60*(minutes?minutes:3); // either the prefs or 3 Minutes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,8 +182,24 @@ function mail_compressFolder() {
|
|||||||
request.sendRequest();
|
request.sendRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mail_changeProfile
|
||||||
|
* @param folder, the ID of the selected Node -> should be an integer
|
||||||
|
* @param _widget, handle to the tree widget
|
||||||
|
*/
|
||||||
|
function mail_changeProfile(folder,_widget) {
|
||||||
|
// alert(folder);
|
||||||
|
var request = new egw_json_request('mail.mail_ui.ajax_changeProfile',[folder]);
|
||||||
|
request.sendRequest(false);
|
||||||
|
mail_refreshMessageGrid();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mail_changeFolder
|
* mail_changeFolder
|
||||||
|
* @param folder, the ID of the selected Node
|
||||||
|
* @param _widget, handle to the tree widget
|
||||||
*/
|
*/
|
||||||
function mail_changeFolder(folder,_widget) {
|
function mail_changeFolder(folder,_widget) {
|
||||||
//alert('change Folder called:'+folder);
|
//alert('change Folder called:'+folder);
|
||||||
@ -185,6 +207,14 @@ function mail_changeFolder(folder,_widget) {
|
|||||||
var img = _widget.getSelectedNode().images[0]; // fetch first image
|
var img = _widget.getSelectedNode().images[0]; // fetch first image
|
||||||
if (!(img.search(eval('/'+'NoSelect'+'/'))<0) || !(img.search(eval('/'+'thunderbird'+'/'))<0))
|
if (!(img.search(eval('/'+'NoSelect'+'/'))<0) || !(img.search(eval('/'+'thunderbird'+'/'))<0))
|
||||||
{
|
{
|
||||||
|
if (!(img.search(eval('/'+'thunderbird'+'/'))<0))
|
||||||
|
{
|
||||||
|
rv = mail_changeProfile(folder,_widget);
|
||||||
|
if (rv)
|
||||||
|
{
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (_widget.event_args.length==2)
|
if (_widget.event_args.length==2)
|
||||||
{
|
{
|
||||||
folder = _widget.event_args[1];
|
folder = _widget.event_args[1];
|
||||||
@ -213,6 +243,7 @@ function mail_changeFolder(folder,_widget) {
|
|||||||
app_refresh(myMsg, 'mail');
|
app_refresh(myMsg, 'mail');
|
||||||
}
|
}
|
||||||
mail_refreshFolderStatus(folder,'forced');
|
mail_refreshFolderStatus(folder,'forced');
|
||||||
|
mail_startTimerFolderStatusUpdate(mail_refreshTimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user