[turba] Composite fields

Richard Heggs richard.heggs at nottinghamcity.gov.uk
Thu Nov 20 03:32:07 PST 2003


Quoting Chuck Hagenbuch <chuck () horde ! org>:

>Quoting Richard Heggs <richard.heggs at nottinghamcity.gov.uk>:
>
>> I'm trying to create a composite search/display field for my LDAP
>backend.
>> I want to make the 'name' field map to a composite of the LDAP 'dn' and
>> 'givenName' attributes.
>
>Something like this, but you'll need to adapt it to your backend:
>
>        'name' => array('fields' => array('firstname', 'lastname'),
>                        'format' => '%s %s'),
>        'firstname' => 'object_firstname',
>        'lastname' => 'object_lastname',
>
>Also, I don't think I ever tested composite fields with LDAP, so while it
>*should* work, you might run into a thing or two.

*sound of ssh session being fired up*
*tappety-tappety-tap*

Yup, that works a treat, thanks. :)  I can't search a composite field, but I
can display it (which is what I wanted anyway).  Is it possible to make it
searchable, or is that just adding unnecessary complexity?

>
>> Could someone point to the appropriate place in TFM[L]? that I should R,
>> please? :)
>
>There isn't one for HEAD yet. I think you just volunteered to write this
>bit. ;)
>Gladly.  Patch for sources.php below.

Richard.

diff -u sources.php.orig sources.php.dist
--- sources.php.orig    2003-11-20 11:08:29.000000000 +0000
+++ sources.php.dist    2003-11-20 11:30:13.000000000 +0000
@@ -16,7 +16,16 @@
  *
  * map: This is a list of mappings from the standard Turba attribute
  * names (on the left) to the attribute names by which they are known in
- * this contact source (on the right).
+ * this contact source (on the right).  Turba supports composite fields for
+ * display.  A composite field is defined by mapping the field name to an
+ * array containing a list of component fields and a format string (similar
+ * to a printf() format string).  Here is an example:
+ * ...
+ * 'name' => array('fields' => array('firstname', 'lastname'),
+ *                 'format' => '%s %s'),
+ * 'firstname' => 'object_firstname',
+ * 'lastname' => 'object_lastname',
+ * ...
  *
  * search: A list of Turba attribute names that can be searched for
  * this source.


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


######################################################################
This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of Nottingham City Council unless specifically
stated. If you have received it in error, please delete it from your system,
do not use, copy or disclose the information in any way nor act in reliance
on it and notify the sender immediately. Please note that Nottingham City
Council monitors e-mails sent or received. Further communication will
signify your consent to this.
######################################################################


More information about the turba mailing list