From: Gunnar Wrobel
Date: Mon, 6 Apr 2009 14:56:29 +0000 (+0200) Subject: Allow to derive horde attribute types from the LDAP schema. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1eed5ab0b484e12e8e7362fb7c29630fb4d833f0;p=horde.git Allow to derive horde attribute types from the LDAP schema. --- diff --git a/koward/lib/Form/Object.php b/koward/lib/Form/Object.php index abbf26bf9..93eccaf4a 100644 --- a/koward/lib/Form/Object.php +++ b/koward/lib/Form/Object.php @@ -102,8 +102,25 @@ class Koward_Form_Object extends Horde_Form { && in_array($key, $config['attributes']['hide'])) { continue; } + + if (isset($config['attributes']['type'][$key])) { + $type = $config['attributes']['type'][$key]; + } else if (isset($attributes[$key]['syntax'])) { + list($syntax, $length) = explode('{', $attributes[$key]['syntax'], 2); + switch ($syntax) { + case '1.3.6.1.4.1.1466.115.121.1.50': + $type = 'phone'; + break; + default: + $type = 'text'; + break; + } + } else { + $type = 'text'; + } + $form_attributes[$key] = array( - 'type' => 'text', + 'type' => $type, 'required' => in_array($key, $attribute_map['required']), 'readonly' => in_array($key, $attribute_map['locked']), 'params' => array('regex' => '', 'size' => 40, 'maxlength' => 255)