forked from extern/egroupware
Clicking on profile in tree changes profile & selects inbox
This commit is contained in:
parent
e103145a53
commit
4f9c9a8892
@ -3707,9 +3707,11 @@ blockquote[type=cite] {
|
||||
/**
|
||||
* empty changeProfile - its called via json, so the function must start with ajax (or the class-name must contain ajax)
|
||||
*
|
||||
* @param int $icServerId New profile / server ID
|
||||
* @param bool $getFolders The client needs the folders for the profile
|
||||
* @return nothing
|
||||
*/
|
||||
function ajax_changeProfile($icServerID)
|
||||
function ajax_changeProfile($icServerID, $getFolders = true)
|
||||
{
|
||||
//lang('Connect to Profile %1',$icServerID);
|
||||
if ($icServerID && $icServerID != $this->mail_bo->profileID)
|
||||
@ -3718,7 +3720,16 @@ blockquote[type=cite] {
|
||||
$this->changeProfile($icServerID);
|
||||
}
|
||||
$response = egw_json_response::get();
|
||||
$response->call('egw_refresh',lang('changed profile'),'mail');
|
||||
//$folderInfo = $this->mail_bo->getFolderStatus($icServerID,false);
|
||||
|
||||
// Send full info back in the response
|
||||
if($getFolders)
|
||||
{
|
||||
$refreshData = array(
|
||||
$icServerID => $this->getFolderTree(true, $icServerID, true)
|
||||
);
|
||||
$response->call('app.mail.mail_reloadNode',$refreshData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1071,12 +1071,27 @@ app.classes.mail = AppJS.extend(
|
||||
* mail_changeProfile
|
||||
* @param folder, the ID of the selected Node -> should be an integer
|
||||
* @param _widget, handle to the tree widget
|
||||
* @param {boolean} getFolders Flag to indicate that the profile needs the mail
|
||||
* folders. False means they're already loaded in the tree, and we don't need
|
||||
* them again
|
||||
*/
|
||||
mail_changeProfile: function(folder,_widget) {
|
||||
mail_changeProfile: function(folder,_widget, getFolders) {
|
||||
if(typeof getFolders == 'undefined')
|
||||
{
|
||||
getFolders = true;
|
||||
}
|
||||
// alert(folder);
|
||||
egw_message(this.egw.lang('Connect to Profile %1',_widget.getSelectedLabel()));
|
||||
egw.json('mail.mail_ui.ajax_changeProfile',[folder])
|
||||
.sendRequest();
|
||||
|
||||
this.lock_tree();
|
||||
egw.json('mail.mail_ui.ajax_changeProfile',[folder, getFolders], jQuery.proxy(function() {
|
||||
// Profile changed, select inbox
|
||||
var inbox = folder + '::INBOX';
|
||||
_widget.reSelectItem(inbox)
|
||||
this.mail_changeFolder(inbox,_widget,'');
|
||||
this.unlock_tree();
|
||||
},this))
|
||||
.sendRequest(true);
|
||||
|
||||
return true;
|
||||
},
|
||||
@ -1106,7 +1121,7 @@ app.classes.mail = AppJS.extend(
|
||||
if (server[0] != previousServer[0] && profile_selected)
|
||||
{
|
||||
// mail_changeProfile triggers a refresh, no need to do any more
|
||||
return this.mail_changeProfile(_folder,_widget);
|
||||
return this.mail_changeProfile(_folder,_widget, _widget.getSelectedNode().childsCount == 0);
|
||||
}
|
||||
|
||||
// Apply new selected folder to list, which updates data
|
||||
|
Loading…
Reference in New Issue
Block a user