From 1eed5ab0b484e12e8e7362fb7c29630fb4d833f0 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Mon, 6 Apr 2009 16:56:29 +0200 Subject: [PATCH] Allow to derive horde attribute types from the LDAP schema. --- koward/lib/Form/Object.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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) -- 2.11.0