preparations to get mail_activesync into gear

This commit is contained in:
Klaus Leithoff 2014-01-14 13:35:39 +00:00
parent cfa981480e
commit b3ad328429
5 changed files with 2168 additions and 84 deletions

File diff suppressed because it is too large Load Diff

View File

@ -510,7 +510,7 @@ class mail_bo
* getAllIdentities - function to gather the identities connected to the current user
* @return array - array(email=>realname)
*/
function getAllIdentities() {
static function getAllIdentities() {
$userEMailAdresses = array();
foreach(emailadmin_account::search($only_current_user=true, $just_name=true) as $acc_id => $identity_name)
{

View File

@ -948,7 +948,7 @@ class mail_compose
*/
// prepare signatures, the selected sig may be used on top of the body
//identities and signature stuff
$allIdentities = $this->mail_bo->getAllIdentities();
$allIdentities = mail_bo::getAllIdentities();
$selectedMailAccount = ($content['mailaccount']?$content['mailaccount']:$this->mail_bo->profileID);
$acc = emailadmin_account::read($this->mail_bo->profileID);
$selectSignatures = array(
@ -959,13 +959,12 @@ class mail_compose
if (is_null(mail_bo::$mailConfig)) mail_bo::$mailConfig = config::read('mail');
// not set? -> use default, means full display of all available data
if (!isset(mail_bo::$mailConfig['how2displayIdentities'])) mail_bo::$mailConfig['how2displayIdentities'] ='';
$globalIds = 0;
$defaultIds = array();
$identities = array();
foreach($allIdentities as $key => $singleIdentity) {
if (isset($identities[$singleIdentity['acc_id']])) continue; // only use the first
$iS = mail_bo::generateIdentityString($singleIdentity);
if (mail_bo::$mailConfig['how2displayIdentities']=='' || count($allIdentities) ==1 || count($allIdentities) ==$globalIds)
if (mail_bo::$mailConfig['how2displayIdentities']=='' || count($allIdentities) ==1)
{
$id_prepend ='';
}
@ -994,7 +993,7 @@ class mail_compose
foreach($allSignatures as $key => $singleIdentity) {
//$identities[$singleIdentity['ident_id']] = $singleIdentity['ident_realname'].' <'.$singleIdentity['ident_email'].'>';
$iS = mail_bo::generateIdentityString($singleIdentity);
if (mail_bo::$mailConfig['how2displayIdentities']=='' || count($allIdentities) ==1 || count($allIdentities) ==$globalIds)
if (mail_bo::$mailConfig['how2displayIdentities']=='' || count($allIdentities) ==1)
{
$id_prepend ='';
}

View File

@ -79,7 +79,7 @@ class mail_sieve
$this->mailPreferences =& $this->mailbo->mailPreferences;
$this->mailConfig = config::read('mail');
$allIdentities = $this->mailbo->getAllIdentities();
$allIdentities = mail_bo::getAllIdentities();
$defaultIdentity = $this->mailbo->getDefaultIdentity();
$this->currentIdentity = $allIdentities[$defaultIdentity];
$this->currentIdentity['identity_string'] = mail_bo::generateIdentityString($allIdentities[$defaultIdentity],true);
@ -456,7 +456,7 @@ class mail_sieve
}
$allIdentities = $this->mailbo->getAllIdentities();
$allIdentities = mail_bo::getAllIdentities();
$defaultIdentity = $this->mailbo->getDefaultIdentity();
foreach($allIdentities as $key => $singleIdentity)
{

View File

@ -3315,83 +3315,6 @@ blockquote[type=cite] {
}
}
/**
* ajax_refreshNode - its called via json, so the function must start with ajax (or the class-name must contain ajax)
* @param string $_folderName folder to refresh
* @param string $_subscribedOnly wether to fetch subscribed or unsubscribed too
* @return nothing
*/
function ajax_refreshNode($_folderName, $_subscribedOnly)
{
//lang("Rename Folder %1 to:",$OldFolderName);
//lang("Rename Folder %1 ?",$OldFolderName);
error_log(__METHOD__.__LINE__.' FolderName:'.array2string($_folderName).' subscribedOnly:'.array2string($_subscribedOnly));
if ($_folderName)
{
$decodedFolderName = $this->mail_bo->decodeEntityFolderName($_folderName);
$del = $this->mail_bo->getHierarchyDelimiter(false);
$oA = array();
list($profileID,$folderName) = explode(self::$delimiter,$decodedFolderName,2);
$hasChildren = false;
error_log(__METHOD__.__LINE__.' FolderName:'.array2string($folderName).' profile:'.array2string($profileID).'<->'.$this->mail_bo->profileID);
if (is_numeric($profileID))
{
if ($profileID != $this->mail_bo->profileID) return; // only current connection
$pA = explode($del,$folderName);
array_pop($pA);
$parentFolder = implode($del,$pA);
$this->mail_bo->resetFolderObjectCache($profileID);
//error_log(__METHOD__.__LINE__."$folderName, $parentFolder, $_newName");
$success=true;
$delimiter = $this->mail_bo->getHierarchyDelimiter();
$nameSpace = $this->mail_bo->_getNameSpaces();
$prefix = $this->mail_bo->getFolderPrefixFromNamespace($nameSpace, $folderName);
//error_log(__METHOD__.__LINE__.'->'."$_folderName, $delimiter, $prefix");
$fragments = array();
$subFolders = $this->mail_bo->getMailBoxesRecursive($folderName, $delimiter, $prefix);
foreach ($subFolders as $k => $folder)
{
// we do not monitor failure or success on subfolders
if ($folder == $folderName)
{
unset($subFolders[$k]);
}
else
{
$id=$profileID.self::$delimiter.$folder;
$oA[$id]['id'] = $id;
$fS = $this->mail_bo->getFolderStatus($folder,false);
if ($fS['unseen'])
{
$oA[$id]['desc'] = '<b>'.$fS['shortDisplayName'].' ('.$fS['unseen'].')</b>';
}
else
{
$oA[$id]['desc'] = $fS['shortDisplayName'];
}
}
}
}
if ($folderName==$this->mail_bo->sessionData['mailbox'])
{
$this->mail_bo->sessionData['mailbox']=$folderName;
$this->mail_bo->saveSessionData();
}
error_log(__METHOD__.__LINE__.' '.$folderName.' status of method:'.$success.' ->'.array2string($oA));
$response = egw_json_response::get();
if ($oA && $success)
{
$response->call('app.mail.mail_setLeaf',$oA);
}
else
{
$response->call('egw_refresh',lang('failed to refresh %1 ! Reason: %2',$oldFolderName,$msg),'mail');
}
}
}
/**
* ajax_renameFolder - its called via json, so the function must start with ajax (or the class-name must contain ajax)
* @param string $_folderName folder to rename and refresh