pass imapClassName, imapLoginType and imapDomainName to addACL Form to be used by setACL Routine; that way being independent of originating imapClass

This commit is contained in:
Klaus Leithoff 2013-08-14 12:44:29 +00:00
parent 7998d2d53a
commit bffe164587
4 changed files with 15 additions and 8 deletions

View File

@ -79,31 +79,32 @@ class ajaxfelamimail
//error_log("ajaxfelamimail::ajaxfelamimail ActiveProfile:".$this->imapServerID.' activeFolder:'.$this->sessionDataAjax['folderName'].'./.'.$this->sessionData['mailbox'].' ConnectionStatus:'.array2string($this->_connectionStatus));
}
function addACL($_accountName, $_aclData, $_recursive=false)
function addACL($_accountName, $_aclData, $_recursive=false, $_imapClassName='', $_imapLoginType='', $_imapDomainName='')
{
if($this->_debug) error_log("ajaxfelamimail::addACL for ".$_accountName."->".array2string($_aclData));
if (is_numeric($_accountName) && ($account=$GLOBALS['egw']->accounts->read($_accountName)))
{
//error_log(__METHOD__.__LINE__.array2string($account));
$imapClassName = get_class($this->bofelamimail->icServer);
$imapClassName = (!empty($_imapClassName)?$_imapClassName:get_class($this->bofelamimail->icServer));
$alllowercase = false;
if (!empty($imapClassName) && stripos(constant($imapClassName.'::CAPABILITIES'),'lowercaseloginname') !== false) $alllowercase=true;
if ($alllowercase) $account['account_lid']=strtolower($account['account_lid']);
$isgroup=$account['account_id']<0?constant("$imapClassName::ACL_GROUP_PREFIX"):'';
$domainName = $this->bofelamimail->icServer->domainName;
if ($this->bofelamimail->icServer->loginType=='standard') // means username
$domainName = (!empty($_imapDomainName)?$_imapDomainName:$this->bofelamimail->icServer->domainName);
$loginType = (!empty($_imapLoginType)?$_imapLoginType:$this->bofelamimail->icServer->loginType);
if ($loginType=='standard') // means username
{
$_accountName = $isgroup.$account['account_lid'];
}
elseif ($this->bofelamimail->icServer->loginType=='email')
elseif ($loginType=='email')
{
if (!empty($account['account_email'])) $_accountName = $isgroup.$account['account_email'];
}
elseif ($this->bofelamimail->icServer->loginType=='vmailmgr') // means username + domainname
elseif ($loginType=='vmailmgr') // means username + domainname
{
$_accountName = $isgroup.trim($account['account_lid'].'@'.$domainName);
}
elseif ($this->bofelamimail->icServer->loginType=='uidNumber') // userid + domain
elseif ($loginType=='uidNumber') // userid + domain
{
$_accountName = $isgroup.trim($account['account_id'].'@'.$domainName);
}

View File

@ -114,6 +114,9 @@
$this->t->set_var('accountSelection',$accountSelection);
$aclShortCuts = felamimail_bo::$aclShortCuts;
unset($aclShortCuts['custom']);
$this->t->set_var('imapClassName',$imapClassName);
$this->t->set_var('imapLoginType',$bofelamimail->icServer->loginType);
$this->t->set_var('imapDomainName',$bofelamimail->icServer->domainName);
$this->t->set_var('aclSelection',html::select('aclSelection',0,$aclShortCuts,false,'id="aclSelection" style="width:100%"'));
$this->translate();
if (isset($lprofileID)) $this->bofelamimail = felamimail_bo::getInstance(false, $lprofileID);

View File

@ -14,7 +14,7 @@ function onNodeSelect(_nodeID)
function resetACLAddView()
{
window.xajax_doXMLHTTPsync('felamimail.ajaxfelamimail.addACL', document.getElementById('accountName').value, window.xajax.getFormValues('formAddACL'),document.getElementById('recursive').checked );
window.xajax_doXMLHTTPsync('felamimail.ajaxfelamimail.addACL', document.getElementById('accountName').value, window.xajax.getFormValues('formAddACL'),document.getElementById('recursive').checked,document.getElementById('imapClassName').value,document.getElementById('imapLoginType').value,document.getElementById('imapDomainName').value );
document.getElementById('recursive').checked = false;
document.getElementById('accountName').value = '';
opener.updateACLView();

View File

@ -159,6 +159,9 @@
<!-- BEGIN add_acl -->
<form id="formAddACL" name="formAddACL">
<input type='hidden' id='imapClassName' name='imapClassName' value='{imapClassName}'>
<input type='hidden' id='imapLoginType' name='imapLoginType' value='{imapLoginType}'>
<input type='hidden' id='imapDomainName' name='imapDomainName' value='{imapDomainName}'>
<table border="0" width="100%" bgcolor="#FFFFFF">
<tr class="th">
<td>