new type API
This commit is contained in:
parent
ccc2721f51
commit
7027522950
|
@ -357,9 +357,18 @@ class nisMailAliasUser extends baseModule {
|
||||||
$return->addElement(new htmlHiddenInput('recipient', $recipient), true);
|
$return->addElement(new htmlHiddenInput('recipient', $recipient), true);
|
||||||
// new mail alias
|
// new mail alias
|
||||||
$return->addElement(new htmlSubTitle(_('Create new alias')), true);
|
$return->addElement(new htmlSubTitle(_('Create new alias')), true);
|
||||||
$typeObj = new mailAlias();
|
$typeManager = new \LAM\TYPES\TypeManager();
|
||||||
$ous = $typeObj->getSuffixList();
|
$mailAliasTypes = $typeManager->getConfiguredTypesForScope('mailAlias');
|
||||||
$return->addElement(new htmlTableExtendedSelect('new_ou', $ous, array(), _('Suffix'), 'suffix'), true);
|
$ous = array();
|
||||||
|
foreach ($mailAliasTypes as $type) {
|
||||||
|
$ous = array_merge($ous, $type->getBaseType()->getSuffixList());
|
||||||
|
}
|
||||||
|
$ous = array_unique($ous);
|
||||||
|
usort($ous, 'compareDN');
|
||||||
|
$suffixSelect = new htmlTableExtendedSelect('new_ou', $ous, array(), _('Suffix'), 'suffix');
|
||||||
|
$suffixSelect->setRightToLeftTextDirection(true);
|
||||||
|
$suffixSelect->setSortElements(false);
|
||||||
|
$return->addElement($suffixSelect, true);
|
||||||
$newAliasCn = empty($_POST['new_cn']) ? '' : $_POST['new_cn'];
|
$newAliasCn = empty($_POST['new_cn']) ? '' : $_POST['new_cn'];
|
||||||
$return->addElement(new htmlTableExtendedInputField(_('Alias name'), 'new_cn', $newAliasCn, 'newAlias'), true);
|
$return->addElement(new htmlTableExtendedInputField(_('Alias name'), 'new_cn', $newAliasCn, 'newAlias'), true);
|
||||||
$return->addVerticalSpace('5px');
|
$return->addVerticalSpace('5px');
|
||||||
|
|
|
@ -389,6 +389,23 @@ class TypeManager {
|
||||||
return $configuredTypes;
|
return $configuredTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of configured types for this scope.
|
||||||
|
*
|
||||||
|
* @param string $scope scope (e.g. user)
|
||||||
|
* @return \LAM\TYPES\ConfiguredType[] list of ConfiguredType
|
||||||
|
*/
|
||||||
|
public function getConfiguredTypesForScope($scope) {
|
||||||
|
$allTypes = $this->getConfiguredTypes();
|
||||||
|
$scopedTypes = array();
|
||||||
|
foreach ($allTypes as $type) {
|
||||||
|
if ($type->getScope() == $scope) {
|
||||||
|
$scopedTypes[] = $type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $scopedTypes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a configured account type.
|
* Builds a configured account type.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue