provide params to be able to pass subscribedOnly flag (true/false) to the getFolderObjects method, to be able to display all folders

This commit is contained in:
Klaus Leithoff 2013-12-19 10:32:42 +00:00
parent 78d3a5126f
commit ca93a60668
2 changed files with 15 additions and 4 deletions

View File

@ -548,17 +548,19 @@ class mail_ui
* We currently load all folders of a given profile, tree can also load parts of a tree.
*
* @param string $_GET[id] if of node whos children are requested
* @param boolean $_subscribedOnly flag to tell wether to fetch all or only subscribed (default)
*/
public function ajax_foldertree($_nodeID = null)
public function ajax_foldertree($_nodeID = null,$_subscribedOnly=true)
{
$nodeID = $_GET['id'];
if (!is_null($_nodeID)) $nodeID = $_nodeID;
$subscribedOnly = $_subscribedOnly;
//error_log(__METHOD__.__LINE__.'->'.array2string($_REQUEST));
//error_log(__METHOD__.__LINE__.'->'.array2string($_GET));
$fetchCounters = !is_null($_nodeID);
list($_profileID,$_folderName) = explode(self::$delimiter,$nodeID,2);
if (!empty($_folderName)) $fetchCounters = true;
$data = $this->getFolderTree($fetchCounters, $nodeID);
$data = $this->getFolderTree($fetchCounters, $nodeID, $subscribedOnly);
//error_log(__METHOD__.__LINE__.':'.$nodeID.'->'.array2string($data));
if (!is_null($_nodeID)) return $data;
header('Content-Type: application/json; charset=utf-8');
@ -570,6 +572,7 @@ class mail_ui
* getFolderTree, get folders from server and prepare the folder tree
* @param bool $_fetchCounters, wether to fetch extended information on folders
* @param string $_nodeID, nodeID to fetch and return
* @param boolean $_subscribedOnly flag to tell wether to fetch all or only subscribed (default)
* @return array something like that: array('id'=>0,
* 'item'=>array(
* 'text'=>'INBOX',
@ -579,7 +582,7 @@ class mail_ui
* )
* );
*/
function getFolderTree($_fetchCounters=false, $_nodeID=null)
function getFolderTree($_fetchCounters=false, $_nodeID=null, $_subscribedOnly=true)
{
if (!is_null($_nodeID) && $_nodeID !=0)
{
@ -594,7 +597,7 @@ class mail_ui
}
}
//$starttime = microtime(true);
$folderObjects = $this->mail_bo->getFolderObjects(true,false,false,true);
$folderObjects = $this->mail_bo->getFolderObjects($_subscribedOnly,false,false,true);
//$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__.' Fetching folderObjects took: '.$endtime);
$trashFolder = $this->mail_bo->getTrashFolder();

View File

@ -113,6 +113,14 @@ app.classes.mail = AppJS.extend(
window.setTimeout(function() {
self.mail_refreshFolderStatus.call(self,undefined,undefined,false);
},1000);
// intention was, to enable drag and drop with the tree
// and then somehow hook into the event and do the server side action
// does not work here at that time, do not know why, so we go for
// the traditional way of a rightclick action on the tree
//var tree_wdg = this.et2.getWidgetById(this.nm_index+'[foldertree]');
//tree_wdg.enableDragAndDrop(true,false);
//tree_wdg.setDragBehavior('child',true);
//tree_wdg.enableDragAndDropScrolling(true);
}
if (isDisplay)
{