From f052fc4fe47dffc1ebb74eb58468b0d82d07df16 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 20 Feb 2013 12:04:29 +0000 Subject: [PATCH] JSON callback to autoload folders of other profiles (not yet working, as getFolderTree returns too much, should only be children (item) of selected node) --- mail/inc/class.mail_ui.inc.php | 24 +++++++++++++++++++++--- mail/templates/default/index.xet | 4 ++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 20305088ea..7fe892e500 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -79,7 +79,7 @@ class mail_ui 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 =& egw_cache::getSession('mail','activeProfileID'); $oldicServerID = $icServerID; // save pref $GLOBALS['egw']->preferences->add('mail','ActiveProfileID',$icServerID,'user'); @@ -133,7 +133,7 @@ class mail_ui unset($content['msg']); } $this->mail_bo->restoreSessionData(); - + // filter is used to choose the mailbox //if (!isset($content['nm']['foldertree'])) // maybe we fetch the folder here /* @@ -169,7 +169,7 @@ class mail_ui // Set tree actions $etpl->set_cell_attribute('nm[foldertree]','actions', array( - + 'drop_move_mail' => array( 'type' => 'drop', 'acceptedTypes' => 'mail', @@ -342,6 +342,24 @@ class mail_ui common::egw_footer(); } + /** + * Ajax callback to fetch folders for given profile + * + * We currently load all folders of a given profile, tree can also load parts of a tree. + * + * @param string $_GET[selected] if of node whos children are requested + */ + public function ajax_foldertree() + { + list($profileId) = explode(':', $_GET['selected']); + + $data = $this->getFolderTree(false, $profileId); + + header('Content-Type: application/json; charset=utf-8'); + echo json_encode($data); + common::egw_exit(); + } + /** * getFolderTree, get folders from server and prepare the folder tree * @param bool $_fetchCounters, wether to fetch extended information on folders diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index a16c377ca2..fb5ae4d7f0 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -38,8 +38,8 @@ - \ No newline at end of file +