From ca93a60668b5603a2b06e5d8d38a598906c9f25f Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 19 Dec 2013 10:32:42 +0000 Subject: [PATCH] provide params to be able to pass subscribedOnly flag (true/false) to the getFolderObjects method, to be able to display all folders --- mail/inc/class.mail_ui.inc.php | 11 +++++++---- mail/js/app.js | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index e1f7d08ae3..84bb67cc7a 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -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(); diff --git a/mail/js/app.js b/mail/js/app.js index 38532362d5..341ee61b64 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -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) {