first shot at show all folders menu action on tree

This commit is contained in:
Klaus Leithoff 2014-02-06 09:09:57 +00:00
parent 458648bf8b
commit 903245f550
3 changed files with 71 additions and 9 deletions

View File

@ -2008,24 +2008,40 @@ class mail_bo
// fetch and sort all folders
//echo $type.'->'.$foldersNameSpace[$type]['prefix'].'->'.($type=='shared'?0:2)."<br>";
$allMailboxesExt = $this->icServer->getMailboxes($foldersNameSpace[$type]['prefix'],2,true);
if( PEAR::isError($allMailboxesExt) )
try
{
error_log(__METHOD__.__LINE__.' Failed to retrieve all Boxes:'.$allMailboxesExt->message);
$allMailboxesExt = $this->icServer->getMailboxes($foldersNameSpace[$type]['prefix'],2,true);
}
catch (Exception $e)
{
error_log(__METHOD__.__LINE__.' Failed to retrieve all Boxes:'.$e->getMessage());
$allMailboxesExt = array();
}
if (empty($allMailboxesExt) && $type == 'shared')
{
$allMailboxesExt = $this->icServer->getMailboxes('',0,true);
try
{
$allMailboxesExt = $this->icServer->getMailboxes('',0,true);
}
catch (Exception $e)
{
$allMailboxesExt = array();
}
}
else
{
if ($prefix_present=='forced' && $type=='personal') // you cannot trust dovecots assumed prefix
{
$allMailboxesExtAll = $this->icServer->getMailboxes('',0,true);
try
{
$allMailboxesExtAll = $this->icServer->getMailboxes('',0,true);
}
catch (Exception $e)
{
$allMailboxesExtAll=array();
}
foreach ($allMailboxesExtAll as $kaMEA => $aMEA)
{
if( PEAR::isError($aMEA) ) continue;
if (!in_array($aMEA,$allMailboxesExt)) $allMailboxesExt[] = $aMEA;
}
}
@ -2187,6 +2203,8 @@ class mail_bo
#echo "$folderName failed to be here <br>";
continue;
}
if (isset($folders[$folderName])) continue;
if (isset($autoFolderObjects[$folderName])) continue;
$folderParts = explode($delimiter, $folderName);
$shortName = array_pop($folderParts);
@ -2227,6 +2245,7 @@ class mail_bo
} else {
$folders[$folderName] = $folderObject;
}
//error_log(__METHOD__.__LINE__.':'.$folderObject->folderName);
}
}
}

View File

@ -3487,6 +3487,45 @@ blockquote[type=cite] {
}
}
/**
* reload node
*
* @param string _folderName folder to reload
*
* @return void
*/
function ajax_reloadNode($_folderName,$_subscribedOnly=true)
{
translation::add_app('mail');
$decodedFolderName = $this->mail_bo->decodeEntityFolderName($_folderName);
$del = $this->mail_bo->getHierarchyDelimiter(false);
$oA = array();
list($profileID,$folderName) = explode(self::$delimiter,$decodedFolderName,2);
if ($profileID != $this->mail_bo->profileID) return; // only current connection
$parentFolder=(!empty($folderName)?$folderName:'INBOX');
$folderInfo = $this->mail_bo->getFolderStatus($parentFolder,false);
if ($folderInfo['unseen'])
{
$folderInfo['shortDisplayName'] = $folderInfo['shortDisplayName'].' ('.$folderInfo['unseen'].')';
}
if ($folderInfo['unseen']==0 && $folderInfo['shortDisplayName'])
{
$folderInfo['shortDisplayName'] = $folderInfo['shortDisplayName'];
}
$refreshData = array(
$profileID.self::$delimiter.$parentFolder=>$folderInfo['shortDisplayName']);
// Send full info back in the response
$response = egw_json_response::get();
foreach($refreshData as $folder => &$name)
{
$name = $this->getFolderTree(true, $folder, $_subscribedOnly);
}
$response->call('app.mail.mail_reloadNode',$refreshData);
}
/**
* move folder
*

View File

@ -2570,9 +2570,13 @@ app.classes.mail = AppJS.extend(
*/
all_folders: function(_action,_senders)
{
var mailbox = _senders[0].id.split('::');
acc_id = mailbox[0];
egw.json('mail.mail_ui.ajax_foldertree',[acc_id,!_action.checked])
//console.log(_action,_senders);
this.lock_tree();
var mailbox = _senders[0].id.split('::');
acc_id = mailbox[0];
egw.json('mail.mail_ui.ajax_reloadNode',[acc_id,!_action.checked], jQuery.proxy(function() {
this.unlock_tree();
},this))
.sendRequest();
},