JSON callback to autoload folders of other profiles (not yet working, as getFolderTree returns too much, should only be children (item) of selected node)

This commit is contained in:
Ralf Becker 2013-02-20 12:04:29 +00:00
parent 5c6f6471f3
commit f052fc4fe4
2 changed files with 23 additions and 5 deletions

View File

@ -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

View File

@ -38,8 +38,8 @@
</grid>
</template>
<template id="mail.index" template="" lang="" group="0" version="1.9.001">
<tree id="nm[foldertree]" onclick="mail_changeFolder(widget.event_args[0],widget);" parent_node="tree_target"/>
<tree id="nm[foldertree]" onclick="mail_changeFolder(widget.event_args[0],widget);" parent_node="tree_target" autoloading="mail.mail_ui.ajax_foldertree"/>
<html id="msg"/>
<nextmatch id="nm" options="mail.index.rows"/>
</template>
</overlay>
</overlay>