diff --git a/lam/docs/devel/upgrade.htm b/lam/docs/devel/upgrade.htm index 4e53e27d..9e4945f6 100644 --- a/lam/docs/devel/upgrade.htm +++ b/lam/docs/devel/upgrade.htm @@ -71,7 +71,9 @@ This is a list of API changes for all LAM releases.
  • Removed global functions:
  • diff --git a/lam/lib/types.inc b/lam/lib/types.inc index 77585eb5..b0135d6b 100644 --- a/lam/lib/types.inc +++ b/lam/lib/types.inc @@ -80,30 +80,6 @@ function getTypeDescription($type) { return $obj->getDescription(); } -/** -* Returns the default attribute list for an account type. -* It is used as default value for the configuration editor. -* -* @param string $type account type -* @return string attribute list -*/ -function getDefaultListAttributes($type) { - $obj = new $type(); - return $obj->getDefaultListAttributes(); -} - -/** -* Returns a list of attributes which have a translated description. -* This is used for the head row in the list view. -* -* @param string $type account type -* @return array list of descriptions -*/ -function getListAttributeDescriptions($type) { - $obj = new $type(); - return $obj->getListAttributeDescriptions(); -} - /** * Returns the account type for a given type id. * @@ -207,7 +183,7 @@ class ConfiguredType { $attributeSpecs = explode(';', $attributeString); $attributes = array(); foreach ($attributeSpecs as $attributeSpec) { - $attributes[] = new ListAttribute($attributeSpec, $this->scope); + $attributes[] = new ListAttribute($attributeSpec, $this); } $this->attributes = $attributes; return $this->attributes; @@ -333,17 +309,17 @@ class ListAttribute { private $attributeSpec; - private $scope; + private $type; /** * Constructor. * * @param string $attributeSpec spec of attribute (e.g. '#uid' or 'uid:User') - * @param string $scope account type (e.g. 'user') + * @param ConfiguredType $type account type (e.g. 'user') */ - public function __construct($attributeSpec, $scope) { + public function __construct($attributeSpec, $type) { $this->attributeSpec = $attributeSpec; - $this->scope = $scope; + $this->type = $type; } /** * Returns the name of the LDAP attribute. @@ -366,7 +342,7 @@ class ListAttribute { public function getAlias() { if ($this->isPredefined()) { $name = strtolower(substr($this->attributeSpec, 1)); - $hash_table = getListAttributeDescriptions($this->scope); + $hash_table = $this->type->getBaseType()->getListAttributeDescriptions(); $hash_table = array_change_key_case($hash_table, CASE_LOWER); if (isset($hash_table[$name])) { return $hash_table[$name]; diff --git a/lam/templates/config/conftypes.php b/lam/templates/config/conftypes.php index 1341a456..7b90e956 100644 --- a/lam/templates/config/conftypes.php +++ b/lam/templates/config/conftypes.php @@ -291,7 +291,7 @@ if (sizeof($activeTypes) > 0) { $attributes = $typeSettings['attr_' . $activeType->getId()]; } else { - $attributes = \LAM\TYPES\getDefaultListAttributes($activeType->getScope()); + $attributes = $activeType->getBaseType()->getDefaultListAttributes(); } $attrsInput = new htmlTableExtendedInputField(_("List attributes"), 'attr_' . $activeType->getId(), $attributes, '206'); $attrsInput->setFieldSize(40);